docs: Improve predict_tile documentation with examples and tips#1294
docs: Improve predict_tile documentation with examples and tips#1294Prathamesh8989 wants to merge 3 commits intoweecology:mainfrom
Conversation
henrykironde
left a comment
There was a problem hiding this comment.
Thank you for the contribution @Prathamesh8989
docs/user_guide/16_prediction.md
Outdated
| # Predict on large geospatial tiles using overlapping windows | ||
| # Initialize the DeepForest model | ||
| model = main.deepforest() | ||
| model.use_release() # Load a pretrained tree detection model |
There was a problem hiding this comment.
Use model.load_model(model_name="weecology/deepforest-tree", revision="main")
|
Hi @henrykironde , Thanks for the suggestion! |
jveitchmichaelis
left a comment
There was a problem hiding this comment.
I'm concerned about some apparent hallucination in the code - for example "saving" a dataframe as a TIF, and incorrect assumptions about return types of some methods.
Thanks for the contribution, but please check that the snippets you've posted work.
docs/user_guide/16_prediction.md
Outdated
| ) | ||
|
|
||
| # Visualize predicted bounding boxes (if using in-memory predictions) | ||
| # Note: plot_predictions expects a list of bounding boxes, not a raster file |
There was a problem hiding this comment.
predict_file and predict_tile both return a dataframe. This comment is incorrect.
There was a problem hiding this comment.
Please remove this edit
docs/user_guide/16_prediction.md
Outdated
|
|
||
| # Visualize predicted bounding boxes (if using in-memory predictions) | ||
| # Note: plot_predictions expects a list of bounding boxes, not a raster file | ||
| # predictions = model.predict_image(path) # Optional: for small image testing |
There was a problem hiding this comment.
Remove the "optional" part here, it's potentially confusing to users deciding which one to go with.
docs/user_guide/16_prediction.md
Outdated
| # plot_predictions(predictions) | ||
|
|
||
| # To save the merged raster predictions: | ||
| # predicted_raster.save("predicted_output.tif") |
There was a problem hiding this comment.
This is incorrect, you can't save a dataframe as a TIF.
|
Thanks for the feedback — I’ve updated the documentation to correct the return types, removed the invalid raster-saving example, clarified the visualization section, and reverted the unintended .gitignore change. Looking forward to your review. |
Summary
This PR enhances the
predict_tileuser guide by adding detailed tips and parameter explanations to improve clarity for new users.Improvements Included
Added Key Parameters
Included a clear breakdown of:
patch_sizepatch_overlapdataloader_strategyNew Example Usage
Added a clean, standalone code block demonstrating tiled prediction on large rasters.
Grammar & Flow
Refined the documentation text for improved readability and a more professional tone.
Code Consistency
modelpandasandosimports in thepredict_filesectionRelated Issue(s)
This change improves guidance for handling large geospatial raster images, particularly around memory management and patch sizing during prediction.
AI-Assisted Development
AI Tools Used