Learning Distribution-wise Foundation Prior Consistency and Instance-wise Style Calibration for Medical Image Generalization
Abstract
Test-time adaptation (TTA) has emerged as a promising solution to address real world domain shifts in medical image segmentation. Most current approaches adapt by updating or regularizing a pre-trained source model. However, they face two major issues: \textit{(i) the source models on which they rely are prone to overfitting under domain shift; (ii) in dynamic continual testing scenarios, error accumulation and class forgetting are further exacerbated.} To overcome these limitations, we propose \textbf{TanGo}, a novel framework that combines \textbf{T}raining to \textbf{a}dapt with Fou\textbf{n}dation \textbf{G}uidance and C\textbf{o}ntinual Style Calibration. During training, TanGo learns generalization priors from vision foundation models (VFMs) through distribution-level consistency learning. We incorporate stable low-frequency representations from a frozen encoder of VFMs as priors to guide the source model, constraining its output feature distribution to yield a more generalizable feature space. At test time, we introduce an instance-wise style calibration method that employs a learnable data decorator to transform dynamic test images back toward source-like distributions. Subsequently, a set of source-anchored constraints is applied to preserve semantic integrity in the transformed test images and align their distributions more closely with the enhanced source space. Extensive experiments on multiple medical image segmentation tasks demonstrate that TanGo achieves state-of-the-art performance. All code will be made publicly available.