supervision/tests
Mahbod 2fdb970430
fix(annotators): avoid divide-by-zero in HeatMapAnnotator on empty detections (#2269)
When HeatMapAnnotator is called on a fresh annotator with empty detections
(common on the first frames of a video before the model produces any output),
self.heat_mask is all zeros, so temp / temp.max() raises
RuntimeWarning: invalid value encountered in divide and produces nan/inf
in-flight. Skip the normalisation when temp.max() == 0; the resulting
all-zero heat mask filters out via the > 0 check below, so the scene is
returned unchanged.

- Fix `kernel_size: int = 25` → `int | None = 25`; document None disables blur
- Add Note to annotate docstring: empty detections returns scene unchanged
- Add happy path test: single detection must produce visible heat output
- Add stateful tests: empty→real and real→empty sequence coverage

---------

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 Code <noreply@anthropic.com>
2026-05-26 22:27:07 +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): make COCO annotation/image ids chainable across splits (#2267) 2026-05-22 21:41:42 +02:00
detection Guard `InferenceSlicer` against OBB callback crashes when `thread_workers > 1` (#2256) 2026-05-22 18:53:26 +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 Fix KeyPoints 2D boolean mask indexing (uniform-count selection) (#2188) 2026-03-31 01:48:57 +02:00
metrics Correct confusion matrix calculation-function `evaluate_detection_batch` (#1853) 2026-02-12 18:54:00 +09:00
tracker Fix external track ids (#1364) 2026-02-20 00:58:55 +01:00
utils fix: preserve audio stream in process_video (#2252) 2026-05-19 14:09:45 +02:00
__init__.py refactor: reorganize project structure and update module imports (#2112) 2026-02-03 15:24:47 +01:00
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