MachineX: Diabetic retinopathy detection using AI

Reading Time: 3 minutes

In this blog we are going to discuss about diabetic retinopathy and how can we prevent it by using Artificial intelligence.


Diabetic retinopathy is a diabetes complication that affects eyes. Damage to the blood vessels of the light-sensitive tissue of the retina causes this complication. Diabetic retinopathy (DR) is a leading cause of vision-loss globally. Approximately one-third of 285 million people with diabetes mellitus worldwide have signs of DR.

The US Center for Disease Control and Prevention estimates that 29.1 million people in the US have diabetes and the World Health Organization estimates that 347 million people have the disease worldwide. Diabetic Retinopathy (DR) is an eye disease associated with long-standing diabetes. Around 40% to 45% of Americans with diabetes have some stage of the disease. Progression to vision impairment can be slowed or averted if DR is detected in time, however, this can be difficult as the disease often shows few symptoms until it is too late to provide effective treatment.

Traditional Way

One of the most common ways to detect diabetic eye disease is to have a specialist examine pictures of the back of the eye (Figure 1) and rate them for disease presence and severity. Severity is determined by the type of lesions present (e.g. microaneurysms, hemorrhages, hard exudates, etc), which are indicative of bleeding and fluid leakage in the eye. Interpreting these photographs requires specialized training, and in many regions of the world, there aren’t enough qualified graders to screen everyone who is at risk.

Another way, Clinicians can identify DR by the presence of lesions associated with the vascular abnormalities caused by the disease. While this approach is effective, its resource demands are high. The expertise and equipment required are often lacking in areas where the rate of diabetes in local populations is high and DR detection is most needed. As the number of individuals with diabetes continues to grow, the infrastructure needed to prevent blindness due to DR will become even more insufficient.


Currently, detecting DR is a time-consuming and manual process that requires a trained clinician to examine and evaluate digital color fundus photographs of the retina. By the time human readers submit their reviews, often a day or two later, the delayed results lead to lost follow up, miscommunication, and delayed treatment.

AI approach

AI in healthcare plays an important role in transform medical treatment processes with a different approach.

The need for a comprehensive and automated method of DR screening has long been recognized, and previous efforts have made good progress using image classification, pattern recognition, and machine learning.

We are going to use libraries like TensorFlow and PyTorch to find a solution to this problem.

Data description

We have data with a large set of high-resolution retina images taken under a variety of imaging conditions. left and right fields are provided for every subject. Images are labeled with a subject id as well as either left or right (e.g. 1_left.jpeg is the left eye of patient id 1).

A clinician has rated the presence of diabetic retinopathy in each image on a scale of 0 to 4, according to the following scale:

0 – No DR
1 – Mild
2 – Moderate
3 – Severe
4 – Proliferative DR

we will create an automated analysis system capable of assigning a score based on this scale.

Like any real-world data set, this data also consists of noise in both the images and labels. Images may contain artifacts, be out of focus, underexposed, or overexposed. A major aim of this Solution is to develop robust algorithms that can function in the presence of noise and variation.

Stay tuned for the next blog, in which we will go through the implementation of solution to detect DR.

Happy learning 🙂


Written by 

Shubham Goyal is a Data Scientist at Knoldus Inc. With this, he is an artificial intelligence researcher, interested in doing research on different domain problems and a regular contributor to society through blogs and webinars in machine learning and artificial intelligence. He had also written a few research papers on machine learning. Moreover, a conference speaker and an official author at Towards Data Science.