Detecting Diabetic Retinopathy in Fundus Images using Combined Enhanced Green and Value Planes (CEGVP) with k-NN

Diabetic Retinopathy (DR) is a disease that causes damage to the blood vessels of the retina, especially in patients having high uncontrolled blood sugar levels, which may lead to complications in the eyes or loss of vision. Thus, early detection of DR is essential to avoid complete blindness. The automatic screenings through computational techniques would eventually help in diagnosing the disease more accurately. The traditional DR detection techniques identify the abnormalities such as microaneurysms, hemorrhages, hard exudates, and soft exudates from the diabetic retinopathy images individually. When these abnormalities occur in combination, it becomes difficult to predict them and the individual detection (traditional 4 class classification) accuracy decreases. Hence, there is a need to have separate combinational classes (16 class classification) that help to classify these abnormalities in a group or one by one. The objective of our work is to develop an automated DR prediction scheme that classifies the abnormalities either individually or in combination in retinal fundus images. The proposed system uses Combined Enhanced Green and Value Planes (CEGVP) for processing the fundus images, Principal Component Analysis (PCA) for feature extraction, and k-nearest neighbor (k-NN) for classification of DR. The suggested technique yields an average accuracy of 97.11 percent using a k-NN classifier. This is the first time that a 16-class classification is initiated that precisely gives the ability and flexibility to map the combinational complexity in a single step. The proposed method can assist ophthalmologists in efficiently detecting the abnormalities and starting the diagnosis on time. Keywords—Combined enhanced green and value plane; diabetic retinopathy; fundus image; image processing; k-NN; principal component analysis


I. INTRODUCTION
Diabetes is an epidemic affecting millions of people worldwide [1]. DR is a chronic retinal disorder that is caused by the long-term impact of diabetes mellitus [2]. It is a disease that is characterized by gradual progressive alterations in the retinal microvasculature. People with diabetes and less controlled blood sugar are likely to suffer from DR. It occurs when high blood sugar levels damage the walls of small blood vessels in the retina [3]. These vessels can swell, leak, or close, stopping blood from passing through them. Frequently, there is an accumulation of fluid in the part of the retina called macular edema [4]. Sometimes, in more advanced cases, the supply of blood to the retina is cut off, which results in the growth of abnormal new blood vessels called neo-vascularization. These new fragile vessels can bleed, creating vision-impairing hemorrhages, scar tissue, and separation of the retina from the back of the eye. In DR, blood vessels leak fluid and blood on the retina. These vessels form features such as microaneurysms, hemorrhages, hard exudates, and soft exudates or cotton-wool spots [5]. The microaneurysms are hypercellular saccular out pouching of the capillary wall. They appear as deep-red dots varying from 25 to 100 µm in diameter and have distinct margins. Retinal microaneurysms are usually the first ophthalmoscopic sign of DR [6]. They are located predominantly within the inner nuclear layer and in the deep retinal capillary network. Microaneurysms are the hallmark of Non-Proliferative Diabetic Retinopathy (NPDR) [7]. Intraretinal hemorrhages are another predominant feature of NPDR. It results from ruptured microaneurysms, capillaries, and venules, and is mostly within the outer plexiform and inner nuclear layers. Retinal hemorrhages are blot-shaped or flamed-shaped. Hard exudates are an ophthalmoscopic feature of background diabetic retinopathy [8]. They result from an increase in vascular permeability and the leakage of fluid and lipoprotein in the surrounding tissue. The hard exudates are fat-filled (lipoidal) histiocytes. They are small white or yellowish-white deposits with sharp margins in the outer layers of the retina, deep in the retinal vessels. Soft exudates or cotton-wool spots are localized infarctions of the nerve fiber layer with secondary coagulative necrosis of the retina [9]. They appear as pale yellow or white lesions with illdefined edges in the superficial retina. The presence of soft exudates is the symbol for the onset of progressive change in DR. A cotton-wool spot can occur singly or in conjunction with hemorrhages and microaneurysms and represent retinal microvasculopathy.
The retinal appearance of diabetes mellitus is broadly classified as Non-Proliferative Diabetic Retinopathy (NPDR) or Proliferative Diabetic Retinopathy (PDR). NPDR occurs when there are only intraretinal microvascular changes, such as altered retinal vascular permeability and eventual retinal vessel closure [10]. In advanced NPDR, non-perfusion of the retina may develop and lead to the proliferative phase. The PDR is characterized by the formation of new vessels.
Contrast Limited Adaptive Histogram Equalization (CLAHE) is the process that reduces the noise amplification and it is the type of adaptive histogram equalization [11]. It operates on small regions of the image and works with neighboring tiles to avoid noise enhancement. Top hat filter is 260 | P a g e www.ijacsa.thesai.org a morphological filtering operation that works on grayscale images [12]. This filter relies on the structuring element size and, when fine tuned, it can increase the visibility of the features like red-colored veins in a fundus image. Tunable top hat filters are used for DR detection and when combined with CEGVP, it improves the accuracy of the proposed system.
Although some work has been done in the past, none of the methods have shown combinational identification of the abnormalities that are present in the retinal fundus image. It is quite desirable to have a combinational class because individual detection of these abnormalities may lead to false detection during segmentation, affecting the performance of the system. Hence, a separate class was required for predicting the combined abnormalities, as most of them occur in combination. The major contribution of the proposed method is 16 class classification using CEGVP, which is further passed through machine learning algorithms to diagnose DR. The CEGVP output was further improved using CLAHE and top hat and bottom hat approach. The features were then extracted using PCA and a 16 class classification of the abnormalities was carried out using a k-NN classifier.
The following sections of the paper are organized as follows: Section II presents an explicit literature review, Section III describes the methodology, Section IV highlights the results and discussions. Finally, Section V concludes the study.

II. LITERATURE REVIEW
The researchers have investigated and developed several algorithms for detection of DR. A new technique was developed by Lachure et al. [13] for diagnosing PDR and NPDR. Their work consisted of detecting the abnormalities such as microaneurysms using morphological opening operations and exudates using morphological closing operations. The splat and Gray Level Co-occurrence Matrix (GLCM) features such as entropy, contrast, homogeneity, and energy were extracted and the image was further classified into PDR and NPDR using machine learning classifiers. The performance of SVM was better than compared to k-NN classifier. Safitri et al. [14] have proposed a new method for classifying the DR into three grades. Their work comprised segmentation of green channel image, applying morphological and masking operations, and computing the values of fractal dimensions using the box-counting method. These values were analyzed and classification of DR was performed using the k-NN classifier. The proposed method provided the best accuracy of 89.17% for K=3 and K=4. Labhade and his team [15] had presented an automated method for the detection of DR. Their work included preprocessing, feature extraction, and classification using machine learning algorithms. The preprocessing comprised grayscale conversion and histogram equalization for enhancing the contrast of grayscale fundus images. Textural features were extracted using GLCM by considering 3 angles of 0, 45, 90 degree, and 2 distances. The statistical moments were computed and the retinopathy grade between 0-3 was assigned for each of the fundus images. The SVM classifier provided better accuracy of 88% as compared with other classifiers. Kushol and his group [16] had presented a new blood vessel enhancement technique that separates the blood vessels from the background image. The top-hat and bottom-hat transformations with optimal structuring elements were used to enhance the image. The proposed method yielded an average accuracy of 0.9379 and 0.9504 on DRIVE and STARE datasets, respectively. Kaur et al. [17] had proposed a reliable method of exudate segmentation using dynamic decision thresholding in the diagnosis of DR. Their work includes enhancement of retinal image, segmentation, and elimination of anatomical structures such as optic disc and blood vessels, and segmentation of exudates using adaptive image quantization and dynamic decision thresholding process. The proposed method resulted in a mean sensitivity, specificity and accuracy of 94.62%, 98.64%, 96.74%, respectively, at image based evaluation. Marin and the team [18] had presented a feature-based supervised classification technique for detecting Diabetic Macular Edema (DME) in fundus images. Their work comprised detecting the exudates by using digital image processing algorithms. Edge strengthbased features and the features based on responses from the Gaussian and Difference of Gaussian (DoG) filter bank were computed. The final detection of exudate was obtained by considering only the regions whose probability exceeded a certain threshold value and the severity was graded using supervised classification techniques. The k-NN and SVM classifier resulted in an accuracy of 0.955 and 0.97422 for diagnosing the retinopathy disease. Issac and his team [19] have developed a method for detecting red and bright pathologies for diagnosing DR. A normalization process followed by anisotropic diffusion was used for segmenting bright lesions. A shade-corrected green channel image along with morphological flood filling and regional minima operations were used for detecting the red lesions. A quantitative analysis was performed to grade the severity of the disease. The proposed method using SVM based classifier obtained an average accuracy of 92.13% with a sensitivity of 92.85% and specificity of 80% on the DIARETDB1 dataset. A novel method was presented by Chetoui and his group [20] that comprised texture features, namely Local Ternary Pattern (LTP) and Local Energy-based Shape Histogram (LESH) for diagnosing DR. The histogram was computed using the extracted features and the performance of the system was evaluated for various kernels of SVM classifier. It was observed that LESH outperformed best in terms of accuracy and ROC characteristics. The accuracy of 0.904 and ROC of 0.931 was obtained using the SVM Radial Basis Function kernel. Amin and his team [21] had developed an automated method for the detection and classification of DR using hybrid features. Their work included lesion enhancement using the local contrast method, optic disc elimination, and lesion segmentation. The geometrical and statistical features were extracted for each candidate lesion. Abnormal and normal images were differentiated using multiple classifiers. The proposed method validated on the DIARETDB1 dataset resulted in an accuracy of 92.3% using k-NN and SVM classifier. Sahu et al. [22] have proposed denoising of fundus images using CLAHE. They could achieve an improvement of 7.85%, 1.19%, 0.12%, and 1.28%, in Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index (SSIM), Correlation coefficient (CoC), and Edge preservation index (EPI), respectively, over the existing methods. Huda et al. [23] proposed an automated approach for diagnosing DR. Their study contained normalization, data standardization, and feature extraction from the retinal samples. The feature importance property was used to select the important features from each sample. The scores of each feature were generated and a higher score feature was selected. Their method resulted in six class classifications of the disease and their performance was evaluated using different classifiers. The proposed method with a logistic regression model achieved a precision of 97% and recall of 92%. Reddy et al. [24] have introduced an ensemble-based machine learning model for detecting DR. The grid search parameter tuning optimization method was used for choosing the optimal hyper parameters and the voting mechanism was used to make predictions for each classifier model. It was concluded that the ensemble machine learning model outperforms the individual machine learning algorithms. A study conducted by Alabdulwahhab and his team [25] had introduced a novel method for detecting DR. Their work comprised identifying the most discriminative interpretable features using socio-demographic and clinical information. The factors such as HbA1c, duration of diabetes, body mass index, systolic blood pressure, and the use of medication were used to discriminate the DR patients. Thus, a combination of ophthalmology and ML was integrated for diagnosing the disease pattern. The random forest classifier outperformed best by accurately classifying 86% of the DR patients. The author Sharma and his team [26] have developed an automated system for detecting DR using a combination of image processing and machine learning. Their work included pre-processing techniques such as gray scale conversion, canny edge detection and morphological operations to obtain a clear fundus image. The statistical features were extracted from the images and the performance of the system was evaluated using various classifiers. The weighted k-NN provided an accuracy of 85.8%, SVM with 87.2% and decision tree with 88.6%.
The literature review has highlighted the implementation of several machine learning algorithms applied independently on retinopathy datasets for detection of DR. As reviewed, there was a maximum of 6 class classification performed for diagnosing DR. Each of these techniques contributed to an individual detection of the abnormalities in the fundus images because of which the performance of the system was affected. The authors could achieve a maximum accuracy of 95.55%. The sensitivity computed for most of the methods was between 90% to 93%. AUC of 1 was obtained for very few methods. None of the techniques could identify the combination of the abnormalities as most of the time these abnormalities occur in combination in the retinal fundus images. Hence, a 16 class classification comprising a unique combination of CEGVP and dimensionality reduction approach using PCA is proposed that accurately classifies the four abnormalities either individually or in a group for diagnosing DR.

III. METHODOLOGY
The proposed method consists of classifying four types of abnormalities, such as hard exudates, soft exudates, microaneurysms and hemorrhages, either individually or in combination from a fundus image using CEGVP and k-NN classifier. Fig. 1 shows the conceptual diagram of the proposed system. A fundus camera captures the images of an eye, which is then processed using CEGVP. The features are extracted and fed into the k-NN classification algorithm, which classifies each image into one of the 16 categories. All 16 categories represent various abnormalities that may or may not be present in a fundus image. The diagnosis can be made based on the category into which the k-NN algorithm classifies the given test image.
The suggested technique combines four steps: preprocessing, segmentation, feature extraction, and classification. The input image is converted to grayscale. This grayscale image is used for a mass generation and binarization. The green color plane is enhanced by stretching the histogram and applying the mask. CLAHE is used to extract blood vessels from images using the Lab color space and exudates are extracted using top hat filtering. After enhancement, the combined green and value plane is passed through a Canny edge detector and subjected to morphological operations for object detection after binarization. Finally, the binary objects are combined, and the principal component is extracted as a feature for the k-NN algorithm. Fig. 2 shows the overall process of the proposed work.
The first step of processing comprises reading the original colored image (Fig. 3(a)) from the database and converting it into grayscale (Fig. 3(b)). The height and width of the input image was compared and the larger dimension was set to 640 and the other dimension was scaled, such that the aspect ratio of the image was maintained (Fig. 3(c)). A binary image (Fig. 3(d)) was generated from the grayscale image by using a threshold of 0.05 on the scale between 0 and 1. The resized original input image (colored) was again converted into a grayscale image. Each pixel of the new grayscale image was checked. If the value of a pixel was less than 10, then that pixel value was set to 0. Otherwise, if the value of a pixel was greater than 10, then that pixel value was set to 255, achieving the mask for the fundus (similar to Fig. 3(d) but with the dimension of 640 pixels on the larger dimension).   Red and green color planes were extracted from the original input image with green color plane as shown in (Fig. 3(e)). A structuring element was defined that had a size of 350 pixels and a shape of a disk. Morphological opening operation was performed on the green color plane. For the morphological operation of opening previously defined structural element was used on the green color plane. The output of the opening operation was then subtracted from the original green color plane. A maximum pixel value of this subtracted image was found out. The mask image was then used for masking the outer region with white color (pixel value of 255) as seen in (Fig. 3(f)). A copy of this processed image was made for further processing. All the dark pixels in the green channel were preserved whereas all the lighter pixels with a value greater than 50 were whitewashed. The copy image of the green channel was then contrast stretched between 0 and 255 ( Fig. 3(f)).
The original image was used yet another time to extract the red, green, and blue color planes. A mask was applied to the green color plane and the same color plane was contrast enhanced for maximum value (255). A secondary mask was created with the help of the green channel having the threshold of 60 on a scale of 0 to 255. All the pixel values below 60 were made 0, and 255 otherwise. A blue color mask was used, similar to green color with a threshold of 130. A similar operation was performed on the blue color plane. The color pane of the original image was changed to HSV from RGB and further hue, saturation, and value planes were separated. The value plane was then masked, and contrast-enhanced between 0 to 255 ( Fig. 4(a)). Similar operations were performed on saturation and hue color planes. The hue color plane was enhanced 18 times. The combinational color plane was generated using the enhanced green plane and the value color plane (Fig. 4(b)). Further, all the max values were replaced with mean values to ensure that contrast enhancement can be done properly. Because of this operation, all the regions of the mask were neglected. The combinational plane was then contrast enhanced (Fig. 4(c)) and the entire image was rescaled to a smaller matrix of 3X3 to extract a single-valued function available at the center of these 3X3 images (Fig. 4(d)).  The combination image of the green color plane and value color plane was masked using the mask image and further enhanced with the saturation values at the bottom and top 1% amongst all pixel values. The image was rescaled to 3X3 and the entire process was repeated. Finally, a Canny edge detector was applied to this enhanced combinational color plane (green & value plane) with a factor of 0.1 (Fig. 4(e)). Simultaneously, adaptive binarization was applied to the enhanced combinational color plane (green & value plane). All pixels in the output of the binarization process that had a value of less than 200 were removed. A structuring element of disk shape with size 15 pixels was used to call a morphological opening operation on the enhanced combinational color plane. Further, the background was then removed using the image which was operated using the opening operation. The overall contrast was then enhanced and all the objects touching the border were removed. A 4pixel neighboring connectivity was checked for connected components and areas of all the objects segmented from this neighboring pixel connectivity were used to find the maximum area. All the segregated objects were then binarized and the entire image was resized to 512 X 512 pixels. This resizing ensured that machine-to-machine variability is not affecting the classification results. The original input image was then passed through the color channel separator to segregate the green color channel component. A structuring element with a disk shape of 5 pixels was then used on the green channel to achieve bottom hat filtering (Fig. 4(f)).
The same green channel image was also simultaneously passed through a top-hat filter (Fig. 5(a)) but with a structuring element of disk shape having a size of 8 pixels. Finally, a bottom hat filtered image was subtracted from the top-hat filtered image, and binarization with a threshold of 0.1 was carried to extract the hard exudates ( Fig. 5(b)). The original image was resized to 584 X 656 pixels and converted into a Lab color space to extract the principal components from the converted image using PCA. The entire image was then normalized and contrast enhanced using CLAHE (Fig. 5(c)). An averaging filter of 9 X 9 pixels was used to exclude the background. Thresholding was performed on the background removed image and then the entire image was converted to binary with a level of 0.08% lower than the automated thresholding level to extract the blood vessels as shown in (Fig. 5(d)). Small objects less than 100 pixels were removed and then the image was inverted. Finally, the entire image is resized to 512X512 to merge with the earlier results. All the three outputs detecting microaneurysm, hemorrhages, and exudates in their binary form were added and scaled by a scalar of 85 to produce a final grayscale output (Fig. 5(e)) which can then be given to the feature extraction algorithm. The final image was then passed to extract the first 64 components. Finally, a class is assigned to these 64 extracted components based on the supervisory dataset DIARETDB0 [27], DIARETDB1 [28], and Indian Diabetic Retinopathy Image Dataset (IDRid) [29]. The novelty of the proposed methods lies in the combination of the green sub-color plane from RGB planes and the value sub-color plane from the HSV color planes (CEGVP) to enhance the overall features. This is the first time a unique combination of combined color planes and 16 class classification has been performed for predicting the abnormalities in the fundus image for detection of DR. This work presents the combination of image processing techniques for enhanced feature extraction and classical machine learning approach, such as k-NN for classification. The performance of the proposed method was tested using three publicly available databases. In all 300 images with DIARETDB0 (130 images), DIARETDB1 (89 images), and IDRid (81 images) were used respectively.

IV. RESULT AND DISCUSSION
A 5-fold cross validation was used for the analysis and experimentation purposes. The ratio in which the images were split was chosen to be 70% for training and 30% for testing. To verify the performance of the designed system, 450 images were chosen randomly from the test dataset.

A. Result Analysis 1) Performance measures:
The performance measures such as accuracy, sensitivity, specificity and area under the curve (AUC) were used to evaluate the performance of the proposed method. Table I and Fig. 6 shows the performance metrics of various classifiers for PCA feature vector 8x8 using 16 class classification. It was observed from the graph that the highest accuracy of 97.11% and sensitivity of 98.47% was obtained for k-NN classifier. SVM achieved the best specificity of 97.43% as compared to other classifiers. The decision tree classifier performed very low in terms of all the performance measures. The AUC for all classifiers was found to be 1. Thus, it was seen that k-NN was the most optimal classifier for the proposed system.
To increase the ability of the system, bag-of-word concept was used that provided more images for training and testing purpose. Fig. 7(a) shows the confusion matrix for 16 class classification using k-NN. The three classes 4, 9, and 14 were not found in the confusion matrix, as there were no images for training and testing for these classes in the datasets. The worst accuracy was found for class 5, where all the images were mapped to class 7. Other than classes 11, and 15, all the classifications were 100% accurate. Whereas for class 15 and 11, the number of images were more, which resulted in a fraction of misclassification, which is roughly 4.6%. There were maximum of 148 images of class 15, followed by 124 images of class 11 and 55 images of class 2. Fig. 7(b) shows the scatter plot after PCA features were extracted for the 16 classes and the top 2 features were plotted. It can be visually seen that no straight line can separate various classes from each other, and hence k-NN was the preferred method over the traditional SVM.
The Receiver Operating Characteristic (ROC) curve with the false positive and true positive rates is as shown in Fig. 7(c).
2) PCA feature vector of optimal sizes vs accuracy: To select the most optimal method of classification and the optimum size of the PCA feature vector, a separate study was carried out as shown in Table II and its output was summarized in the graph shown in Fig. 8.   It was observed that all the algorithms do get affected if the feature vector size was varied. Since k-NN had the least variation, it was considered being less dependent on the size of the feature vector. The decision tree was highly dependent on the feature vector size. It has a bimodal distribution of accuracy making it difficult to recognize the correct PCA feature vector size.
The 8X8 PCA feature vector size was discovered to be the optimum vector size for k-NN and 3x3 for SVM, as highest accuracy was obtained by both the classifiers for these vector sizes. SVM performed badly with less than 40% accuracy at PCA feature vector size 1 X 1. The decision tree, for all conceivable feature vector sizes always had approximately 10% less accuracy as compared to k-NN. As a result, 8X8 PCA feature vector was found to be the most suitable vector size for KNN classifier. Table III shows the comparative analysis of the proposed work with the existing approaches, as reviewed in the literature. The proposed method achieved the highest accuracy compared to all the similar methods that use k-NN or SVM classifiers. Marin et al. [18] have achieved a similar accuracy, but their sensitivity and specificity were poor. The sensitivity obtained using k-NN classifier was highest using the proposed technique. Lachure et al. [13] could achieve 100% specificity, but they have considered only three classes and overall accuracy was 90%. AUC for the proposed method was comparable to the others as reported in the literature, whereas the number of classes that are segregated in our work is at least 2.5 times than every method ever reported. The overall performance of k-NN is better as compared to SVM and hence we proposed KNN classifier for abnormality detection in fundus images. Some other methods perform better in terms of accuracy, but they are neither working on 16 class classification nor using KNN and SVM classifiers hence, they were excluded from the comparison table. The early diagnosis of DR is a critical step in avoiding total blindness. The goal of our proposed method is to create an automated DR prediction system using Combined Enhanced Green and Value Planes (CEGVP) with k-nearest neighbor (k-NN) classifier in retinal fundus images to classify illnesses either individually or in combination. This was the first time that a 16 class classification was proposed that precisely gives the ability and flexibility to map the combinational complexity in a single step. The proposed work removes the requirement of four different binary classifiers for each abnormality detection and thus saves a lot of computational time, as well as error propagation from each method is also avoided. Our novel technique of 16 class classification using k-NN classifier achieved an accuracy of 97.11%, sensitivity of 98.47%, and specificity of 91.64% on DIARETDB0, DIARETDB1 & IDRid datasets. This new technique can help ophthalmologists discover problems more quickly and begin their diagnosis sooner. Future work includes improving the accuracy of the proposed system by using different machine learning classifiers. Besides RGB and HSV color planes techniques, other color planes can be explored and the useful plane can be merged to extract better features for DR detection.