-
Notifications
You must be signed in to change notification settings - Fork 16
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
keep original rotation on import-export in yolo oriented boxes #72
base: develop
Are you sure you want to change the base?
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe pull request introduces changes to the YOLO format plugin in Datumaro, focusing on bounding box and polygon annotation handling. The modifications include making a function public in the converter, adding a rotation synchronization method in the extractor, and updating the dataset comparison logic in the test suite. These changes aim to improve the handling of oriented bounding boxes and their transformations across different stages of annotation processing. Changes
Sequence DiagramsequenceDiagram
participant Converter
participant Extractor
participant Annotation
Converter->>Annotation: bbox_annotation_as_polygon()
Extractor->>Annotation: _rotate_bbox_to_sync_exported_annotation_with_imported()
Annotation-->>Extractor: Adjusted Bounding Box
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/datumaro/plugins/yolo_format/extractor.py (1)
505-548
: Consider documenting assumptions and edge cases for_rotate_bbox_to_sync_exported_annotation_with_imported
.The logic for determining the best shift is correct and well-organized, but there's no immediate check if
imported_points
has exactly 4 corners — relying on the caller to handle input validation. Adding a short docstring or inline comment would clarify the requirement that bothimported_points
andexported_points
represent quadrilaterals and help future maintainers grasp the shift-by-90° increments concept more easily.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/datumaro/plugins/yolo_format/converter.py
(2 hunks)src/datumaro/plugins/yolo_format/extractor.py
(3 hunks)tests/unit/data_formats/test_yolo_format.py
(1 hunks)
🔇 Additional comments (5)
src/datumaro/plugins/yolo_format/extractor.py (2)
48-48
: Good move making bbox_annotation_as_polygon
accessible.
Importing the newly public function is consistent with the refactor, ensuring reusability across modules.
571-580
: Thorough integration of rotation synchronization.
The adjustment of the bounding box attributes post-cv2.minAreaRect()
via _rotate_bbox_to_sync_exported_annotation_with_imported
is logically coherent, ensuring consistent orientation across imports and exports. The final assignment of rotation attributes appears correct and covers the edge case of near-zero rotation by removing the attribute. Good job.
tests/unit/data_formats/test_yolo_format.py (1)
101-104
: Simplified rotation comparison.
Switching from modulo 180 to 360 and removing the extra 90°-handling logic yields a simpler approach that only treats bounding boxes as matching when their rotation differences are negligible (less than 0.01). However, this disallows bounding boxes rotated by 180° or 90° from matching, which might be a breaking change depending on prior requirements. Confirm that this strict rotation check aligns with the new bounding-box sync logic in the extractor.
src/datumaro/plugins/yolo_format/converter.py (2)
49-49
: Public function promotes clearer usage.
Renaming _bbox_annotation_as_polygon
to bbox_annotation_as_polygon
is a good accessibility improvement, making it available for external references. The rotation logic inside is straightforward.
349-349
: Good integration of bbox_annotation_as_polygon
in oriented boxes converter.
This call consolidates rectangle-to-polygon conversions without code duplication, adhering to DRY principles.
# Conflicts: # src/datumaro/plugins/yolo_format/extractor.py
Quality Gate passedIssues Measures |
Summary
How to test
Checklist
develop
branchLicense
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
New Features
Refactor
bbox_annotation_as_polygon
function publicBug Fixes