Skip to content
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
merged 5 commits into from
Mar 6, 2025

Conversation

fcakyon
Copy link
Collaborator

@fcakyon fcakyon commented Mar 6, 2025

image

@fcakyon fcakyon self-assigned this Mar 6, 2025
fcakyon added 2 commits March 6, 2025 07:50
- 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
@fcakyon fcakyon changed the title update ultralytics demo Fix OBB prediction and update Ultralytics demo notebook Mar 6, 2025
fcakyon added 2 commits March 6, 2025 08:02
- 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
@fcakyon fcakyon requested a review from Copilot March 6, 2025 05:07

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)
@fcakyon fcakyon added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Mar 6, 2025
@fcakyon fcakyon merged commit 13531b7 into main Mar 6, 2025
7 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant