# Comparative Analysis of Machine Learning Algorithms for Categorizing Eye Diseases

Premaladha Jayaraman, R. Krishankumar, K. S. Ravichandran,
Ramakrishnan Sundaram, Samarjit Kar

► To cite this version:

Premaladha Jayaraman, R. Krishankumar, K. S. Ravichandran, Ramakrishnan Sundaram, Samarjit Kar. Comparative Analysis of Machine Learning Algorithms for Categorizing Eye Diseases. 4th International Conference on Intelligence Science (ICIS), Feb 2021, Durgapur, India. pp.303-312, 10.1007/978-3-030-74826-5_27. hal-03741706

HAL Id: hal-03741706

https://inria.hal.science/hal-03741706v1

Submitted on 1 Aug 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# Comparative Analysis of Machine Learning Algorithms for Categorizing Eye Diseases

Premaladha Jayaraman¹, R Krishankumar¹, K S Ravichandran², Ramakrishnan Sundaram¹ and Samarjit Kar³

¹ School of Computing, SASTRA Deemed University, Thanjavur - 613 401, TN, India

² Rajiv Gandhi National Institute of Youth Development, Sriperumbudur, TN, India

³National Institute of Technology, Durgapur. WB, India

dr.samarjitkar@gmail.com

**Abstract.** This paper presents a comparative study on different machine learning algorithms to classify retinal fundus images of glaucoma, diabetic retinopathy, and healthy eyes. This study will aid the researchers to know about the reflections of different algorithms on retinal images. We attempted to perform binary classification and multi-class classification on the images acquired from various public repositories. The quality of the input images is enhanced by using contrast stretching and histogram equalization. From the enhanced images, features extraction and selection are carried out using SURF descriptor and k-means clustering, respectively. The extracted features are fed into perceptron, linear discriminant analysis (LDA), and support vector machines (SVM) for classification. A pretrained deep learning model, AlexNet is also used to classify the retinal fundus images. Among these models, SVM is trained with three different kernel functions and it does multi-class classification when it is modelled with Error Correcting Output Codes (ECOC). Comparative analysis shows that multi-class classification with ECOC-SVM has achieved high accuracy of 92%. The abstract should summarize the contents of the paper in short terms, i.e. 150-250 words.

**Keywords:** Diabetic Retinopathy, Glaucoma, BoF, perceptron, SVM, LDA, CNN

## 1 Introduction

Machine Learning (ML) and Deep Learning (DL) have given remarkable results in various fields like bioinformatics, defence, agriculture, metrology, medicine, etc. Especially, in the field of medicine, the contribution of ML and DL is significant. Conventionally, ophthalmologists analyse the retinal fundus images and diagnose like the diseases like glaucoma, diabetic retinopathy (DR), age-related macular degeneration, macular edema, etc. This research focuses on analysing different machine learning algorithms to build models for classifying the retinal fundus images of Glaucoma, Diabetic retinopathy, and healthy eyes. There is an exponential increase in the number of people who are affected by eye diseases and there is a demand for the trained oph-
thalmologists to analyse & diagnose the images of the patients. In this scenario, it is better to have a computer aided diagnosis system to analyse the images and diagnose the disease in a relatively faster manner. Computer aided diagnosis system comprises of the following phases: i) image acquisition, ii) image preprocessing, iii) feature extraction, iv) feature selection, and v) classification. In case of machine learning models are used for classification, then it is required to implement the feature extractor. In case of deep learning-based models, feature extraction is done by the model itself. Input images can be directly given to the model or it can be given as input after enhancement. Fig. 1 sketches the flow of the research work.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Workflow of the proposed research work</figcaption></figure>

## 1.1 Related work

