WongKinYiu / PyTorch_YOLOv4

PyTorch implementation of YOLOv4
1.87k stars 585 forks source link

when I run detect.py it show "AttributeError: 'collections.OrderedDict' object has no attribute 'float'"? #65

Open zh9369 opened 4 years ago

zh9369 commented 4 years ago

Traceback (most recent call last): File "C:/Users/the-moon/Desktop/python/pytorch-YOLOv4-master/PyTorch_YOLOv4-v/detect.py", line 161, in detect() File "C:/Users/the-moon/Desktop/python/pytorch-YOLOv4-master/PyTorch_YOLOv4-v/detect.py", line 23, in detect model = attempt_load(weights, map_location=device) # load FP32 model File "C:\Users\the-moon\Desktop\python\pytorch-YOLOv4-master\PyTorch_YOLOv4-v\models\experimental.py", line 133, in attempt_load model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model AttributeError: 'collections.OrderedDict' object has no attribute 'float'

Process finished with exit code 1

WongKinYiu commented 4 years ago

guess you download wrong pretrained weights.

zh9369 commented 4 years ago

yolov4-pacsp-x-mish.pt.this is my weight file.Does it work?

ytxiaobaiyang commented 2 years ago

Hello, how is this problem solved