Use trainer.predict for single images - #1398
Merged
Merged
Conversation
jveitchmichaelis
force-pushed
the
predict_lightning
branch
2 times, most recently
from
June 4, 2026 23:41
fc0ccd4 to
a74e9c9
Compare
jveitchmichaelis
marked this pull request as ready for review
June 4, 2026 23:42
jveitchmichaelis
force-pushed
the
predict_lightning
branch
2 times, most recently
from
June 4, 2026 23:48
9e91399 to
ce18d68
Compare
jveitchmichaelis
marked this pull request as draft
June 5, 2026 00:15
jveitchmichaelis
marked this pull request as ready for review
June 5, 2026 00:19
Collaborator
Author
|
Ready for review and we can address the inconsistency separately. For now this should fix the device placement bug. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1398 +/- ##
==========================================
- Coverage 86.61% 85.26% -1.36%
==========================================
Files 26 27 +1
Lines 3736 3875 +139
==========================================
+ Hits 3236 3304 +68
- Misses 500 571 +71
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jveitchmichaelis
force-pushed
the
predict_lightning
branch
from
June 5, 2026 04:06
ce18d68 to
77881cf
Compare
3 tasks
bw4sz
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Use the trainer for single image prediction, similar to other predict routes (predict_file).
I've used
SingleImageas the dataset which seems sensible, but this accepts apatch_sizeoption which is not the behavior we had before. Prediction would use the entire image. Here I've forced patch_size to be the same size as the image only indeepforest.predict_imagewhich is a hack, but the behaviour is the same as before.I've refactored
_dataloader_wrapper_for convenience and added crop_model support for single images. It now uses_crop_models_wrapper_which has the same logic for multiple models.There are some inconsistencies that we could look into - predict_file returns an empty dataframe for no predictions, while predict_tile and predict_image (previously and here) return None. Some prediction paths convert labels from int->str - plan to make everything consistent there?
Related Issue(s)
Would supersede and fix #1391
AI-Assisted Development
N/A