Multi categorical Dice loss? What is the formulation for the Dice loss with multiple categories. 
I know this is the Dice loss for binary classes.
$L_{Dice} = -\frac{2 \sum_i p_{ij} y_{ij}}{\sum_i p_{ij} + \sum_i y_{ij}}$
 A: Dice Loss (DL) for Multi-class: 
Dice loss is a popular loss function for medical image segmentation which is a measure of overlap between the predicted sample and real sample. This measure ranges from 0 to 1 where a Dice score of 1 denotes the complete overlap as defined as follows
$Loss_{DL}\hspace{0.25em}=\hspace{0.25em}1-2\frac{\sum_{l\in L}\sum_{i\in N}y_i^{\left(l\right)}\oversetˆy_i^{\left(l\right)}\hspace{0.25em}+\hspace{0.25em}\varepsilon}{\sum_{l\in L}\sum_{i\in N}{\left(y_i^{\left(l\right)}+\hspace{0.25em}\oversetˆy_i^{\left(l\right)}\right)}+\hspace{0.25em}\varepsilon}$
where $\varepsilon$ is a small constant to avoid dividing by 0.
Generalized Dice (GDL): Sudre et al. proposed to use the class rebalancing properties of the Generalized Dice overlap as a robust and accurate deep-learning loss function for unbalanced tasks. The authors investigate the behavior of Dice loss, cross-entropy loss, and generalized dice loss functions in the presence of different rates of label imbalance across 2D and 3D segmentation tasks. The results demonstrate that the GDL is more robust than the other loss functions
$Loss_{GDL}\hspace{0.25em}=1-2\frac{\sum_{l\in L}w_i\sum_{i\in N}y_i^{\left(l\right)}\oversetˆy_i^{\left(l\right)}\hspace{0.25em}+\hspace{0.25em}\varepsilon}{\sum_{l\in L}w_i\sum_{i\in N}{\left(y_i^{\left(l\right)}+\hspace{0.25em}\oversetˆy_i^{\left(l\right)}\right)}+\hspace{0.25em}\varepsilon}$
For more detailed notations and explanation refer to this Link
More Info
