supervision/tests
Agis Kounelis e1b7a16101
fix(detection): keep `from_inference` aligned on partial masks (#2362)
process_roboflow_result appended a mask only for predictions carrying one
(RLE or polygon), while xyxy/confidence/class_id were appended for every
prediction. A result mixing masked and box-only predictions (e.g. a
segmentation batch where one polygon is empty) produced a mask array shorter
than the boxes, so Detections.from_inference raised a shape-mismatch error.

Append None for box-only predictions and build the mask array only when every
prediction has a mask, otherwise drop masks to preserve alignment, mirroring
the tracker_id handling. Fully-masked and mask-free results are unchanged.

- Update `masks` Returns clause to document partial-drop case and corrupt-RLE blast radius (D1+C1)
- Remove stale "known limitation" note from from_inference docstring; describe actual behavior (D2)
- Extract _all_present_or_none() helper; eliminate duplicated partial-drop-warn pattern (S1)

---------

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-07-01 00:52:57 +02:00
..
annotators chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
assets chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
classification refactor docstrings in `draw`, `classification`, and `key_points` (#2161) 2026-03-10 18:07:39 +01:00
dataset chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
detection fix(detection): keep `from_inference` aligned on partial masks (#2362) 2026-07-01 00:52:57 +02:00
draw chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
geometry chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
key_points chore(typing): Add explicit selection helpers (#2373) 2026-06-29 15:39:58 +02:00
metrics chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
tracker chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
utils chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
__init__.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
conftest.py chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
helpers.py chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00
test_validate_deprecations.py chore: bump minimum Python to 3.10 (#2260) 2026-06-29 14:45:30 +02:00