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

detector.py问题 #3

Open
Miki-lin opened this issue Jan 4, 2021 · 12 comments
Open

detector.py问题 #3

Miki-lin opened this issue Jan 4, 2021 · 12 comments

Comments

@Miki-lin
Copy link

Miki-lin commented Jan 4, 2021

你好,你的这个项目很有参考价值。我使用了你的旋转框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
Copy link
Owner

BossZard commented Jan 4, 2021 via email

@Miki-lin
Copy link
Author

Miki-lin commented Jan 4, 2021

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

@BossZard
Copy link
Owner

BossZard commented Jan 4, 2021 via email

@Miki-lin
Copy link
Author

Miki-lin commented Jan 4, 2021

好的,非常感谢

@Miki-lin
Copy link
Author

Miki-lin commented Jan 4, 2021

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

@BossZard
Copy link
Owner

BossZard commented Jan 4, 2021 via email

@Miki-lin
Copy link
Author

Miki-lin commented Jan 4, 2021

已经解决,非常感谢!

@JJY0710
Copy link

JJY0710 commented Jan 6, 2021

请教一下,我自己训练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
Copy link

请教一下,我自己训练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
Copy link

请教一下,我自己训练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
Copy link

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

@YoonaIAN
Copy link

我在预测的时候遇到这个问题是为什么呢?
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] 找不到指定的模块。

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

7 participants