Full text
id180280 USING DEEP LEARNING TO PREDICTING DIABETIC RETINOPATHY IN OCTA IMAGES ADDING CLINICAL INFORMATION MARTA GIL GARCIA Thesis supervisor: ALFREDOVELLIDOALCACENA(DepartmentofComputerScience) Thesis co-supervisor: ANASSBENALI Degree:MasterDegreeinArtificialIntelligence Master's thesis School of Engineering Universitat Rovira i Virgili (URV) Faculty of Mathematics Universitat de Barcelona (UB) Barcelona School of Informatics (FIB) Universitat Politècnica de Catalunya (UPC) - BarcelonaTech 20/10/2023
Abstract There is a very high demand for DR screening tests. Optical coherence tomography angiography (OCTA) is a new imaging technique that has shown promising results for the early diagnosis of diabetic retinopathy (DR). This has motivated research into automated frameworks for DR detection and scoring based on OCTA data. This thesis studies how best to apply CNNs to classify DM, DR and referable DR (RF-DR) and start-DR using the largest dataset of labeled OCTA images currently available for type 1 DM. The dataset is composed of 3 ×3 mm and 6 ×6 mm images of the superficial and deep capillary plexuses of 726 eyes. Several methods are tested to find the best fine-tune configuration of a CNN. As well as a new approach of using feature extraction as a transfer learning method to obtain features to use with a ML classifier. To these features are added features obtained from the patients’ clinical data. Very promising results are obtained with the feature extraction technique used, especially when combined with clinical data.
Contents 1 Introduction 4 1.1 Objectives................................. 5 2 Background 7 2.1 DMandDR................................ 7 2.2 RetinalImages .............................. 8 2.2.1 Fundus retinography . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.2 Optical Coherence Tomography . . . . . . . . . . . . . . . . . 9 2.2.3 Optical Coherence Tomography Angiography . . . . . . . . . . 9 2.3 Deep Learning and CNN . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.4 Transferlearning ............................. 11 2.4.1 Fine-tuning ............................ 12 2.4.2 Feature extraction . . . . . . . . . . . . . . . . . . . . . . . . 13 3 State of the art 14 3.1 Convolutional Neuronal Network fine-tuning . . . . . . . . . . . . . . 14 3.2 Featureextraction ............................ 16 4 Materials: the Investigated Retinal Image Dataset 18 5 Experiments 21 5.1 Methodology ............................... 21 5.2 Fine-tuning exploration on the DR task . . . . . . . . . . . . . . . . . 22 5.2.1 Data augmentation . . . . . . . . . . . . . . . . . . . . . . . . 23 5.2.2 Learningrate ........................... 24 5.2.3 Lossfunction ........................... 24 5.2.4 Model ............................... 25 5.2.5 Imagetype ............................ 26 5.2.6 Concatenate images . . . . . . . . . . . . . . . . . . . . . . . . 26 5.2.7 Undersampling and oversampling . . . . . . . . . . . . . . . . 27 5.2.8 Pre-train on more similar data . . . . . . . . . . . . . . . . . . 28 5.3 Fine-tuning exploration on DM, RF-DR and start-DR tasks . . . . . 29 5.3.1 Architecture............................ 30 5.3.2 Imagetype ............................ 30 1
5.3.3 Concatenation........................... 31 5.3.4 Lossfunction ........................... 32 5.3.5 Learningrate ........................... 32 5.3.6 Undersampling and oversampling . . . . . . . . . . . . . . . . 32 5.4 Fine-tuningsummary........................... 34 5.5 Feature extraction: results with the activations of the hidden layers . 34 5.6 Adding the clinical data . . . . . . . . . . . . . . . . . . . . . . . . . 35 6 Conclusions 42 References 44 2
Acronyms ANN Artificial Neuronal Network. 11 AUC Area Under Curve. 14 CNN Convolutional Neural Network. 5 DM Diabetes Mellitus. 4 DR Diabetic Retinopathy. 4 FAZ Foveal Avascular Zone. 15 FC Fully Connected. 11 FR Fundus Retinograph. 5 OCT Optical Coherence Tomography. 5 OCTA Optical Coherence Tomography Angiography. 5 SVM Support Vector Machine. 16 3
Chapter 1 Introduction Diabetic Retinopathy (DR) is an eye condition that can cause vision loss and blindness in people who suffer from diabetes. It affects blood vessels in the retina (the lightsensitive layer of tissue at the back of the eye). DR is a major cause of vision loss and blindness in working-age adults worldwide (Kropp, Golubnitschaja, and M. e. al. 2023). The elevated blood sugar levels found in people with Diabetes Mellitus (DM) are responsible for this damage. DM is a chronic medical condition characterized by elevated levels of glucose (sugar) in the blood, which arises due to problems with the hormone insulin. Insulin is produced by the pancreas and helps cells take in glucose from the bloodstream to use for energy. DM is the seventh-greatest cause of death worldwide, affecting 1 in 10 adults (Sun et al. 2022). DR, in turn, is one of the most serious complications of DM, and it affects more than 22% of those with the disease (ZL, YC, and Y. M. e. al. 2021). There are two primary types of DM: type 1 and type 2. In this work, we are going to focus on type 1 DM, which is an autoimmune condition wherein the body mistakenly attacks and destroys the insulin-producing beta cells in the pancreas. As a result, little to no insulin is produced. Neither the cause of the condition nor the means to prevent it are known (World Health Organization n.d.). Although it can appear at any age, it typically begins in children and young adults (National Institute of Diabetes and Digestive and Kidney Diseases n.d.). Type 1 DM is estimated to constitute between 5 to 10% of all diabetes cases (Daneman 2006). As previously said, DR is one of the most serious complications of DM, though in its early stage DR might have no symptoms, or, at most, only mild vision problems, which makes it hard to detect. Even if there are symptoms and a doctor studies the case, it is still difficult to diagnose as the early stages of DR are hard to differenciate from a healthy eye. Detecting DR in early stages is vital to slow down its advancement and prevent the vision complications which can lead to blindness if left untreated. Different non-invasive methods have been developed to detect DR and other dis- 4
eases that affect the retina. These methods are based on imaging techniques that are non-invasive. Some of these methods are: fundus retinography (FR), structural Optical Coherence Tomography (OCT) and Optical Coherence Tomography Angiography (OCTA). lternative methods for detecting DR include direct examination of the eye by a specialist through ophthalmoscopy, or slit-lamp biomicroscopy (Wong et al. 2018). Although these methods are not too expensive, they have the problem of requiring the presence of an ophthalmologist and of not allowing the results to be saved for re-analysis. The advantages of the methods based on imaging techniques are that the results can be stored, which not only allows the re-analysis of the results at any time, but also allows the use of data analysis, in the form, for instance, of machine learning (ML), to study, detect and grade DR. These results are stored as images, which also allows the usage of existing tools for image processing, instead of requiring the creation of specific ones for this task. Traditionally, the research on DR detection has been done using FR photography, due to its widespread availability, and only later from OCT scans, which are not so readily available. Recently, a more advanced version of OCT, namely OCT angiography (OCTA), has begun to be studied. This method allows for direct visualization of flow in the retinal vessels, representing a significant advance in the evaluation of these patients. 1.1 Objectives This thesis aims to evaluate the effectiveness of Convolutional Neural Networks (CNNs) to classify DR from data acquired using the novel OCTA imaging technology. The study is conducted in collaboration with Dr. Javier Zarranz-Ventura (Institut Clinic d’Oftalmologia, ICOF, Hospital Clinic de Barcelona), an ophthalmologist who provided the annotated dataset used in this work. Due to the technical novelty and their sophistication, analyzing and extracting information from OCTA images is of specially relevant. Given this relevance, OCTA images have been previously studied in different fields, including the automatic detection of DR. The current thesis is pioneering in two things: firstly, it investigates a dataset made up entirely of type 1 DM; in the studies carried out in the area, either type 2 or both are used. And secondly, an in-depth study of the application of CNNs and its multiple techniques is conducted. Other studies that also employ CNN techniques use only the basic form of CNN with default parameters and do not delve into experimenting and comparing multiple other methods. The use of this kind of techniques for automatizing the detection of DR are of great interest because if it were perfected enough to be used in a real environment, it would drastically reduce the cost and effort of the process. Given the growing prevalence of DM worldwide, these technologies are likely to progress from being a convenience to 5
become a need. Especially given the high DM-related expenses and the need for the presence of an expert of the current detection methods. Our dataset has been previously investigated. In (Benali 2022), traditional handmade features, and ML classification algorithms are explored. In (Carrera-Escal´e, Benali, Rathert, Ruben Mart´ın-Pinardel, et al. 2023) a ML approach is also used, this time with radiomic features. In the more recent (Zurita 2023), the application of deep learning is studied. Our objective is to start from this last work and further explore the possibilities of deep learning applications. We set the following objectives for the thesis: •Reviewing the state of the art of the application of CNN to OCTA datasets for detecting DR and the methods used. •Review the provided dataset to learn more about its characteristics, and review the previous works done in the dataset. •Implement and select the best CNN techniques depending on the results obtained on the process. •Implement two transfer learning techniques: fine-tuning and feature extraction, and explore their possibilities. •Add clinical data on the feature extraction system and evaluate its impact on the prediction 6
Chapter 2 Background In this chapter, we will explain the main concepts related to this thesis and specially the ones related to ophthalmology. These concepts are necessary to understand the following sections. 2.1 DM and DR As explained in the Introduction, DM is the chronic medical condition characterized by elevated levels of glucose (sugar) in the blood, which arises due to problems with the hormone insulin. Uncontrolled diabetes can lead to numerous complications over time. Chronic hyperglycemia can damage blood vessels, nerves, and organs. There are multiple DM types and the main ones are type 1 and type 2. DM type 1 is an autoimmune condition in which the body’s immune system attacks and destroys the insulin-producing cells in the pancreas. As a result, individuals with type 1 diabetes produce little to no insulin. Type 2 is the body’s resistance to insulin, meaning cells fail to respond to insulin properly. It is more common and often associated with obesity and a sedentary lifestyle. DM type 1 is less common than type 2 and accounts for only 5% - 10% of the cases (Daneman 2006). However, the prevalence of DR is higher in DM1 patients than in DM2 patients (Romero-Aroca et al. 2017), developing DR in a 20-year span in nearly all cases (Fong et al. 2004) DR is the most severe disease affecting the diabetic eye and has the risk of inducing irreversible blindness. It is caused by damage to the blood vessels of the light-sensitive tissue at the back of the eye (retina). At first, DR may cause no symptoms or only mild vision problems. However, it can eventually lead to blindness. DR is a leading cause of preventable blindness globally (Wilkinson et al. 2003a). DR may not have any symptoms at first, but finding it early can help those affected by it to take steps towards vision protection. When someone has diabetes, it is key to undergo a comprehensive dilated eye exam at least once a year. This can be very expensive due to the large number of people with DM. The final objective of the 7
Chapter 3 State of the art With the advantages of being non-invasive and more readily available, OCTA has opened a wealth of possibilities for investigating different types of vascular damage, such as diabetic retinopathy (DR). Recently, research in OCT-A has been evolving in tandem with tremendous improvement in image analysis driven by deep learning. 3.1 Convolutional Neuronal Network fine-tuning In this section we are going to study the related work done in the area of automated DR detection, specially the one done using OCTA images and using fine-tuning CNN methods, or any CNN method. All results presented in this section are computed using an independent validation set. The DM type of patients in the datasets are either DM2 or not mentioned, in which case we assume all or most of them were DM2 patients since DM2 is far more common than DM1. In (Wang et al. 2021) a large OCTA dataset was used for quality image assessment. The objective of the paper was to create a system that classifies the quality of an OCTA image, using a very large public dataset. Although the images do not have the same labels as in our problem, they could be used for transfer learning, since they are more similar to our problem than the ImageNet images. (Li et al. 2022) presented a segmentation model based on U-Net to segment the boundaries of vessels and the foveal avascular zone (FAZ) in OCTA images. Then, a new deep learning framework was proposed to predict the class of OCTA images based on fusing the original OCTA image and the segmentation results. In this paper, a deep learning system is proposed to classify if OCTA images have DR or not. The first part of the study consists of FAZ segmentation, this part is not interesting for us, but the second part compares different architectures to the one created by them, for the DR classification problem. The architecture used and the AUC obtained are the following: Efcientnet 0.76, Mobilenet: 0.56, Squeezenet: 0.73, Resnet50: 0.81, 14
ShuffleNet: 0.84 and theirs: 0.92. (Zang et al. 2022) uses OCT and OCTA images to create a classifier for referable and vision threatening DR using a deep learning aided DR classification framework. The OCTA images used in their work are generated in 3D, and they use a 3D CNN architecture for both OCT and OCTA images. In (Ryu et al. 2022) A CNN and four traditional ML models were trained to classify the DR severity using OCTA images as datasets. The results of the CNN algorithm were compared with those of traditional ML–based classifiers. The CNN-based classifier used ResNet 101 pretrained on ImageNet, while the fine-tuning optimization was done using cross-entropy loss with an Adam optimizer and a learning rate of 0.0001. For the ML–based Classifier, they analysis is organized in three stages: segmentation, feature extraction and classification. In the segmentation step, U-Net was used to segment the blood vessels and foveal avascular zone (FAZ) from the OCTA images. In the feature extraction stage, four local features (blood vessel density, skeletal vessel density, fractal dimension, and FAZ area) were extracted from the segmented OCTA images. In addition, 9 shape features, 18 intensity features, and 75 texture features were extracted from an image and its segmentation masks. Finally, in the classification step, data from these 2,298 extracted features and demographic data for each patient were fed into four different ML classifiers, namely MultiLayer Perceptron (MLP), Random Forest (RF), Support Vector Machine (SVM), and eXtreme Gradient Boost (XGB). The F1 Score obtained by the best CNN was 0.683 (0.014), and the best obtained by the ML methods was 0.435 (0.023). (Yasser et al. 2022) proposes a binary classification system for DR detection, a multiscale framework at which the OCTA images are analyzed at different scales. The input to the system contains three sources of information from which a multi-layer input image is constructed as an input to the classification system: the original superficial OCTA images, the original grayscale image, a binary map of its segmented retinal vasculature (RV) network and a distance map of blood vessels. The main idea behind this multi-layer image is that with smaller size, it will emphasize local features and thus enhance the CNN learning process. The idea behind this work is interesting, but the quantity of data used for testing, 18 images between the two classes, makes it hard to extract significant conclusions. Also, the architecture used was implemented from scratch and it is too simple. The purpose of the work reported in (Le et al. 2020) was to test the feasibility of using deep learning with OCTA images for the detection of DR. For the CNN, they use VGG16 with the default configuration. This study obtained an accuracy of 70.83%. 15
This study does not have enough test samples for the results to be statistically significant; in fact, the results obtained with the test data are an accuracy of 87.27%, while when validating the model with external test data, the accuracy dropped to 70.83%. (Heisler et al. 2020) proposes an ensemble of different deep learning architectures joined using a voting system. Three different CNN architectures were used: VGG19, ResNet50, and DenseNet. Each network was loaded with the pretrained weights on the ImageNet dataset. For the voting system, they implement a majority soft voting scheme by averaging out the probabilities calculated by individual networks. Because voting only considers linear relationships among classifiers, authors tried changing the voting for a classifier, which is able to learn complex associations. Seeing the results, the voting system performs better than the one with a classifier and better than the features created manually. Though the ensemble system has results that do not differ significantly from the ones obtained just with the VGG19 architecture. As a conclusion of the reviewed works, many have used deep learning and standard ML with manually obtained features. The most used models and/or with the best results are: ResNet, VGG16, VGG19, Inception in different versions and DenseNet. Most of the time, these models were pretrained in the ImageNet dataset. We have also seen that the studies that use deep learning do not delve much into the configuration of the models and use the default settings. At most, they compare multiple models, but do not experiment with other possible configurations or methods. Finally, we have seen in multiple papers that the FAZ metric improves the results obtained, unfortunately we do not have the FAZ true values for our dataset, so we cannot try to implement a FAZ segmentation method. 3.2 Feature extraction In this section, we review related work in the area of feature extraction, or, since this is the first application of this technology in our particular area of study, applications in other areas. (Varshni et al. 2019) presents a pneumonia detection using CNN based feature extraction. It extracts the features of all the convolutional layers of a CNN pre-trained on ImageNet and then passes the features to a classifier. The system compares different architecture for extracting the features: Xception, VGG16, VGG-19, ResNet-50, DenseNet-121 and DenseNet-169. And different classifier models: Random Forest, K-nearest neighbors, Naive Bayes and Support Vector Machine(SVM). The best resulting configuration is DenseNet-169 and SVM. They conclude that their proposed system resulted in an optimal solution for classifying Pneumonia on Chest X-Ray images. 16
(Barbhuiya, Karsh, and Jain 2020) proposes a CNN feature extraction to classify sign language. The proposed model uses the VGG16 architecture pre-trained on ImageNet for the feature extraction and SVM as the classifier. The system extracts only the features from the last convolutional layer of the CNN and passes them to the classifier. (Hariharan et al. 2015) proposes to use, for every pixel, take for that pixel the output of each layer and create a vector with them. Notice that the downsampling methods will make some of the values to repeat for different pixels. This way they obtain a feature vector for each pixel, representing different levels of abstraction, and use it for image segmentation. This system improved the state-of-the-art results. Studies from the literature reveal the use of classifiers in combination with CNN based feature extraction, majorly in medical image analysis, (Heba et al. 2018) to meliorate the performance of models. 17
Chapter 4 Materials: the Investigated Retinal Image Dataset The OCTA dataset available for this thesis was collected in a clinical trial sponsored by Hospital Clinic of Barcelona in collaboration with Fundaci´o La Marat´o de TV3 (ClinicalTrials.gov NCT03422965). The images are gray-scaled, have a resolution of 1024×1024 pixels and are saved as bitmap (.bmp) files of size 1 MB. The images are gray-scale with 8 bit depth. The scanning protocols included are 3×3 mm and 6×6 mm for both SCP (superficial) and DCP (deep), we can see an example of each scanning protocol image on the Figure 4.1. These images are classified by the patient ID; for each patient we have these four images for the left and right eye and we also have some clinical data associated (such as, for instance, if the patient smokes or not, and the IMB). Figure 4.1: Images of an eye with DM for the different scanning protocols The dataset differs from many other datasets of common use, mainly in that it has only patients with Type 1 diabetes. Medical and quality exclusion criteria had been applied to discard some of the images, as explained in (Barraso et al. 2020; Benali et al. 2022). Exclusion criteria include concomitant ocular pathologies, macular edema, presence of macular cysts, previous ocular surgery, previous macular laser, previous ocular treatment. After the exclusion criteria, the resulting dataset consists of a total of 439 individuals and includes, overall, 726 eyes. 18
To grade the DR severity, there is not a standard scale, but we will use the widely accepted ICDR severity scale (CP et al. 2003b). This system has 5 levels of severity. To this 5 classes, we have added the control class that stands for patients without DM who volunteered to participate in the study. We can see the resulting classes and its meaning in the Table 4.1. 0 Control 1 No DR 2 Mild non-proliferative DR (NPDR) 3 Moderate NPDR 4 Severe NPDR 5 Proliferative DR Table 4.1: DR scale rating when including controls It should be noted that it would be difficult for a trained optometrist or ophthalmologist to discriminate between the retinal images of controls (class 0) and diabetics with no DR (class 1). As we can see in (Ryu et al. 2022), where two experts grading the DR of dataset were compared to the ground truth and they were shown to differ from the ground truth and from each other in multiple cases. In the Table 4.2, we can see the number of images for each class. Seeing that some classes have a too low number of elements, we decide to discretize the multi-class classification task into multiple binary classification tasks. The tasks were created based on the main current problems in the automatic detection of DM and DR. The created tasks are the following: •DM: discrimination between controls (0) and DM patients (1, 2, 3, 4, and 5). The objective of these tasks is to detect the presence of DM. •DR: discrimination between DM patients with no DR (1) and DR patients (2, 3, 4, and 5). The objective of this task is to detect, from the patients with DM the ones that have DR and the ones that do not. •RF-DR: discrimination between DM patients with mild or no DR (1, 2) and those with advanced DR (3, 4, 5). The objective of this task is to classify, from the patients with DM, the ones with no DR or mild DR from the ones with more advanced DR. •start-DR: discrimination between controls (0) and those with no DR (1). The objective of this task is to discriminate the healthy patients from the ones with DM without DR. For the created task, we can see in the Table 4.3 the number of images for both positive and negative samples. We can see that there is a strong class imbalance in all the tasks, specially the RF-DR task. 19
DR scale Number images 0 136 1 445 2 162 3 25 4 2 5 1 Table 4.2: Number of images for every DR class Task Positive Negative DM 136 635 DR 445 190 RF-DR 607 27 start-DR 136 445 Table 4.3: Number of positive and negative images for task 20
Chapter 5 Experiments This chapter explains the experiments performed, detailing the methodology and the evaluation metrics used. The tasks carried out are also explained in some detail. Finally, we present and compare the results obtained. 5.1 Methodology We worked on each task separately since, for each task, a different subset of data was used and the prediction problem at hand is different. To make the experiments more representative and less dependent on random factors, each experiment was run multiple times and the final result is the average of those runs. Cross-validation was used in the experiments with K=4, except in the RF-DR task that we used K=3, since as it has very few cases in the minority class (27 cases) and we need more test data for these to be representative. In the cases where K=4 performed 2 runs and in the case of K=3 we performed 3; thus, 8 and 9 runs were carried out, respectively, which is enough to obtain a significant average. A key benefit of image-based classification is the minimal data preprocessing required. Therefore, pixels values were just normalized, so that all the values lie between 0 and 1. Images were resized to 256x256 size due to memory limitations. For the loss function, we used binary cross-entropy, which is a loss function used in binary classification problems, scenarios where each input sample belongs to exactly one of two classes. We choose binary cross-entropy as a starting point, and other loss functions were tested as reported later in Section 5.2.3. Adam was used as the optimizer of choice; its default learning rate is 0.001, but because we are doing transfer learning we set the learning rate to 1e−4. Dividing the learning rate by 10 is a common practice when doing transfer learning, as it helps avoid overfitting. We explored other learning rates as reported later in Section 5.2.2. We also implemented an early stopping system also to avoid overfitting. 21
Different evaluation metrics were considered to assess and compare the performance of the models. We finally decided to use the AUC, since it has been the most used metric in the state of the art we explored in the Section 3.1. AUC is a widely used metric, and it is especially designed for evaluating the performance of binary classification models. The AUC metric measures the entire two-dimensional area underneath the entire ROC curve. In fact, we use the AUC to summarize the information in the ROC using a single overall value. It ranges between 0 and 1, where values closer to 1 indicate better performance. AUC provides an aggregate measure of the model’s performance across all possible classification thresholds, so it is independent of the threshold. The ROC curve is a graphical plot that shows the true positive rate (TPR) against the false positive rate (FPR) at all possible threshold values. AUC is insensitive to data imbalance, so it is beneficial when dealing with imbalanced datasets because it does not rely on a particular threshold and considers all possible ones. 5.2 Fine-tuning exploration on the DR task Before starting the exploration, it is relevant to mention that we are facing a very complex classification problem in which the classification model finds it difficult to separate the data. That is, in many cases (for many configurations) the model classifies all the data in the same class. The first step of the process is to create the datasets and apply the pre-processing. As explained in Section 4, we have one dataset with all the information, so for every task we take the samples that apply to it; say, if the task is to discriminate between control (0) patients and DM (1) patients, only the samples labeled as 0 or 1 will be selected. In (Zurita 2023), a master’s thesis carried out using the same dataset, the application of CNN to this dataset was explored and, very summarily, methods to improve the results obtained were investigated, among which we find data augmentation, the selection of the CNN model and the concatenation of several types of images into a single one. As mentioned, this setting was sketchily investigated, whereas the objective of the current work was to do an exhaustive exploration. Trying to use the configuration reported in (Zurita 2023) as a starting point did not yield very good results. So we decided to start the experimental process from scratch. As a first step, we looked for a configuration that could separate the two classes. We started with the DR task: discriminate between DM patients with no DR (1) and DR patients (2, 3, 4, and 5), because it is the easiest task. We started using an image type 3x3 superficial, the VGG16 model, the Binary Cross-entropy loss and a learning rate of 1e−4. 22
5.2.1 Data augmentation Data augmentation is a technique to artificially expand the size of the training dataset by creating modified copies of a dataset using existing data, applying various transformations to the original images, or using deep learning to generate new data points. In the context of CNN, data augmentation is especially beneficial and widely used due to the nature of visual data and the spatial hierarchy inherent in CNNs. Data augmentation helps reduce the overfitting and improving the performance of the model. However, it has several limitations, as biases from the original dataset persist in the augmented data, because the created data are variations of the original data. Augmented data is drawn from original data with some minor changes. In the case of image augmentation, we make geometric and color space transformations (flipping, resizing, cropping, brightness, contrast) to increase the size and diversity of the training set. Synthetic data is generated artificially without using the original dataset. This technique often uses DNN (Deep Neural Networks) and GAN (Generative Adversarial Networks) to generate synthetic data. In this thesis, we used data augmention, since synthetic data generation has too much complexity and requires too much data to be reliably applied to our problem. Our dataset is made up of images that represent eyes, which therefore have a certain axial symmetry. We must take this into account to select the methods for data augmentation from our dataset. We must also keep in mind that the images are in grayscale and all were taken under similar conditions, so methods like modifying the brightness or the contrast are bound not to be very effective. Also, resizing and cropping are discarded as the images have all the same size and cannot be cropped. So we decided to use rotations and flips. Specifically, the data augmentation methods used are the following: •Flips: flip the image vertical and/or horizontally •Rotate 90º: random rotation in a range from -90ºto 90º •Rotate 180º: random rotation without range limit •Orthogonal rotation: random rotation of 90º, 180ºor 270º. This is to preserve some orientation of the eye. Method AUC (standard deviation) No Data Augmentation 0.6209 (0.11) Flips 0.6563 (0.11) Rotate 90º0.6322 (0.12) Rotate 180º0.6984 (0.08) Orthogonal rotation 0.7333 (0.09) Orthogonal rotation & flips 0.6820 (0.10) Table 5.1: Performance comparison over different data augmentation methods 23
The configuration we start with uses the 3x3 mm superficial images, because the concatenation obtained for the DR task is too task-specific. We use the loss function and learning rate obtained in the DR task because they are less task-specific. 5.3.1 Architecture The architectures included in our experiments are the same as in the previous section, obtained from the state of the art: ResNet101, VGG16, VGG19, InceptionV3, DenseNet and InceptionResNetV2. Method DR RF-DR start-DR ResNet101 0.4559 (0.03) 0.4875 (0.03) 0.4652 (0.02) VGG16 0.5337 (0.08) 0.5008 (0.11) 0.5420 (0.04) VGG19 0.5008 (0.06) 0.4875 (0.03) 0.5187 (0.06) InceptionV3 0.4665 (0.04) 0.5105 (0.11) 0.4818 (0.02) DenseNet 0.4892 (0.05) 0.5297 (0.08) 0.5278 (0.06) InceptionResNetV2 0.4931 (0.03) 0.5404 (0.12) 0.5261 (0.03) Table 5.9: Performance comparison over different architectures for DM, RF-DR and start-DR tasks As shown in Table 5.9, the best architecture for the DM and start-DR tasks is VGG16, while the best one for the RF-DR task is InceptionResNetV2. 5.3.2 Image type In order to choose the best image type to use in each task, we tried the four of them: 3x3 mm deep, 3x3 mm superficial, 6x6 mm deep and 6x6 mm superficial. Method DM RF-DR start-DR 3x3 deep 0.4627 (0.04) 0.3284 (0.09) 0.4839 (0.05) 3x3 superficial 0.5337 (0.08) 0.5289 (0.09) 0.5229 (0.06) 6x6 deep 0.4680 (0.06) 0.3451 (0.09) 0.4833 (0.03) 6x6 superficial 0.5079 (0.07) 0.4013 (0.11) 0.5464 (0.07) Table 5.10: Performance comparison over the different image types for DM, RF-DR and start-DR tasks As shown in Table 5.10, the most suitable image type for DM and start-DR tasks is the 3x3 mm superficial and for the RF-DR, the 6x6 mm superficial. We will use this values in the following section to decide the type of images to use in the concatenation. 30
5.3.3 Concatenation In this section, we experiment with the concatenation of multiple image types into a single one. As explained in Section 5.2.6, we use two different methods for concatenation: width-wise and channel-wise. In width-wise, all the four image types are concatenated, but in channel-wise only three of them can be used. So, to select the image types to concatenate, we consider the results obtained in the previous section of every image type and also the fact that two images with the same size (3x3 or 6x6) will have more in common and will probably yield better results when concatenated. The same happens with the scanning protocols (deep or superficial). Therefore, we tried to avoid using three images without having at least the same size or the same scanning protocol. Method DM No concatenation (3x3 superficial) 0.5337 (0.08) Width-wise 0.5882 (0.07) Channel-wise (3x3 superficial, 3x3 superficial, 3x3 deep) 0.5380 (0.06) Channel-wise (3x3 superficial, 3x3 superficial, 6x6 superficial) 0.5611 (0.07) Channel-wise (6x6 superficial, 6x6 superficial, 6x6 deep) 0.4726 (0.07) Table 5.11: Performance comparison over different concatenation methods on DM Method RF-DR No concatenation (3x3 superficial) 0.5289 (0.09) Width-wise 0.3168 (0.07) Channel-wise (3x3 superficial, 3x3 superficial, 3x3 deep) 0.3302 (0.05) Channel-wise (6x6 superficial, 6x6 superficial, 6x6 deep) 0.3409 (0.05) Channel-wise (6x6 superficial, 6x6 superficial, 3x3 superficial) 0.3312 (0.05) Table 5.12: Performance comparison over different concatenation methods on RF-DR Method start-DR No concatenation (6x6 superficial) 0.5464 (0.07) Width-wise 0.5093 (0.03) Channel-wise (3x3 deep, 3x3 deep, 3x3 superficial) 0.5126 (0.04) Channel-wise (6x6 superficial, 6x6 superficial, 6x6 deep) 0.5328 (0.05) Channel-wise (6x6 superficial, 6x6 superficial, 3x3 superficial) 0.5803 (0.06) Table 5.13: Performance comparison over different concatenation methods on start- DR 31
Table 5.11 shows, for the DM task, the results for the different concatenation methods tried. According to these, the best method is to concatenate width-wise all the images. Table 5.12 shows the methods and results for the RF-DR task; we can observe that the concatenation is not suitable for this task because the best results are obtained with no concatenation. Finally, for the start-DR task, the methods and results are shown in the Table 5.13; the best method is the channel-wise concatenation of the 6x6 superficial, 6x6 superficial and 3x3 superficial image types. 5.3.4 Loss function To select the best loss function for each of the tasks, we will try the BCE (the loss function used until now) and the BFCE. The BFCE parameter values (α,γ) are the ones explained in Section 5.2.3. Method DM RF-DR start-DR Binary Cross-entropy 0.5882 (0.07) 0.5924 (0.08) 0.5637 (0.05) Binary Focal Cross-entropy 0.4549 (0.03) 0.3791 (0.12) 0.4625 (0.02) Table 5.14: Performance comparison over different learning rates for DM, RF-DR and start-DR tasks The results in Table 5.14 show that BCE performs better for all the tasks. 5.3.5 Learning rate Once the loss function has been selected, we proceed to select the learning rate. As previously explained, the learning rate used in the previous experiments is 1e−5, the best value for the DR task found in the Section 5.2.2 Method DM RF-DR start-DR 1e−4 0.4712 (0.02) 0.3679 (0.11) 0.5637 (0.05) 1e−50.5882 (0.07) 0.5924 (0.08) 0.5767 (0.03) 1e−6 0.5342 (0.03) 0.3541 (0.11) 0.4625 (0.02) Table 5.15: Performance comparison over different learning rates for DM, RF-DR and start-DR tasks Table 5.15 shows that the learning rate value of 1e−5 is the most suitable one for all the tasks. The learning curves for the different learning rate values have also been checked. 5.3.6 Undersampling and oversampling Let us remind that the datasets under analysis are imbalanced: in the DR task we have 445 positive and 190 negative samples, but in other cases it is rather severe: in 32
the RF-DR task, we have 607 positive and only 27 negative samples. In this section, we use undersampling and oversampling methods to mitigate such dataset imbalance. Method DM RF-DR start-DR Original 0.5882 (0.07) 0.5924 (0.08) 0.5767 (0.03) Undersample 25% 0.5422 (0.05) 0.3298 (0.09) 0.5800 (0.05) Oversample 25% 0.6306 (0.05) 0.3476 (0.06) 0.5914 (0.06) Undersample and oversample 25% 0.6042 (0.05) 0.3294 (0.06) 0.6072 (0.03) Undersample 50% 0.6352 (0.05) 0.3369 (0.08) 0.5666 (0.05) Oversample 50% 0.5500 (0.08) 0.3335 (0.06) 0.5990 (0.03) Undersample and oversample 50% 0.6482 (0.04) 0.3542 (0.07) 0.5939 (0.03) Undersample 75% - - - Oversample 75% - - - Undersample and oversample 75% 0.6708 (0.06) - - Undersample 100% - - 0.6219 (0.04) Oversample 100% - - 0.6194 (0.05) Undersample and oversample 100% 0.5078 (0.03) - 0.6316 (0.02) Undersample 150% - - 0.5812 (0.07) Oversample 150% - - 0.6275 (0.03) Undersample and oversample 150% - - 0.5890 (0.06) Table 5.16: Performance comparison over undersampling and oversampling methods for DM, RF-DR and start-DR tasks The undersampling and oversampling methods used, and the results obtained with these methods are shown in the Table 5.16. For the DM task, where we have 136 positive samples and 635 negative, the best method is to undersample and oversample 75% of the sample difference from the two classes. For the RF-DR task, where we have 607 positive samples and 27 negatives, the best method is not to use any undersampling or oversampling. This result is not the one expected, because the RF-DR task is the one with the biggest data imbalance, but this could be due to the fact that we only have 27 samples for the minority class and maybe those are not enough to try an oversampling method (too many repeated samples), and the same for undersampling. For the start-DR task, where we have 136 positive samples and 445 negatives, the best method is to undersample and oversample 100% of the sample difference from the two classes. So the resulting dataset will have the same number of instances from each class. 33
5.4 Fine-tuning summary In this section, we summarize the best configurations obtained for each task. The data augmentation method used, orthogonal rotations, is not included because it is not tested for each task. The same happens with the method of pre-training on more similar data, where we decided that it did not yield good enough results, and therefore it was not taken into account for the exploration in the other tasks. Method DM DR RF-DR start-DR Architecture VGG16 VGG19 InceptionResNetV2 VGG16 Channel-wise Channel-wise Image type or Width-wise all (3x3 superficial, 3x3 superficial (6x6 superficial, concatenation image types 3x3 superficial, 6x6 superficial, 3x3 deep) 3x3 superficial Loss function Binary Binary Binary Binary Cross-entropy Cross-entropy Cross-entropy Cross-entropy Learning rate 1e−5 1e−5 1e−5 1e−5 Under and over sample Under and over 75% Under 25% None Under and over 100% Results 0.6708 (0.06) 0.7825 (0.02) 0.5924 (0.08) 0.6316(0.02) Table 5.17: Summary model configurations for each task The resulting AUC and standard deviation for each task (DM, DR, RF-DR, start-DR) are: 0.6708 (0.06), 0.7825 (0.02), 0.5924 (0.08) and 0.6316(0.02). 5.5 Feature extraction: results with the activations of the hidden layers In this section, the experiments of the feature extraction technique are reported. We present the experiments carried out using a pre-trained model as a feature extractor for our specific task. The chosen model, the choice of layers for feature extraction, the process followed, and, of course, the results obtained, are detailed. Through this analysis, we seek to understand how feature extraction has influenced the performance of our system and how it compares to the fine-tuning process, which was discussed in the previous sections. We use the same methodology that for the fine-tuning, namely cross-validation with 4 folds run twice with a total of 8 runs, except for the RF-DR task, where we use 3 folds and run 3 times. One fold is used for validation and the rest for training. For the pre-processing, we resize all the images to 256x256 and normalize the pixels values so that all the values are between 0 and 1. For the classifier, we use SVM. It is a supervised ML algorithm that can be used for both classification and regression challenges. It performs classification by finding the hyperplane that best divides a dataset into classes. SVM are a very popular and time honoured classifiers, being their main advantage their effectiveness in high dimensional 34
spaces, like the one our data reside on. The main disadvantage of SVM is its inability to directly provide probability estimates, and these are calculated using an expensive five-fold cross-validation. The probabilities are calibrated using Platt scaling (Platt 1999): logistic regression on the SVM’s scores, fit by an additional cross-validation on the training data. We need the probabilities to calculate the AUC. To perform the feature extraction, we took the data and passed it through the pretrained model, without training it. We removed the fully connected layers, which is a common practice on feature extraction; this is because these layers are usually very specific to the source task classes. For each sample, we take the output of each convolutional layer and perform spatial average pooling, so we take one value, the mean, for every filter (deep of the layer). With that, for each layer, we apply normalization over all the samples. After, because the dimensionality of extracted features is too big, we need to reduce the complexity without losing expressivity, so we discretize all the values to -1, 0 or 1. To choose the architecture, we used the models tried for the fine-tuning. Only VGG16 and VGG19 were selected for their good performance and their simplicity; inception based architectures are too complicated and have far too many layers; ResNet101 did not yield a good performance on the fine-tuning experiments. Once the best architecture is chosen, we tried using the fine-tuned version rained in the previous section. For the RF-DR task, we used the InceptionRedNetV2 architecture that we did not want to use for feature extraction, so we fine-tuned a model with a VGG16 architecture. The results obtained are reported in Table 5.18. Method DM DR RF-DR start-DR VGG16 0.7489 (0.03) 0.8043 (0.04) 0.8298 (0.05) 0.6633 (0.03) VGG19 0.7540 (0.02) 0.8065 (0.02) 0.8448 (0.04) 0.7009 (0.04) Fine-tuned 0.7763 (0.02) 0.8051 (0.02) 0.8665 (0.03) 0.6876 (0.05) Table 5.18: Results from feature extraction methods 5.6 Adding the clinical data Our experiments so far have only resorted to the images themselves. Now, we wanted to investigate whether the addition of patients’ clinical data improved the performance of the classifiers. To do it, for each task, we took the method with the best result. The objective was to add the clinical data to the feature vector obtained with the feature extraction, but, first, we had to select the clinical data to use and pre-process it appropriately. We have a dataset of patient’s clinical data obtained by a doctor through questioning the patient, or through the patient’s medical records. The future objective of all the work carried out with this dataset is to deploy an automation system for DR detection 35
tests. Although this final objective is beyond the scope of this work, we must work on the basis that this system can end up being deployed in a real environment. Therefore, we should not use data that could not straightforwardly be obtained by the doctor, given a well-defined protocol. The clinical attributes that we decided to use are: •Smoker: whether the patient is a smoker or not, or used to be •Age: patient age when the OCTA images were taken •BMI: Body Mass Index, a measurement of a person’s leanness or corpulence based on their height and weight •Ictus: whether the patient has had an ictus or not •Coronary heart disease: whether the patient has had a coronary hearth disease or not •Peripheral vascular disease: whether the patient has had a peripheral vascular disease or not •Arterial hypertension: whether the patient has arterial hypertension These clinical data were pre-processed. For the categorical variables (smoker), we used the one-hot-encoding technique; for the numerical variables (age and BMI), we normalized; and for the binary attributes (the rest), pre-processing was not required. This results in 10 attributes. Let us take a look at the correlation matrix in Figure 5.1. The class variable is the DR level of the patient. There is not much correlation between the clinical data variables and the objective variables. Too high correlation values could mean that there are conflicts between that variable and the objective. For example, if one of the selected variables was obtained from one or more target variables, it could not be used in the prediction model. The features extracted from the image have a size of 4,224 for VGG16 and 5,504 for VGG19. The clinical data only has 10 features, so, in order to give more importance to the clinical data, we first tried to reduce the number of image features. To do this, the number of layers from which information was taken was reduced. The CNNs that we have used (VGG16 and VGG19) are divided into blocks. Here we report an experiment in which we take the output of increasingly fewer blocks. We start with all of them (5); then we leave the first one and take only 4; then we leave the first two and so on until we only use the last one. We aim to find out how many blocks we can discard while retaining results. Figure 5.2 and Figure 5.3 show the architectures of VGG16 and VGG19, the layers that form it, and how the blocks are divided, taking into account that the FC layers have not been used. Notice that for both architectures, the number of blocks are the same (five). 36
Figure 5.4 shows the performance comparison across different numbers of layer blocks used for the DM task. Results are quite similar for five, four and three layer blocks, and then performance begins to decrease with two; therefore, the most parsimonious out of the good solutions (3 blocks) is kept. Which means 3840 features. In Figure 5.5, the same graphic for the DR task is shown. The performance is almost the same for every number of layer blocks used, so we keep one block, which means 2048 features. Figure 5.6 shows the results for the RF-DR task. The performance is the same for five, four, three and two, and starts decreasing at one. So we keep two layers, which means 3972 features. Finally, Figure 5.7 shows the results for the start-DR task. Here the results decrease when using just one layer’s block, so we keep two. That means 4096 Now that the number of layers to use for each task has been found, we perform feature extraction with the clinical data. The results of this experiment and the previous are shown in the Table 5.19. We see that the results obtained with this method improve those obtained previously for the DM, RF-DR and start-DR tasks. In the case of DM and start-DR, this improvement is very significant. DM and start-DR task have in common that both differentiate the class 0 (control class) from other classes, so we could conclude that the clinical data mostly helps to differentiate the 0 class from the rest. Method DM DR RF-DR start-DR VGG16 0.7489 (0.03) 0.8043 (0.04) 0.8298 (0.05) 0.6633 (0.03) VGG19 0.7540 (0.02) 0.8065 (0.02) 0.8448 (0.04) 0.7009 (0.04) Fine-tuned 0.7763 (0.02) 0.8051 (0.02) 0.8665 (0.03) 0.6876 (0.05) Adding data 0.9602 (0.01) 0.7919 (0.04) 0.8867 (0.05) 0.9545 (0.02) Table 5.19: Results from feature extraction methods with the clinical data 37
Figure 5.1: Clinical data correlation matrix Figure 5.2: VGG16 architecture 38
Figure 5.3: VGG19 architecture Figure 5.4: Task DM: feature extraction performance for different number of layers blocks used 39
Wilkinson, CP et al. (2003a). Proposed international clinical diabetic retinopathy and diabetic macular edema disease severity scales. Ophthalmology. Vol. 110(9), pp. 1677–1682. doi:10.1016/S0161-6420(03)00475-5. – (2003b). Proposed international clinical diabetic retinopathy and diabetic macular edema disease severity scales. Ophthalmology. Vol. 110(9), pp. 1677–1682. doi:10. 1016/S0161-6420(03)00475-5. Wong, TY et al. (2018). Guidelines on Diabetic Eye Care: The International Council of Ophthalmology Recommendations for Screening, Follow-up, Referral, and Treatment Based on Resource Settings. Ophthalmology. Vol. 125(10), pp. 1608–1622. doi: 10.1016/j.ophtha.2018.04.007. World Health Organization (n.d.). Diabetes.https : / / web . archive . org / web / 20130826174444/http://www.who.int/mediacentre/factsheets/fs312/en/. Accessed: 2023-03-20. Yasser, I. et al. (2022). Automated Diagnosis of Optical Coherence Tomography Angiography (OCTA) Based on Machine Learning Techniques.doi:10.3390/s22062342. url:https://doi.org/10.3390/s22062342. Zang, P et al. (2022). A Diabetic Retinopathy Classification Framework Based on Deep-Learning Analysis of OCT Angiography.doi:10.1167/tvst.11.7.10.url: https://pubmed.ncbi.nlm.nih.gov/35822949/. ZL, Teo, Tham YC, and Yu M et al. (2021). Global Prevalence of Diabetic Retinopathy and Projection of Burden through 2045: Systematic Review and Meta-analysis. Ophthalmology. Vol. 128, pp. 1580–1591. doi:10.1016/j.ophtha.2021.04.027. Zurita, Yazmina (2023). Predicting Diabetic Retinopathy in OCTA Images using a Deep Learning Framework.url:http://hdl.handle.net/2117/385009. 46