All submissions of the EM system will be redirected to Online Manuscript Submission System. Authors are requested to submit articles directly to Online Manuscript Submission System of respective journal.

Approach of Deep Learning to detect Diabetes using Retinal Images

Muhammad Muzammil*

Department of Data Science, Riphah Istitute of Science and Technology, Islamabad, Pakistan

*Corresponding Author:
Department of DataScience,
Riphah Istitute of Scienceand Technology,

Received: 19-Jan-2023, Manuscript No. GRCS-23-87460; Editor assigned: 23-Jan-2023, Pre QC No. GRCS-23-87460 (PQ); Reviewed: 07-Feb-2023, QC No. GRCS-23-87460; Revised: 14-Feb-2023, Manuscript No. GRCS-23-87460 (R); Published: 21-Feb-2023, DOI: 10.4172/2229-371X.14.4.010

Citation: Muzammil M. Approach of Deep Learning to detect Diabetes using Retinal Images. J Glob Res Comput Sci. 2023;14:010.

Copyright: © 2023 Muzammil M. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution and reproduction in any medium, provided the original author and source are credited.

Visit for more related articles at Journal of Global Research in Computer Sciences


Diabetes can cause diabetic retinopathy, which effect the retinal blood vessels and affects the eyes. It does not initially manifest symptoms or causes sporadic visual issues. When it becomes bad enough, it affects both eyes and eventually impairs vision completely or partially. Mostly happens when the blood sugar level is out of control. As a result, the chance of contracting this illness is always high for someone with diabetes mellitus. The risk of total and permanent blindness can be avoided with early diagnosis. Consequently, a reliable screening mechanism is needed. The densely connected convolutional network dense net is used in the current work to examine a deep learning approach for the early diagnosis of diabetic retinopathy. According to the severity levels, the fundus pictures are categorized as No DR, mild, moderate, severe, and proliferative DR. Diabetic retinopathy detection 2016 and aptos 2020 blindness detection, both collected from Kaggle, are the datasets that are considered. The phases included in the proposed technique are data collection, preprocessing, augmentation, and modelling. 92% accuracy was reached by our suggested model. The regression model, which was also used, had a 75% accuracy rate. The primary goal of this effort is to create a reliable method for automatically detecting DR.s.


Deep learning; Diabetic Retinopathy; Diabetes; Regression model; Blindness


One of the most prevalent diseases, diabetes is becoming more prevalent all over the world. It is largely linked to the body's excessive blood sugar levels and insulin production, which leads to abnormal metabolic processes and problems include cardiovascular illnesses, renal failures, neurological disorders, and diabetic retinopathy (vision loss), among others. A serious eye illness called diabetic retinopathy causes permanent vision loss that cannot be prevented or treated. No matter if a person has type 1 or type 2 diabetes, the likelihood of developing the condition rises with age. People who have a lengthy history of diabetes are more likely to get afflicted with it. WHO claims that DR is a severe eye condition that need immediate consideration on a global scale. According to a research, India has 65 million diabetics with eye disorders, but only 10,000 ophthalmologists to treat them. The fact that most people are unaware that they have this condition is the primary cause of the alarmingly high number of sufferers. Additionally, they exhibit insensitivity and a careless attitude toward this illness. A diabetic individual is 20 times more likely to get DR than a healthy person, and about 18% of those with diabetes have the condition. Due to the fact that this condition is asymptomatic or manifests extremely modest symptoms, leaving a person in ignorance and eventually leading to vision impairment, it is challenging to diagnose this disorder at an early stage [1].

Therefore, it is crucial to identify DR early on in order to avoid the complications of this illness. The diagnosis of this sickness necessitates the expertise of professionals and specialists with cutting edge tools and methods that improve the prognosis for this ailment. Figure 1 respectively depict the picture of a normal retina and a retina with diabetic retinopathy. Since a precise automatic detection method is needed to categorise and consider the DR severity level. The majority of DR research was conducted using machine learning algorithms for feature extraction, however difficulties with manual feature extraction led researchers to turn to deep learning [2].


Figure 1: The picture of a normal retina and a retina with diabetic retinopathy.

