Source-linked AI summary

A survey of loss functions for semantic segmentation

Shruti Jadon

arXiv:2006.14822v4eess.IVcs.CVcs.LG

TL;DR

Semantic segmentation uses diverse loss functions for differing data and structural conditions, but evidence is needed on which objectives suit particular cases. This paper surveys 14 well-known losses, proposes log-cosh Dice loss, and evaluates them on the NBFS skull-stripping dataset. Focal Tversky achieved the highest reported Dice coefficient, while log-cosh Dice performed nearly as well and specificity remained consistent across losses.

  • Problem

    Loss-function suitability varies with segmentation dataset properties such as distribution, skewness, and boundaries, so no single objective performs best in every use case.

    Source: §IV · p. 6
  • Method

    The paper summarizes 14 semantic-segmentation loss functions, proposes log-cosh Dice loss, and compares them using Dice Coefficient, Sensitivity, and Specificity.

    Source: §I · p. 1, §IV · p. 6, 1) Evaluation Metrics · p. 6
  • Results

    A Dice coefficient of 0.98 was achieved with Focal Tversky Loss, while Log-Cosh Dice Loss achieved 0.975; specificity remained consistent across loss functions.

    Source: 1) Evaluation Metrics · p. 6
  • Takeaways & Limitations

    Highly imbalanced segmentation works better with focus-based losses, balanced datasets with binary cross-entropy, and mildly skewed datasets with smoothed or generalized Dice coefficients.

    Source: §IV · p. 6

Abstract

from arXiv · show

Image Segmentation has been an active field of research as it has a wide range of applications, ranging from automated disease detection to self-driving cars. In the past five years, various papers came up with different objective loss functions used in different cases such as biased data, sparse segmentation, etc. In this paper, we have summarized some of the well-known loss functions widely used for Image Segmentation and listed out the cases where their usage can help in fast and better convergence of a model. Furthermore, we have also introduced a new log-cosh dice loss function and compared its performance on the NBFS skull-segmentation open-source data-set with widely used loss functions. We also showcased that certain loss functions perform well across all data-sets and can be taken as a good baseline choice in unknown data distribution scenarios. Our code is available at Github: https://github.com/shruti-jadon/Semantic-Segmentation-Loss-Functions.

I. INTRODUCTION

Semantic segmentation classifies image pixels to identify structures such as tumors and lesions, making loss-function choice central to model learning. The paper surveys widely used losses and introduces log-cosh Dice loss, evaluated on skull-stripping data.

  • Semantic image segmentation classifies pixels into image elements and supports localization of tumors, lesions, and other findings in medical scans.Source: §I · p. 1
  • Loss-function choice is important because objectives initiate learning, and researchers have developed domain-specific functions for different datasets.Source: §I · p. 1
  • The paper proposes log-cosh Dice loss and compares loss functions on the NBFS skull-stripping dataset using Dice Coefficient, Sensitivity, and Specificity.Source: §I · p. 1
  • Binary Cross-Entropy is derived from the Bernoulli distribution and is applied to semantic segmentation with two pixel-level classes.Source: §II · p. 2, A. Binary Cross-Entropy · p. 2

B. Weighted Binary Cross-Entropy

Weighted and balanced cross-entropy variants address class-skewed segmentation, while focal loss reduces emphasis on easy examples to focus learning on difficult cases.

B. Weighted Binary Cross-Entropy

D. Focal Loss

  • Focal Loss down-weights easy examples and focuses training on hard negatives through a modulating factor, ((1 − p)t)^γ.Source: D. Focal Loss · p. 2
  • When γ = 1, Focal Loss behaves like Cross-Entropy, while α may be set using inverse class frequency or treated as a hyperparameter.Source: D. Focal Loss · p. 2

E. Dice Loss

Dice Loss adapts the Dice coefficient for segmentation optimization, but its non-convex formulation requires an edge-case safeguard to remain defined.

E. Dice Loss

  • Dice Loss adapts the widely used Dice coefficient, a similarity metric between two images, for segmentation objectives.Source: E. Dice Loss · p. 2
  • Adding 1 to the numerator and denominator prevents the function from becoming undefined when y = p̂ = 0.Source: E. Dice Loss · p. 2

F. Tversky Loss

