Closed sweetagar closed 1 year ago
Ok, noted.
def update(self, frame, detections):
if len(detections) == 0:
self.tracker.predict()
self.tracker.update([])
self.update_tracks()
return
bboxes = np.asarray([d[:-1] for d in detections])
bboxes[:, 2:] = bboxes[:, 2:] - bboxes[:, 0:2]
scores = [d[-1] for d in detections]
features = self.encoder(frame, bboxes)
dets = []
for bbox_id, bbox in enumerate(bboxes):
dets.append(Detection(bbox, scores[bbox_id], features[bbox_id]))
self.tracker.predict()
self.tracker.update(dets)
self.update_tracks()
I sent a commit with the edit.
File "/Users/[path]/tracker.py", line 30, in update bboxes[:, 2:] = bboxes[:, 2:] - bboxes[:, 0:2] IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
It happens whenever there is no detection, guess need to add a check for empty detections list.