There are many profound research works carried out in the field of analysing the retinal fundus images for diagnosis and prognosis. Researchers prefer machine learning and deep learning algorithms to achieve higher accuracy in classification and prediction. Few research articles which are helpful in establishing the foundation for this research are discussed in this section. Tong et al., have done a detailed review on machine learning applications in ophthalmic imaging modalities [1]. They have emphasized the role of machine learning in automated detection and grading of pathological features in ocular diseases. These models can assist the ophthalmologists to provide high-quality diagnosis and personalized treatment plans. Hemelings et al., have used transfer learning to classify glaucoma images [2]. They have used color fundus images and 42% of the data were used for training. The model achieved 0.995 of Area Under Curve (AUC). Sengupta et al., presented a critical review on deep learning models to classify retinal diseases like age-related macular degeneration, glaucoma, and diabetic retinopathy [3]. They have presented a clear description about the databases and different algorithms to process and segment the retinal parts like optic cup, optic disc, macula, and fovea. Sarki et al., have trained a deep learning model to provide an overall classification of diseased and healthy retinal fundus images [4]. They have developed mild multi-class diabetic eye disease (DED) and multi-class DED. Fundus images annotated by the ophthalmologists were used for training the model. They have achieved an accuracy of 88.3% using VGG16 and 85.95% for mild-multiclass classification. Kamran et al., have proposed a convolutional neural network to distinguish between the different degeneration of retinal layers using optical coherence tomography (OCT) images [5]. Das et al., performed classification of retinal diseases using transfer learning [6]. They have used VGG19, pretrained model and trained it retinal database which has glaucoma, diabetic retinopathy, and healthy eye
images. Selvathi et al., have used thermal images to detect the diabetic retinopathy using support vector machines (SVM). From the thermography images, the authors extracted texture features from Gray level cooccurrence matrix (GLCM) and statistical features from RGB and HSI images [7]. The extracted texture and statistical features are classified using SVM and achieved 86.2% accuracy.

It is evident from the literature review that machine learning and deep learning algorithms provide a significant contribution in analysing the fundus images and diagnosing the diseases. In this research work, machine learning algorithms like perception, support vector machines, linear discriminant analysis are modelled with the key features of the images. Also, the results are compared with the pretrained AlexNet with the retinal fundus images.

# 2 Materials and methods

## 2.1 Image acquisition

The retinal fundus images used for this research work are taken from High resolution fundus (HRF) images database [8]. As the name implies, HRF database provides images with resolution of 3504x2336. The database has 45 images, and it is categorized into glaucoma, diabetic retinopathy, healthy. Each category has 15 images. Sample images are shown in Figs. 2 to 4.

<figure><img src="image_3.png" /><figcaption>Fig. 2. Glaucoma</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Fig. 3. Diabetic Retinopathy</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>Fig. 4. Healthy eye</figcaption></figure>

## 2.2 Image enhancement

Image enhancement is the process which enriches the quality of the image. In this research work, contrast stretching is used for image enhancement. This technique finds the maximum and minimum pixel values of the image and normalizes the other pixels within the max-min range. The intensity values are stretched evenly between maximum and minimum. The contrast stretching is expressed mathematically as in Equation (1).

$$I_{new} = \frac{l_{input} - l_{min}}{l_{max} - l_{min}} \times 255 \qquad (1)$$

where $l_{new}$ is the new normalized intensity value, $l_{input}$ is the intensity value to be normalized, $l_{max}$, $l_{min}$ are maximum and minimum values of the input image respec-
tively, 255 is the global maximum value. The input image and the contrast stretched
image are shown in the Figs. 5 and 6.

<figure><img src="image_6.png" /><figcaption>**Fig. 5.** Original fundus image of Diabetic Retinopathy</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>**Fig. 6.** Enhanced fundus image of Diabetic Retinopathy</figcaption></figure>

The contrast enhanced images are fed into feature extractor to get the interest points for classification.

**2.3 Feature extraction & selection**

The enhanced images are taken as input for this phase. Bag of words (BoW) approach is employed in this research work to carryout feature extraction and selection. BoW extracts the interest points/keypoints from the images using feature descriptors and selects the representative keypoints using k-means clustering algorithm. The cluster centers resulted from k-means algorithm are the bag of features or words that best represents the input image. These features are given as input for classification phase. k-means clustering algorithm resulted in 10,000 key points for each image and the matrix of 45 (samples) x 10,000 (interest points) is given as input to the classifier.

**2.4 Classification**

The extracted features are classified using perceptron, LDA, SVM, and deep learning
algorithm (i.e.,) convolutional neural networks.

**2.4.1. Machine learning algorithms**

