Skip to content

feat(reid): R6 scene-adaptive ReID accept threshold (tighten in look-alike scenes)#94

Merged
TCVinNYC merged 1 commit into
mainfrom
feat/r6-adaptive-reid
Jun 24, 2026
Merged

feat(reid): R6 scene-adaptive ReID accept threshold (tighten in look-alike scenes)#94
TCVinNYC merged 1 commit into
mainfrom
feat/r6-adaptive-reid

Conversation

@TCVinNYC

Copy link
Copy Markdown
Member

The ReID recovery match used a FIXED reid_threshold_hi (0.70). When two people in frame genuinely look alike (high inter-person appearance similarity), 0.70 can be too low and the lost target re-binds onto the wrong look-alike (an ID switch). When everyone looks distinct, 0.70 is fine.

Safe scope: a pure reid.adaptive_threshold_hi(candidates, base_hi) raises the recovery accept threshold toward the observed max inter-person cosine (clamp(max(base, max_pairwise+0.05), base, 0.95)) — demanding MORE confidence to re-bind in ambiguous scenes, but NEVER below the configured base, and only on the recovery path (target already lost). So it can only tighten matching where wrong-recovery is likely; it cannot regress vs. today. Wired into _maybe_reid_recover (both the scoring and confirmation calls); threshold_lo unchanged; identical behavior with <2 candidates or ReID disabled.

25 new pure tests; full suite green.

Roadmap item R6 (adaptivity). Real-scene validation (look-alike crowds vs distinct) at the final RC.

🤖 Generated with Claude Code

Adds `adaptive_threshold_hi()` pure helper to reid.py that raises the
recovery accept threshold toward the most-similar candidate pair (max
pairwise cosine + margin), clamped to [base_hi, cap]. Wires `eff_hi`
into `_maybe_reid_recover` in camera_worker so look-alike scenes demand
higher confidence before rebinding — prevents ID switches without
loosening the threshold in distinct scenes. Behavior is identical when
<2 candidates or ReID is disabled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@TCVinNYC TCVinNYC merged commit ab4fa59 into main Jun 24, 2026
3 checks passed
@TCVinNYC TCVinNYC mentioned this pull request Jun 24, 2026
TCVinNYC added a commit that referenced this pull request Jun 24, 2026
Second **pre-release** of the 2.2.0 reliability + performance roadmap,
for real-hardware validation before the stable 2.2.0. Bumps
`__version__` to `2.2.0-rc2`; on merge, tag `v2.2.0-rc2` triggers the
pre-release installer build.

**New since rc1 (all merged, CI-green + multi-agent-reviewed):**
- #92 CPU subservice governor — fewer CPU spikes (phase-stagger) +
cadence throttle under load
- #93 preview-rate-cap (~20fps)
- #90 live GPU-acceleration verdict in the Services panel
- #91 OpenVINO auto-install for Intel
- #94 scene-adaptive ReID threshold
- #95/#96 opt-in fused TargetAssociator (off by default)
- #97 batched detect_batch primitive

**Validate especially:** CPU usage/spikes with all subservices running
(your priority), and \`python -m autoptz --bench\` / the Services-panel
verdict on Intel-Mac+AMD. To try the new tracking logic, set
\`tracking.use_target_associator = true\`.

Follow-ups after your validation: P4 coalescing scheduler, wire the
associator ReID/pose cues + flip its default, int8 CPU quant, stable
Win/Linux device binding.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant