fix: enhance bounding box processing with rotation support#231
Merged
przemyslaw-aszkowski merged 1 commit intoPUTvision:develfrom Feb 2, 2026
Merged
Conversation
przemyslaw-aszkowski
approved these changes
Jan 26, 2026
Author
|
The PR process has stopped for some reason that I do not know. Anything I can do @przemyslaw-aszkowski ? |
Contributor
|
There is some issue with Ubunto20 pipeline, I merged the PR, thanks! |
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.
Fixes #228
Summary
This PR adds rotation-aware intersection calculation to the
non_max_kdtreemethod, fixing duplicate detection removal for Oriented Bounding Box (OBB) detections.Problem
When using
YOLO_ULTRALYTICS_OBBdetector type, thenon_max_kdtreepost-processing step was not considering bounding box rotation. This could lead to incorrect removal of overlapping detections for rotated bounding boxes.Changes
with_rotparameter tonon_max_kdtree()method_calculate_rotated_intersection_over_smaller_area()static method that uses QGIS geometry operations to compute intersection area for rotated rectanglesremove_overlaping_detections()to passwith_rotflagTesting
manual_test_map_processor_obb_yolo_ultralytics.py- correctly detects 2 planesKnown Limitations
Related
Related to OBB detection support added in earlier PRs.
Note that as explained in #228, Detector.non_max_suppression_fast was already addressing the obb case with with_rot=True, but non_max_kdtree was missing with_rot=True implementation as also verified by @przemyslaw-aszkowski in #228 .