Skip to content

docs: Improve predict_tile documentation with examples and tips#1294

Open
Prathamesh8989 wants to merge 3 commits intoweecology:mainfrom
Prathamesh8989:first-docs-fix
Open

docs: Improve predict_tile documentation with examples and tips#1294
Prathamesh8989 wants to merge 3 commits intoweecology:mainfrom
Prathamesh8989:first-docs-fix

Conversation

@Prathamesh8989
Copy link

@Prathamesh8989 Prathamesh8989 commented Feb 1, 2026

Summary

This PR enhances the predict_tile user 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_size
    • patch_overlap
    • dataloader_strategy
  • New 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

    • Standardized variable naming to consistently use model
    • Added missing pandas and os imports in the predict_file section

Related Issue(s)

This change improves guidance for handling large geospatial raster images, particularly around memory management and patch sizing during prediction.


AI-Assisted Development

  • I used AI tools (e.g., GitHub Copilot, ChatGPT, etc.) in developing this PR
  • I understand all the code I'm submitting
  • I have reviewed and validated all AI-generated code

AI Tools Used

  • ChatGPT: Used for correcting grammatical issues and improving the flow of documentation text
  • Gemini: Used for structuring the documentation merge and verifying Python code consistency

Copy link
Contributor

@henrykironde henrykironde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @Prathamesh8989

# Predict on large geospatial tiles using overlapping windows
# Initialize the DeepForest model
model = main.deepforest()
model.use_release() # Load a pretrained tree detection model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use model.load_model(model_name="weecology/deepforest-tree", revision="main")

@Prathamesh8989
Copy link
Author

Hi @henrykironde ,

Thanks for the suggestion!
I’ve updated the documentation to use
model.load_model(model_name="weecology/deepforest-tree", revision="main")
instead of model.use_release() and pushed the changes.

Copy link
Collaborator

@jveitchmichaelis jveitchmichaelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

)

# Visualize predicted bounding boxes (if using in-memory predictions)
# Note: plot_predictions expects a list of bounding boxes, not a raster file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

predict_file and predict_tile both return a dataframe. This comment is incorrect.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this edit


# 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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the "optional" part here, it's potentially confusing to users deciding which one to go with.

# plot_predictions(predictions)

# To save the merged raster predictions:
# predicted_raster.save("predicted_output.tif")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, you can't save a dataframe as a TIF.

@Prathamesh8989
Copy link
Author

Hi @jveitchmichaelis,

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.

@bw4sz bw4sz added the Awaiting author contribution Waiting on the issue author to do something before proceeding label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Awaiting author contribution Waiting on the issue author to do something before proceeding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants