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 making predictions after training gelan-c-seg #530

Open
Quik7 opened this issue Jul 3, 2024 · 1 comment
Open

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

Quik7 opened this issue Jul 3, 2024 · 1 comment

Comments

@Quik7
Copy link

Quik7 commented Jul 3, 2024

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

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

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