C:\Users\10783\PycharmProjects\pythonProject\Smart_Construction-master>python detect.py --save-txt --source ./C:/Users/10783\PycharmProjects/pythonProject/Smart_Construction-master
/VOC2028/JPEGImages/ --weights ./weights/yolov5x.pt
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=640, iou_thres=0.5, output='inference/output', save_txt=True, source='./C:/Users/10783\Pych
armProjects/pythonProject/Smart_Construction-master/VOC2028/JPEGImages/', update=False, view_img=False, weights=['./weights/yolov5x.pt'])
Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1650', total_memory=4096MB)
C:\Users\10783\Anaconda3\lib\site-packages\torch\serialization.py:657: SourceChangeWarning: source code of class 'models.yolo.Model' has changed. you can retrieve the original source code
by accessing the object's source attribute or set torch.nn.Module.dump_patches = True
and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
C:\Users\10783\Anaconda3\lib\site-packages\torch\serialization.py:657: SourceChangeWarning: source code of class 'models.yolo.Detect' has changed. you can retrieve the original source cod
e by accessing the object's source attribute or set torch.nn.Module.dump_patches = True
and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
Fusing layers... Model Summary: 284 layers, 8.89222e+07 parameters, 8.89222e+07 gradients
Traceback (most recent call last):
File "detect.py", line 161, in
detect()
File "detect.py", line 52, in detect
_ = model(img.half() if half else img) if device.type != 'cpu' else None # run once
File "C:\Users\10783\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "C:\Users\10783\PycharmProjects\pythonProject\Smart_Construction-master\models\yolo.py", line 99, in forward
return self.forward_once(x, profile) # single-scale inference, train
File "C:\Users\10783\PycharmProjects\pythonProject\Smart_Construction-master\models\yolo.py", line 119, in forward_once
x = m(x) # run
File "C:\Users\10783\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "C:\Users\10783\PycharmProjects\pythonProject\Smart_Construction-master\models\yolo.py", line 27, in forward
x[i] = self.mi # conv
File "C:\Users\10783\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 593, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Detect' object has no attribute 'm'
你好,在pytorch1.5下 又遇到了这个问题 权重用的也是你v2.0的权重,这又是什么问题谢谢!