WongKinYiu / PyTorch_YOLOv4

PyTorch implementation of YOLOv4
1.88k stars 585 forks source link

运行detect.py时出现错误,请问该怎么改 #430

Open reamdy opened 1 year ago

reamdy commented 1 year ago

Traceback (most recent call last): File "/data/wsx/yolov4/detect.py", line 45, in detect model.load_state_dict(torch.load(weights[0], map_location=device)['model']) File "/home/wsx/.conda/envs/yolov5/lib/python3.8/site-packages/torch/serialization.py", line 579, in load with _open_file_like(f, 'rb') as opened_file: File "/home/wsx/.conda/envs/yolov5/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "/home/wsx/.conda/envs/yolov5/lib/python3.8/site-packages/torch/serialization.py", line 211, in init super(_open_file, self).init(open(name, mode)) IsADirectoryError: [Errno 21] Is a directory: '/'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/data/wsx/yolov4/detect.py", line 189, in detect() File "/data/wsx/yolov4/detect.py", line 49, in detect load_darknet_weights(model, weights[0]) File "/data/wsx/yolov4/models/models.py", line 582, in load_darknet_weights with open(weights, 'rb') as f: IsADirectoryError: [Errno 21] Is a directory: '/'

quzhuo19 commented 1 year ago

You can change line 49 "load_darknet_weights(model, weights[0])" to "load_darknet_weights(model, weights)" in detect.py or test.py. It may can sovle the problem.