Many computer aided technologies, such as data mining, image processing, machine learning, and deep learning, were made possible by ongoing research in the medical areas. Deep learning, however, has been more popular recently in a variety of domains, including sentiment analysis, handwriting identification, stock market prediction, and picture analysis for medical purposes, among others. When it comes to the task of picture categorization, CNN in deep learning frequently offers beneficial outcomes. Figure 2 depicts the structure of CNN with its several layers. The fundus (eye) picture categorization used in this study uses deep learning technology, particularly the CNN version DenseNet, which automatically extracts features rather than doing it manually. For this investigation, the Kaggle data sets "diabetic retinopathy detection" from 2015 and "aptos 2019 blindness detection" were combined [3-8].


Figure 2: Stages of diabetic retinopathy.

Diabetic retinopathy

Diabetes is the root cause of diabetic retinopathy, a disease that damages the retina of the eye. Small blood vessels in the retina may swell and get damaged in the early stages of the illness. Microaneurysms, which are tiny, red or yellow patches on the retina, may develop as a result of this. Intraretinal hemorrhages, or retinal bleeding, can occur when the wall of a microaneurysm bursts. Other symptoms of Non-Proliferative Diabetic Retinopathy (NPDR) include anomalies in the retina's tiny blood vessels and the formation of fatty deposits called exudates. These anomalies might include constricted blood arteries and convoluted, swollen vessels. The form of bigger blood arteries, like venous beading and loops, can also change as a result of NPDR. When new blood vessels start to sprout in the retina, the condition can proceed to a more severe type called Proliferative Diabetic Retinopathy (PDR). This is a reaction to the retina's inadequate blood flow, which is brought on by the tiny blood vessels destruction. Neovascularization, or the development of new blood vessels in the retina, is a feature of PDR. Diabetes can cause Diabetic Macular Edoema (DME) at any stage of diabetic retinopathy. The core area of the retina known as the macula, which is crucial for crisp, clear vision, is impacted by DME, a major consequence of diabetes. The macula accumulating fluid or exudates, the macula's retina thickening, or the appearance of microaneurysms or hemorrhages are all signs of DME. The severity of diabetic retinopathy can be graded using a variety of techniques. The Early Treatment Diabetic Retinopathy Study (ETDRS) grading system is the one that is most frequently employed. It might be challenging to apply this technique in routine clinical practice, though. Many other scales that attempt to streamline the grading procedure and enhance communication amongst healthcare professionals have been presented as solutions to this problem [9].

Although several multiple measures have been developed, there is still no international consensus on how to grade diabetic retinopathy. The International Clinical Diabetic Retinopathy disease severity scale (ICDR) has been proposed by the global diabetic retinopathy project group as a universally accepted system for grading diabetic retinopathy. The ICDR scale offers a severity rating based on the most severe finding and considers the existence and severity of microaneurysms, hemorrhage’s, exudates, and neovascularization. The ICDR scale aims to establish a straightforward and user-friendly system for grading diabetic retinopathy that can enhance collaboration among medical specialists and speedup research into the condition [10].

Materials and Methdos

Related works

One of the serious issues that have the world's attention right now is diabetic retinopathy. Receiving attention from a variety of researchers to identify the best methods for this disease's early identification, which will afterwards avoid premature changes in vision. In this area, several researches have been done and are continuously being done with the goal of making life easier for both patients and clinicians. This section offers a summary of several studies on diabetic retinopathy. For the objective of detecting diabetic retinopathy, J Calleja, et al., employed a two stage strategy that included LBP (Local Binary Patterns) for feature extraction and machine learning, more especially SVM and random forest, for classification. With an accuracy of 97.46%, the random forest outperformed the SVM in terms of outcomes. Nevertheless, with just 71 photos, the dataset employed in this study was rather tiny [11].

A variety of computer based approaches were used in earlier research to identify DR utilizing manual feature extraction. U Acharya, et al., employed SVM with an accuracy of more than 80% to identify characteristics such blood vessels, microaneurysms, exudates, and hemorrhage’s from 331 fundus pictures. In their published work, K Anant, et al., exploited texture and wavelet characteristics for DR detection using data mining and image processing on the DIARETDB1 database, and they reached 95.95% accuracy. By identifying exudates from fundus pictures, M Gandhi, et al., suggested a technique for automated DR detection with SVM classifier. Some studies attempt to combine manual and deep learning feature extraction for DR. one of such work include J Orlando, et al., where CNN with hand crafted feature are used for feature extraction for detecting red lesion in the retina of an eye.

