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
Fix issue #299 #300
Fix issue #299 #300
Conversation
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.
Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap.
supervision/detection/utils.py
Outdated
@@ -20,7 +20,10 @@ def polygon_to_mask(polygon: np.ndarray, resolution_wh: Tuple[int, int]) -> np.n | |||
""" | |||
width, height = resolution_wh | |||
mask = np.zeros((height, width)) | |||
cv2.fillPoly(mask, [polygon], color=1) | |||
|
|||
# Empty numpy array check |
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.
Thank you for addressing the bug; I suggest using if polygon.size > 0: to directly check for an empty array, ensuring against cases with all-zero coordinates.
Hi, @ShubhamKanitkar32 👋🏻! Thanks a lot for submitting a PR so fast. We definitely can't allow It seems reasonable for me for the Maybe we should move that fix to |
@SkalskiP no problem, happy to contribute! I agree with you. It makes more sense for it to live under |
Awesome @ShubhamKanitkar32! 🔥 In that case, I have to ask you for two things:
Once again thanks for helping us to get to the bottom of this problem 🙏🏻 |
Hi @ShubhamKanitkar32 👋🏻! I think we are ready to implement. Take a look at my last comment under your issue: #299 (comment) |
Hi, @ShubhamKanitkar32 I've made some changes to your implementation and added unit tests to make sure it works as expected. I'm merging changes into |
btw, @onuralpszr I love per-commit |
Description
Fixes issue - #299
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Test script provided under the issue