Repository navigation
fix: Isolate BYTETracker IDs per instance and bound removed tracks - #170
Merged
Merged
Conversation
Owner
|
Hi @M-Colley! Thanks for the fix! I pushed a few small changes to keep it closer to the original ByteTrack code and dropped the parts outside the two fixes. |
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes multi-tracker ID collisions, unbounded memory/CPU growth, and CLI tracking bugs in ByteTrack:
BYTETrackerIDs (uniface/tracking/bytetrack/tracker.py): Track IDs are now allocated perBYTETrackerinstance (self._next_id) rather than resetting globalBaseTrack._countinsidereset(). Previously, callingreset()on oneBYTETrackercaused concurrent trackers to reuse active IDs and silently drop new face tracks during_joint_stracksdeduplication. (BaseTrack.next_id()remains intact for standaloneSTrackcallers.)BaseTrackcontainers (uniface/tracking/bytetrack/basetrack.py): Movehistoryandfeaturesfrom shared mutable class attributes intoBaseTrack.__init__.removed_stracks(uniface/tracking/bytetrack/tracker.py): Subtract only the current frame'sremoved_stracksfromself.lost_stracksand capself.removed_stracksto 1,000 entries, fixing unbounded memory growth andO(total_historical_tracks)per-frame overhead on long streams.KalmanFilter.multi_predict(uniface/tracking/bytetrack/kalman.py): Replace the per-tracknp.diagPython loop with vectorized diagonal indexing and batched matrix multiplication.tools/track.py): Forward low-confidence detections (> tracker.low_thresh) so ByteTrack's second-stage association runs as intended, and match tracks 1-to-1 to detectedFaceobjects by IoU so occluded tracks cannot overwrite another face'strack_id.Testing
tests/test_tracking.pycovering two-stage association, multi-instance reset isolation, instance-scoped containers, boundedremoved_stracks, Kalman batch parity, and 1-to-1 CLI track assignment.