Diabetic retinopathy (DR) is a progressive retinal disease and a major cause of preventable blindness among diabetic patients worldwide. Early diagnosis is essential to avoid irreversible vision loss, yet manual screening methods are often time-consuming, inconsistent, and inaccessible in low-resource settings. This project presents an AI-based system for automated DR detection and severity grading using deep learning techniques applied to retinal fundus images from APTOS, Messidor, and EyePACS datasets. The model classifies DR into five clinically defined stages—ranging from No DR to Proliferative DR—by learning subtle pathological features such as microaneurysms, hemorrhages, and neovascularization. To enhance interpretability and clinical trust, Grad-CAM is integrated to generate heatmaps that highlight lesion-specific regions influencing the model\'s predictions. The system achieves 84% test accuracy with F1-scores of 0.93 for No DR and 0.90 for Proliferative DR. The system is optimized for deployment on CPU-based hardware, making it suitable for scalable and accessible screening in real-world environments. By combining diagnostic accuracy with explainability, this project demonstrates how AI can support ophthalmologists, improve early intervention, and reduce the global burden of DR-related vision impairment.
Introduction
This text presents a deep learning-based system for detecting and classifying diabetic retinopathy (DR) from retinal images, aimed at improving early diagnosis and making screening more accessible.
Diabetic retinopathy is a major complication of diabetes that can lead to blindness if not detected early. Traditional screening methods rely on ophthalmologists manually analyzing retinal images, which is slow, expensive, and often unavailable in rural or low-resource areas. This creates a need for automated, accurate, and scalable diagnostic tools.
The proposed solution uses a deep learning approach based on EfficientNet-B3, trained on a combined dataset (APTOS, Messidor, EyePACS) to classify retinal images into five severity levels. To improve performance, the system uses data augmentation and class-weighted loss functions to handle imbalanced datasets. It also focuses on deploying efficiently on CPU-based systems, making it suitable for real-world healthcare environments.
A key contribution is the integration of Grad-CAM, which provides visual explanations by highlighting regions of the retina that influenced the model’s prediction. This improves transparency and helps clinicians trust the system’s decisions.
The literature review shows that while deep learning models have achieved high accuracy in DR detection, most lack interpretability and real-world deployability. This work addresses those gaps by combining accuracy, generalization, and explainability in a single system.
Conclusion
This paper presented an automated system for detecting and grading diabetic retinopathy from retinal fundus images using EfficientNet-B3 and Grad-CAM. The system was trained on a diverse combined dataset from APTOS, Messidor, and EyePACS, covering all five clinical DR severity levels. An overall test accuracy of 84% was achieved, with strong F1-scores on the extreme severity classes (No DR: 0.93, Proliferative DR: 0.90).
The integration of Grad-CAM addresses one of the most persistent criticisms of AI tools in medicine—that they function as unexplainable black boxes. By generating heatmaps that highlight which retinal regions influenced each prediction, the system gives clinicians something concrete to examine and challenge. The system is also deliberately designed to run on CPU-based hardware, making it deployable in resource-constrained settings such as rural clinics and mobile screening programs without specialized computing infrastructure.
Together, these design choices demonstrate that a well-chosen deep learning architecture combined with an interpretability layer and practical hardware optimization can produce an automated DR screening tool that is both clinically meaningful and realistically deployable.
References
[1] V. Gulshan, L. Peng, M. Coram, M. C. Stumpe, D. Wu, A. Narayanaswamy, S. Venugopalan, K. Widner, T. Madams, J. Cuadros, R. Kim, R. Raman, P. C. Nelson, J. L. Mega, and D. R. Webster, \"Development and Validation of a Deep Learning Algorithm for Detection of Diabetic Retinopathy in Retinal Fundus Photographs,\" JAMA, vol. 316, no. 22, pp. 2402-2410, Dec. 2016.
[2] R. Gargeya and T. Leng, \"Automated Identification of Diabetic Retinopathy Using Deep Learning,\" Ophthalmology, vol. 124, no. 7, pp. 962-969, Jul. 2017.
[3] R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra, \"Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization,\" in Proceedings of the IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 2017, pp. 618-626.
[4] H. Pratt, F. Coenen, D. M. Broadbent, S. P. Harding, and Y. Zheng, \"Convolutional Neural Networks for Diabetic Retinopathy,\" Procedia Computer Science, vol. 90, pp. 200-205, 2016.
[5] M. A. Jabbar, R. Subhashini, Y. C. Reddy, and N. S. N. Rajesh, \"A Hybrid Deep Learning Framework for Multi-Stage Diabetic Retinopathy Detection Including Severe Stage Lesions,\" IEEE Access, vol. 12, pp. 1-19, 2024.
[6] M. Tan and Q. V. Le, \"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks,\" in Proceedings of the 36th International Conference on Machine Learning (ICML), Long Beach, CA, USA, 2019, pp. 6105-6114.
[7] K. He, X. Zhang, S. Ren, and J. Sun, \"Deep Residual Learning for Image Recognition,\" in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 2016, pp. 770-778.
[8] A. Krizhevsky, I. Sutskever, and G. E. Hinton, \"ImageNet Classification with Deep Convolutional Neural Networks,\" Communications of the ACM, vol. 60, no. 6, pp. 84-90, May 2017.
[9] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, \"Rethinking the Inception Architecture for Computer Vision,\" in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 2016, pp. 2818-2826.
[10] P. Porwal, S. Pachade, R. Kamble, M. Kokare, G. Deshmukh, V. Sahasrabuddhe, and F. Meriaudeau, \"IDRiD: Diabetic Retinopathy—Segmentation and Grading Challenge,\" Medical Image Analysis, vol. 59, pp. 101561, Jan. 2020.
[11] J. Y. Shin, M. J. Lee, and H. S. Seo, \"Automated Diabetic Retinopathy Detection Using Bag-of-Words Model with Multiple Features,\" Journal of Digital Imaging, vol. 33, no. 3, pp. 635-644, Jun. 2020.
[12] Q. Abbas, \"DeepDR: Deep Learning-Based Framework for Diabetic Retinopathy Grading Using Fundus Images,\" IEEE Journal of Biomedical and Health Informatics, vol. 26, no. 7, pp. 3256-3265, Jul. 2022.
[13] T. Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar, \"Focal Loss for Dense Object Detection,\" in Proceedings of the IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 2017, pp. 2980-2988.
[14] S. Ioffe and C. Szegedy, \"Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift,\" in Proceedings of the 32nd International Conference on Machine Learning (ICML), Lille, France, 2015, pp. 448-456.