2
$\begingroup$

I am training a deep learning model for semantic segmentation. I am using the cityscapes dataset for training/evaluation.

In cityscapes, there are 34 classes, and of which, we consider only 19 classes and the rest of the classes are ignored. For training, I have assigned the 19 classes with 0-19 traid_ids.

Now, since the rest of the classes are ignored, I have ignored them when computing the loss using cross enropy with ignore_index=255.

But, the above effect can also be achieved by assigning a background class, i.e 20 as bg class and assign all the ignored classes to it.

Now my question is, which method would be better to achieve a high mIoU in cityscapes? And what would be your intuition in choosing the approach?

$\endgroup$
1
  • $\begingroup$ I don't have much experience with pytorch, but the way you describe them the two seem to be equivalent. One other option I would like to add would be the addition of class weights. Usually the weights are selected to be inverse the imbalance ratio between the classes. This would cause one background pixel's misclassification to have a much less impact to the model's training than one of the actual classes. $\endgroup$
    – Djib2011
    Apr 14 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.