S Preetha, et al., used data mining and machine learning techniques in their research to forecast several diabetic related ailments, notably heart disease and skin cancer, while taking both benefits and drawbacks into account.
While there have been several studies or works on the use of data mining or machine learning technologies, a very different methodology has also been developed for the diagnosis of diabetic retinopathy. The quantative technique is used by S Sadda, et al., to find new parameters for identifying proliferative diabetic retinopathy. It is predicated on the idea that the location, quantity, and size of lesions might help foretell retinal degeneration. Subjects and imaging data, ultra wide field image lesion segmentation, quantitative lesion parameters, and statistical analysis were the approaches employed in this study. Lesion number, lesion surface area, lesion distance from the centre of the ONH, and regression analysis were used to compare the lesions [12].

The work by J Amin, et al., provides a review of various methodologies for detecting haemorrhages, micro aneurysms, exudates, and blood vessels in diabetic retinopathy. It also analyses the various experimental results obtained from these methodologies in order to provide a detailed understanding of ongoing research. The work conducted by Y Kumaran and C Patil focuses on several preprocessing and segmentation approaches and provides a detailed strategy for detecting diabetic retinopathy in human eyes using a variety of systems and classifiers. A diagnostic approach for DR is proposed by M Chetoui, et al., utilizing machine learning, more especially SVM and texture characteristics. LTP (Local Ternary Pattern) and LESH (Local Energy based Shape Histogram) were employed as texture characteristics, and they produced superior results to Local Binary Pattern (LBP). LESH combined with SVM produced an accuracy of 92.4%.

Proposed methodology

Building a reliable and noise compatible method for detecting diabetic retinopathy is the major goal of this effort. In order to identify diabetic retinopathy depending on severity (No DR, mild, moderate, severe, and proliferative DR), this work uses deep learning technology. Before the photos were sent to the network, many procedures were completed. In this study, two models our suggested model and the regression model were trained, and the accuracy results from the two models were compared [13]. Nevertheless, our suggested model outperformed the regression model. The suggested technique is depicted underneath (Figure 3).


Figure 3: The accuracy results from the two models.

Data source

The data utilized in this study came from Kaggle’s APTOS 2019 blindness detection and diabetic retinopathy detection 2015. Both datasets include tens of thousands of retinal pictures taken under various circumstances. Two pictures of each subject's left and right eyes are shown. Due to the fact that the photographs originate from many sources, including various cameras and model types. It appears to have a lot of noise attached to it that must be eliminated, necessitating several preprocessing procedures [14]. On a scale of 0 to 4, the diabetic retinopathy linked to each picture has been graded as follows Figure 4.

•0-No DR




•4-Proliferative DR


Figure 4: The diabetic retinopathy linked to each picture.

Data processing

Preprocessing is necessary in order to retrieve the photos in the standard format since the photographs in the dataset contain a lot of noise, such as images that may be out of focus, have excessive exposure, additional illumination, or have a black backdrop. The following activities take place during the preprocessing stage (Figure 5) [15].

•The black backdrop surrounding the fundus picture is eliminated since it serves no use and does not offer anyinformation to the image.

•Due to the fundus image's rounded form, even after the black border was removed, some black cornersremained. In this stage, the image's black corners are eliminated.

•256*256 (width*height) is the new picture size.

•By setting the kernel size to 256/6, the pictures are blurred with a Gaussian filter. This technique aids ineliminating Gaussian noise.


Figure 5: The pictures are blurred with a gaussian filter.

Data augmentation

When we analyse the data, we find that the diabetic retinopathy severity picture classes are significantly imbalanced, which led to a propensity for data augmentation. In order to balance the data across the classes of diabetic retinopathy severity, data augmentation is framed by aligning one class to the class with the majority of samples [16]. 6500 photos were acquired in each class after the dataset was augmented by mirroring and rotating photographs (Figure 6).


Figure 6: The augmented by mirroring and rotating photographs.


For training purposes, we employed a DenseNet (densely connected convolutional neural network) and regression model. Weights are fed into the network without the top or final layer in DenseNet-169. The last layer is originally absent while modelling the network. Using global average pooling 2D, a dropout layer set at 0.6, and an output with five nodes for each class, we create this layer. While global average pooling 2D operates similarly to 2D average pooling, it counts the whole input block size as the pool size. Over fitting is addressed with a dropout layer. The weights used to train this model are optimised using the Adam method [17]. Convolutional, dropout, dense, optimizer, and other customised layers are added using a sequential modelling technique (Figure 7).


