supervision/tests
Agis Kounelis a48532f6f5
perf(annotators): share mask painting and give HaloAnnotator the CompactMask path (#2339)
MaskAnnotator paints CompactMask detections into their bounding-box crop, but
HaloAnnotator never got that path: it materialized every mask full-frame, painted
via full-frame boolean indexing, and built its foreground mask as a 2M-element
Python list per frame. Extract the shared compact/dense painting into a single
_paint_masks_by_area helper used by both annotators. On a 1080p frame with 30
masks, HaloAnnotator on CompactMask runs about 4x faster; output is unchanged.

- Replace in-place `union` param with `collect_union: bool` return value;
  HaloAnnotator now captures the returned union array
- Add Google-style Args/Returns to `_paint_masks_by_area` docstring
- Fix HaloAnnotator.annotate() example (was maskless → no-op) and scene arg wording
- Add section comment above shared helper for discoverability
- Add union accumulation tests (dense + CompactMask paths via collect_union=True)
- Add test documenting out-of-bbox True-pixel divergence between compact and dense
- Add image-edge bbox test for CompactMask annotators
- Move helper tests into TestPaintMasksByArea and TestCompactMaskParity classes
- Rename test_annotate_with_empty_masks → test_annotate_with_all_false_mask

---------

Co-authored-by: jirka <6035284+Borda@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-06-18 12:37:11 +02:00
..
annotators perf(annotators): share mask painting and give HaloAnnotator the CompactMask path (#2339) 2026-06-18 12:37:11 +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 chore: preserve all polygons when exporting multi-part masks to COCO (#2322) 2026-06-16 00:43:19 +02:00
detection perf(detection): compute mask IoU via matmul instead of an (N, M, H, W) intermediate (#2323) 2026-06-18 10:45:56 +02:00
draw feat: add support for hexadecimal RGBA color format (#2004) 2026-03-30 15:57:18 +02:00
geometry Extend docstrings to test cases for enhanced readability (#2130) 2026-02-03 17:28:33 +01:00
key_points feat: add `KeyPoints.with_nms()` method (#2338) 2026-06-18 10:42:43 +02:00
metrics fix(metrics): count false positives on background images and absent classes (#2331) 2026-06-17 19:46:10 +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 refactor: enrich `KeyPoints` with visibility mask, split confidence fields, and redesign uncertainty annotator (#2286) 2026-06-11 18:34:33 +02:00
test_validate_deprecations.py refactor: privatize validation helpers (#2294) 2026-06-06 13:15:54 -06:00