Complex-YOLOv3 icon indicating copy to clipboard operation
Complex-YOLOv3 copied to clipboard

cv2 error

Open didnmj opened this issue 3 years ago • 5 comments

joon@DESKTOP-J3EB27K:~/Complex-YOLOv3$ python test_both_side_detection.py --split=sample --folder=sampledata --save_video=true Namespace(class_path='data/classes.names', conf_thres=0.8, folder='sampledata', img_size=608, model_def='config/complex_yolov3.cfg', nms_thres=0.4, save_video=True, split='sample', weights_path='checkpoints/yolov3_ckpt_epoch-298.pth') Load TESTING samples from data/KITTI/object/sampledata Done: total TESTING samples 12 Traceback (most recent call last): File "test_both_side_detection.py", line 90, in front_bev_result, img_detections = detect_and_draw(model, front_bevs, Tensor, True) File "test_both_side_detection.py", line 51, in detect_and_draw bev_utils.drawRotatedBox(display_bev, x, y, w, l, yaw, cnf.colors[int(cls_pred)]) File "/home/joon/Complex-YOLOv3/utils/kitti_bev_utils.py", line 174, in drawRotatedBox cv2.line(img, (corners_int[0, 0], corners_int[0, 1]), (corners_int[3, 0], corners_int[3, 1]), (255, 255, 0), 2) cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'line'

Overload resolution failed:

  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type
  • Can't parse 'pt1'. Sequence item with index 0 has a wrong type

didnmj avatar Jan 17 '22 07:01 didnmj

kitti_bev_utils.py line 169 ~ 174 ////////////////////////////////////// def drawRotatedBox(img,x,y,w,l,yaw,color): bev_corners = get_corners(x, y, w, l, yaw) corners_int = bev_corners.reshape(-1, 1, 2).astype(int) cv2.polylines(img, [corners_int], True, color, 2) corners_int = bev_corners.reshape(-1, 2) cv2.line(img, (corners_int[0, 0], corners_int[0, 1]), (corners_int[3, 0], corners_int[3, 1]), (255, 255, 0), 2)

didnmj avatar Jan 17 '22 07:01 didnmj

following

Shibaditya99 avatar Jan 27 '22 05:01 Shibaditya99

I have the same problem.. Have you solved it?

sjkaang avatar Mar 25 '22 04:03 sjkaang

I have the same problem.. Have you solved it?

sunny553 avatar Mar 29 '22 14:03 sunny553

I have the same problem.. Have you solved it?

I have solved this. Change as below

kitti_bev_utils.py line 174 /////////////////////////////////// cv2.line(img, (int(corners_int[0, 0]), int(corners_int[0, 1])), (int(corners_int[3, 0]), int(corners_int[3, 1])), (255, 255, 0), 2)

But I'm not sure why 'astype' didn't work in line 171 >>> "corners_int = bev_corners.reshape(-1, 1, 2).astype(int)"

sjkaang avatar Mar 30 '22 01:03 sjkaang