-
Notifications
You must be signed in to change notification settings - Fork 638
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 OBB prediction and update Ultralytics demo notebook #1126
Merged
Conversation
This file contains 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
Collaborator
fcakyon
commented
Mar 6, 2025
•
edited
Loading
edited
- Add OBB (Oriented Bounding Box) prediction example to inference notebook - Enhance visualization for OBB predictions in cv utils - Update AutoDetectionModel and prediction methods to support OBB models - Bump package version to 0.11.22 - Improve demo notebook with additional test image and simplified imports
- Increase citation count to 300+ - Add new 2025 video tutorial link - Update Colab notebook links for YOLO12, YOLO11-OBB, and YOLO11 - Remove (NEW) tag from some existing links - Add Encord blog link explaining Slicing Aided Hyper Inference
- Clean up whitespace and formatting in predict.py and cv.py - Remove unnecessary whitespace and improve code readability - Minor formatting adjustments in visualization and point conversion functions
- Eliminate unnecessary polygon closure checks in test_ultralyticsmodel.py - Simplify segmentation validation to focus on essential checks - Improve test flexibility for segmentation point representation
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.
PR Overview
This PR fixes OBB prediction handling and updates the Ultralytics demo notebook along with several related improvements.
- Updated README links and publication count to reflect the new demo and resources.
- Modified visualization logic in the computer vision utility to handle OBB polygons.
- Adjusted model inference and prediction postprocessing for OBB outputs, with corresponding updates to tests and documentation.
Reviewed Changes
File | Description |
---|---|
README.md | Updated Colab demo link from YOLOv5 to Ultralytics and increased the publication count. |
sahi/utils/cv.py | Revised object visualization to support OBB polygons including label placement adjustments. |
sahi/predict.py | Added default full_shape handling and enforced NMS postprocessing for Ultralytics OBB outputs. |
sahi/models/ultralytics.py | Modified OBB segmentation conversion and updated import statements for consistency. |
sahi/auto_model.py | Updated docstring examples to include new detection frameworks. |
pyproject.toml | Bumped version to signal the release. |
tests/test_ultralyticsmodel.py | Removed assertions for closed polygon format in line with the new OBB segmentation output. |
sahi/models/torchvision.py | Renamed variables for consistency in segmentation handling. |
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
sahi/models/ultralytics.py:210
- The OBB segmentation output now returns 8 coordinates (without a duplicated closing point), so please update the corresponding docstring to reflect this new format to avoid confusion downstream.
segmentation = [obb_points.reshape(-1).tolist()]
sahi/utils/cv.py:563
- [nitpick] Consider refactoring the OBB polygon labeling block (lines 562-586) into a dedicated helper function for improved readability and maintainability.
points = np.array(segmentation).reshape((-1, 1, 2)).astype(np.int32)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
documentation
Improvements or additions to documentation
enhancement
New feature or request
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.