supervision/tests
Agis Kounelis ace3ebd03e
fix(detection): make `Detections.area` OBB-aware (#2306)
* fix(detection): make Detections.area OBB-aware

When detections carry ORIENTED_BOX_COORDINATES (the four xyxyxyxy corners),
the area property returned the area of the derived axis-aligned bounding
box instead of the rotated body. The AABB overestimates by up to ~2x for a
45-degree rotation, which silently miscomputes downstream values — most
visibly the area-sorted z-ordering inside MaskAnnotator / HaloAnnotator,
and any user code that filters detections by area.

* docs(detection): use string literal in Detections.area doctest
* test(detection): single-line docstring on test_uses_oriented_box_corners_when_present
* fix(detection): validate (N,4,2) shape of OBB data field in Detections.area
* perf(detection): replace np.roll pair with cross-diagonal shoelace in Detections.area
* perf(detection): cast x/y slices to float64 instead of full corners array
* refactor(detection): extract obb_polygon_area to detection/utils/boxes.py
* test(detection): add test_raises_on_malformed_obb_coordinates_shape
* test(detection): assert per-branch dtype contract for Detections.area
* docs(detection): document OBB dispatch contract and dtype in Detections.area docstring

---------

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-06-09 22:20:34 +02:00
..
annotators fix(annotators): avoid divide-by-zero in HeatMapAnnotator on empty detections (#2269) 2026-05-26 22:27:07 +02:00
assets feat: replace print statements with structured logging (#2154) 2026-02-20 13:14:53 +01:00
classification refactor docstrings in `draw`, `classification`, and `key_points` (#2161) 2026-03-10 18:07:39 +01:00
dataset fix(dataset): preserve OBB rotation in `DetectionDataset.as_yolo` (#2289) 2026-06-08 15:31:04 +02:00
detection fix(detection): make `Detections.area` OBB-aware (#2306) 2026-06-09 22:20:34 +02:00
draw feat: add support for hexadecimal RGBA color format (#2004) 2026-03-30 15:57:18 +02:00
geometry
key_points Revert "feat: store keypoints on detections (#2290)" (#2291) 2026-06-04 11:43:48 -06:00
metrics Fix OBB IoU for non-square canvases (#2282) 2026-06-01 09:20:38 +02:00
tracker Fix external track ids (#1364) 2026-02-20 00:58:55 +01:00
utils fix: normalize file extension filters (#2298) 2026-06-08 13:41:25 +02:00
__init__.py
conftest.py ci(tests): disable matplotlib GUI and exclude non-test dirs from collection (#2262) 2026-05-20 23:40:21 +02:00
helpers.py Add unittests for `supervision.key_points.core` (#2190) 2026-03-30 20:36:31 +02:00
test_validate_deprecations.py refactor: privatize validation helpers (#2294) 2026-06-06 13:15:54 -06:00