-
Notifications
You must be signed in to change notification settings - Fork 405
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
Bugfix for empty preds or target in iou scores #2806
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2806 +/- ##
========================================
- Coverage 69% 35% -34%
========================================
Files 338 338
Lines 18334 18352 +18
========================================
- Hits 12586 6387 -6199
- Misses 5748 11965 +6217 |
@SkafteNicki thanks for implementing the fix! I just noticed another potential unexpected behaviour is when both targets and preds contain empty boxes:
This yields an IoU of 0, but it probably should return 1 |
@yurithefury I do partly not agree. When both target and preds contains empty boxes both the intersection and union of those boxes are 0, meaning that we end up trying to compute 0/0, which is undefined. It would maybe make the most sense setting it to Nan, but that would mess with average over multiple samples where only one is not defined. So there is really no right or wrong value in this case. Maybe it needs to be an argument to control? |
@SkafteNicki Good point! Allowing an option to set this value, like |
What does this PR do?
Fixes #2805
When either preds or target have empty boxes the score for that pair should be 0. Currently instead it is a empty tensor which then are not counted towards the global average making the scores too high.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃
📚 Documentation preview 📚: https://torchmetrics--2806.org.readthedocs.build/en/2806/