Loading…
Loading…
google/vit-base-patch16-224-in21kEducational project. NOT a medical device. Not for diagnosis or clinical decisions.
A Vision Transformer fine-tuned to classify pediatric (age 1-5) chest X-rays as NORMAL or PNEUMONIA.
Base model: google/vit-base-patch16-224-in21k (Apache-2.0).
Kermany et al. (2018), "Chest X-Ray Images (Pneumonia)", CC BY 4.0, from Guangzhou Women and Children's Medical Center.
Two stages: (1) backbone frozen, classification head only (4 epochs, lr 3e-4); (2) full fine-tuning (6 epochs, lr 2e-5). AdamW, cosine schedule with warmup, batch size 32, fp16, class-weighted cross-entropy (NORMAL ~1.93, PNEUMONIA ~0.68), seed 42. Augmentation (train only): random resized crop (0.85-1.0), rotation up to 10 degrees, brightness/contrast jitter. No flips. Best epoch of each stage was chosen by validation AUC.
| Model | AUC | Sensitivity | Specificity | Accuracy | F1 |
|---|---|---|---|---|---|
| Frozen backbone (baseline) | 0.919 [0.896-0.939] | 0.728 | 0.953 | 0.812 | 0.829 |
| Fine-tuned (this model) | 0.987 [0.977-0.994] | 0.992 [0.982-1.000] | 0.821 [0.769-0.868] | 0.928 | 0.945 |
The fine-tuned model missed 3 of 390 pneumonia cases and raised false alarms on 42 of 234 normal images. Validation specificity (~0.98) was much higher than test specificity (0.82), so validation scores overestimate performance. A lower threshold chosen on validation (0.09) did not transfer to the test set and is not recommended.
Kermany, D., Zhang, K., Goldbaum, M. (2018). Large Dataset of Labeled Optical Coherence Tomography (OCT) and Chest X-Ray Images. Mendeley Data, V3. doi:10.17632/rscbjbr9sj.3