Detection of Diabetic Retinopathy using Deep Learning

Download Full-Text PDF Cite this Publication

Text Only Version

Detection of Diabetic Retinopathy using Deep Learning

Anushree Vartak Dept. of Computer V.C.E.T

Sagar Kataria Dept. of Computer V.C.E.T

Zeal Vala Dept.of Computer V.C.E.T.

Dr. Swapna Borde Asst. Prof. Dept. of Computer Engineering

V.C.E.T. Vasai, India

Abstract:- Diabetic Retinopathy (DR) is a common complication of diabetes mellitus, which causes lesions on the retina that effect vision. If it is not detected early, it can lead to blindness. Unfortunately, DR is not a reversible process, and treatment only sustains vision. DR early detection and treatment can significantly reduce the risk of vision loss. The manual diagnosis process of DR retina fundus images by ophthalmologists is time-, effort-, and cost-consuming and prone to misdiagnosis unlike computer-aided diagnosis systems. Recently, deep learning has become one of the most common techniques that has achieved better performance in many areas, especially in medical image analysis and classification. Convolutional neural networks are more widely used as a deep learning method in medical image analysis and they are highly effective. For this article, the recent state-of- the-art methods of DR color fundus images detection and classification using deep learning techniques have been reviewed and analyzed. Furthermore, the DR available datasets for the color fundus retina have been reviewed. Difference challenging issues that require more investigation are also discussed.


    Diabetes is a chronic and organ disease that occurs when the pancreas does not secrete enough insulin or the body is unable to process it properly. Over time, diabetes affects the circular system, including that of the retina. Diabetes retinopathy (DR) is a medical condition where the retina is damaged because of fluid leaks from blood vessels into the retina. It is one of the most common diabetic eye diseases and a leading cause of blindness. Nearly 415 million diabetic patients are at risk of having blindness because of diabetics. It occurs when diabetes damages the tiny blood vessels inside the retina, the light sensitive tissue at the back of the eye. This tiny blood vessel will leak blood and fluid on the retina forms features such as micro-aneurysms, haemorrhages, hard exudates, cotton wool spots or venous loops. Diabetic retinopathy can be classified as non- proliferative diabetic

    retinopathy (NPDR) and proliferative diabetic retinopathy (PDR). Depending on the presence of features on the retina, the stages of DR can be identified. In the NPDR stage, the disease can advance from mild, moderate to severe stage

    with various levels of features except less growth of new blood vessels. PDR is the advanced stage where the fluids sent by the retina for nourishment trigger the growth of new blood vessels. They grow along the retina and over the surface of the clear, vitreous gel that fills the inside of the eye. If they leak blood, severe vision loss and even blindness can result.

    Currently, detecting DR is a time-consuming and manual process that requires a trained clinician to examine and evaluate digital colour 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.


    Diabetic retinopathy is one of the most threatening complications of diabetes that leads to permanent blindness if left untreated. One of the essential challenges is early detection, which is very important for treatment success. Unfortunately, the exact identification of the diabetic retinopathy stage is notoriously tricky and requires expert human interpretation of fundus images. Simplification of the detection step is crucial and can help millions of people. Convolutional neural networks (CNN) have been successfully applied in many adjacent subjects, and for diagnosis of diabetic retinopathy itself. However, the high cost of big labeled datasets, as well as inconsistency between different doctors, impede the performance of these methods. In this paper, we propose an automatic deep-learning-based method for stage detection of diabetic retinopathy by single photography of the human fundus. Additionally, we propose the multistage approach to transfer learning, which makes use of similar datasets with different labeling. The presented method can be used as a screening method for early detection of diabetic retinopathy with sensitivity.


    The related work in the field of medical sciences as well as machine learning, shows that researchers have proposed and implemented various machine learning methods, but the study comparative study among these deep learning methods is still lacking for as far as Diabetic Retinopathy is concerned. The work done hence proves to be a novel approach while considering the results and fining for various machine learning algorithms for DR. Raman et al. [1]focuses on developing of computer-aided detection mechanism for finding abnormality of the retinal imaging, while detecting the existence of abnormal features from the retinal fundus images. Their proposed methodology focuses on enhancing images, filtering of the noise, detection of the blood vessels and identifying optic disc, extracting exudates and the micro aneurysms (MA), extracting features and classifying various stages of the diabetic retinopathy as mild, the moderate, the severe NPDR(Non-Proliferative Diabetic Retinopathy) and the PDR(Proliferative Diabetic Retinopathy) by the use of machine learning techniques.[2] Singh&Tripathi used Image analysis techniques for the automated and early discovery of the Diabetic Retinopathy, by the use of Image processing among many other analysis techniques. Soomro et al. in their research, proposed an image enhancement technique on the basis of [3] morphological operation accompanied bythe proposed threshold centered static wavelet transforms for the retinal fundus image in addition to CLAHE (Contrast Limited Adaptive Histogram Equalisation) for vessel enhancement.

    [4] Zhao et al. in their paper, proposed a novel saliency- based technique for detecting of the leakage in the fluoresce in angiography. Their proposed methodology is validated using only two publiclyaccessible datasets which are Diabetic Retinopathy and Malarial Retinopathy. Prasad et al. proposed use of the morphological operations along withthe segmentation procedures for detecting the blood vessels, micro aneurysms and the. The [5] PCA (Principal Component Analysis) is applied for improved feature selection. Further, Back-propagation NN and the one-rule classifier methods were deployed for classification of images as non-diabetic or diabetic.M. Usman Akram et al

    [6] approach is based on a hybrid classifier detecting the retinal lesions by preprocessing, extracting lesions from candidate, formulation of feature followed by classification. The work leads to further extension of m-Mediods based modeling methodology, combining it with Gaussian Mixture Model so to form some hybrid classifier in order to improve accuracy of classification. Winder, R. John, et al [7] survey based on algorithms for automatic detection of retinopathy while considering digital color retinal images. The algorithms considered for study were categorized in 5 stages (preprocessing, localization and segmentation of the optic disk, segmentation of the retinal vasculature, localization of the macula and fovea, localization and segmentation of retinopathy). Haleem, Muhammad Salman, et al [8] a paper surveys advanced methods for automatic extraction of the anatomical features in order to assist the early diagnosis of Glaucoma, from the retinal images. They carried out critical estimations of existing automatic extraction approaches

    based on the features comprising of CDR (Optic Cup to Disc Ratio), RNFL (Retinal Nerve Fiber Layer), and PPA (Parapapillary Atrophy) among others. The paper tabulated possible technique and their accuracy results very precisely. Gardner et al. worked on determining that if neural networks are able to detect the diabetic features prevailing in the [9]fundus images along with comparing network against ophthalmologist screening set of the fundus images. The work showed the detection of hemorrhages, exudates and vessels. Further comparing with ophthalmologist, their network attained better accuracy for detection of the Diabetic Retinopathy. Roychowdhury et al. in their paper, contributed to the reduction of number of features to be used for the [11] lesion classification by the feature ranking by the use of Adaboost. They proposed novel two-step hierarchical classification approach where non-lesions or the false positives are discarded in first step. And in second step, bright lesions are further classified as the hard exudates along with the cotton wool spots. Also red lesions remain classified as the hemorrhages and the micro-aneurysms (MA).[13] Rakshitha et al. work throws light on uses of the new imaging transformation methods for the enhancement of the retinal images like contourlet transform, curvelet transform and wavelet transform. Their paper thus draws comparison among these three imaging transformations. Vo et al. research studies discriminant texture features which are obtained by the color multi-scale uniform [14] LBPs(Local Binary Patterns)that are descriptors on the two proposed hybrid and the five common color spaces. Then the extracted features can be evaluated by enhanced EFM, a Fisher Linear Discriminant.


