On the Out of Distribution Robustness of Foundation Models in Medical Image Segmentation

Duy Minh Ho Nguyen, Tan Ngoc Pham, Nghiem Tuong Diep, Nghi Quoc Phan, Quang Pham, Vinh Tong, Binh T. Nguyen, Ngan Hoang Le, Nhat Ho, Pengtao Xie, Daniel Sonntag, Mathias Niepert

TL;DR

Foundation models like MedSAM demonstrate significantly better robustness to domain shifts in medical imaging compared to traditional architectures. To help deploy these models safely, the authors introduce a novel post-hoc Bayesian uncertainty estimator that accurately predicts out-of-distribution (OOD) performance using only unlabeled data, outperforming standard metrics used in natural computer vision.

What Problem Does This Paper Address?

In medical imaging, a model trained on data from one hospital often fails when deployed at another due to "domain shift"—differences in scanner hardware, acquisition protocols, or patient populations. While foundation models (like the Segment Anything Model, or SAM) have shown promise, their robustness to these shifts in the specific context of medical segmentation hasn't been fully explored.

Furthermore, there is a critical need for "performance predictors": ways to estimate how well a model will perform on a new, unlabeled dataset before actually using it on patients. In natural image classification, researchers often use indicators like "accuracy on the line" or "agreement on the line," but this paper investigates whether these standard tools actually hold up for complex medical segmentation tasks.

Methods

The researchers conducted a two-part study:

  1. Robustness Benchmarking: They compared MedSAM (a version of SAM fine-tuned for medical tasks) against traditional supervised models like UNet, UNet++, and TransUNet (all initialized with ImageNet weights).
  2. Uncertainty Estimation: They developed a new post-hoc Bayesian uncertainty estimator for frozen models.

Unlike previous methods that only look at a model's output mask to gauge uncertainty, their approach uses an auxiliary network that considers both the original input image and the predicted mask. This is a crucial distinction; because segmentation masks are binary and sparse, they lack the rich contextual information needed for reliable uncertainty estimation. By conditioning on the input image, the estimator can better identify regions where the model is likely to struggle.

The proposed framework pairs a frozen segmentation model with an independent uncertainty estimator.

Datasets

The study utilized several diverse medical imaging datasets to simulate real-world domain shifts:

  • Prostate Segmentation (3D MRI): BMC, BIDMC, RUNMC, and HK datasets.
  • Diabetic Retinopathy (DR) Lesion Segmentation (2D Fundus): FGADR and IDRiD datasets.
  • Liver Segmentation (3D CT): FLARE and LiTS datasets.

For 3D volumes, the authors processed them as independent 2D slices and merged the results for evaluation.

Key Insights and Ideas

  • Foundation Models are Inherently More Robust: MedSAM consistently outperformed traditional models in OOD scenarios, often maintaining high performance where traditional models crashed.
  • Natural CV Metrics Fail in Medicine: A major "aha moment" was discovering that popular OOD indicators like "accuracy on the line" have very poor linear correlation with actual performance in medical segmentation. Pearson coefficients were as low as 0.06, suggesting these metrics are unreliable for clinical deployment.
  • Context is King: The authors proved that for segmentation, uncertainty estimation must be driven by both the input image and the output mask. Without the input image, the estimator tends to overfit and fails to capture the maximum likelihood conditions.
  • Uncertainty as a Performance Proxy: The study found a strong inverse correlation between their Bayesian uncertainty and OOD accuracy. Lower predicted uncertainty consistently pointed to higher actual performance, making it a viable tool for model selection in new environments.

Key Results

  • Quantitative Superiority: In the BIDMC $\rightarrow$ BMC prostate segmentation shift, MedSAM achieved an impressive 90.77% IoU, while a standard UNet (ResNet50) dropped to just 27.07%.
  • Reliable Estimation: The proposed Bayesian method achieved the lowest Mean Squared Error (MSE) when predicting actual model errors, significantly beating baselines like BayesCap and test-time data augmentation (TTDA).
  • Visual Correlation: As shown in Figure 3, there is a clear visual trend: as the model's uncertainty increases, its OOD performance decreases across different architectures.
Visualization showing that higher uncertainty values correspond to lower OOD performance.

Limitations and Future Work

The authors acknowledge that their uncertainty metric is an approximation of true error. While it works well for general performance trends, it may lack the precision to distinguish between two models that have very similar performance margins.

Future research will focus on refining this estimator and testing it across a wider variety of foundation models and even more diverse clinical settings to ensure these "performance thermometers" are ready for real-world hospital deployment.

Summary updated

BibTeX
@misc{nguyen2023out,
  author = {Duy Minh Ho Nguyen and Tan Ngoc Pham and Nghiem Tuong Diep and Nghi Quoc Phan and Quang Pham and Vinh Tong and Binh T. Nguyen and Ngan Hoang Le and Nhat Ho and Pengtao Xie and Daniel Sonntag and Mathias Niepert},
  title = {{On the Out of Distribution Robustness of Foundation Models in Medical Image Segmentation}},
  year = {2023},
  eprint = {2311.11096},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.11096},
}
Figure