# On the Optimal Combination of Cross-Entropy and Soft Dice Losses for Lesion Segmentation with Out-of-Distribution Robustness

arXiv: https://arxiv.org/abs/2209.06078 · HTML: https://mlsanity.com/paper/2209.06078/

## Key facts

- Cited by 11 papers in the map (data through 14 Oct 2026).
- Builds on 22 of its 27 references that are in the map.
- First posted on arXiv 13 Sep 2022.

## Builds on (most cited first, 22 of 22)

- [Feature Pyramid Networks for Object Detection](https://mlsanity.com/paper/1612.03144/) (2016)
- [A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks](https://mlsanity.com/paper/1610.02136/) (2016)
- [V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation](https://mlsanity.com/paper/1606.04797/) (2016)
- [The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalization](https://mlsanity.com/paper/2006.16241/) (2020)
- [Generalised Dice overlap as a deep learning loss function for highly unbalanced segmentations](https://mlsanity.com/paper/1707.03237/) (2017)
- [Confidence Calibration and Predictive Uncertainty Estimation for Deep Medical Image Segmentation](https://mlsanity.com/paper/1911.13273/) (2019)
- [Autoencoders for Unsupervised Anomaly Segmentation in Brain MR Images: A Comparative Study](https://mlsanity.com/paper/2004.03271/) (2020)
- [Plex: Towards Reliability using Pretrained Large Model Extensions](https://mlsanity.com/paper/2207.07411/) (2022)
- [The Devil is in the Margin: Margin-based Label Smoothing for Network Calibration](https://mlsanity.com/paper/2111.15430/) (2021)
- [Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medical image segmentation](https://mlsanity.com/paper/2102.04525/) (2021)
- [Optimizing the Dice Score and Jaccard Index for Medical Image Segmentation: Theory & Practice](https://mlsanity.com/paper/1911.01685/) (2019)
- [Optimization for Medical Image Segmentation: Theory and Practice when evaluating with Dice Score or Jaccard Index](https://mlsanity.com/paper/2010.13499/) (2020)
- [Spatially Varying Label Smoothing: Capturing Uncertainty from Expert Annotations](https://mlsanity.com/paper/2104.05788/) (2021)
- [Assessing generalisability of deep learning-based polyp detection and segmentation methods through a computer vision challenge](https://mlsanity.com/paper/2202.12031/) (2022)
- [SoftSeg: Advantages of soft versus binary training for image segmentation](https://mlsanity.com/paper/2011.09041/) (2020)
- [FUSeg: The Foot Ulcer Segmentation Challenge](https://mlsanity.com/paper/2201.00414/) (2022)
- [Post Training Uncertainty Calibration of Deep Networks For Medical Image Segmentation](https://mlsanity.com/paper/2010.14290/) (2020)
- [Translating Clinical Delineation of Diabetic Foot Ulcers into Machine Interpretable Segmentation](https://mlsanity.com/paper/2204.11618/) (2022)
- [Do We Really Need Dice? The Hidden Region-Size Biases of Segmentation Losses](https://mlsanity.com/paper/2104.08717/) (2021)
- [Double Encoder-Decoder Networks for Gastrointestinal Polyp Segmentation](https://mlsanity.com/paper/2110.01939/) (2021)
- [Distributional Gaussian Process Layers for Outlier Detection in Image Segmentation](https://mlsanity.com/paper/2104.13756/) (2021)
- [Test Time Transform Prediction for Open Set Histopathological Image Recognition](https://mlsanity.com/paper/2206.10033/) (2022)

## Built on by (most cited first, 11 of 11)

- [A Flexible 2.5D Medical Image Segmentation Approach with In-Slice and Cross-Slice Attention](https://mlsanity.com/paper/2405.00130/) (2024)
- [StenUNet: Automatic Stenosis Detection from X-ray Coronary Angiography](https://mlsanity.com/paper/2310.14961/) (2023)
- [Benchmarking Retinal Blood Vessel Segmentation Models for Cross-Dataset and Cross-Disease Generalization](https://mlsanity.com/paper/2406.14994/) (2024)
- [Efficient Generative Adversarial Networks for Color Document Image Enhancement and Binarization Using Multi-scale Feature Extraction](https://mlsanity.com/paper/2407.04231/) (2024)
- [MFE-GAN: Efficient GAN-based Framework for Document Image Enhancement and Binarization with Multi-scale Feature Extraction](https://mlsanity.com/paper/2512.14114/) (2025)
- [Wildfire spread forecasting with Deep Learning](https://mlsanity.com/paper/2505.17556/) (2025)
- [PCA for Enhanced Cross-Dataset Generalizability in Breast Ultrasound Tumor Segmentation](https://mlsanity.com/paper/2505.23587/) (2025)
- [Learning Pore-scale Multi-phase Flow from Experimental Data with Graph Neural Network](https://mlsanity.com/paper/2411.14192/) (2024)
- [Unified Multimodal Coherent Field: Synchronous Semantic-Spatial-Vision Fusion for Brain Tumor Segmentation](https://mlsanity.com/paper/2509.17520/) (2025)
- [AI for Mycetoma Diagnosis in Histopathological Images: The MICCAI 2024 Challenge](https://mlsanity.com/paper/2512.21792/) (2025)
- [Learning a Sampling-Free Variational DNN Plugin from Tiny Training Sets to Refine OOD Segmentation With Uncertainty Estimation](https://mlsanity.com/paper/2606.15837/) (2026)

## Abstract (arXiv)

We study the impact of different loss functions on lesion segmentation from medical images. Although the Cross-Entropy (CE) loss is the most popular option when dealing with natural images, for biomedical image segmentation the soft Dice loss is often preferred due to its ability to handle imbalanced scenarios. On the other hand, the combination of both functions has also been successfully applied in this kind of tasks. A much less studied problem is the generalization ability of all these losses in the presence of Out-of-Distribution (OoD) data. This refers to samples appearing in test time that are drawn from a different distribution than training images. In our case, we train our models on images that always contain lesions, but in test time we also have lesion-free samples. We analyze the impact of the minimization of different loss functions on in-distribution performance, but also its ability to generalize to OoD data, via comprehensive experiments on polyp segmentation from endoscopic images and ulcer segmentation from diabetic feet images. Our findings are surprising: CE-Dice loss combinations that excel in segmenting in-distribution images have a poor performance when dealing with OoD data, which leads us to recommend the adoption of the CE loss for this kind of problems, due to its robustness and ability to generalize to OoD samples. Code associated to our experiments can be found at https://github.com/agaldran/lesion_losses_ood .
