From 57ca530519d00a05e6be6b3dbd58eb3ad68bf58a Mon Sep 17 00:00:00 2001 From: bknight44 <42849166+bknight44@users.noreply.github.com> Date: Wed, 7 May 2025 23:19:06 -0400 Subject: [PATCH] Update sort.py Fixes a bug when the program starts with a detection in frame and then it goes away and there is an index out of bounds --- sort.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sort.py b/sort.py index 4b2ca8a..3d8abe6 100644 --- a/sort.py +++ b/sort.py @@ -157,7 +157,7 @@ def associate_detections_to_trackers(detections,trackers,iou_threshold = 0.3): Returns 3 lists of matches, unmatched_detections and unmatched_trackers """ - if(len(trackers)==0): + if(len(trackers)==0 or len(detections)==0): return np.empty((0,2),dtype=int), np.arange(len(detections)), np.empty((0,5),dtype=int) iou_matrix = iou_batch(detections, trackers)