Zing Forum

Reading

Automatic Detection of Diabetic Retinopathy Using Deep Convolutional Neural Networks: From Fundus Images to Clinical Grading

This article introduces an end-to-end deep learning project based on TensorFlow/Keras, which automatically detects and classifies the severity of diabetic retinopathy by analyzing fundus photos, providing technical support for early diagnosis.

糖尿病视网膜病变卷积神经网络医学影像分析TensorFlowKeras深度学习计算机辅助诊断眼底图像
Published 2026-06-13 19:45Recent activity 2026-06-13 19:48Estimated read 6 min
Automatic Detection of Diabetic Retinopathy Using Deep Convolutional Neural Networks: From Fundus Images to Clinical Grading
1

Section 01

[Introduction] Automatic Detection Project of Diabetic Retinopathy Based on Deep Convolutional Neural Networks

The open-source project introduced in this article was released on GitHub by lossunzer0841 on June 13, 2026 (link: https://github.com/lossunzer0841/diabetic-retinopathy-cnn). Its core is to build an end-to-end deep convolutional neural network using TensorFlow/Keras, which automatically analyzes fundus photos and classifies the 5 clinical severity levels of diabetic retinopathy, providing technical support for early diagnosis.

2

Section 02

Project Background and Significance

Diabetic Retinopathy (DR) is one of the leading causes of blindness worldwide. Traditional diagnosis relies on ophthalmologists examining fundus photos one by one, which is time-consuming and labor-intensive, and difficult to popularize in areas with scarce medical resources. Artificial intelligence technology can automatically analyze fundus images by training CNNs, improving screening efficiency while ensuring accuracy. This project is built on this idea to construct a complete deep learning framework.

3

Section 03

Dataset and Clinical Grading Standards

The project uses the APTOS 2019 Blindness Detection Dataset, which contains fundus images annotated by professional ophthalmologists. DR is divided into 5 levels:

  • Class 0: No lesion (normal fundus)
  • Class 1: Mild (microaneurysms)
  • Class 2: Moderate (microaneurysms + hemorrhage/exudation, etc.)
  • Class 3: Severe (massive hemorrhage + venous beading/IRMA)
  • Class 4: Proliferative stage (neovascularization, prone to vitreous hemorrhage or retinal detachment) Accurate grading is crucial for formulating treatment plans, such as regular monitoring for mild cases and immediate intervention for severe cases.
4

Section 04

Technical Architecture and Model Design

The technology stack includes TensorFlow 2.18.0, Keras, OpenCV (image preprocessing), NumPy/Pandas (data processing), and Matplotlib/Seaborn (visualization). Network Architecture:

  1. Input layer: 224×224 RGB image, pixel normalized to [0,1]
  2. Convolutional layers: 3 Conv2D layers (32→64→128 filters, ReLU activation) + MaxPooling2D
  3. Regularization: Dropout layer (dropout rate 0.5) to prevent overfitting
  4. Output layer: Fully connected layer with 5 neurons, Softmax to output class probabilities Training Strategy: Loss function is categorical cross-entropy, Adam optimizer (lr=0.0001), batch size 32, training for 20 epochs, dataset divided by 80/20 stratified sampling (to solve class imbalance).
5

Section 05

Image Preprocessing Flow

Preprocessing Steps:

  1. Size standardization: Adjust to 224×224 resolution
  2. Pixel normalization: Convert from 0-255 to 0.0-1.0 floating point numbers In addition, advanced preprocessing such as contrast enhancement and noise removal may be included (not fully expanded in the document), which are crucial for improving the robustness of low-quality images.
6

Section 06

Practical Application Value and Limitations

Application Value: Provides a low-cost and efficient screening tool for areas with insufficient medical resources, which can be deployed on ordinary devices to assist primary care doctors and concentrate specialist resources on cases requiring intervention. Limitations: AI tools are only auxiliary means and cannot replace professional diagnosis; they need to be combined with clinical history and other factors for comprehensive judgment. The generalization ability of the model on images taken by different races and devices needs further verification.

7

Section 07

Summary and Outlook

This project demonstrates a complete deep learning process from data preparation to training and evaluation, providing a reference example for medical image analysis with clear code structure and detailed documentation. Future Improvement Directions: Introduce advanced architectures such as ResNet/EfficientNet, expand samples through data augmentation, use transfer learning with pre-trained models, develop lesion area localization functions, etc. The application prospects of AI in ophthalmic screening are broad.