Semantic segmentation for one class using FCN

Dear all,
I am working on cavity segmentation problem. My data has only one class i.e., cavity. Initially, I am trying to fine tune baseline FCN segmentation model. By default, the model is trained on 21 classes, as shown in following figure.

I have modified the output “21” to “1”, however, it fully colors the whole images, instead of specific image region.

I shall be grateful if somebody guide me regarding, how can i fine tune this model for one class data.


In the paper cited in the FCN_ResNet50 documentation you can see that they use the PASCAL VOC 2011 dataset, which has 20 classes. They also mention that the 21st class would be the background.

So for your implementation I would try and use 2 different classes, one for the objects that you want to detect and one for the background.

model.classifier[4] = nn.Conv2d(512, 2, ...)
model.aux_classifier[4] = nn.Conv2d(512, 2, ...)

After this you can fine tune your model.

Hope this helps :smile: