pytorch-semseg
pytorch-semseg copied to clipboard
ValueError: Segmentation map contained invalid class values
Hi guys,
I was trying to run cityscapes dataset. While doing train.py, I was getting this error like,
RUNDIR: runs/frrnB_cityscapes/26539
Found 20 train images
Found 10 val images
INFO:ptsemseg:Using cross_entropy with {} params
INFO:ptsemseg:Using loss functools.partial(<function cross_entropy2d at 0x7fdc8ce9c158>)
INFO:ptsemseg:No checkpoint found at 'frrnB_cityscapes_best_model.pkl'
Traceback (most recent call last):
File "train.py", line 229, in
Can someone help me in this.
Thank you.
Not exactly sure what is causing the error, but it will disappear if you turn data augmentation off
Not sure if this is a similar issue, but I was working with the Pascal dataloader and realized the .resize() functions used in the transforms are generating new (undefined) values in the segmentation map. If you change all data read/write and resize function to cv2 functions, with resizing via NEAREST NEIGHBOR (interpolation =cv2.INTER_NEAREST), it could help preserve the class integers/colors.