mikel-brostrom/boxmot

How to reset the tracking id for ByteTracker

Closed this issue · 1 comments

Search before asking

  • I have searched the Yolo Tracking issues and found no similar bug report.

Question

I am using the bytetracker as follows

from boxmot import DeepOCSORT,BYTETracker,BoTSORT,HybridSORT
tracker = BYTETracker()
tracks = tracker.update(dets, og_frame)
for track in tracks:
                        track_id = track[4]

I want to reset the tracker id back to 1 again during a specific process being manually stopped and started. It is integrated to a PyQT app which runs the camera stream. So when the camera stream is turned off and started again, the track id needs to be reset to 1 again.
I tried doing the following

  1. Reset the tracker by reinitializing the tracker = BYTETracker()
  2. I tried initializing tracker.tracks = []
  3.                         tracker.tracks=[]
                         tracker.trackers = []
                         tracker._next_id = 1
    
  4. tracker.init()

But it seems to be storing the last tracker in cache or somewhere and it restarts from the last id before the camera stream was stopped.

Any help would be appreciated! Thanks in advance!

You should now be able to do:

bytetrack = BYTETracker()
bytetrack.BaseTrack.clear_count()