ycszen / pytorch-segmentation

Pytorch for Segmentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

num_classes do not seem correct

ibadami opened this issue · comments

Thank you for very good semantic segmentation library.
I have two questions in your library:

  1. I was wondering why do you have 22 classes instead of 21 in the training of VOC Pascal dataset.
    The number of classes in VOC dataset is 20 and with the addition of the background the total number of classes should be 21. But I see that the weights are defined for 22 classes and the weight of the last class (background: weight[21]) is set to zero.

  2. Moreover, during the testing, argmax is computed on all the channels of the output. In this case the background class can also appear as a label. But by setting the weight zero for background class we are ignoring that label during the training. If the label is not learned we should not predict it.
    Do you think applying softmax on the first 20 channels of the output and then taking the argmax on them is the correct way to predict the labels?
    Thank you for your help.

1.This is because there are some invalid pixels not belong to background and other classes. I have this into consider but not train it.
2.In the VOC dataset, we have to consider the background classe. However, You can experiment your idea.If you can show me your result, It's my pleasure.

Thank you for your reply. I am using cityscape dataset for semantic segmentation. In their evaluation policy, they ignore certain classes labeled as 255 or -1.
I trained on this dataset using your code. I have 19 classes and the 20th class was set as ignore class label. After the training I see that 20th class never appears as an output when I perform max() operation on the class channels. That is very promising. In that case you can have untrained classes in your output without any problem. 👍 Thank you for your time.