fix(bytetrack): prune unmatched tracks after kalman refactor#376
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
@Borda the tests were failing earlier - f74ada7. |
|
PR #310 noted two deliberate behavioural changes for ByteTrack:
This PR addresses two regressions that were not part of #310's stated intent:
I'm a bit confused. Was this change intentional, or really a bug? |
|
Good catch. The 1. switching maturity to number_of_successful_consecutive_updates was intended, but we seem to have introduced these bugs by no updating with None and by no checking |
There was a problem hiding this comment.
Pull request overview
Adds cross-tracker regression coverage for track pruning semantics after the Kalman/tracklet refactor (#310), and fixes ByteTrack’s missed-frame accounting so expired tracks are actually pruned.
Changes:
- Add parametrized pruning/occlusion regression tests that apply to SORT, ByteTrack, and OC-SORT.
- Fix ByteTrack to call
tracklet.update(None)for tracks unmatched after both association passes, ensuringtime_since_updateadvances and tracks expire. - Adjust ByteTrack “alive tracklet” maturity logic to treat confirmation as sticky (based on assigned
tracker_id), and update stored expected benchmark outputs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
trackers/core/bytetrack/utils.py |
Makes “confirmed/mature” status sticky by using tracker_id != -1 as the confirmation signal. |
trackers/core/bytetrack/tracker.py |
Advances time_since_update for tracks unmatched after both passes via update(None) to enable pruning. |
trackers/core/base.py |
Adds a base-level tracks type annotation to formalize the common tracker surface. |
test/data/tracker_expected_sportsmot.json |
Updates ByteTrack expected benchmark metrics after the behavioral fix. |
test/data/tracker_expected_dancetrack.json |
Updates ByteTrack expected benchmark metrics after the behavioral fix. |
test/core/test_tracker_pruning.py |
Introduces regression tests for pruning, missed-frame advancement, and short-occlusion survival across trackers. |
Reflect corrected benchmark numbers across bytetrack.md and comparison.md. Made-with: Cursor
|
@Borda with the discussed changes applied, the PR LGTM |
What does this PR do?
Add parametrized regression tests across SORT, ByteTrack, and OCSORT covering three contracts every tracker must satisfy after the recent kalman/tracklet refactor (#310):
1. A confirmed track is pruned after
lost_track_buffer + Nempty frames.2.
time_since_updateadvances when a track is not matched in a frame.3. A confirmed track survives a short occlusion (a few empty frames well below the lost-track buffer).
These tests pass on SORT and OCSORT. On ByteTrack, two of them fail: the tracker never calls
tracklet.update(None)on tracks unmatched in either association pass, sotime_since_updatestays at 0 and_get_alive_trackletsnever sees an expired track.Related Issue(s):
Type of Change
Testing
Test details:
Checklist