-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let ByteTrack to maintain track ID per instance #1528
Conversation
I finally found time to look at this. There's still a few things to think through - I'll take this one over. When two The question is - do we need that? All use cases that I'm aware of have used one tracker only. The requirements for untangling the IDs come from inference where Also, this PR does exactly what it claims, but it only solves half of the greater problem we have - dependence between multiple * I'm a bit skeptical whether |
In inference we have batch of images - more than 1 video can be processed simultaneously, I'd imagine each stream requires separate tracker and this is how we handle it in inference, by creating separate instance of ByteTrack per stream. We need tracker_id to be deterministic (i.e. we don't want one stream to interfere with tracker_id assigned in another stream). Also there can be another situation - when processing batch of videos, each pass of inference will create new instance of ByteTrack - this instance should produce tracker_id consistently, that is it does not matter what other instances of ByteTrack we had in the past within scope of the process, assigned tracker_id values should be always the same (i.e. same as if we were only processing 1 video in isolation). |
* External IDs were counted as the numbers grow very large very fast * Reworked ID counting as a class, as state is necessary, and only STracks know if an external ID is required after the update (see conditions everywhere before self.external_id_counter.new_id() is called).
I slept on it, and was slightly wrong: there's no ambiguity - we'll never support multiple trackers at once applied to the same Testing unfortunately revealed a regression in the external ID system. It's used to trim down the visible number of track IDs - see video below. Since only individual Video before my change: out_massive_IDs_optim.mp4Video after my change: out_optim.mp4Thanks @grzegorz-roboflow! I can finally merge it. It was also my first time engaging with the tracker code. Looking at it, let's say a tiny bit of remodeling coming. 🔥🪓 |
Description
BaseTrack
implementation includes_count
class var, similarlySTrack
implementation includes_external_count
class var. This results in undesirable behavior when running more than one tracker in the same process. In inference we added a block wrapping ByteTrack, if more than 1 video is processed, objects across videos will receive non-deterministic track IDs.In this change class vars are removed and track ID assignment is handled by upper layer (
ByteTrack
)Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Added unit test to cover this scenario.
Any specific deployment considerations
N/A
Docs
N/A