i) Perceptron: Perceptron is a commonly used machine learning algorithm for bina-
ry classification. It is a neural network with single layer. Perceptron takes the feature
vector derived using BoF as input and it calculates weighted sum. Output from each
neuron is triggered out using activation function in which the weighted sum is ap-
plied. The output of the network will be either (0,1) or (1,1). HRF dataset has images
of three classes. Three perceptron models are trained where the first model is inputted
with the features of glaucoma and healthy images, the second model with features of
diabetic retinopathy and healthy images, and the third model is trained with features
of glaucoma and diabetic retinopathy images. The classification results are discussed
in section-3. The general architecture of perceptron nets is shown in Fig. 7

ii) Linear discriminant analysis (LDA): LDA can be used for classification when the data is categorical. Linear discriminant analysis tries to maximise the distance between inter class mean and minimise the intra class spread. This makes it an ideal
candidate for classification problems especially binary classification. LDA projects the features in a plane making it linear in the projected plane. This projection of features leads to dimensionality reduction which is also one application of LDA. If the data follows a Gaussian mixture model, LDA yields the least classification error.

<figure><img src="image_8.png" /><figcaption>Fig. 7. Architecture of Perceptron Nets</figcaption></figure>

In LDA, empirical estimates of population covariance matrix and class mean are calculated from the training data. LDA uses probability to predict to which class the data belongs to. LDA estimates the probability using Bayes' theorem which gives the probability estimate of the output class for the given input. LDA classifier is trained to classify DR & healthy images, Glaucoma & healthy images, and DR & glaucoma images. The results of these classifiers are discussed in section 3.

iii) Support vector machines (SVM): Support vector machines (SVM) are used for binary classification. In this research work, it has been combined with Error Correcting Output Codes (ECOC) and it is used for multi-class classification. SVM-ECOC takes the input of all three classes and classifies it using OVO (One-versus-One) scheme. The structure of SVM-ECOC has three learners, where the first learner considers Glaucoma as positive class, DR as negative class and healthy eyes features are kept neutral. The second learner takes Glaucoma as positive class, Healthy eyes as negative class, and DR as neutral. The third learner considers DR as positive, Healthy as negative and Glaucoma as neutral. SVM-ECOC uses the Equation (2) which makes use of coding matrix elements and predicted classification score to get the final output of the classifier [9].

$$ \hat{k} = \operatorname*{argmin} \frac{\sum_{l=1}^{L} |cm_{kl}| g(cm_{kl}, score_{l})}{\sum_{l=1}^{L} |cm_{kl}|} \qquad (2) $$

where CM is the coding matrix with elements cmkl, and scorel is the predicted classification score for the positive class of learner l.

Arbitrary input is assigned to the class that minimizes the aggregation of losses for the L learners. The results of ECOC-SVM with the HRF dataset is discussed in the section 3.

### 2.4.2 AlexNet

The original fundus images are trained with a pretrained model called AlexNet [10]. This model has 5 convolutional layers in which few of these layers are followed by max pooling layers, and three fully connected layers with softmax activation function.
Dropout regularization is used to reduce overfitting. The architecture of AlexNet is depicted in Fig. 8.

<figure><img src="image_9.png" /><figcaption>Fig. 8. AlexNet Architecture [9]</figcaption></figure>

This is a pretrained model which has been trained for nearly 22,000 categories. The trained model's knowledge is transferred to classify DR, glaucoma, and healthy eye images. This model has been trained for original images, enhanced images, enhanced and flipped images. The results of these model are discussed in section - 3.

## 3 Results and discussion

Classification of retinal images are done by using perceptron, linear discriminant analysis, support vector machines with different kernel functions, and convolutional neural networks. Among these models, perceptron and LDA performs binary classification, ECOC-SVM and AlexNet performs multi-class classification. Binary classifiers are modelled with 10,000 features extracted and selected from the 45 input images (i.e.,) feature vector is of size 45 x 10000.

**Perceptron:** The results of perceptron algorithm are shown in Fig. 9a – 9c. Fig. 9a shows the error plot against the number of epochs for classifying Glaucoma & healthy images. By default, the algorithm executes 1000 epochs. “Early stopping” procedure is called to terminate the program if the algorithm fails to converge or results in oscillating pattern. Fig. 9 shows the error plot against the number of epochs for classifying glaucoma & healthy images. Fig. 10 shows the error plot against the number of epochs for classifying DR & healthy images. Fig. 11 shows the error plot against the number of epochs for classifying DR & Glaucoma images.