Supervised Learning Model

Supervised learning is the machine learning task of inferring a function from supervised training data . Training data for supervised learning includes a set of examples with paired input subjects and desired output. A supervised learning algorithm analyses the training data and produces an inferred function, which is called classifier or a regression function. The function should predict the correct output value for any valid input object. This requires the learning algorithm to generalize from the training data to unseen situations in a reasonable way.

A simple analogy to supervised learning is the relationship between a student and a teacher. Initially the teacher teaches the student about a particular topic. Teaching the student the concepts of the topic and then giving answers to many questions

regarding the topic. Then the teacher sets an exam paper for the student to take, where the student answers newer questions.

Figure 2.1 describes that the system learns from the data provided which contains the features and the output as well. After it has done learning, newer data is provided without outputs, and the system generates the output using the knowledge it gained from the data on which it trained. Here is how supervised learning model works.

Proposed Model

Our First phase is data collection. We have collected our dataset from UCI Machine Learning repository website. The

dataset contains features extracted from Messidor image set to predict whether an image have signs of diabetic retinopathy or not. Then features and labels of the dataset are identified. After that the dataset is divided into two sets, one for training where most of the data is used and the other one is testing. In training set four different classification algorithms has been fitted for the analysis performance of the model. The algorithms we used are k-Nearest Neighbor, random forest, support vector machine and neural networks. After the system has done learning from training datasets, newer data is provided without outputs. The final model generates the output using the knowledge it gained from the data on which it was trained. In final phase we get the accuracy of each algorithm and get to know which particular algorithm will give us more accurate results for the prediction of diabetic retinopathy.

Figure 3.1 shows the proposed model of our system. All the steps in sequential order are given

Models Specification

