Commit graph

1 commit

Author SHA1 Message Date
kiyo9w
afb59b487f feat: live recognition session (track, classify once, label)
One LiveSession per streaming client. Each frame runs detection and tracking,
then classification is scheduled for products that are new, big enough, fully in
frame and not already settled; results are cached on the track so detection
never waits for classification. Empty-slot gaps are smoothed over frames and
quality hints (glare, blur, too far) come from a 320 px downscale.

Correctness work that the acceptance run forced out:

- Classification submissions happen OUTSIDE the session lock. add_done_callback
  runs the callback inline when the future already completed, so attaching it
  while holding the lock deadlocked the session on the second frame.
- A label is dropped only when its box has drifted off the product for two
  consecutive frames (panning slides boxes onto neighbours), and the anchor is
  the box the crop came from, not wherever the track moved by the time
  classification finished.
- An id that disappears and comes back is a restart, not the same object: the
  old label is cleared instead of silently labelling a neighbour. relabels and
  restarts counters are monotonic per id so clients can tell a re-verification
  from a silent flip.
- Track ids are tracked per session (tracking.py) and counters survive pruning.

Measured on the synthetic pan (30 frames, 248 label observations): 20
re-verifications, 0 unexplained label changes, detection 20 ms/frame.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-24 12:21:44 +09:00