Files
frigate/frigate
a2b46f5d84 perf(util): cut redundant work in per-frame detection consolidation (#23522)
video/detect.py runs these for every frame:

- get_cluster_candidates: used_boxes was a list with `in` membership tests
  inside the nested loop (O(n) per check). It is only ever membership-tested,
  so switching it to a set (O(1)) leaves output unchanged.
- get_consolidated_object_detections: area(current_box) was recomputed on
  every inner-loop iteration though it is loop-invariant; hoist it to one
  call per outer detection.

Both are bit-identical (verified against the previous implementations over
randomized inputs). Measured in the release image, get_cluster_candidates on
a frame of 30 detection boxes: 59.2 us -> 42.1 us (1.4x); the gain scales
with the number of boxes per frame.

Adds a partition-invariant test (every box index lands in exactly one
cluster).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 15:23:18 -06:00
..
2026-05-22 08:39:52 -06:00
2026-06-16 08:56:52 -05:00
2026-03-26 12:54:12 -06:00
2026-06-04 12:48:58 -06:00
2026-05-21 08:12:53 -06:00
2026-05-29 06:53:17 -06:00
2026-06-01 12:08:46 -05:00
2026-05-27 09:19:11 -06:00
2021-01-26 21:40:33 -06:00
2026-05-30 21:35:03 -06:00
2026-05-27 09:19:11 -06:00
2026-02-03 13:29:52 -06:00
2026-03-26 12:54:12 -06:00
2026-04-29 16:20:19 -06:00