-
Notifications
You must be signed in to change notification settings - Fork 7.1k
More rotated bboxes transforms #9095
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
Merged
NicolasHug
merged 8 commits into
pytorch:main
from
AntoineSimoulin:rotated-bboxes-transforms
Jun 6, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
87e821f
Delete `is_rotated_bounding_box_format` function
AntoineSimoulin 782f406
Update `resize_bounding_boxes` for rotated boxes
AntoineSimoulin a28fa39
Update `_affine_bounding_boxes_with_expand` for rotated boxes
AntoineSimoulin eee56d8
Update `pad_bounding_boxes` for rotated boxes
AntoineSimoulin 0629b64
Update `crop_bounding_boxes` for rotated boxes
AntoineSimoulin c96676a
Fix tests for `int` rotated boxes
AntoineSimoulin a1156f1
Adjust `_parallelogram_to_bounding_boxes`
AntoineSimoulin 2f322f0
Adjust `atol` for `TestCrop`
AntoineSimoulin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you help me understand why we need a
flip
parameter inreference_affine_rotated_bounding_boxes_helper
, but not inreference_affine_bounding_boxes_helper
?It seems that
reference_affine_bounding_boxes_helper
, the flip is done through theaffine_matrix
? Is this something we can do for the rotated case as well? If not it might be worth adding a comment to explain whyThere 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.
@NicolasHug, this is a good question. As illustrated in the image below. When we apply the flip operation, we actually transform each points (x1, y1), (x2, y2), (x3, y3), (x4, y4) from the bounding box. However the flip operation will typically change the order of the points if we go through them in clock-wise order. Given the definition of "XYXYXYXY", "CXCYWHR", and "XYWHR", we do want to go through (x1, y1), (x2, y2), (x3, y3), (x4, y4) in clock-wise order. This is why we are switching the point (x2, y2) and (x4, y4). This typically does not append for non-rotated boxes as we re-assign the points with
min
andmax
operations here. I hope it makes sense?