**LDA:** In binary classification, LDA has been implemented with same feature set, whereas first model is trained with Dr and Glaucoma features, second model is trained with DR and healthy eye's features, and the third model is trained with Glaucoma and healthy eye's features. Three models of LDA have achieved an average accuracy of 84.5% and the results of individual classifier along with confusion matrix is tabulated in Table. 1.

<table><caption>Table 1. Classification accuracy for LDA</caption><thead><tr><td>Input features</td><td>Accuracy</td></tr></thead><tbody><tr><td>DR & Glaucoma</td><td>96.7%</td></tr><tr><td>DR & Healthy</td><td>80.0%</td></tr><tr><td>Glaucoma & Healthy</td><td>76.7%</td></tr></tbody></table>
<figure><img src="image_10.png" /><figcaption>Fig. 9. Glaucoma vs Healthy</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>Fig. 10. DR vs Healthy</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>Fig. 11. DR vs Glaucoma</figcaption></figure>

Figs. 12–14 show the scatter plots of the LDA models and Tables 2 to 4 give the confusion matrices of the LDA models.

<figure><img src="image_13.png" /><figcaption>Fig. 12. LDA - Scatter plot for DR & Glaucoma</figcaption></figure>

<figure><img src="image_14.png" /><figcaption>Fig. 13. LDA - Scatter plot for DR & Health</figcaption></figure>

<figure><img src="image_15.png" /><figcaption>Fig. 14. LDA - Scatter plot for DR & Healthy</figcaption></figure>
<table><caption>**Table 2.** LDA – Confusion matrix for DR & Glaucoma</caption><thead><tr><th rowspan="2">True class</th><th colspan="2">Predicted class</th></tr><tr><th>DR</th><th>G</th></tr></thead><tbody><tr><th>DR</th><td>14</td><td>1</td></tr><tr><th>G</th><td>0</td><td>15</td></tr></tbody></table>

<table><caption>**Table 3.** LDA – Confusion matrix for DR & Healthy</caption><thead><tr><th rowspan="2">True class</th><th colspan="2">Predicted class</th></tr><tr><th>DR</th><th>Healthy</th></tr></thead><tbody><tr><th>DR</th><td>10</td><td>5</td></tr><tr><th>Healthy</th><td>1</td><td>14</td></tr></tbody></table>

<table><caption>**Table 4.** LDA – Confusion matrix for Glaucoma & Healthy</caption><thead><tr><th rowspan="2">True class</th><th colspan="2">Predicted class</th></tr><tr><th>G</th><th>Healthy</th></tr></thead><tbody><tr><th>G</th><td>11</td><td>4</td></tr><tr><th>Healthy</th><td>3</td><td>12</td></tr></tbody></table>

SVM: ECOC-SVM is trained with the features extracted from glaucoma, DR, and healthy eye images. Three learners are used in this model and it has achieved an average accuracy of 92%. These SVM learners are trained with linear, polynomial, and RBF kernels, out of which linear kernel outperforms other kernels. ROC curves for the learners with linear kernel are given in the Figs. 15 – 17.

<figure><img src="image_16.png" /><figcaption>**Fig. 15.** DR & Healthy</figcaption></figure>

<figure><img src="image_17.png" /><figcaption>**Fig. 16.** Glaucoma & Healthy</figcaption></figure>

*AlexNet*: AlexNet is trained with three sets of images (i.e.,) original images, enhanced images, enhanced flipped images. The accuracy achieved by these models are tabulated in Table 5. CNN extracts the features from images by itself and hence manual feature extraction, selection process is not required. The training progress and the loss incurred at each iteration is shown in Figs. 18 – 20. From Table 5, it is inferred that the model trained with the original images provided better accuracy when compared to other two models.
<figure><img src="image_18.png" /><figcaption>Fig. 17. DR & Glaucoma</figcaption></figure>

<table><caption>Table 5. Results of AlexNet</caption><thead><tr><th></th><th>Original images</th><th>Enhanced images</th><th>Enhanced-flipped images</th></tr></thead><tbody><tr><th>Accuracy</th><td>83.33</td><td>66.67%</td><td>75%</td></tr></tbody></table>