Tversky Loss generalizes Dice by weighting false positives and false negatives, while Focal Tversky further emphasizes hard examples such as small regions of interest.

F. Tversky Loss

  • Tversky Index generalizes the Dice coefficient by weighting false positives and false negatives with β.Source: F. Tversky Loss · p. 2
  • When β = 1/2, the Tversky Index reduces to the regular Dice coefficient, and Tversky Loss is defined from this index.Source: F. Tversky Loss · p. 3
  • Focal Tversky Loss uses γ to learn hard examples, including small regions of interest, similarly to Focal Loss.The stated range for γ is [1,3].Source: G. Focal Tversky Loss · p. 3

H. Sensitivity Specificity Loss

This section describes loss functions that combine segmentation metrics or structural cues to address class imbalance, curve quality, and shape similarity.

  • Sensitivity and specificity are widely used metrics for evaluating segmentation predictions.Source: H. Sensitivity Specificity Loss · p. 3
  • The sensitivity-specificity formulation can address class imbalance through a weighting parameter w.Source: H. Sensitivity Specificity Loss · p. 3
  • Shape-aware loss weights cross-entropy with average point-to-curve Euclidean distance around predicted and ground-truth boundaries.This incorporates segmentation shape into the loss rather than operating only at the pixel level.Source: §I · p. 3
  • Using E_i, the network learns prediction masks similar to the training shapes.Source: §I · p. 3
  • Combo loss combines Dice loss with modified cross-entropy as a weighted sum.Dice loss addresses class imbalance, while cross-entropy is used for curve smoothing.Source: J. Combo Loss · p. 3

K. Exponential Logarithmic Loss

Exponential Logarithmic loss combines transformed Dice and cross-entropy terms to emphasize less accurately predicted structures and support finer boundaries and data-distribution accuracy.

M. Hausdorff Distance Loss

Hausdorff Distance is used to track segmentation performance, while tractable Hausdorff-based losses adapt the metric through several error-aggregation constructions.

O. Log-Cosh Dice Loss

The paper proposes Log-Cosh Dice Loss as a tractable, smoothed Dice-based objective, motivated by the continuous and finite behavior of log-cosh derivatives.

O. Log-Cosh Dice Loss

  • Cosh(x) is defined as the average of e^x and e^-x.Source: Figure 4 · p. 4
  • Log-Cosh Dice Loss combines the Dice coefficient’s segmentation objective with log-cosh smoothing for tractable optimization.The proposal follows a proof that the log-cosh function remains continuous and finite after first-order differentiation.Source: O. Log-Cosh Dice Loss · pp. 4–5

III. EXPERIMENTS

The experiments evaluate nine loss functions with a 2D U-Net on the NBFS Skull-stripping dataset, using predefined training, validation, and test splits.

III. EXPERIMENTS

  • The study uses a simple 2D U-Net with 10 convolutional encoder layers and 8 transposed-convolution decoder layers.Source: §III · p. 5
  • The NBFS Skull-stripping dataset contains 125 skull CT scans, each with 120 slices.Source: §III · p. 5
  • The dataset is split into 60% training, 20% validation, and 20% test data, with batch size 32 and Adam learning rate 0.001.Source: §III · p. 5
  • Experiments compare nine loss functions and evaluate them using Dice, Sensitivity, and Specificity.Source: §III · p. 5, Table III · p. 5

1) Evaluation Metrics:

The paper evaluates segmentation outputs with Dice Coefficient, Sensitivity, and Specificity, then concludes that loss-function performance depends on dataset characteristics and task imbalance.

1) Evaluation Metrics:

  • Dice Coefficient measures overlap between ground-truth and predicted segmentation outputs.Source: 1) Evaluation Metrics · p. 6
  • Sensitivity emphasizes True Positives, while Specificity measures the ratio of True Negatives.Source: 1) Evaluation Metrics · p. 6
  • A Dice coefficient of 0.98 was achieved with Focal Tversky Loss, while Log-Cosh Dice Loss achieved 0.975.Source: 1) Evaluation Metrics · p. 6
  • No single loss function performs best in every use case; highly imbalanced segmentation favors focus-based losses, while balanced data favors binary cross-entropy.Source: §IV · p. 6
Loading 2006.14822v4…