Skip to content

Phase B1: appearance re-ID (wire HSV descriptors into detection + cross-camera matching) - #9

Closed
mandarwagh9 wants to merge 1 commit into
feat/phaseA-4-coverage-liftfrom
feat/phaseB-1-appearance-reid
Closed

mandarwagh9 wants to merge 1 commit into
feat/phaseA-4-coverage-liftfrom
feat/phaseB-1-appearance-reid

Conversation

@mandarwagh9

Copy link
Copy Markdown
Owner

What & why

Phase B1 — the first feature build of the 10× roadmap. Activates appearance re-ID, which was scaffolded but completely dormant: compute_appearance() was never called, so Detection.appearance was always None — tracking ran pure-IoU and cross-camera matching was distance-only.

⚠️ Stacked on the Phase-A chain (#8 → #7 → #6 → #5 → #4). Auto-retargets as the stack merges.

Changes

  • Detection — extracted a module-level compute_hsv_appearance() (64-dim L2-normalized HSV histogram) and populate Detection.appearance per detection (toggle via APPEARANCE_REID_ENABLED). This also activates the appearance term already in the tracking cost matrix.
  • World model — cross-camera association is now gated on appearance cosine similarity (CROSS_CAMERA_APPEARANCE_THRESHOLD, default 0.5): two differently-dressed people at the same ground position stay separate world objects. The fused descriptor is EMA-smoothed (α = 0.3).
  • Config — added appearance_reid_enabled + cross_camera_appearance_threshold as real Settings fields (genuinely env-wired) + .env.example docs.
  • README — flipped "Appearance re-ID" from 🔭 planned to ✅ implemented.

Tests (TDD)

7 new in test_appearance_reid.py: descriptor shape/normalization, same-vs-different-color similarity, degenerate bbox → None, appearance-gated matching (similar merges, dissimilar stays separate), distance fallback when no appearance, and a config-wiring guard (so the new keys can't silently become no-ops).

Verification

  • ruff clean · mypy clean · 81 tests pass (was 74).
  • Coverage 52% → 55% (floor 50%).

🤖 Generated with Claude Code

… matching

Phase B1 — the first feature build. Activates appearance re-ID, which was
scaffolded but dormant (compute_appearance was never called; Detection.appearance
was always None, so tracking was pure-IoU and cross-camera matching distance-only).

- detection: extract module-level compute_hsv_appearance() and populate
  Detection.appearance per detection (64-dim L2-normalized HSV histogram;
  toggle via APPEARANCE_REID_ENABLED). This also activates the appearance term
  already present in the tracking cost matrix.
- world model: gate cross-camera association on appearance cosine similarity
  (CROSS_CAMERA_APPEARANCE_THRESHOLD, default 0.5) so differently-dressed people at
  the same ground position stay separate; EMA-smooth (alpha=0.3) the fused descriptor.
- config: add appearance_reid_enabled + cross_camera_appearance_threshold as real
  Settings fields (env-wired) + .env.example docs.
- README: flip "Appearance re-ID" from planned to implemented.
- Tests: 7 new (descriptor shape/similarity/degenerate; appearance-gated matching;
  distance fallback; config wiring).

Coverage 52%->55%. ruff/mypy clean, 81 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mandarwagh9

Copy link
Copy Markdown
Owner Author

Superseded — all commits from this phase landed on main via the merge of #13 (the top of the stack, which contains every phase commit). Closing to tidy up; the work is fully merged.

@mandarwagh9
mandarwagh9 deleted the feat/phaseB-1-appearance-reid branch June 19, 2026 15:49
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