wasidennis / AdaptSegNet

Learning to Adapt Structured Output Space for Semantic Segmentation, CVPR 2018 (spotlight)
847 stars 203 forks source link

Train the model on other dataset. #42

Closed JIANGbb95 closed 5 years ago

JIANGbb95 commented 5 years ago

Hello! I have trained your model successfully recently on GTA5 and Cityscapes. And I want to try it on other dataset. I am a newbie in this domain and I met a problem. The new dataset labels are black-and-white images. I found that there maybe some problems in labels. So I want to know that what does "label2train" mean in json file? I really can not understand these numbers([0, 255], [1, 255], [2, 255], [3, 255], [4, 255], [5, 255], [6, 255], [7, 0], [8, 1], [9, 255], [10, 255], [11, 2], [12, 3], [13, 4], [14, 255], [15, 255], [16, 255], [17, 5], [18, 255], [19, 6], [20, 7], [21, 8], [22, 9], [23, 10], [24, 11], [25, 12], [26, 13], [27, 14], [28, 15], [29, 255], [30, 255], [31, 16], [32, 17], [33, 18], [-1, 255]).

And some of them is applied in the gta5_dataset.py in init. I really can not understand these numbers.
Maybe my problem is very stupid. I am really a newbie just want to learn more. Thank you very much!!

wasidennis commented 5 years ago

This mapping is to convert target labels to [0, 18], while the 255 label means the ignore ones that the network will not train. If you are using your own dataset, you need to make sure you have target N categories from 0 to N-1, and if there are other classes, you need to set them as 255.

JIANGbb95 commented 5 years ago

Yes. Thank you very much~ But I still cannot understand the left number in each bracket just the numbers 1 2 3 4 5.......33 -1 I don't know these numbers meaning. Thank you for your reply.

wasidennis commented 5 years ago

They are the original label space of the dataset, but eventually only 19 of them are considered in training.

soans1994 commented 2 years ago

is this one hot encoding? i cannot find that you have used this in the code?