-
Notifications
You must be signed in to change notification settings - Fork 7.1k
draw_bounding_boxes should check that (W, H) >= (xmax, ymax) >= (xmin, ymin) >= (0, 0) #5517
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
Comments
I agree with the overall sentiment here. My question is how you got to the situation. Did you know that you had "cxcywh" bounding boxes and missed that In the former case, we also could have a We are currently in the process of introducing new abstractions for bounding boxes. With that, bounding boxes store information about the format and thus a conversion as proposed above would be handled automatically. vision/torchvision/prototype/features/_image.py Lines 83 to 86 in 71d2bb0
In an internal discussion following #5500 (comment), we decided to move this functionality into |
@pmeier I knew that The class abstraction definitely sounds like a good idea. I still think though that it would be a good idea to add this check to the "functional" version |
@norabelrose thanks for the suggestion, we'd be happy to review a PR that adds these checks |
To avoid code duplication and for convenience. I suggest we create a small util With this single util we could check all places and raise ValueError suggesting to either check the input or use cc @NicolasHug @norabelrose |
There was some discussions before about adding these checks in the ops (box_iou, nms etc.). We don't do it because this would require adding a synchronization point of the CUDA streams. It's probably best to ignore the ops for now and stick to |
I could look into this if no one else is. |
Sure, go ahead! |
Go ahead @singhularAdi Feel free to ping Nicolas for review :) Edit: |
🚀 The feature
Currently,
draw_bounding_boxes
does not sanity check the input bounding boxes to ensure that(xmax, ymax) >= (xmin, ymin)
. This can lead to unexpected output that can be difficult to debug if the user, say, inputs boxes in cxcywh format.I could make a PR for this if needed but would prefer if someone else did it since I have my hands full with a PR I'm working on for PyTorch proper.
Motivation, pitch
I personally just ran into this problem and I thought something was wrong with my network for a while.
Currently, the box conversion ops do this check, and it seems at least as important to do the same check in
draw_bounding_boxes
.Alternatives
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: