TypeError: Argument ‘angle‘ can not be treated as a double

Posted AI浩

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TypeError: Argument ‘angle‘ can not be treated as a double相关的知识,希望对你有一定的参考价值。

问题如下:

 File "D:\\rotation-yolov5-master\\detect.py", line 173, in <module>
    detect()
  File "D:\\rotation-yolov5-master\\detect.py", line 78, in detect
    pred = rotate_non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=True)
  File "D:\\rotation-yolov5-master\\utils\\general.py", line 869, in rotate_non_max_suppression
    i = nms(boxes, scores)
  File "D:\\rotation-yolov5-master\\utils\\general.py", line 797, in nms
    rotate_ious = rotate_iou(max_iou_boxes[-1], sort_boxes[1:])
  File "D:\\rotation-yolov5-master\\utils\\general.py", line 710, in rotate_iou
    r_b1 = get_rotated_coors(box1[i])
  File "D:\\rotation-yolov5-master\\utils\\general.py", line 729, in get_rotated_coors
    R[:2] = cv2.getRotationMatrix2D(angle=-a*180/math.pi, center=(cx,cy), scale=1)
TypeError: Argument 'angle' can not be treated as a double

解决方法:

   R[:2] = cv2.getRotationMatrix2D(angle=-a*180/math.pi, center=(cx,cy), scale=1)

改为:

R[:2] = cv2.getRotationMatrix2D(angle=float(-a*180/math.pi), center=(cx,cy), scale=1)

以上是关于TypeError: Argument ‘angle‘ can not be treated as a double的主要内容,如果未能解决你的问题,请参考以下文章

TypeError: take(): argument 'index' (position 1) must be Tensor, not numpy.ndarray

TypeError argument should be a Buffer

Python_异常:TypeError: write() argument must be str, not list

如何修复 'ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type' RaspberryPi

Python_报错:TypeError: Tuple or struct_time argument required

Python错误TypeError: write() argument must be str, not bytes