i can't run this code correctly due to y_onehot.scatter_(1, y, 1).float() in eval_IOU.py
hisrg opened this issue · 1 comments
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?
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.