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

i can't run this code correctly due to y_onehot.scatter_(1, y, 1).float() in eval_IOU.py #59

Open
hisrg opened this issue Jun 9, 2022 · 1 comment

Comments

@hisrg
Copy link

hisrg commented Jun 9, 2022

hello,
i'll try to run this code in eval_IOU.py, but there are some issue as below:
y_onehot_size: torch.Size([1, 23, 512, 1024])
max(y): tensor(26)
Traceback (most recent call last):
File "eval_iou.py", line 153, in
main(parser.parse_args())
File "eval_iou.py", line 94, in main
iouEvalVal.addBatch(outputs.max(1)[1].unsqueeze(1).data, labels)
File "/workspace/data/ERFNet2/erfnet_pytorch-master/eval/iouEval.py", line 58, in addBatch
y_onehot.scatter_(1, y, 1).float()
RuntimeError: index 26 is out of bounds for dimension 1 with size 23
root@7b72ac96a07e:/workspace/data/ERFNet2/erfnet_pytorch-master/eval#

tha'ts why?

@vkg2001
Copy link

vkg2001 commented Aug 5, 2022

Check if you have met all the requirements.
I encountered the same error and had ignored the below requirement:

The Cityscapes dataset: Download the "leftImg8bit" for the RGB images and the "gtFine" for the labels. Please note that for training you should use the "_labelTrainIds" and not the "_labelIds", you can download the cityscapes scripts and use the conversor to generate trainIds from labelIds

Convert labelIds to labelTrainIds by following the above method and that shall solve your issue.

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