Tuberculosis (TB) is one of the most common and dangerous bacterial ailments. Every year, it causes a large number of deaths worldwide. Although many deep learning models can detect tuberculosis from chest X-rays quite accurately, severe domain shift across datasets makes the task challenging. Different imaging protocols, patient demographics, and equipment across domains make the task of generalization difficult. In real-world settings, a model may perform well on one dataset but show a noticeable drop in performance when tested on another. In this work, we address this domain adaptation challenge through a few-shot scaling study. A controlled cross-dataset evaluation is presented in this paper using TBX11K as the source domain and the Mendeley TB dataset as the target domain. It is investigated how varying the number of target samples affects model performance under three training regimes: frozen backbone adaptation, full fine-tuning of a source-pretrained DenseNet121 model, and training from scratch. The results indicate that the model can perform well even with limited data and can achieve 98.36% accuracy with just 75 labeled samples per class. The adaptation curves demonstrate how fine-tuning effectively mitigates domain shift. These findings establish full fine-tuning of pretrained models as a highly effective and practical strategy for mitigating domain shift in low-resource clinical deployment scenarios.
Figures & tables
Step 1: Initialize DenseNet-121 with pretrained weights from TBX11K
Step 2: Replace classifier with binary output layer
Step 3: Train model on source dataset (TBX11K)
For each shot size k∈{10,25,50,75,100} :
Sample k labeled images per class from target dataset
If Frozen Backbone Adaptation:
Freeze feature extractor layers
Table 1: Few-Shot Domain Adaptation for TB Detection
Setting
Pretrained
Fine-Tuning Scope
Target Labels Used
Zero-shot
Yes
None
0
Frozen
Yes
Classifier only
k per class
Full FT
Yes
All layers
k per class
Scratch
No
All layers
k per class
Table 2: Experimental Settings
Figure 1: Graphically visualizing the performance improvement of few-shot adaptation over frozen backbone and training from scratch.
Shots per class
Frozen Backbone
Full Fine-tuning
Scratch
10
75.07
88.86
93.88
25
77.89
98.21
94.76
50
88.86
99.45
92.81
75
88.56
98.36
97.55
100
90.78
99.68
91.13
Table 3: Few-shot adaptation accuracy (%) on the Mendeley dataset.
Figure 2: Confusion matrix for the full fine-tune model (using the 15% target adaptation split) on the Mendeley test set. Very few mistakes overall, especially on the TB side.
Figure 3: Grad-CAM heatmaps for normal and TB cases from the Mendeley dataset
Metric
Value
Accuracy
98.43%
Precision (TB)
100.0%
Recall (TB)
98.1%
F1-score (TB)
99.05%
AUC
99.99%
Table 4: Detailed performance metrics for the adapted model (using the 15% target adaptation split)
Test-time adaptation (TTA) aims to align a model to shifting test domains using only unlabeled streaming data. Most existing methods implicitly infer a single global domain distribution, ignoring the multidimensional and sample-specific nature of real-world domain shifts, leading to fragile adaptation. We propose DOME, an effective domain encoder that explicitly models each sample's domain in a zero-shot manner. DOME leverages vision-language pretraining to extract dense, continuous representations, parameterizes domains as distributional variables, and introduces a momentum-updated sparse domain bank for disentangled supervision. By injecting these explicit domain cues into downstream models, even a basic entropy-minimization TTA strategy achieves state-of-the-art performance across ImageNet-C, ImageNet-R, and ImageNet-Sketch, outperforming complex TTA approaches. Our results demonstrate that robust adaptation stems not from intricate adaptation algorithms, but from explicit, structured domain representation.
Foundation models have shown significant potential across diverse fields and have been applied to medical imaging, but their robustness across patient populations remains unclear. In this work, we investigate foundation models' ability to generalize from adult to pediatric chest X-ray classification. To the best of our knowledge, this is the first benchmark to compare multiple foundation models under a common adult-to-pediatric evaluation setting while also analyzing the effect of adaptation depth. We harmonize VinDr-CXR and PediCXR into a five-label classification task and evaluate six foundation models and two CNN baselines. All models are adapted using adult data only and tested in both the in-domain and pediatric domains using linear probing, partial fine-tuning, and full fine-tuning. The benchmark reveals a clear and consistent trend: all models suffer a substantial performance degradation when transferred from adult to pediatric data, with drops exceeding 10 percentage points. While Macro-AUROC values reach approximately 92% on the adult test set, performance decreases to around 78% on the pediatric domain. Another important finding is that increasing the depth of adaptation does not significantly improve cross-population generalization. Moreover, strong in-domain performance does not translate into better performance on pediatric data.
Sara Inácio, Hugo Proença, João C. Neves
University of Beira Interior, Portugal · NOVA LINCS · IT: Instituto de Telecomunicações
Large pretrained clinical models provide a practical way to reuse learned prior knowledge across hospitals by adapting models to them. In practice, a target hospital may only have a small labeled patient cohort, a setting commonly referred to as few-shot adaptation. This requires making multiple decisions, such as which pretrained model to adapt, how much of the model to update, and which patients to use. Nevertheless, this process faces two primary challenges. First, the best adaptation strategy varies across clinical tasks. Second, evaluating and comparing candidate strategies becomes unreliable due to the small patient cohort. In this work, we introduce AutoAdapt with two core designs to deal with these challenges. The Adapter defines an extensible space of adaptation recipes, and the Automator forms a weighted recipe combination from evidence within the adaptation patients. We propose a reliability rule to ensure that only the most effective strategy on most available patients will be selected. These selected strategies then form a combination for effective few-shot adaptation. We conduct extensive experiments across critical care, emergency care, and diagnostic datasets, and the results show that AutoAdapt consistently achieves state-of-the-art performance using only a few patients for adaptation.