WongKinYiu / yolov9

Implementation of paper - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
GNU General Public License v3.0
9.04k stars 1.44k forks source link

AttributeError: 'tuple' object has no attribute 'shape' (detect.py --visualize error) #287

Open JamesBird02 opened 8 months ago

JamesBird02 commented 8 months ago

I have executed the following command: !python detect_dual.py --source /content/example_mush.jpeg --weights runs/train/yolov9-c3/weights/best_idp.pt --conf-thres 0.75 --iou-thres 0.6 --device 0 --visualize --hide-labels --hide-conf

and encountered this error: Saving runs/detect/exp15/example_mush/stage22_RepNCSPELAN4_features.png... (32/512) Traceback (most recent call last): File "/content/yolov9/utils/plots.py", line 188, in feature_visualization batch, channels, height, width = x.shape # batch, channels, height, width AttributeError: 'tuple' object has no attribute 'shape'

This error only occurs when --visualize is added to the command, making me believe it has something to do with that.

Thanks!

TonyLee1256 commented 8 months ago

mee too

B4RT1M commented 8 months ago

If you are trying to use segment/predict.py you need to change line 187: 'if 'Detect' not in module_type:' to 'if 'Detect' not in module_type and 'Segment' not in module_type:' That makes it work for me.