Enhancement/add obb support confusion matrix #1845
Open
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.
Description
This pull request introduces support for evaluating oriented bounding boxes (OBBs) in the confusion matrix calculations within the
supervision
library. The changes include adding a new parameter to enable OBB support, modifying the IoU calculation logic, and adding comprehensive tests to validate the functionality.Enhancements to IoU and Confusion Matrix Calculations:
use_oriented_boxes
parameter to thefrom_detections
,from_tensors
, andevaluate_detection_batch
methods, allowing users to toggle between axis-aligned and oriented bounding box IoU calculations.oriented_box_iou_batch
whenuse_oriented_boxes
is set toTrue
. This ensures accurate IoU calculations for OBBs.Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
Added a new test file,
test/metrics/test_confusion_matrix_obb.py
, to validate the confusion matrix functionality with and without OBB support. These tests include scenarios for perfect matches and slight offsets between predictions and ground truth.Docs
from_detections
method's docstring to demonstrate how to use theuse_oriented_boxes
parameter with both axis-aligned and oriented bounding boxes.