Repository navigation
chore: update YOLO OBB annotation export support - #2302
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2302 +/- ##
=======================================
- Coverage 80% 80% -0%
=======================================
Files 66 66
Lines 8785 8787 +2
=======================================
+ Hits 7045 7046 +1
- Misses 1740 1741 +1 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for exporting oriented bounding box (OBB) annotations from sv.Detections into YOLO polygon-style annotation lines when Detections.data contains ORIENTED_BOX_COORDINATES.
Changes:
- Extend
detections_to_yolo_annotationsto emit normalized polygon coordinates for OBB detections. - Add a unit test asserting OBB export produces the expected YOLO token layout.
Quality Score (1–5):
- Code quality: 3/5
- Testing: 3/5
- Docs: 3/5
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/supervision/dataset/formats/yolo.py | Adds OBB-aware export path in detections_to_yolo_annotations. |
| tests/dataset/formats/test_yolo.py | Adds a new test covering OBB export output. |
Resolves merge conflict with origin/develop by accepting the develop-side implementation of detections_to_yolo_annotations, which supersedes the presence-based OBB detection in this PR with an explicit is_obb flag approach. - adopt is_obb: bool = False parameter for explicit OBB export routing - adopt comprehensive docstring with Args, Returns, Raises, Examples - adopt object_to_yolo delegation (no DRY duplication, resolves /review H3) - adopt warnings.warn when is_obb=True and mask is not None (resolves /review M1) - adopt ValueError guard when is_obb=True but ORIENTED_BOX_COORDINATES absent - adopt comprehensive test suite: exact-value assertions (resolves /review H1), asymmetric 200x100 fixture (resolves /review L2), multiple detections, round-trip via DetectionDataset (resolves /review H2), raises-without-corners, empty-detections, token-count parametrized, background-image round-trip - remove contributor's presence-based OBB branch (superseded by is_obb flag) - add from supervision.dataset.core import DetectionDataset to test imports --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
- add shape guard: raise ValueError when per-detection corners.shape != (4,2) mirrors the (N,4,2) invariant in metrics/utils/object_size.py; surfaces malformed input loudly instead of silently producing corrupt YOLO output - add test: OBB data in detections.data ignored when is_obb=False; verifies bbox 5-token format emitted when ORIENTED_BOX_COORDINATES present but flag not set, exercising the flag-based routing added by the merge commit --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Replace bare inline comment with #: Sphinx autodoc attribute documentation describing value layout (shape (N,4,2), float32, pixel coords), corner ordering, and the two YOLO format functions that consume the key. --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Borda
approved these changes
Jun 10, 2026
Closed
Borda
added a commit
that referenced
this pull request
Jun 16, 2026
- Merge Added [#2312] + Changed [#2312] into single Added entry covering xyxyxyxy_to_xyxy utility and with_nmm OBB merge - Merge Fixed [#2282] + Fixed [#2317] into single entry [#2282, #2317]; #2317 replaced the rasterization approach from #2282 entirely - Fold Fixed [#2252] into Added [#2252]; same function, one entry covers both preserve_audio feature and muxing bug fixes - Fold Fixed [#2289] into Added [#2302, #2289]; same function, one entry covers both is_obb parameter and rotation-loss fix --- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds support for exporting oriented bounding box (OBB) annotations in YOLO format.
Changes
ORIENTED_BOX_COORDINATES.Validation
test_detections_to_yolo_annotations_exports_obb.31 passed).