abewley / sort

Simple, online, and realtime tracking of multiple objects in a video sequence.
GNU General Public License v3.0
3.82k stars 1.07k forks source link

error in iou__batches #161

Open day-night-py opened 1 year ago

day-night-py commented 1 year ago

yy1 = np.maximum(bb_test[..., 1], bb_gt[..., 1]) IndexError: index 1 is out of bounds for axis 1 with size 1

xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0]) ValueError: operands could not be broadcast together with shapes (0,) (1,2)

getting these two error while running

marunava21 commented 1 year ago

I am also getting similar issue were you able to resolve it? ' xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])', 'ValueError: operands could not be broadcast together with shapes (0,) (1,32)

sauravns commented 1 year ago

@marunava21 @day-night-py check the detections you're passing to tracker, even if there are no detections just pass "np.empty((0, 5))".

marunava21 commented 1 year ago

@sauravns Thanks for the suggestion, i solved the issue

MihirD002 commented 7 months ago

@sauravns Thanks for the suggestion, i solved the issue

How did you solve the error, can you please explain? I'm facing the same error.

sbieee commented 5 months ago

I am also getting similar error. Any idea what could be the issue?

File "/home/ubuntu/PycharmProjects/sort/sort.py", line 238, in update matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets, trks, self.iou_threshold) File "/home/ubuntu/PycharmProjects/sort/sort.py", line 169, in associate_detections_to_trackers iou_matrix = iou_batch(detections, trackers) File "/home/ubuntu/PycharmProjects/sort/sort.py", line 56, in iou_batch xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0]) ValueError: operands could not be broadcast together with shapes (0,) (1,2)

sbieee commented 5 months ago

Thanks @sauravns for the suggestion.. In the iou_batch() function, we should check whether detection length and if its 0 then set the detection to empty numpy array,

def iou_batch(bb_test, bb_gt): """ From SORT: Computes IOU between two bboxes in the form [x1,y1,x2,y2] """

if len(bb_test) == 0:
    bb_test = np.empty((0, 5))

... ...

ZXStudio commented 3 months ago

谢谢@sauravns对于建议..在iou_batch()函数中,我们应该检查检测长度是否为0,然后将检测设置为空numpy数组,

def iou_batch(bb_test, bb_gt): """ 来自 SORT:以 [x1,y1,x2,y2] 形式计算两个 bbox 之间的 IOU """

if len(bb_test) == 0:
    bb_test = np.empty((0, 5))

……​

Thank you!!