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

Error about detect.py #162

Closed
jayer95 opened this issue Mar 5, 2024 · 2 comments
Closed

Error about detect.py #162

jayer95 opened this issue Mar 5, 2024 · 2 comments

Comments

@jayer95
Copy link

jayer95 commented Mar 5, 2024

When I execute the command to test "detect.py",

python detect.py
--source test.mp4
--weights yolov9-e.pt
--imgsz 640
--conf-thres 0.25
--iou-thres 0.1

I encountered the following error:

Traceback (most recent call last):
File "/home/gvsai/yolov9/detect.py", line 231, in
main(opt)
File "/home/gvsai/yolov9/detect.py", line 226, in main
run(**vars(opt))
File "/home/gvsai/anaconda3/envs/yolov5/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/gvsai/yolov9/detect.py", line 102, in run
pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gvsai/yolov9/utils/general.py", line 905, in non_max_suppression
device = prediction.device
^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'device'

The following line needs to be changed:

pred = model(im, augment=augment, visualize=visualize)

to:

pred, _ = model(im, augment=augment, visualize=visualize)

Then "detect.py" can be executed normally!

@mkrupczak3
Copy link

#11

@jayer95
Copy link
Author

jayer95 commented Mar 6, 2024

@mkrupczak3
Thanks!!

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

3 participants