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

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

Open
reamdy opened this issue May 2, 2023 · 1 comment
Open

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

reamdy opened this issue May 2, 2023 · 1 comment

Comments

@reamdy
Copy link

reamdy commented May 2, 2023

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
Copy link

quzhuo19 commented Aug 2, 2023

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.

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

2 participants