hellochick / PSPNet-tensorflow

TensorFlow-based implementation of "Pyramid Scene Parsing Network".
326 stars 123 forks source link

labeltrainId.png #6

Closed anqingjianke closed 6 years ago

anqingjianke commented 6 years ago

Hi, I have a small question. I didn't find labeltrainId.png data that list in your "train_list.txt". The Cityscapes dataset only includes labelId.png. So are they same data? Since I used labelId.png instead, training model can not converge. Thank you.

hellochick commented 6 years ago

Hey, they are data converted by the code in https://github.com/mcordts/cityscapesScripts/tree/master/cityscapesscripts/preparation You can take a look on it

anqingjianke commented 6 years ago

@hellochick Thanks a lot, I got it. So, I also confused about whether should I change "tf.one_hot" to "true"? I also do not understand how the net can get label ID in preprocessing step. Thanks again!

hellochick commented 6 years ago

@anqingjianke, since tf.nn.sparse_softmax_cross_entropy_with_logits has the definition like following:

A common use case is to have logits of shape [batch_size, num_classes] and labels of shape [batch_size]. 

So, we can just feed the label without one_hot signal.

For another question, we can get label ID according to the pixel value in the image ( gray scale 0-255 )

anqingjianke commented 6 years ago

However, for instance, if I use "labelId.png" as ground-truth, the pixel value is not from 0 to 19(20 classes). I got that the pixel value of road is 7(class 0), building is 11(class 2), and so on. So without one-hot, I wonder how can we change label to "(1,class_number)" vector?

hellochick commented 6 years ago

So, We need to transform labelId.png to labelTrainIds.png. You can take a look on the content of it.

frankfurt_000000_000294_gtfine_labeltrainids

anqingjianke commented 6 years ago

I got it. Thank you very much for your answer!