Figure 7: DenseNet-169 model with three dense blocks.

•In order to process the fundus pictures and generate a dot product, it makes use of many kernels or filters. Inthis layer, each kernel or filter produces a different set of visual properties.

•By lowering the spatial dimension, it offers an abstract representation of convolved characteristics. Althoughit takes the max or min region depending on the kind of pooling from kernel overlapped input, it is relativelycomparable to the convolution layer.

•In order to reduce over fitting, neural networks have been controlled using the dropout method.

•In a 1-dimensional series, flattening changes the data so it moves to the following layer.

A regression model was also employed to stabilise the data, and it had a 75% accuracy rate.


Python was used for the implementation, and a broad range of libraries were used to analyse pictures and familiarize ourselves with the process of building convolutional neural networks like DenseNet-169. OpenCV was the kind of library used for image management (such as rotation and scaling) and preprocessing. NumPy, however, carried out the mathematical operations necessary for the implementation. For effective deep learning model maintenance and model definition, TensorFlow and Scikit learn were also employed. The model's implementation uses a GPU enabled device for simpler and quicker processing [18].

Results and Discussion

We combined the datasets from the Kaggle competitions diabetic retinopathy detection 2016 and APTOS 2020 blindness detection to train our suggested model using DenseNet-169. Preprocessing was required since the photos given by the dataset had a lot of noise associated with them. In order to concentrate more on the fundus picture alone during preprocessing, the black border and corners of the photographs were first eliminated. The images were then downsized to a standard format of 256*256 of width and height. Finally, the photos were blurred with a Gaussian function to get rid of the Gaussian noise. After preprocessing, we find that the data is significantly out of balance between the severity classes, with the majority of the data falling within class '0,' or no DR. We employed data augmentation, which gave us 6500 photos from each severity class and balanced the data, to overcome this problem. Data was eventually given to the DenseNet-169 for model training after preprocessing and picture enhancement. After assessing our model, we found that the training accuracy was 0.933 and the validation accuracy was 0.9234. Additionally, we determined the Cohen Kappa score, which was 0.814. We also used a regression model to analyze our data, and the accuracy of its validation was 0.689 [19, 20].

Proposed Model-2023


The suggested model obtains an accuracy of 92%, which is higher than SVM's accuracy of 86.6%, decision tree's accuracy of 84.1%, regression's accuracy of 75%, and KNN's accuracy of 56.17%.


Traditional methods for DR detection are time consuming, difficult, and expensive; as a result, several studies have been done to automate the detection process utilising machine learning and deep learning techniques. We sought to propose our own deep learning strategy for the early identification of retinopathy using a DenseNet169 in this work after presenting a thorough analysis of existing approaches for automatically detecting diabetic retinopathy (which is a new CNN architecture, having many deep layers). For this investigation, the datasets "diabetic retinopathy detection 2015" and "APTOS 2019 blindness detection" from Kaggle were combined. To standardise the data in the required format and eliminate the undesired noise, extensive preprocessing and augmentation was performed. In addition to the DenseNet-169 classifier, we also utilised a regression model to compare the outcomes. Moreover, the suggested system was contrasted with machine learning classifiers including SVM, DT, and KNN. The suggested model, which also divides the photos into a greater number of classes, achieved the greatest accuracy out of all. While the regression model only produced an accuracy of 75%, our suggested model outperformed it by getting an accuracy of 92%.

Limitation and Future Scope

As there are many photographs that need to be preprocessed and enhanced because they were shot under various conditions, certain characteristics of the images may be lost. As a result, strategies should be utilised that can successfully preprocess the images while also preserving all of the little, crucial details. Additionally, more than two photographs should be supplied for each patient. This will enhance the likelihood that the images will be accurately classified because more information can be acquired. With the development of new neural networks via improved pooling techniques, the potential of adjusting hyper parameters keeps expanding. These techniques can be taken into account for next research to explore the potential for improving performance in this area. Additionally, employing several networks for the ensemble process of model training might improve outcomes. Since each model has unique performance benefits, combining them can increase a system's total productivity rather than just the productivity of each individual model. In this analysis, we employed two datasets; however, increasing the number of datasets or combining other datasets may enhance generalizability. Mobile net, a convolutional neural network for creating mobile apps, can be used for the deployment of such systems. As a tool for diagnosing diabetic retinopathy, online apps that can run on Windows, Linux, and Android operating systems can be created.