WongKinYiu / yolov9

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

Error making predictions after training gelan-c-seg #530

Open Quik7 opened 2 months ago

Quik7 commented 2 months ago

Hello, I hope this message found you well. I have been using the google colab to train a custom model. I have an issue trying to use the predict.py from gelan-c-seg. This is my code: !python segment/predict.py \ --img 1280 --conf 0.1 --device 0 \ --weights {HOME}/yolov9/runs/train-seg/gelan-c-seg3/weights/best.pt \ --source {dataset.location}/test/images/ And this is the output I am obtaining: Traceback (most recent call last): File "/home/llama/Enrique/maderas/yolov9/segment/predict.py", line 246, in <module> main(opt) File "/home/llama/Enrique/maderas/yolov9/segment/predict.py", line 241, in main run(**vars(opt)) File "/home/llama/.venv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/llama/Enrique/maderas/yolov9/segment/predict.py", line 126, in run masks = process_mask(proto[i], det[:, 6:], det[:, :4], im.shape[2:], upsample=True) # HWC ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/llama/Enrique/maderas/yolov9/utils/segment/general.py", line 54, in process_mask c, mh, mw = protos.shape # CHW ^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'shape' I have also tried passing just one image but I have the same problem. Can you help me please?

Thank you very much and kind regards

plutus123 commented 2 months ago

masks = process_mask(proto[2].squeeze(0), det[:, 6:], det[:, :4], im.shape[2:], upsample=True) # HWC use this inplace of masks = process_mask(proto[i], det[:, 6:], det[:, :4], im.shape[2:], upsample=True) # HWC