We have used three models for obtaining greater accuracy. The three models are as follows:

  1. CNN : CNNs have broken the mould and ascended the throne to become the state-of-the-art computer vision technique. Among the different types of neural networks (others include recurrent neural networks (RNN), long short term memory (LSTM), artificial neural networks (ANN), etc.), CNNs are easily the most popular.

    CNNs are used for image classification and recognition because of its high accuracy. The CNN follows a hierarchical model which works on

    building a network, like a funnel, and finally gives out a fully-connected layer where all the neurons are connected to each other and the output is processed

    Only image data is being trained for CNN model. Processed images with single band has been given as a input of the network with given levels. The CNN model has been considered is the VGGnet model. The VGGnet [39] model structured of CONV layers which performs 3×3 convolution alongside stride:1 and pad:1, and of POOL layers which performs 2×2 maxpooling with stride:2. There is no padding existed in the network. The network trained with CPU support. As activation function ReLU has been used. All convolutional layers are followed with Maxpool used in the pooling layed for extracting the most significant feature between the image pixel. VGGnet works very well with densed featured images. As per model there is no normalizaton layers used here, because either way it does not improve the accuracy of the model. Figure giving the model view.


  2. ResNet50 is a variant of ResNet model which has 48 Convolution layers along with 1 MaxPool and 1 Average Pool layer. It has 3.8 x 10^9 Floating points operations. It is a widely used ResNet model.

    FIG.2. ResNet50 MODEL VIEW

  3. MobileNet-v2 is a convolutional neural network that is 53 layers deep. You can load a pretrained version of the network trained on more than a million images from the ImageNet database.



  1. LOGIN :

    Here the respective doctor or patients login onto the site.If the user turns out to be new he/she can sign up.


    The user has to enter data that is necessary for the reference so as to get a brief details about ones health background and personal details.


    Here the fundus image is given as input to the pre trained model.


    After the image is uploaded and scanned , one gets an accurate result of the intensity of his/her Diabetic Retinopathy.

    Here the parameters are as follows:

    1. No DR

    2. Mild DR

    3. Moderate DR

    4. Severe DR

    5. Proliferative

    Tools and Technology Requirement:

    • Hardware requirement

      • CPU


      • GPU NVIDIA GeForce GT 620

      • RAM 8GB

    • Software requirement

    • PYTHON

    • OS 10

    • DJANGO

    • Visual Studio.


      In the previous chapter we have discussed about proposed system and implementation of our thesis. We have demonstrated how we collected our dataset, dataset description, visualization and algorithms we used. Now we discussing about the results we obtained from our experiments upon the implementation of this system. We have divided our dataset into two parts- training and testing

      dataset. I this chapter we will show the outcome of the training and testing dataset. As mentioned before we have used four machine learning algorithms. First, we trained our dataset with these four algorithms and then we built a model. Then, we tested our testing dataset in this model. If the test set accuracy is near to train set accuracy then we can conclude that we built a good model.

      We have total 1151 data of different individual in our dataset. There are 1151 rows and 20 columns in the dataset. After splitting the data into two parts now we have 920 rows for train data and for test data we have 231 rows. When we trained our train data for analysis performance of different algorithms. This is the result we got-

      Figure 4.6 shows accuracy on the training and test datasets over training epochs

      Fig 4.6: Train-Test model accuracy

      From the plot of accuracy we can see that the model could probably be trained a little more as the trend for accuracy on both datasets is still rising for the last few epochs. We can also see that the model has not yet over-learned the training dataset, showing comparable skill on both datasets. Figure

      4.7 shows a plot of loss on the training and test datasets over training epochs.

      Fig 4.7: Train-Test model loss

      From the plot of loss, we can see that the model has comparable performance on both train and test datasets. If these parallel plots start to depart consistently, it might be a sign to stop training at an earlier epoch.

      If the lines of train-test loss seem to converge to the same value and are close at the end, then the classifier has high bias. If on the other hand the lines are quite far apart, and then we have a low training set error but high validation error, then your classifier has too high variance.

      From these we can conclude that our train-test loss model training set loss is low and our test set error is not too high. So, from this it can be said that we have a good train-test accuracy model.

      Fig. Profile of the patient

      Fig. Details that are to be entered.

      Fig. Choosing an image to upload

      model to implementresults on diabetic patients easily. We can then input the data of the patient and wait for the machine to create a new prescription integrated with Doctors suggestion

      4. Software Implementation: We can build a website or an android app for this purpose. In this way patient will be able to upload their data into our server and our machine learning software will let them know about their disease through our website whether it is in a good or bad condition.

      Fig. Results


      There are many difficulties we faced while working. First of all, theres a lot more to do before an algorithm like this can be used widely. Secondly, if we could manage more of our training data we could train our algorithm more to achieve more accuracy. Furthermore, we also faced some problems while choosing models. It was quite difficult for us to choose some specific models that would give accurate classification of the disease.

      We have tried to construct an ensemble to predict if a patient has diabetic retinopathy using features from retinal photos. After training and testing the model the accuracy we get is quite similar. For both sets CNN is providing higher accuracy rate for predicting DR. Despite the shortcomings in reaching good performance results, this work provided a means to make use and test multiple machine learning models and try to arrive to ensemble models that would outperform individual learners. It also allowed exploring a little feature selection, feature generation, parameter selection and ensemble selection problems and experiences the constraints in computation time when looking for possible candidate models in high combinatorial spaces, even for a small dataset as the one used. The structure of our research has been built in such a way that with proper dataset and minor alternation it can work to classify the disease in any numberof categories


