BossZard / rotation-yolov5

rotation detection based on yolov5
GNU General Public License v3.0
377 stars 97 forks source link

detector.py问题 #3

Open Miki-lin opened 3 years ago

Miki-lin commented 3 years ago

你好,你的这个项目很有参考价值。我使用了你的旋转框yolov5,我下载了你的权重文件,当我运行detect.py文件时,存在以下问题,请问怎么解决呢 /home/miki/anaconda3/envs/yolov5/bin/python /home/miki/project/object_detection/rotation-yolov5/detect.py Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=1024, iou_thres=0.5, output='inference/output', save_txt=False, source='inference/images', update=False, view_img=False, weights='weights/m-70.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1050 Ti', total_memory=4036MB)

Fusing layers... Model Summary: 188 layers, 2.22122e+07 parameters, 0 gradients image 1/1 /home/miki/project/object_detection/rotation-yolov5/inference/images/1.tif: Traceback (most recent call last): File "/home/miki/project/object_detection/rotation-yolov5/detect.py", line 174, in detect() File "/home/miki/project/object_detection/rotation-yolov5/detect.py", line 79, in detect pred = rotate_non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=True) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 869, in rotate_non_max_suppression i = nms(boxes, scores) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 798, in nms rotate_ious = rotate_iou(max_iou_boxes[-1], sort_boxes[1:]) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 710, in rotate_iou r_b1 = get_rotated_coors(box1[i]) File "/home/miki/project/object_detection/rotation-yolov5/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

Process finished with exit code 1 希望能得到你的回复,谢谢!

BossZard commented 3 years ago

opencv版本换到4.4

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: ZJUT_miki <notifications@github.com> 发送时间: 2021年1月4日 11:01 收件人: BossZard/rotation-yolov5 <rotation-yolov5@noreply.github.com> 抄送: Subscribed <subscribed@noreply.github.com> 主题: 回复:[BossZard/rotation-yolov5] detector.py问题 (#3)

你好,你的这个项目很有参考价值。我使用了你的旋转框yolov5,我下载了你的权重文件,当我运行detect.py文件时,存在以下问题,请问怎么解决呢 /home/miki/anaconda3/envs/yolov5/bin/python /home/miki/project/object_detection/rotation-yolov5/detect.py Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=1024, iou_thres=0.5, output='inference/output', save_txt=False, source='inference/images', update=False, view_img=False, weights='weights/m-70.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1050 Ti', total_memory=4036MB)

Fusing layers... Model Summary: 188 layers, 2.22122e+07 parameters, 0 gradients image 1/1 /home/miki/project/object_detection/rotation-yolov5/inference/images/1.tif: Traceback (most recent call last): File "/home/miki/project/object_detection/rotation-yolov5/detect.py", line 174, in detect() File "/home/miki/project/object_detection/rotation-yolov5/detect.py", line 79, in detect pred = rotate_non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=True) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 869, in rotate_non_max_suppression i = nms(boxes, scores) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 798, in nms rotate_ious = rotate_iou(max_iou_boxes[-1], sort_boxes[1:]) File "/home/miki/project/object_detection/rotation-yolov5/utils/general.py", line 710, in rotate_iou r_b1 = get_rotated_coors(box1[i]) File "/home/miki/project/object_detection/rotation-yolov5/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

Process finished with exit code 1 希望能得到你的回复,谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Miki-lin commented 3 years ago

image 你好,我的opencv就是4.4,可是不行,你可以再看看嘛

BossZard commented 3 years ago

抱歉,说错了,是4.2.0.34

------------------ 原始邮件 ------------------ 发件人: "BossZard/rotation-yolov5" <notifications@github.com>; 发送时间: 2021年1月4日(星期一) 下午3:17 收件人: "BossZard/rotation-yolov5"<rotation-yolov5@noreply.github.com>; 抄送: "梁同学"<804072710@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [BossZard/rotation-yolov5] detector.py问题 (#3)

你好,我的opencv就是4.4,可是不行,你可以再看看嘛

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Miki-lin commented 3 years ago

好的,非常感谢

Miki-lin commented 3 years ago

我用opencv4.2解决了这个问题,但是我还是想问一下,为啥4.4不行,这是有什么差别嘛,我找不到原因

BossZard commented 3 years ago

建议可以自己读一下报错,好像是这个函数新版本opencv不支持double类型的计算

------------------ 原始邮件 ------------------ 发件人: "BossZard/rotation-yolov5" <notifications@github.com>; 发送时间: 2021年1月4日(星期一) 晚上9:06 收件人: "BossZard/rotation-yolov5"<rotation-yolov5@noreply.github.com>; 抄送: "梁同学"<804072710@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [BossZard/rotation-yolov5] detector.py问题 (#3)

我用opencv4.2解决了这个问题,但是我还是想问一下,为啥4.4不行,这是有什么差别嘛,我找不到原因

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Miki-lin commented 3 years ago

已经解决,非常感谢!

JJY0710 commented 3 years ago

请教一下,我自己训练DOTA1.5数据集后使用detect.py显示general这行代码报错,这个xy不知道是怎么来的。 /home/gwc/anaconda3/envs/TH/bin/python /home/gwc/project/rotation-yolov5/detect.py --device 0 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='0', img_size=1024, iou_thres=0.5, output='inference/output', save_txt=False, source='data/images', update=False, view_img=False, weights='weights/best.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1660', total_memory=5941MB)

Fusing layers... Model Summary: 236 layers, 4.84147e+07 parameters, 0 gradients image 1/469 /home/gwc/project/rotation-yolov5/data/images/P0006.png: /home/gwc/project/rotation-yolov5/utils/general.py:803: UserWarning: This overload of nonzero is deprecated: nonzero() Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at /pytorch/torch/csrc/utils/python_arg_parser.cpp:882.) index.append((torch.sum((boxes==d),dim=1)==5).nonzero()[0].item()) Traceback (most recent call last): File "/home/gwc/project/rotation-yolov5/detect.py", line 174, in detect() File "/home/gwc/project/rotation-yolov5/detect.py", line 115, in detect plot_one_box(xywh, im0, label=label, color=colors[int(cls)], line_thickness=3, path=path) File "/home/gwc/project/rotation-yolov5/utils/general.py", line 1326, in plot_one_box _x, _y = poly_box.intersection(maxbox).exterior.coords.xy AttributeError: 'list' object has no attribute 'xy'

