Supervised Transfer vs. Contrastive Pretraining in GI Endoscopy
A controlled comparison of supervised transfer learning against SimCLR contrastive pretraining for gastrointestinal endoscopy classification, across ResNet50, EfficientNet-B0, and ViT-B/16. SimCLR reached 56.72% accuracy where supervised transfer reached 89.19% — and the vision transformer lost to both CNNs.

CASE STUDY
Select a section to explore the project one part at a time.
Problem
Self-supervised learning is supposed to win when labels are scarce.
The case for contrastive pretraining is that labels are expensive and unlabelled images are not — especially in medicine, where annotation requires a clinician. SimCLR and its successors are presented as the answer to that constraint.
Kvasir v2 is a reasonable place to test it: 8,000 endoscopy images across 8 gastrointestinal findings, perfectly balanced at 1,000 images per class. Moderate scale, real clinical variation, and no label imbalance to confound the metrics.
What this project asks
- Does contrastive pretraining beat supervised transfer at this scale? 8,000 images is small for ImageNet fine-tuning and small for contrastive learning. Neither regime is obviously favoured.
- Do transformers or CNNs generalise better here? ViT-B/16 against ResNet50 and EfficientNet-B0, same data, same schedule.
- Does accuracy tell the whole story on a balanced dataset? With 1,000 images per class, accuracy and macro-F1 should agree. Where they diverge, something is failing unevenly.
Kvasir v2, 8 classes, 8,000 images at 224×224 with ImageNet normalisation. Stratified 64/16/20 split. All metrics reported on the held-out test set.