-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(yolo): round polygon coords before int cast to improve mask accuracy #2080
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
Conversation
|
Hey @SkalskiP, would you be able to review this? |
|
Hey @Borda , when you have a moment could you please take a look at this PR and let me know if everything looks good on your end? Appreciate the review! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2080 +/- ##
=======================================
Coverage 52% 52%
=======================================
Files 61 61
Lines 7076 7076
=======================================
Hits 3657 3657
Misses 3419 3419 🚀 New features to boost your workflow:
|
|
Hi @Pranay0302 👋🏻 Thanks a lot for your interest in supervision and drafting this PR. Looks good. Merged! |
Before submitting
Description
Improve YOLO polygon-to-mask conversion accuracy by rounding scaled polygon coordinates before integer casting. This removes a consistent top-left bias introduced by flooring behavior when coordinates contain decimals greater than 0.5.
Type of Change
Motivation and Context
YOLO polygon annotations are stored as relative (float) coordinates. During mask conversion, coordinates were implicitly floored when cast to
int, shifting polygons toward the top-left and producing inaccurate masks. This PR basically switches to rounding before integer conversion to align pixels correctly.Closes #2023
Changes Made
np.round()prior toastype(int)to avoid systematic flooring bias.resolution_whasfloat32to prevent premature integer casting.Testing
Notes:
Additional Notes
This is a non-breaking change that only affects polygon-to-mask conversion accuracy for YOLO polygon annotations with fractional coordinates.