Dice Loss In Medical Image Segmentation

2 min readJul 21, 2023

Looking Back to Look Forward

For Medical Imaging segmentation, works like U-Net often choose IoU loss and Dice loss as the loss metrics.

IoU is illustrated in the following figure:

Where IoU loss is defined as: 1 — IoU, so it motivates the network to enlarge the IoU.

We also frequently see the adoption of dice loss in medical image segmentation networks.

Dice Coefficient is defined as:

Dice loss is defined accordingly as 1 — Dice_Coefficient.

So why bother to use dice loss in semantic segmentation, especially for medical images?

From the definition, we notice that dice coefficient enlarges the weight of overlap both in the denominator and numerator, based on Sugar water inequality, if the overlap rises, the dice loss will response with greater gradient flow information which encourages more precise segmentation.

In medical images, like cell pathology imaging, usually the cells themselves occupy the most majority of the image, if using IoU Loss, the network may chooses to predict the whole images as positive and still yields decent performance, this would make further learning hard. If Dice Loss employed, the weight of overlap in the loss definition increases, so the network would be motivated to split the cells other than learning some heuristics like the case in IoU Loss.


[1] Ronneberger, Olaf, Philipp Fischer, and Thomas Brox. “U-net: Convolutional networks for biomedical image segmentation.” Medical Image Computing and Computer-Assisted Intervention–MICCAI 2015: 18th International Conference, Munich, Germany, October 5–9, 2015, Proceedings, Part III 18. Springer International Publishing, 2015.