remove idle trackers

This commit is contained in:
James Gallagher committed 2024-01-23 13:38:15 +00:00
1 parent 24ca25ef94
commit 21791c8522
1 file changed
+9
+9
View File
@@ -111,6 +111,8 @@ class DetectionsSmoother:
self.current_frame += 1
used_tracker_ids = {}
for detection_idx in range(len(detections)):
tracker_id = detections.tracker_id[detection_idx]
if tracker_id is None:
@@ -123,6 +125,13 @@ class DetectionsSmoother:
self.tracks[tracker_id].append(detections[detection_idx])
self.track_ends[tracker_id] = self.current_frame
used_tracker_ids[tracker_id] = True
for track_id in list(self.tracks.keys()):
if track_id not in used_tracker_ids:
del self.tracks[track_id]
del self.track_ends[track_id]
for track_id in self.tracks:
track = self.tracks[track_id]
if self.track_ends[track_id] < self.current_frame: