CoinCheung / pytorch-loss

label-smooth, amsoftmax, partial-fc, focal-loss, triplet-loss, lovasz-softmax. Maybe useful

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about Multi-class focal loss

DingYuan0118 opened this issue · comments

I notice that it seems that focal_loss.py only implements focal loss on the binary classification setting. Do there exist any implementations about focal loss for a multi-class classification setting?

Hi,

I can think of two methods for multi-class classification:

  1. focal loss works in same way like sigmoid-cross-entropy, thus you can consider each class as a seperate binary classification task.
  2. change sigmoid function into softmax function, this would require modifying the code.

From my personal experience, focal loss does not work so well as expected in multi-class classification tasks. I have not done sufficiently experiments to verify this, but I simply have this impression.

question about answered.