Process finished with exit code 1

wangning7149 commented 3 years ago

请教一下,我自己训练DOTA1.5数据集后使用detect.py显示general这行代码报错,这个xy不知道是怎么来的。 /home/gwc/anaconda3/envs/TH/bin/python /home/gwc/project/rotation-yolov5/detect.py --device 0 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='0', img_size=1024, iou_thres=0.5, output='inference/output', save_txt=False, source='data/images', update=False, view_img=False, weights='weights/best.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1660', total_memory=5941MB)

Fusing layers... Model Summary: 236 layers, 4.84147e+07 parameters, 0 gradients image 1/469 /home/gwc/project/rotation-yolov5/data/images/P0006.png: /home/gwc/project/rotation-yolov5/utils/general.py:803: UserWarning: This overload of nonzero is deprecated: nonzero() Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at /pytorch/torch/csrc/utils/python_arg_parser.cpp:882.) index.append((torch.sum((boxes==d),dim=1)==5).nonzero()[0].item()) Traceback (most recent call last): File "/home/gwc/project/rotation-yolov5/detect.py", line 174, in detect() File "/home/gwc/project/rotation-yolov5/detect.py", line 115, in detect plot_one_box(xywh, im0, label=label, color=colors[int(cls)], line_thickness=3, path=path) File "/home/gwc/project/rotation-yolov5/utils/general.py", line 1326, in plot_one_box _x, _y = poly_box.intersection(maxbox).exterior.coords.xy AttributeError: 'list' object has no attribute 'xy'

Process finished with exit code 1

我也遇到了这个问题,还有我的训练过程box的loss一直下不去,请问你有这个问题吗?

tiny-cold-hands commented 3 years ago

请教一下,我自己训练DOTA1.5数据集后使用detect.py显示general这行代码报错,这个xy不知道是怎么来的。 /home/gwc/anaconda3/envs/TH/bin/python /home/gwc/project/rotation-yolov5/detect.py --device 0 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='0', img_size=1024, iou_thres=0.5, output='inference/output', save_txt=False, source='data/images', update=False, view_img=False, weights='weights/best.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1660', total_memory=5941MB)

Fusing layers... Model Summary: 236 layers, 4.84147e+07 parameters, 0 gradients image 1/469 /home/gwc/project/rotation-yolov5/data/images/P0006.png: /home/gwc/project/rotation-yolov5/utils/general.py:803: UserWarning: This overload of nonzero is deprecated: nonzero() Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at /pytorch/torch/csrc/utils/python_arg_parser.cpp:882.) index.append((torch.sum((boxes==d),dim=1)==5).nonzero()[0].item()) Traceback (most recent call last): File "/home/gwc/project/rotation-yolov5/detect.py", line 174, in detect() File "/home/gwc/project/rotation-yolov5/detect.py", line 115, in detect plot_one_box(xywh, im0, label=label, color=colors[int(cls)], line_thickness=3, path=path) File "/home/gwc/project/rotation-yolov5/utils/general.py", line 1326, in plot_one_box _x, _y = poly_box.intersection(maxbox).exterior.coords.xy AttributeError: 'list' object has no attribute 'xy'

Process finished with exit code 1

你好,我也遇到用DOTA的测试集不裁切,直接detect的.py。提示没有xy。请问你解决了吗

ZJuanJuan commented 2 years ago

您好,同样的问题,box的损失一直下不去,检测的时候也出现了AttributeError: 'list' object has no attribute 'xy'的错误,请问这个问题您解决了吗?方便提供一下解决思路吗,谢谢

YoonaIAN commented 1 year ago

我在预测的时候遇到这个问题是为什么呢? Traceback (most recent call last): File "E:/rotation-yolov5-master/detect.py", line 13, in from models.experimental import attempt_load File "E:\rotation-yolov5-master\models\experimental.py", line 7, in from models.common import Conv, DWConv File "E:\rotation-yolov5-master\models\common.py", line 6, in from utils.general import non_max_suppression File "E:\rotation-yolov5-master\utils\general.py", line 27, in from shapely.geometry import Polygon, MultiPoint File "D:\anaconda\envs\pytorch\lib\site-packages\shapely\geometry__init.py", line 4, in from .base import CAP_STYLE, JOIN_STYLE File "D:\anaconda\envs\pytorch\lib\site-packages\shapely\geometry\base.py", line 19, in from shapely.coords import CoordinateSequence File "D:\anaconda\envs\pytorch\lib\site-packages\shapely\coords.py", line 8, in from shapely.geos import lgeos File "D:\anaconda\envs\pytorch\lib\site-packages\shapely\geos.py", line 154, in _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll')) File "D:\anaconda\envs\pytorch\lib\ctypes\init.py", line 348, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] 找不到指定的模块。