Closed Joda0515 closed 1 year ago
@xixi-jodaHuang I can update the tutorial shortly, but in the meantime, you can use the notebook that is in the package. See detectree2/notebooks/colab/predictJB.ipynb
This will take you through the process of making predictions.
I can supply you with a pre-trained model too. What kind of area are you predicting on?
Thank you very much!I look forward to your early update. I don't know if there is a pre-trained model for urban areas , if there is, it would be great.
When I was consolidating the predictions, I ran into a problem.
from detectree2.models.outputs import stitch_crowns, clean_crowns folder = "/content/drive/MyDrive/detectree2/data/tilespred/predictions_geo" crowns = stitch_crowns(folder,1)
ValueError Traceback (most recent call last)
2 frames
/usr/local/lib/python3.7/dist-packages/detectree2/models/outputs.py in
ValueError: invalid literal for int() with base 10: 'Jodagiv'
“Jodagiv” is the tiff file I tested.
But if the name ends with a "_," there will be no error eg: filename = "Prediction_joda_342362_6453876_40_3032633" parts = os.path.basename(filename).split("_") parts = [int(part) for part in parts[-6:-1]] minx = parts[0] miny = parts[1] width = parts[2] buffer = parts[3] crs = parts[4] print((minx, miny, width, buffer, crs))
I'm not sure if that's the problem.
@xixi-jodaHuang that file name should end with .tif
. Does it work if you include that?
@xixi-jodaHuang that file name should end with
.tif
. Does it work if you include that?
img_path = site_path + "/Jodagiv.tif" This is the path to my tif file.This part should be fine.
from detectree2.models.outputs import stitch_crowns, clean_crowns folder = "/content/drive/MyDrive/detectree2/data/tilespred/predictions_geo" crowns = stitch_crowns(folder,1)
After I manually added a "_" to the end of each "geojosn" file name, the code ran.
I think the problem is in the tiling function - I forgot to update it for the new file format. I'll look into that now.
我认为问题出在平稳运行上——我忘记了新的文件格式更新了它。我现在会调查一下。
Thank you very much and look forward to hearing from you.
@Joda0515 I think I have fixed the bug. Hopefully it will work now.
"If you would just like to make predictions on an orthomosaic with a pre-trained model from the model_garden, skip to part 4."
2.3 and 2.4 are missing from this document. When will they be updated?
Do I need to run this file now if I want to use the pre-trained model provided by the author for image prediction ?
Thanks again to the author's intention to answer, I wish you a happy life!