optimize coordinate validation, handling both -ve and OOB error#1285
optimize coordinate validation, handling both -ve and OOB error#1285musaqlain wants to merge 8 commits intoweecology:mainfrom
Conversation
|
Thanks for your contribution, lets wait for the tests to pass. |
|
@jveitchmichaelis, my general philosophy has always been to focus DeepForest on novice users and help avoid errors before they happen. So in this case there is a raise if there are bad coordinates in the annotations. I think that is still right and not too annoying, instead of just printing or warning. I think we want to prioritize, 'hey there is a problem here' versus streamlined and betting the user understands what they are doing. Agreed? |
bw4sz
left a comment
There was a problem hiding this comment.
have a look at test failures.
There was a problem hiding this comment.
Requested some of the LLM-style comments be cleaned up.
It would be interesting to run this with a profiler. I assume 90+% of the time is spent opening images (and so caching is the real win to avoid reloading images). Hence why I don't think vectorizing is the most important aspect here, even though it's definitely an improvement.
I tested filtering a 100M row numpy array on Colab, takes a couple of seconds. So minutes of runtime is likely I/O.
|
@bw4sz sorry to belabor this review. If the goal is to show users where issues are, I think it's important that the output is actually useful for debugging. Seeing that some number of boxes are malformed, or only their coordinates, doesn't help me fix what's wrong with my dataset. What do you think about reporting a complete list of image name / box issues? e.g. In the existing code we print an error string for all invalid boxes, while this PR reports a number only for negative coords: @musaqlain If you move the logic for negative coordinates into the |
|
completely makes sense, i have updated the logic to catch both the -ve coordinates as well as out of bound coordinates to give users a detailed report. thanks cc @jveitchmichaelis |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1285 +/- ##
==========================================
- Coverage 87.89% 87.21% -0.69%
==========================================
Files 20 20
Lines 2776 2784 +8
==========================================
- Hits 2440 2428 -12
- Misses 336 356 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
PTAL cc @jveitchmichaelis |
Achieved an ~8.2x speedup (9.5 min -> 1.1 min) in dataset validation by reducing disk I/O and vectorizing coordinate checks.
Changes
iterrowswith Pandas boolean masking.Fixes #1244
AI-Assisted Development