yolov9 icon indicating copy to clipboard operation
yolov9 copied to clipboard

Error about detect.py

Open jayer95 opened this issue 11 months ago • 1 comments

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: https://github.com/WongKinYiu/yolov9/blob/9660d127cf5a4f8d51d19b09ba299f98a0672ca7/detect.py#L98

to:

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

Then "detect.py" can be executed normally!

jayer95 avatar Mar 05 '24 07:03 jayer95

#11

mkrupczak3 avatar Mar 05 '24 17:03 mkrupczak3

@mkrupczak3 Thanks!!

jayer95 avatar Mar 06 '24 01:03 jayer95