Open tomanick opened 2 years ago
I think you can. Because official code also supports multi-class. I just converted the official repository code into a PyTorch. But I did not test. so If you can't, please let me know.
@tomanick Does AsymmetricUnifiedFocalLoss works fine on multi-class? I tried, but got some unexpected errors.
back_dice = (1-dice_class[:,0])
fore_dice = (1-dice_class[:,1]) * torch.pow(1-dice_class[:,1], -self.gamma)
This is not suitable for multi-class, right?
Calculate losses separately for each class, only enhancing foreground class
back_dice = (1-dice_class[:,0]) fore_dice = (1-dice_class[:,1]) * torch.pow(1-dice_class[:,1], -self.gamma)
This is not suitable for multi-class, right?
Yes this assumes one channel is background and another is foreground.
Calculate losses separately for each class, only enhancing foreground class
back_dice = (1-dice_class[:,0]) fore_dice = (1-dice_class[:,1]) * torch.pow(1-dice_class[:,1], -self.gamma)
This is not suitable for multi-class, right?
Yes this assumes one channel is background and another is foreground.
Hello, my output tensor and label tensor only have one channel, so how to modify this code?
There is an issue with a snippet in the official tensor flow repo: https://github.com/mlyg/unified-focal-loss/issues/8
Thanks for your sharing! If I want to use multi-class AsymmetricUnifiedFocalLoss, is current version available?