Trouble with the split_raster
command
#674
Replies: 11 comments 7 replies
-
Thanks for this discussion. At the start, I want to underline that we never think of DeepForest as a zero-shot tool for tree detection globally. Retraining will always be the right choice. Can you confirm you are using the latest DeepForest version? There must be something specific about your use case, as many users use split_raster all the time in the way you described. I happened to run it myself like this yesterday. Let's try to unravel what's happening with your data. Can you share a single image and annotation file? Then we can visualize each step and figure out what's happening. The general steps are to use deepforest.visualize.plot_predictions to confirm that the initial annotations look correct. Then let's try patch_size = 0, to see if its the overlap. I suspect that this is a flip_y_axis issue, in what program are you looking at the image above? Numpy/matplotlib/qgis all use very slightly different axis conventions. But that's just a guess. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response. I'm using deepforest 1.3.3 from pypi and pre-built model 1.0.0 from your github repo I started by creating tree crown label in QGIS (following your method). I digitized rectangular bounding boxes (n=150) on top of a drone orthomosaic geotif (RGB; EPSG:4326 - WGS 84) and saved them as a shapefile (EPSG:4326 - WGS 84). Next, I converted the shapefile to annotation and used the same orthomosaic geotif as the
This produced a dataframe with 6 columns (image_path | xmin | ymin | xmax | ymax | label) and 150 rows Next, I did the Attached is a single image (.png) that was created from the Sorry, but I don't understand how to use The image I provided in my first message was a png what was output from your deepforest command. I did not use any python software to look at the this first image. It was a .png that I simply clicked on and opened on my computer. Something seems to be going wrong in the either the |
Beta Was this translation helpful? Give feedback.
-
We could go back in forth forever on this topic. It may be more useful to do a Zoom call together. My email is [email protected] |
Beta Was this translation helpful? Give feedback.
-
Do y-axis image coordinates start from the top or start from the bottom? |
Beta Was this translation helpful? Give feedback.
-
Because I am struggling to execute annotation of geospatial data (qgis, shapefiles), perhaps it makes sense to do the tree crown labeling on my many non-georeferenced jpeg drone images. In this way I could skip any conversion from geographic to image coordinates. Would you recommend labeling of non-georeferenced drone images? Do you have a suggested workflow to do this? I probably just need to get the annotation data into your format (image_path; xmin, ymin, xmax, ymax, label)? Have you used Label Studio to do this? Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hey @jeffgillan, let's get this done, I sense there isn't anything wrong here, just the docs need to be better. your command looks fine here "This produced a dataframe with 6 columns (image_path | xmin | ymin | xmax | ymax | label) and 150 rows you can confirm they are correct by using https://deepforest.readthedocs.io/en/latest/source/deepforest.html#deepforest.visualize.plot_predictions. Can you slow down, provide full code, annotations and image data and we can go through this. Let see the plots and make this reproducible. |
Beta Was this translation helpful? Give feedback.
-
@bw4sz Can you please suggest some python snippet to use your plot_predictions tools? I'm weak at python and don't know the exact code needed to use your visualization tool. I have spent many hours trying with no success. My entire code is here https://github.com/ua-datalab/Geospatial_Workshops/blob/main/notebooks/deepforest_2.ipynb Thank you |
Beta Was this translation helpful? Give feedback.
-
@bw4sz I've managed to cobble some python together and have made some progress. I now believe that the root of my problem may be occurring in the My evidence: After I do the Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Okay, I can confirm the error with supplied data.
Tiny note: https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13472 is the correct citation, from the notebook, I can see a different paper. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I think we can close this in favor of a dedication issue and bug fix. #695 |
Beta Was this translation helpful? Give feedback.
-
Hi DeepForest. Thanks for making this python library and helping to simplify deep learning and CNNs for those of us not well versed in pytorch. My name is Jeff Gillan and I'm a researcher/data scientist at University of Arizona. I am also associated with the NSF funded Open Forest Observatory project. Over the last few months I've been playing with DeepForest and trying to identify trees in some of my drone imagery (~ 1 cm gsd). The prebuilt model kind of works but it seems some fine-tuning is necessary to really make it work well.
I have a shapefile of tree crown labels and have successfully converted them to the annotation data frame using the
shapefile_to_annotations
. The conversion from geographic coordinates to pixel coordinates seems to work. The problem comes when I use:At first it appears that everything was done correctly. The command takes the large geotif and splits it into many equally sized smaller images along with the associated annotation. But upon further inspection, the pixel coordinates of the cropped image annotation do not make any sense. The bounding boxes do not appear to be where the should be, (ie, on top of the tree crowns).
I was oblivious to this for a long time and assumed I was making a mistake during
model.trainer.fit(model)
. But I think I tracked it down to thesplit_raster
step.Here is an cropped image output from
model.evaluate
that hopefully helps illustrate my problem.I assume the orange boxes are the manual labels that I provided and the blue boxes are the prediction. I assure you, those orange boxes are not where they should be.
Any ideas what could be the problem here? I'm totally stumped. If you want to see my entire code, it is here Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions