Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: operands could not be broadcast together with shapes (0,) (1,3) #176

Open
sailohitaksh-cryptic opened this issue Jan 19, 2024 · 1 comment

Comments

@sailohitaksh-cryptic
Copy link

When testing with a certain video the code is giving this error.

Traceback (most recent call last):
File "D:\Documents\Ripik\truck_detect\main.py", line 31, in
track_ids = mot_tracker.update(np.asarray(detections_))
File "D:\Documents\Ripik\truck_detect\sort\sort.py", line 232, in update
matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks, self.iou_threshold)
File "D:\Documents\Ripik\truck_detect\sort\sort.py", line 163, in associate_detections_to_trackers
iou_matrix = iou_batch(detections, trackers)
File "D:\Documents\Ripik\truck_detect\sort\sort.py", line 54, in iou_batch
xx1 = np.maximum(bb_test[..., 0], bb_gt[..., 0])
ValueError: operands could not be broadcast together with shapes (0,) (1,3)

@ZXStudio
Copy link

ZXStudio commented Mar 22, 2024

I have encountered similar problems before. Thank you for your answer at @sauravns. In the iou_batch() function of sort.py, we should first check if the length of bb_test is 0, and then set the detection to an empty numpy array.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants