Add box_area_center
and box_iou_center
functions for cxcywh format with tests
#8992
+163
−0
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.
Related #8961
This pull request introduces new utility functions for handling bounding boxes and adds corresponding tests. The main changes include the addition of
box_area_center
andbox_iou_center
functions, as well as comprehensive tests to ensure their correctness.New utility functions:
torchvision/ops/boxes.py
: Addedbox_area_center
function to compute the area of bounding boxes specified by their center coordinates.torchvision/ops/boxes.py
: Addedbox_iou_center
function to compute the intersection-over-union (IoU) for bounding boxes specified by their center coordinates.Documentation updates:
docs/source/ops.rst
: Updated the documentation to includebox_area_center
andbox_iou_center
.Test additions:
test/test_ops.py
: AddedTestBoxAreaCenter
class with tests forbox_area_center
function.test/test_ops.py
: AddedTestBoxIouCenter
class with tests forbox_iou_center
function.Module initialization:
torchvision/ops/__init__.py
: Updated the module initialization to includebox_area_center
andbox_iou_center
[1] [2].