Generalised Dice Overlap as a Deep Learning Loss Function for Highly Unbalanced Segmentations
Carole H. SudreWenqi LiTom Kamiel Magda VercauterenSébastien OurselinM. Jorge Cardoso
Proposes adapting the Generalized Dice overlap into a deep learning loss function to solve severe class imbalance problems in 2D and 3D medical image segmentation.
Medical image segmentation often targets rare pathologies such as brain tumors or white matter lesions that occupy only a tiny fraction of each scan. This severe class imbalance destabilizes standard deep-learning training and produces unreliable results. The issue has grown more pressing as deep-learning tools move into routine clinical use where missing small lesions can affect diagnosis or treatment planning.
The article set out to compare the training stability of three established loss functions designed for imbalance and to test whether the Generalized Dice overlap, already used as an evaluation metric, could serve as a more robust loss function for both balanced and highly unbalanced segmentation tasks.
The authors reimplemented four representative networks—two 2D and two 3D—and trained them on the public BRATS tumor dataset and an in-house set of 524 subjects with age-related white-matter hyperintensities. They systematically varied learning rates and patch sizes to produce different levels of foreground-background imbalance, then measured final Dice scores over the last 200 training iterations.
The Generalized Dice loss proved consistently more stable than weighted cross-entropy, the two-class Dice loss, or the sensitivity-specificity loss, especially when imbalance exceeded roughly 1 percent and when higher learning rates were used. Weighted cross-entropy frequently failed to train under the most unbalanced conditions, while the Dice loss and sensitivity-specificity loss showed large performance drops or network-dependent behavior. On the held-out 3D test set the Generalized Dice loss maintained higher and less variable Dice scores across sampling strategies.
These results indicate that the choice of loss function can determine whether a segmentation model succeeds or fails in realistic clinical settings where lesions are small and variable. Adopting the Generalized Dice loss reduces the need for exhaustive hyper-parameter tuning and improves the chance of detecting punctate lesions that other losses overlook.
The authors recommend using the Generalized Dice loss as the default for any new unbalanced segmentation task and note that the implementation is already available in the open-source NiftyNet package. They also call for further experiments on more extreme imbalance ratios, such as those encountered when detecting lacunes or perivascular spaces.
The study examined only two imaging tasks and four networks without data augmentation, so results may not generalize to every anatomy or architecture. Nevertheless, the consistent advantage of the Generalized Dice loss across the tested range of imbalance and hyper-parameters gives reasonable confidence that it offers a practical improvement for many current applications.
- Paper: V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation, Fausto Milletari et al. (2016). Introduces the standard Dice loss for 3D biomedical segmentation, which the source explicitly generalizes to handle multi-class and extreme class imbalance.
- Paper: U-Net: Convolutional Networks for Biomedical Image Segmentation, Olaf Ronneberger et al. (2015). Presents the foundational U-Net architecture and weighted cross-entropy formulations evaluated and extended for imbalanced medical image segmentation.
- Paper: 3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotation, Özgün Çiçek et al. (2016). Establishes the 3D U-Net architecture used directly as one of the baseline deep networks analyzed under varying degrees of class imbalance.
- Paper: Efficient multi‐scale 3D CNN with fully connected CRF for accurate brain lesion segmentation, Konstantinos Kamnitsas et al. (2016). Provides the multi-scale 3D CNN baseline framework and brain lesion segmentation setting benchmarked in the source's comparative loss study.
- Paper: Brain tumor segmentation with Deep Neural Networks, Mohammad Havaei et al. (2015). Details the BRATS brain tumor segmentation task and the fundamental challenges of severe foreground-background class imbalance in neural networks.
- Paper: Fully convolutional networks for semantic segmentation, Jonathan Long et al. (2015). Introduces end-to-end fully convolutional networks for dense pixel-wise segmentation underlying the 2D network architectures evaluated in the study.
- Paper: UNet++: A Nested U-Net Architecture for Medical Image Segmentation, Zongwei Zhou et al. (2018). Extends medical image segmentation by redesigning skip connections into nested dense pathways and leveraging hybrid overlap losses for fine-scale lesion boundary capture.
- Paper: UNet 3+: A Full-Scale Connected UNet for Medical Image Segmentation, Huimin Huang et al. (2020). Builds on overlap-based training objectives by combining multi-scale skip connections with a compound loss targeting severe organ-scale imbalance.
- Paper: Attention U-Net: Learning Where to Look for the Pancreas, Ozan Oktay et al. (2018). Incorporates attention gates into 3D U-Net architectures to suppress background noise and improve segmentation of small, highly unbalanced target organs like the pancreas.
- Paper: UNETR: Transformers for 3D Medical Image Segmentation, Ali Hatamizadeh et al. (2021). Applies transformer encoders to volumetric medical segmentation, advancing beyond CNNs while continuing to optimize overlap metrics on unbalanced MRI and CT benchmarks.
- Paper: Swin UNETR: Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images, Ali Hatamizadeh et al. (2022). Continues the brain tumor segmentation line on BraTS data by pairing shifted-window transformer backbones with overlap-optimized loss objectives.
- Paper: Class-Balanced Loss Based on Effective Number of Samples, Yin Cui et al. (2019). Develops a generalized theoretical approach to class-imbalanced loss design by scaling training penalties via the effective number of samples across unbalanced datasets.
