Skip to content

Commit

Permalink
Fix ValueError: cannot select an axis to squeeze out which has size n…
Browse files Browse the repository at this point in the history
…ot equal to one.
  • Loading branch information
acai66 committed Dec 28, 2021
1 parent 9e38ec3 commit 883d0cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
# i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS

i = cv2.dnn.NMSBoxesRotated(boxes_for_cv2_nms, scores_for_cv2_nms, conf_thres, iou_thres)
i = np.squeeze(i, axis=-1)
if i.ndim > 1:
i = np.squeeze(i, axis=-1)

if i.shape[0] > max_det: # limit detections
i = i[:max_det]
Expand Down

0 comments on commit 883d0cc

Please sign in to comment.