Skip to content

Commit

Permalink
fix frame count
Browse files Browse the repository at this point in the history
  • Loading branch information
mikel-brostrom committed May 13, 2024
1 parent cc0426c commit 6dd8cd8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion boxmot/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def wrapper(*args, **kwargs):
# Initialize an array to store the tracks for each class
per_class_tracks = []

# same frame count for all classes
frame_count = instance.frame_count

for i, cls_id in enumerate(range(self.nr_classes)):
Expand All @@ -58,6 +59,7 @@ def wrapper(*args, **kwargs):

# reset frame count for every class
instance.frame_count = frame_count
logger.info(instance.frame_count)

# Update detections using the decorated method
tracks = self.update(instance, class_dets, im)
Expand All @@ -67,11 +69,14 @@ def wrapper(*args, **kwargs):

if tracks.size > 0:
per_class_tracks.append(tracks)

print(cls_id, instance.frame_count)

# when all active tracks lists have been updated
instance.per_class_active_tracks = self.per_class_active_tracks

instance.frame_count = instance.frame_count - 1
# increase frame count by 1
instance.frame_count = frame_count + 1

tracks = np.vstack(per_class_tracks) if per_class_tracks else np.empty((0, 8))
else:
Expand Down

0 comments on commit 6dd8cd8

Please sign in to comment.