Diabetes is regarded as a serious illness, and early detection enhances patient treatment and quality of life. This research develops a convolutional neural network for diabetes detection using fundus images from the IDRID image set. The convolutional neural network's performance analysis is applied to cross-validation and comparison with other patterns found in earlier research using techniques including Random Forest, Extra Trees, SVM, and AdaBoost. Our CNN pattern consists of an input layer, three convolutional layers, three pooling layers, two fully connected layers, and an output layer with two neurons. An accuracy of 83.50% was obtained from the evaluation of the convolutional neural network pattern using 103 photos, which is better than the results of earlier research.
Highlights:
Keywords: Convolutional Neural Network, Diabetes Screening, Machine Learning, Deep Learning.
One of the most prevalent and dangerous side effects of diabetes mellitus is diabetic retinopathy (DR), which is also a major contributor to blindness and impaired vision in working-age individuals [1],[ 2]. According to estimates from the International Diabetes Foundation (IDF), 451 million people worldwide had diabetes in 2017; more than one-third of them had diabetic retinopathy (DR) [3], putting them at high risk of blindness or visual impairment. It is anticipated that 693 million people globally would have diabetes by 2045. Furthermore, due to quiet symptoms, nearly half (49.7%) of all diabetics go years without receiving a diagnosis [3]. However, long-term high blood sugar levels ultimately destroy blood vessels and nerves, leading to complications, such as cardiovascular disease and blindness. Detection and treatment of DR in the early stage will prevent its development or progression. Diabetes is critical disease; 537 million people in the world suffer from it and it is responsible for the death of 6.7 million people. Early detection of diabetes allows for improved patient care and treatment, reducing deaths from this disease making early detection of diabetes more important.
Machine learning and deep learning algorithms play an increasingly important role in the early detection of diseases, whether based on textual (medical records) or graphical (imaging test) information from patients. The performance of these algorithms is based on their predictive ability to build a pattern (based on a set of valid data) and evaluate it (using sophisticated statistical techniques) to generate estimates and predictions about new observations about a future environment whose validity can be [4],[5].
This research develops a convolutional neural network for diabetes detection using fundus images from the IDRID image set. The performance analysis of the convolutional neural network applies to cross-validation and is compared with other patterns used in previous studies based on methods the IDRiD image set was used with 413 images for training and 103 images for evaluation.
Related Work
Computer Aided Diagnosis (CAD) systems can be designed using image processing technologies to diagnose various medical diseases. Automated detection of diabetic retinopathy from fundus images is another practical use of image processing, where several fundus image structural characteristics are employed to accurately classify and identify DR in its various stages.
Extensive research has been carried out on methods for a Machine learning and deep learning algorithms play an increasingly important role in the early detection of diseases. In [1],propose a diabetes detection system that begins with the removal of noise from the data, which is subsequently classified using the Support Vector Machine technique, achieving a success rate of 96.71%. The authors in [2] propose a diabetes classification pattern based on an artificial neural network with nine neurons in hidden layers, achieving an accuracy rate of 91.6%.
In [3], a fuzzy hierarchical pattern in the detection of diabetes with success rates of 87.46%. In [4], a diabetes prediction pattern was proposed based on the Gaussian Process (GP) algorithm with a classification performance of 81.97%. In [5], analyzed and compared different machine learning algorithms such as Random Forest, Support Vector Machine, k-nearest neighbors, Classification And Regression Trees, and Linear Discriminant analysis. Their results show that Random Forest generates better performance. The author in [6] developed a pattern based on random forest for the early detection of diabetes and obtained a performance of 82%.
In [8], different patterns were developed to detect diabetes, using the linear support vector machine, radial support vector machine, k nearest neighbors, artificial neural networks and multi-dimensional reduction algorithms, having better results with SVM- linear. Several patterns based on machine learning have been used for diabetes detection [9]; among the most used are Decision Trees (DT), k-Nearest Neighbors (k-NN ), Genetic Algorithms (GA), and Support Vector Machines (SVM) [5]. The aforementioned works use the Pima Indian Diabetes Dataset as a data set, which is data from medical records, and the patterns obtain high performance in correctly detecting diabetes. However, more recently, the literature shows works that use images as a source. of valid data, which highlights the set of fundus images called DIARETDB1 [9].
In [10], tests were conducted with 200 images, on which normalization and feature extraction were applied using statistics, texture analysis and dimensionality transformation. Experiments were then carried out with binary tree, random forest, AdaBoost, support vector machine and a neural network, generating an accuracy of 89.66% with the random forest algorithm as the best performance. In another study[11], convolutional neural network (CNN - Convolutional Neural Network) with 166 high-resolution images from the Kaggle Dataset with five classes, which identify diabetic retinopathy levels. The AlexNet, VGG16, and InceptionNet patterns were evaluated, with the latter having the best performance with 66% accuracy.
The latest studies mentioned in the previous paragraphs demonstrate the study of the iris with the aim of extracting valid information about diabetes in the human body; however, there are limitations in the performance of the patterns. On the other hand, the rapid development of image processing and deep learning algorithms allows the development of solutions that can be used for the early and effective diagnosis of different diseases, as is the case of the development proposed in this work to detect diabetes. through iris fundus images, to obtain effective results with a high accuracy rate.
The methodology used consists of four stages, starting from the acquisition of the images to the evaluation of the pattern. The stages of the methodology are shown in figure 1.
The stages of the methodology used are described below.
1. Image acquisition: It consists of selecting the set of valid images composed of information from patients with diabetes and without diabetes. In addition, you must have a set of images for training and another for validation.
2. Image processing: Various image analysis and processing techniques are performed, such as size reduction, conversion to a 3-dimensional array, and data rescaling. Both for the training images and for the validation images.
3. Pattern training: Training images are applied to machine learning-based patterns such as Random Forest, Extra Trees, SVM, and AdaBoost, in addition to the Convolutional Neural Network pattern on which the performance of each pattern is evaluated to determine the pattern to optimize.
4. Pattern evaluation. With the trained pattern, the validation images are used to make the pattern predictions, entering the images of both patients with and without diabetes into the pattern so that it verifies and correctly classifies each case, for which the accuracy metrics are used for the evaluation of the patterns.
Figure 1. Methodology
Following the proposed methodology, each stage is developed and the results are described below.
Data set
Recent research has provided a better understanding of the requirements in the clinical practice of eye care to identify better ways of identifying retinal diseases. In [9] and [10], a set of fundus images was used, and imaging tests were performed for the detection of diabetes.
The IDRiD dataset [17] contains 516 retinal fundus images, publicly available with a structure categorized into retinal images with signs of diabetes and retinal images without signs of diabetes or normal. As seen in figure 2.
Figure 2. Retinal images with and without signs of diabetes
Images are labeled according to previously diagnosed levels of Diabetic Retinopathy (DR) and degrees of Diabetic Macular Edema (DME). DR levels range from level 0 (without DR) to level 4 (1: with mild DR, 2: with moderate DR, 3: with severe DR and 4: with severe DR). The images have a resolution of 4288x2848 pixels and are in color format, divided into two folders, one for training and the other for validation.
As shown in Table 1, the image set consists of a total of 516 images, of which 413 (80%) are for training and 103 (20%) images are for validation. In addition, 168 images correspond to class 0, without DR (without symptoms of Diabetic Retinopathy), and 348 images correspond to class 1, with DR (with symptoms of Diabetic Retinopathy).
IDRiD Images | Total | Percentage | Classes | |
Without RD | With RD | |||
Training | 413 | 80% | 134 | 279 |
Validation | 103 | 20% | 34 | 69 |
Total | 516 | 168 | 384 |
Data processing
The images are high resolution, so high memory and processor hardware capabilities are required. In addition, the images are in color, so the three dimensions of the colors must be saved. As part of the established processing, the image size is reduced to 150x150 pixels, we convert them into a 3D array, and then separate the features from the labels.
In Figure 3, we visualize five processed training images; each image shows the label of the class it belongs to at the top; and then we display the first image in the 3D array format (150x150x3).
Figure 3. Visualization of processed training images
Pattern training
We evaluated machine and deep learning algorithms that have been used by previous works, whose analysis allowed us to select the Random Forest (RF), Extra Trees (ET), SVM, AdaBoost (AB), and Network Neural Convolution (CNN) methods, on which we performed a performance evaluation considering cross-validation with 10 iterations.
As shown in Table 2, the median accuracy generated by RF is 78.90%, ET is 78.63%, SVM is 73.81%, AB is 76.72%, and CNN is 82.90%. In addition, the estimated standard deviation for each pattern is presented, as well as the minimum and maximum accuracy generated in the iterations.
pattern | median | |||
RF | 78.90 | 5.24 | 87.10 | 67.29 |
ET | 78.63 | 5.96 | 89.48 | 67.29 |
SVM | 73.81 | 5.63 | 84.37 | 62.41 |
AB | 76.72 | 4.97 | 84.71 | 65.67 |
CNN | 82.90 | 2.73 | 88.02 | 74.61 |
The CNN pattern presents the best results compared to the other patterns used, the median precision being considered as a performance indicator, which is why this pattern is considered appropriate for the purposes of the research, and therefore it is optimized to make predictions with new images for the pattern. Figure 4 shows the CNN pattern for diabetes detection.
Figure 4. CNN pattern for diabetes detection
As shown in Figure 4, the developed CNN pattern consists of an input layer, three convolutional layers, three pooling layers, two fully connected layers, and an output layer with two neurons.
The input layer supports an image in the form of a 3D array previously scaled to 150x150 pixels. The convolutional layers have a 3x3 kernel with padding the same and the activation function relu. The pooling layers use the 2x2 max pooling function. The fully connected layers begin by converting the 3-dimensional images to a single one with the flatten layer, then two dense layers with the relu activation function, and finally the output layer with the two classes to predict whether the image that was input corresponds to a patient with symptoms of diabetic retinopathy or not. Figure 5 shows the summary of the CNN pattern after running on its implementation code. The input layer is shown with a rescaling of the data, the convolutional layers, the pooling layers, the flatten layer, and the output layer with its different characteristics and functionalities.
The CNN pattern is fine-tuned; the best accuracy of the pattern is obtained when the smallest difference is achieved between the calculated value and the correct value. Neural networks use the term “backpropagation”, which refers to the process of the algorithm going back and adjusting weights and biases; each cycle of backpropagation and forward propagation correction to reduce the loss is called an epoch. The evaluation is carried out with 120 epochs, and the accuracy obtained from both the training and validation stages is measured for each epoch.
As shown in Figure 6, from epoch 100 there are stable results, and therefore the final pattern is obtained, which is finally saved for making the predictions.
Figure 5. Summary of the CNN pattern implementation
Figure 6. Epochs vs accuracy of the CNN pattern
Evaluations and Discussion
We evaluate the performance of the final pattern with the validation images from the IDRiD dataset. Figure 7 shows an output of the CCN pattern evaluation with ten images. At the top of each image, the real label is placed on the left side and the pattern prediction label is placed on the right side; if the labels match, the pattern correctly classified the input image and turns it blue; If the labels do not match, it means that the pattern has not classified correctly, and they are displayed in red.
Figure 7. Visualization of Diabetes prediction with images
The evaluation of the CNN pattern is carried out with the 103 images of the IDRiD data set, and we use the confusion matrix [19].
True positives and true negatives refer to instances that have been correctly classified by the pattern; the false positives refer to the images that were labeled by the pattern as class “With RD ,” but in reality correspond to the class “Without RD,” and the false negatives refer to the images that were labeled by the pattern in the class “Without RD” but in reality correspond to the class “With RD”.
As shown in Table 3, of the 69 images of the “With RD” class, the pattern correctly classifies 59, achieving 86% True Positives (TP). Furthermore, it is shown that of the 34 images of the “No RD” class, the pattern correctly classifies 27, achieving 79% True Negatives (VN).
Royal Labeling | Classes | Predictive Labeling with CNN | ||
With RD | Without RD | Total | ||
With RD | 59 | 10 | 69 | |
VP | FN | |||
Without RD | 7 | 27 | 34 | |
FP | VN |
With the results of the confusion matrix, we calculate the performance metrics [13], [14], [18]. Accuracy is the metric most used by previous works and allows evaluating the effectiveness of the pattern; sensitivity (recall) is the metric that allows knowing the proportion of positive cases “with DR” that were correctly classified by the pattern, and specificity is the metric that allows evaluating the negative “No DR” cases that are correctly classified by the pattern.
As shown in Table 4, an accuracy of 83.50%, sensitivity of 85.50%, and specificity of 79.41% are obtained, which indicates that the pattern obtains better predictive results with the class “With RD,” that is, the pattern Be more accurate with images that have symptoms of diabetes.
Evaluated Metric | Formula | Result |
Accuracy | Accuracy = (VP+VN) /(VP+VN+FP+FN) | 83.50% |
Sensitivity | recall = (VP)/(VP+FN) | 85.50% |
Specificity | Specificity = (VN)/(VN+FP) | 79.41% |
The IDRiD image set was used with 413 images for training and 103 images for evaluation. The fundus images were processed by converting them to a 3D array and resizing them to 150x150 pixels. Machine learning and deep learning patterns such as Random Forest, Extra Trees, Support Vector Machine, AdaBoost, and a convolutional neural network were evaluated; the latter obtained better performance results. The convolutional neural network that achieved the best results consists of an input layer, three convolutional layers, three pooling layers, two fully connected layers, and an output layer of two neurons to classify the image as an image with diabetes or without diabetes. In the evaluation of the performance of the convolutional neural network in detecting diabetes with fundus images, an accuracy of 83.50% is obtained. The results obtained represent better performance compared to other patterns indicated in previous studies.