Tiling to transfer: patch-level contrastive learning framework for cross-dataset generalization on downstream diabetic retinopathy grading tasks
Abstract
This study presents a patch-based contrastive learning framework (Patch-SimCLR) designed to improve the generalizability and calibration of diabetic retinopathy classification across heterogeneous fundus datasets. By extracting overlapping, and non-overlapping patches and leveraging contrastive pretraining, the model learns domain-robust representations without relying on explicit domain-generalization mechanisms. Evaluated on five benchmark datasets (APTOS, IDRiD, Messidor-2, DDR, and EyePACS), the proposed approach achieves state-of-the-art performance on APTOS, IDRiD, and EyePACS, and remains competitive on the more distributionally shifted Messidor-2 and DDR sets. The method also delivers low entropy and calibration error on the source domains, highlighting the reliability of its uncertainty estimates. While performance drops under severe domain shift, the findings demonstrate that self-supervised, patch-level representation learning is a simple and effective strategy for scalable diabetic retinopathy screening. Future work can extend this framework to multi-source contrastive training and lesion-aware patch sampling to further enhance robustness and clinical utility.