image-segmentation-keras
image-segmentation-keras copied to clipboard
Ignore background class
I have a background class masked as '0'. I do not want to train it so I use flag 'ignore_zero_class' but the accuracy doesn't increase beyond 3%.
I have a made quite a few changes now to make it work on binary classification for just 1 class -
- Updated activation to 'sigmoid'
- Made changes in data_loader.py so that it works with n_classes = 1 (instead of 2 which was required originally)
- Loss - Implemented dice loss
- Metric - Implemented IOU
Since >95% of the pixels was background class, the metrics that were presented by the authors were not correctly representating the training progress in my case. Hence I made the additional implementations. Planning to incorporate the Focal Loss as well. The training seems to be going fine, will post results after it is completed
With all these changes, there’s areas outside the code base where the issue(s) could be. You also didn’t provide any of the new code so no one can really help besides saying double check your work.
Also softmax works for binary and multiclass. Since dice and iou is meant for class imbalanced data, I don’t see a reason for going through the hassle of ignoring the background class in a binary problem.
My point of doing this was to reduce the strain on the network, and make the network focus only on the necessary areas. The code required very minor changes as I explained above.