Distance-based detection of out-of-distribution silent failures for Covid-19 lung lesion segmentation

Camila González, Karol Gotkowski, Moritz Fuchs, Andreas Bucher, Armin Dadras, Ricarda Fischbach, Isabel J. Kaltenborn, Anirban Mukhopadhyay

TL;DR

This paper introduces a lightweight, post-hoc method for detecting out-of-distribution (OOD) data in medical image segmentation. By leveraging the Mahalanobis distance in a low-dimensional feature space, their approach effectively flags scans that are likely to cause segmentation models to fail silently, thereby improving the safety and reliability of AI in clinical settings.

What Problem Does This Paper Address?

Deep learning models have shown remarkable success in medical image segmentation, but their deployment in clinical practice is hampered by a critical vulnerability: they can fail silently on data that differs from their training distribution (out-of-distribution or OOD data). This "domain shift" can lead to incorrect segmentations that appear plausible to the model, posing significant safety risks. While existing OOD detection methods often require modifications to the model architecture or training process, or rely on observing network logits which can be misleading, there's a need for a simple, post-hoc method that can be seamlessly integrated into existing segmentation pipelines to identify unreliable predictions. This is particularly crucial for tasks like COVID-19 lung lesion segmentation, where accurate and reliable segmentation is vital for patient management, especially during resource-intensive periods.

Methods

The core of the proposed method is a distance-based approach to OOD detection. After a segmentation model (specifically, a nnU-Net architecture) is trained, the authors extract feature maps from an intermediate layer of the encoder. These high-dimensional features are then projected into a lower-dimensional subspace to make computation feasible. During training, a multi-variate Gaussian distribution is estimated from these projected features of the in-distribution (ID) data. At inference time, for a new input image, the same feature extraction and projection process is applied. The Mahalanobis distance between the new sample's features and the learned Gaussian distribution is then calculated. A large Mahalanobis distance signals that the sample is dissimilar to the training data, indicating a potential OOD case. This distance is then used to generate an uncertainty mask, which is aggregated to a subject-level score. The Mahalanobis distance is chosen over Euclidean distance because it accounts for the covariance of the features, making it more robust in identifying deviations from the training distribution.

Datasets

The study utilizes several datasets for training and evaluation:

  • COVID-19 Lung CT Lesion Segmentation Challenge (Challenge/ID): Used for training the primary model.
  • Radiopedia and Mosmed: Publicly available datasets used to simulate a "dataset shift" scenario.
  • In-house cohort: Comprising 50 COVID-19 positive and 50 non-COVID pneumonia patients, used for a "diagnostic shift" scenario.
  • Medical Segmentation Decathlon (MSD): Spleen and Colon tasks from MSD were used for a "far-OOD" evaluation.
  • MR Datasets (Hippocampus and Prostate): Various datasets (MSD H, Dryad, HarP for hippocampus; MSD P, NCI-ISBI 2013, I2CVB, UCL for prostate) were used to evaluate the method's transferability to MRI segmentation tasks.

Key Insights and Ideas

  • Mahalanobis distance is superior to Euclidean distance for OOD detection: The paper visually and quantitatively demonstrates that Mahalanobis distance better captures deviations in feature space, effectively distinguishing OOD samples from ID samples, even when they appear similar in Euclidean space.
  • Lightweight and post-hoc integration: The method requires no changes to the segmentation model's architecture or training procedure, making it highly practical for deployment with pre-trained models.
  • Intermediate features are key: Ablation studies reveal that features from the middle layers of the network (specifically, convolutional and batch normalization layers in the sixth encoding block) are most informative for detecting distribution shifts.
  • Overly cautious but safe: While the method is sometimes overly cautious in flagging OOD cases (leading to potential under-utilization), this conservatism is generally preferred in clinical settings over missing critical failures.
  • MRI is more susceptible to domain shift: The study highlights that MRI data exhibits greater variability and is more prone to performance deterioration on OOD data compared to CT scans, underscoring the importance of robust OOD detection for MRI applications.

Key Results

  • The proposed distance-based method achieved an AUC of 0.96 for the dataset shift scenario, significantly outperforming baselines like Max. Softmax (0.61) and Energy Scoring (0.31).
  • For transformation shifts (artefacts and affine transformations), the method showed good performance, with uncertainties generally increasing with the intensity of the transformations.
  • In the diagnostic shift scenario (COVID-19 vs. non-COVID pneumonia), the method correctly flagged poorly segmented non-COVID cases as OOD, which is crucial for clinical safety.
  • For far-OOD cases (spleen and colon CTs), the method achieved near-perfect detection with an FPR of 0 and detection errors up to 0.1.
  • On MRI tasks (hippocampus and prostate segmentation), the method also successfully distinguished ID from OOD cases, demonstrating its broad applicability.

Limitations and Future Work

  • Overly cautious uncertainty estimation: The method sometimes assigns high uncertainty to technically OOD samples that are still well-segmented, potentially leading to under-utilization of the model.
  • Difficulty with subtle ID failures: The method struggles to detect ID samples that are poorly segmented due to subtle differences (e.g., small lesions) not captured by the OOD detection mechanism.
  • Diagnostic shift nuances: The method assigns similar uncertainties to both COVID-19 and non-COVID cases in the diagnostic shift scenario, even when segmentation quality differs significantly. Future work should explore how to better distinguish between harmless and harmful distribution shifts.
  • Improving uncertainty calibration: The authors suggest future work should focus on improving uncertainty calibration to better identify high-quality predictions.
  • Exploring other architectures: While tested on nnU-Net and HighResNet, further exploration of its effectiveness on other segmentation architectures is warranted.

Summary updated

Abstract

Automatic segmentation of ground glass opacities and consolidations in chest computer tomography (CT) scans can potentially ease the burden of radiologists during times of high resource utilisation. However, deep learning models are not trusted in the clinical routine due to failing silently on out-of-distribution (OOD) data. We propose a lightweight OOD detection method that leverages the Mahalanobis distance in the feature space and seamlessly integrates into state-of-the-art segmentation pipelines. The simple approach can even augment pre-trained models with clinically relevant uncertainty quantification. We validate our method across four chest CT distribution shifts and two magnetic resonance imaging applications, namely segmentation of the hippocampus and the prostate. Our results show that the proposed method effectively detects far- and near-OOD samples across all explored scenarios.
BibTeX
@article{gonzalez2022distance,
  author = {Camila González and Karol Gotkowski and Moritz Fuchs and Andreas Bucher and Armin Dadras and Ricarda Fischbach and Isabel J. Kaltenborn and Anirban Mukhopadhyay},
  title = {{Distance-based detection of out-of-distribution silent failures for Covid-19 lung lesion segmentation}},
  journal = {Medical Image Analysis},
  year = {2022},
  doi = {10.1016/j.media.2022.102596},
}
Figure