mcordts / cityscapesScripts

README and scripts for the Cityscapes Dataset
MIT License
2.19k stars 608 forks source link

Converting Cityscapes to have 19 classes with createTrainIdLabelImgs.py doesn't seem to work #87

Closed ghost closed 5 years ago

ghost commented 5 years ago

I am trying to use createTrainIdLabelImgs.py to change the labels in "gtFine" to have 19 classes instead of the original 33. I've modified line 63 dst = f.replace( "_polygons.json", "_labelTrainIds.png") with dst = f,replace( "_polygons.json" , "_trainIds.png").

However, once I load the supposedly converted Cityscapes dataset using torchvision.datasets.Cityscapes and torch.utils.data.DataLoader, the max value of the label of any img turns out to be 33 instead of 19.

Is there something about the "trainId"s that I've misunderstood? Or does loading the dataset via torch and torchvision somehow does not reflect the conversion made via createTrainIdLabelImgs.py?

ghost commented 5 years ago

It was an issue with the what img files were actually loaded by torchvision.dataset.Cityscapes. So I made a copy of the source file cityscapes.py and modified line 204 to return '{}_trainIds.png'.format(mode)

viet2411 commented 5 years ago

Hello, I'm trying to create png image with instancesID for 13 classes, but it's not going well. Can you share how you did it? Thank you and best regards.