Explainable Diabetic Retinopathy Detection with Multi-Scale Attention
Main Article Content
Abstract
Diabetic retinopathy is a major cause of preventable visual impairment, yet large-scale screening is limited by the shortage of trained graders and by the limited transparency of automated severity classifiers. This study presents a multi-scale attention fusion network (MSAF-DRNet) for five-class diabetic retinopathy grading on the APTOS 2019 dataset. The model uses an ImageNet-pretrained EfficientNet-B4 backbone, feature extraction at three depths, scale-specific channel and spatial attention, adaptive feature fusion, and an ordinal-aware focal loss that accounts for the ordered severity grades and class imbalance. Circle cropping, contrast enhancement, data augmentation, Mixup, CutMix, stochastic weight averaging, and five-view test-time augmentation are used during training and inference. Grad-CAM is integrated to provide a visual explanation for each prediction. On a stratified 80/10/10 split of 3,662 images, the proposed system achieved 95.63% accuracy, 0.937 quadratic weighted kappa, 0.93 macro F1, and 0.987 macro AUC. All 16 test errors were between adjacent grades, while the learned fusion weights showed complementary contributions from fine, medium, and coarse features. These results support the value of combining multi-scale representation, ordinal learning, and visual explanation in automated diabetic retinopathy grading.
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
References
Akram, M. U., Khalid, S., & Khan, S. A. (2013). Identification and classification of microaneurysms for early detection of diabetic retinopathy. Pattern Recognition, 46(1), 107–116. https://doi.org/10.1016/j.patcog.2012.07.002
Asia Pacific Tele-Ophthalmology Society. (2019). APTOS 2019 blindness detection dataset. Kaggle. https://www.kaggle.com/c/aptos2019-blindness-detection
Bhimavarapu, U., Chintalapudi, N., & Battineni, G. (2023). Automatic detection and classification of diabetic retinopathy using the improved pooling function in the convolution neural network. Diagnostics, 13(15), 2606. https://doi.org/10.3390/diagnostics13152606
Boulaabi, M., Ben Aïcha Gader, T., Kacem Echi, A., & Bouraoui, Z. (2025). Enhancing DR classification with Swin Transformer and shifted window attention. In Artificial Intelligence in Medicine (AIME 2025) (pp. 57–61). Springer. https://doi.org/10.1007/978-3-031-95841-0_11
Dihin, R. A., AlShemmary, E. N., & Al-Jawher, W. A. M. (2023). Diabetic retinopathy classification using Swin Transformer with multi wavelet. Journal of Kufa for Mathematics and Computer, 10(2), 167–172. https://doi.org/10.31642/JoKMC/2018/100221
Haque, M. M., Akter, S., & Ashrafi, A. F. (2024). Swin-MedNet: Leveraging Swin Transformer for robust diabetic retinopathy classification from the RetinaMNIST2D dataset. In Proceedings of the 6th International Conference on Electrical Engineering and Information & Communication Technology (ICEEICT) (pp. 1286–1291). IEEE. https://doi.org/10.1109/ICEEICT62016.2024.10534567
International Diabetes Federation. (2021). IDF diabetes atlas (10th ed.). International Diabetes Federation. https://diabetesatlas.org
Islam, S. M. S., Hasan, M. M., & Abdullah, S. (2018). Deep learning based early detection and grading of diabetic retinopathy using retinal fundus images. arXiv preprint arXiv:1812.10595. https://doi.org/10.48550/arXiv.1812.10595
Izmailov, P., Podoprikhin, D., Garipov, T., Vetrov, D., & Wilson, A. G. (2018). Averaging weights leads to wider optima and better generalization. In Proceedings of the Conference on Uncertainty in Artificial Intelligence (UAI) (pp. 876–885). https://doi.org/10.48550/arXiv.1803.05407
Kalyani, G., Janakiramaiah, B., Karuna, A., & Prasad, L. V. N. (2023). Diabetic retinopathy detection and classification using capsule networks. Complex & Intelligent Systems, 9(3), 2651–2664. https://doi.org/10.1007/s40747-021-00318-9
Kamal, E. S., & Sharmin, N. (2026). Retinal vessel segmentation using a Swin Transformer-based encoder–decoder architecture. Signal, Image and Video Processing, 20(1), 27. https://doi.org/10.1007/s11760-025-05089-1
Khalifa, N. E. M., Loey, M., Taha, M. H. N., & Mohamed, H. N. E. T. (2019). Deep transfer learning models for medical diabetic retinopathy detection. Acta Informatica Medica, 27(5), 327–332. https://doi.org/10.5455/aim.2019.27.327-332
Kinyoun, J., Barton, F., Fisher, M., Hubbard, L., Aiello, L., & Ferris, F., III. (1989). Detection of diabetic macular edema: Ophthalmoscopy versus photography—Early Treatment Diabetic Retinopathy Study Report Number 5. Ophthalmology, 96(6), 746–751. https://doi.org/10.1016/S0161-6420(89)32814-4
Lin, T.-Y., Goyal, P., Girshick, R., He, K., & Dollár, P. (2017). Focal loss for dense object detection. In Proceedings of the IEEE International Conference on Computer Vision (ICCV) (pp. 2980–2988). https://doi.org/10.1109/ICCV.2017.324
Liu, Y., Yao, D., Ma, Y., Wang, H., Wang, J., Bai, X., Zeng, G., & Liu, Y. (2025). STMF-DRNet: A multi-branch fine-grained classification model for diabetic retinopathy using Swin-TransformerV2. Biomedical Signal Processing and Control, 103, 107352. https://doi.org/10.1016/j.bspc.2024.107352
Narasimha-Iyer, H., Can, A., Roysam, B., Stewart, C. V., Tanenbaum, H. L., Majerovics, A., & Singh, H. (2006). Robust detection and classification of longitudinal changes in color retinal fundus images for monitoring diabetic retinopathy. IEEE Transactions on Biomedical Engineering, 53(6), 1084–1098. https://doi.org/10.1109/TBME.2005.863971
Qureshi, I., Ma, J., & Abbas, Q. (2021). Diabetic retinopathy detection and stage classification in eye fundus images using active deep learning. Multimedia Tools and Applications, 80(8), 11691–11721. https://doi.org/10.1007/s11042-020-10238-4
Rakhlin, A. (2018). Diabetic retinopathy detection through integration of deep learning classification framework. bioRxiv, 225508. https://doi.org/10.1101/225508
Selvaraju, R. R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., & Batra, D. (2017). Grad-CAM: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision (ICCV) (pp. 618–626). https://doi.org/10.1109/ICCV.2017.74
Shankar, K., Sait, A. R. W., Gupta, D., Lakshmanaprabu, S. K., Khanna, A., & Pandey, H. M. (2020). Automated detection and classification of fundus diabetic retinopathy images using synergic deep learning model. Pattern Recognition Letters, 133, 210–216. https://doi.org/10.1016/j.patrec.2020.02.026
Tan, M., & Le, Q. V. (2019). EfficientNet: Rethinking model scaling for convolutional neural networks. In Proceedings of the 36th International Conference on Machine Learning (ICML) (pp. 6105–6114). https://proceedings.mlr.press/v97/tan19a.html
Tan, T.-E., & Wong, T. Y. (2023). Diabetic retinopathy: Looking forward to 2030. Frontiers in Endocrinology, 13, 1077669. https://doi.org/10.3389/fendo.2022.1077669
Woo, S., Park, J., Lee, J.-Y., & Kweon, I. S. (2018). CBAM: Convolutional block attention module. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 3–19). https://doi.org/10.1007/978-3-030-01234-2_1
Xu, H., Shao, X., Fang, D., & Huang, F. (2024). A hybrid neural network approach for classifying diabetic retinopathy subtypes. Frontiers in Medicine, 10, 1293019. https://doi.org/10.3389/fmed.2023.1293019
Yun, S., Han, D., Oh, S. J., Chun, S., Choe, J., & Yoo, Y. (2019). CutMix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE International Conference on Computer Vision (ICCV) (pp. 6023–6032). https://doi.org/10.1109/ICCV.2019.00612
Zhang, H., Cisse, M., Dauphin, Y. N., & Lopez-Paz, D. (2018). mixup: Beyond empirical risk minimization. In Proceedings of the International Conference on Learning Representations (ICLR). https://doi.org/10.48550/arXiv.1710.09412
27. Zuiderveld, K. (1994). Contrast limited adaptive histogram equalization. In Graphics Gems IV (pp. 474–485). Academic Press. https://doi.org/10.1016/B978-0-12-336156-1.50061-6