For any research, there is always room for improvement. Ours is not an exception of that.

We have found some areas where this system can be improvised:

  1. Work on more Categories: This can be improvised with a lot more categorized such as according to ages, genders, background studies, working facilities and so on. As an example, A matured man from the IT background has different eye condition that a matured women from Teaching background.

  2. Work on more classes: As we working on only two classes whether it is good or bad. In future we are going to add more classes like low, medium, severe condition. In this way patients can know about their condition more accurately

  3. Hardware Implementation: A hardware product can be the best solution for patient. So, we are looking forward to build a hardware system where we can use our


      We (the author) would like to thank our guide Dr. Swapna Borde and all the Staff of Computer Department for their constant support and encouragement they gave us. We are very thankful for all the faith they had in us. And last but not the least our friends and family for their support. The dedication of our team members and enthusiasm helped us to move forward.


  1. V. Raman, P. Then and P. Sumari. Proposed retinal abnormality detection and classification approach: Computer-aided detection for diabetic retinopathy by machine learning approaches, Communication Software and Networks (ICCSN), 2016 8th IEEE International Conference on. IEEE, (2016).

  2. N. Singh and R. Chandra Tripathi. Automated early detection of diabetic retinopathy using image analysis techniques, International Journal of Computer Applications, vol. 8, no. 2, (2010), pp. 18-23.

  3. T. A. Soomro, Role of Image Contrast Enhancement Technique for Ophthalmologist as Diagnostic Tool for Diabetic Retinopathy, Digital Image Computing: Techniques and Applications (DICTA), 2016 International Conference on. IEEE, (2016).

  4. Y. Zhao, Intensity and Compactness Enabled Saliency Estimation for Leakage Detection in Diabetic and Malarial Retinopathy, IEEE Transactions on Medical Imaging, vol. 36, no. 1, (2017), pp. 51-63.

  5. D. K. Prasad, L. Vibha and K. R. Venugopal, Early detection of diabetic retinopathy from digital retinal fundus images, Intelligent Computational Systems (RAICS), 2015 IEEE Recent Advances in. IEEE, (2015).

  6. M. U. Akram, Detection and classification of retinal lesions for grading of diabetic retinopathy, Computers in biology and medicine, vol. 45, (2014), pp. 161-171.

  7. R. J. Winder, Algorithms for digital image processing in diabetic retinopathy, Computerized Medical Imaging and Graphics, vol. 33, no.8,(2009), pp. 608-622.

  8. Mu. S. Haleem, Automatic extraction of retinal features from colour retinal images for glaucoma diagnosis: A review, Computerized medical imaging and graphics, vol. 37, no. 7, (2013), pp. 581-596

  9. G. G. Gardner, Automatic detection of diabetic retinopathy using an artificial neural network: a screening tool, British journal of Ophthalmology, vol. 80, no. 11, (1996), pp. 940-944.

  10. R. Sivakumar, Diabetic retinopathy analysis, BioMed Research International, vol. 2005, no. 1, (2005), pp.20-27.

  11. S. Roychowdhury, D. D. Koozekanani and K. K. Parhi, Dream: Diabetic retinopathy analysis using machine learning, IEEE journal of biomedical and health informatics, vol. 18, no. 5, (2014), pp. 1717- 1728.

  12. M. N. Wernick, Machine learning in medical imaging, IEEE signal processing magazine, vol. 27, no. 4, (2010), pp. 25-38.

  13. T. R. Rakshitha, D. Devaraj and S.C. Prasanna Kumar, Comparative study of imaging transforms on diabetic retinopathy images, Recent Trends in Electronics, Information & Communication Technology (RTEICT), IEEE International Cnference on. IEEE, (2016).

  14. H. H. Vo and A. Verma, Discriminant color texture descriptors for diabetic retinopathy recognition, Intelligent Computer Communication and Processing (ICCP), 2016 IEEE 12th International Conference on. IEEE, (2016).

Leave a Reply

Your email address will not be published. Required fields are marked *