Closed JohnMBrandt closed 5 years ago
Specifically -- the predictions converge to 0.5. If I train the model with BCE + Dice and fine-tune with lovasz softmax, within a few epochs the entire predicted segmentation converges to 0.5.
Fixed by implementing equibatch sampling
How about changing per_image
to be True
?
What's the effect of that parameter? I think it's natural to calculate loss per image, and then take its mean.
@JohnMBrandt Hello, can you share us about how to implement equibatch sampling?
I have an image segmentation task with small batch size (4-8) and some samples that have only the background (negative) class.
I have implemented lovasz softmax as below:
where probs are B, H, W, C, and label is B, H, W with a range of [0, 1]
However, the network does not learn at all -- the output feature maps look random, and tuning the learning rate does not improve the issue.
The same network works fine with dice, Tversky, focal, or BCE loss.
I think it is due to the presence of background-only classes -- I know that classes = 'present' solves this for multi class problems. Is there a way to do the same for a binary lovasz softmax?