Deep sight: Transformer-based prediction of diabetic retinopathy using PyTorch
摘要
Diabetic retinopathy (DR) is a progressive eye disease caused by long-term diabetes and can result in severe vision loss or blindness if not diagnosed early. Automated DR screening plays a critical role in improving early detection rates and enhancing patient outcomes. Deep learning methods, especially Convolutional Neural Networks (CNNs), have been widely used for DR classification. With the emergence of vision transformers, new opportunities have arisen for capturing complex retinal patterns more effectively.
ObjectiveThis study aims to evaluate transformer-based architectures—including standalone transformers and hybrid CNN-transformer models—for multi-class DR classification using PyTorch. It also examines the impact of advanced preprocessing techniques such as Gaussian filtering and Contrast Limited Adaptive Histogram Equalisation (CLAHE) on improving retinal image quality and highlighting clinically relevant features.
MethodsA multi-class diabetic retinopathy dataset was used to train and test various transformer architectures. Multiple models were implemented and compared, including pure transformer networks and CNN-transformer hybrids. Preprocessing steps involving Gaussian filtering and CLAHE were applied to enhance visibility of retinal structures before feeding images into the models.
ResultsAmong the evaluated architectures, the ConvNeXt-Transformer Hybrid achieved the best performance with an accuracy of 93.14%.
ConclusionThe findings demonstrate that transformer-based models, particularly hybrid architectures, hold strong potential for automated DR screening. Their ability to capture intricate retinal details through attention mechanisms makes them efficient and scalable solutions suitable for integration into clinical ophthalmology workflows.