<figure><img src="image_19.png" /><figcaption>Fig. 18. Original images</figcaption></figure>

<figure><img src="image_20.png" /><figcaption>Fig. 19. Enhanced images</figcaption></figure>

<figure><img src="image_21.png" /><figcaption>Fig. 20. Enhanced flipped images</figcaption></figure>

## 4 Conclusion

This research work is carried out for classifying the retinal diseases, diabetic retinopathy, glaucoma, from healthy retina images. The dataset has 45 high resolution fundus images, with 15 images are there for each category (i.e.,) DR, Glaucoma, and healthy. These images are preprocessed for quality enhancement and significant interest points
are extracted from each image to formulate the feature set to train different machine
leaning models. These images are directly given as input for training the deep learn-
ing model because it has convolution layers to extract the significant features from the
images. With respect to classification accuracy, SVM with linear kernel provided
higher accuracy for multi-class classification. It is inferred that if the number of fea-
tures is greater than the number of samples then the linear kernel will provide better
accuracy. Huge drop in accuracy is found with the perceptron and LDA is because of
the nature of the input vector which is linearly non-separable, and the dimensions of
the features are high. Classification accuracy achieved by AlexNet is also less than
the SVM model. If the model parameters are fine-tuned and the number of training
samples are increased, then increase in accuracy can be expected.

References

1. Tong, Y., Lu, W., Yu, Y. et al. Application of machine learning in ophthalmic imaging modalities. *Eye and Vis* **7**, 22 (2020). https://doi.org/10.1186/s40662-020-00183-6

2. Hemelings R, Elen B, Barbosa-Breda J, Lemmens S, Meire M, Pourjavan S, Vandewalle E, Van de Veire S, Blaschko MB, De Boever P, Stalmans I. Accurate prediction of glaucoma from colour fundus images with a convolutional neural network that relies on active and transfer learning. Acta Ophthalmologica. 2020 Feb;98(1):e94-100.

3. Sengupta S, Singh A, Leopold HA, Gulati T, Lakshminarayanan V. Ophthalmic diagnosis using deep learning with fundus images–A critical review. Artificial Intelligence in Medicine. 2020 Jan 1;102:101758.

4. Sarki, R., Ahmed, K., Wang, H. et al. Automated detection of mild and multi-class diabetic eye diseases using deep learning. Health Inf Sci Syst 8, 32 (2020). https://doi.org/10.1007/s13755-020-00125-5

5. Kamran, S.A., S. Saha, A. S. Sabbir and A. Tavakkoli, "Optic-Net: A Novel Convolutional Neural Network for Diagnosis of Retinal Diseases from Optical Tomography Images," 2019 18th IEEE International Conference On Machine Learning And Applications (ICMLA), Boca Raton, FL, USA, 2019, pp. 964-971, doi: 10.1109/ICMLA.2019.00165.

6. Das, A., R. Giri, G. Chourasia and A. A. Bala, "Classification of Retinal Diseases Using Transfer Learning Approach," 2019 International Conference on Communication and Electronics Systems (ICCES), Coimbatore, India, 2019, pp. 2080-2084, doi: 10.1109/ICCES45898.2019.9002415.

7. Selvathi and K. Suganya, "Support Vector Machine Based Method for Automatic Detection of Diabetic Eye Disease using Thermal Images," 2019 1st International Conference on Innovations in Information and Communication Technology (ICIICT), CHENNAI, India, 2019, pp. 1-6, doi: 10.1109/ICIICT1.2019.8741450.

8. Odstrcilik J, Kolar R, Budai A, Hornegger J, Jan J, Gazarek J, Kubena T, Cernosek P, Svoboda O, Angelopoulou E. Retinal vessel segmentation by improved matched filtering: evaluation on a new high-resolution fundus image database. IET Image Processing. 2013 Jun 1;7(4):373-83.

9. Sundaram R, Ravichandran KS. An automated eye disease prediction system using bag of visual words and support vector machine. Journal of Intelligent & Fuzzy Systems. 2019 Jan 1;36(5):4025-36.

10. Krizhevsky A, Sutskever I, Hinton GE. Imagenet classification with deep convolutional neural networks. Communications of the ACM. 2017 May 24;60(6):84-90.