-
Notifications
You must be signed in to change notification settings - Fork 224
Add validation checks for bounding boxes #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@jveitchmichaelis I justed noticed that you have a similar commit somewhere from the history in #1015. We can close this if you were planning to submit something similar. Sorry I didn't catch that earlier. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1211 +/- ##
==========================================
+ Coverage 87.47% 87.50% +0.02%
==========================================
Files 20 20
Lines 2586 2616 +30
==========================================
+ Hits 2262 2289 +27
- Misses 324 327 +3
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:
|
d6856ab to
a60b8ff
Compare
|
I guess that's in the dino branch? Struggling to see where that commit belongs - it looks like I added it when I was testing the pretrain data and then squashed. So we can keep this one if it didn't make it into main. |
jveitchmichaelis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coverage checker is requesting failure tests for image path and geometry, might not be a bad idea to add those.
test_validate_dataset_missing_image and test_validate_dataset_bad_geometry etc.
Checks to see if bounding boxes occur outside of image boundaries and clearly communicates to user when they do. This is a version of weecology#1015 that accounts for changes in the codebase over the last year. Closes weecology#1014 Co-authored-by: Keerthi Reddy <[email protected]>
a60b8ff to
c8a48c2
Compare
Added a test for the missing image. Couldn't figure out how to trigger a bad geometry. You're welcome to PR one into this branch or point me in the right direction. |
|
Yeah it's not clear to me how you'd fail that. Unless it's possible to store a bad box in WKT format and Shapely blindly loads the bounds? But otherwise I think the only way to trigger that error would be to have more (or less) than 4 bounding coordinates. Or if the shape doesn't have |
Should I just go ahead and pull that try/except block then? |
|
Apparently even a shapely.Point has "real" bounds: https://shapely.readthedocs.io/en/stable/reference/shapely.Point.html Two options? If the check is to verify that it's a box, and we want to be strict, we should test for it geometrically. This seems like a neat solution. I would use https://stackoverflow.com/questions/62467829/python-check-if-shapely-polygon-is-a-rectangle Alternatively we could take the bounds and assert non-zero area which would allow us to load polygon data (degraded as boxes), but not points. Adding a check for zero (or very small) area is also probably good. |
Checks to see if bounding boxes occur outside of image boundaries and clearly communicates to user when they do.
This is a version of #1015 that accounts for changes in the codebase over the last year. This was good work by @reddykkeerthi that I didn't want to see get lost.
Closes #1014