Diabetic Retinopathy Grade Detection using Convolutional Neural Networks (CNNs) and Transfer Learning techniques
- To automate the process of detecting the severity grades (grade 0 to grade 4) of Diabetic Retinopathy (DR) disease using Convolutional Neural Networks(CNN) with a better prediction than guessing.
- Experimentation with different data pre-processing techniques, parameters and hyperparameters related to the model (Parameters: configuration variables internal to the model, Hyperparameters: explicitly specified parameters that control the training), and model architectures and understanding how it affects the final effectiveness of predictions
- Implementing Filter, Kernel, Feature attribute, layer attribute visualization techniques for model explainability
Indian Diabetic Retinopathy Dataset (IDRID) - Disease Grading sub-section which consists of -
- Original color fundus images of human retina (516 images divided into train set (413 images) and test set (103 images) - JPG Files)
- Groundtruth Labels for Diabetic Retinopathy (Divided into train and test set - CSV File)
The dataset can be downloaded from this link: https://ieee-dataport.org/open-access/indian-diabetic-retinopathy-image-dataset-idrid
Before running the commands, make sure to change or set the directory names as necessary in all the relevant occurances of the "dir" variable across different modules.
-
Run main.py in the root directory using the command -
python3 main.py
- In order to run the different versions, the corresponding parameters in the main method of main.py have to be tweaked. Different options of changing parameters are mentioned as follows -
In the first part of the main method, the dataset parameters can be tweaked.
- batch_size and input_size can be changed.
- Cross validation, per image normalization, per dataset normalization and data augmentation can be activated.
Here, the model to be used for training and making predictions is initialized.
- A deep network can be imported through the sel parameter. ["sel" stands for selection.]
- If sel is None, the baseline CNN will be initialized.
The parameters of the network can be tuned by accordingly changing the following variables -
- The learning rate and number of epochs can be changed.
- The current optimizer is ADAM.
- The current loss function is the Cross Entropy Loss
- The save_name acts as an identifier and is very important. Two directories will be created according to save_name. The checkpoints and logs will be stored in these folders. If a save_name is used a second time, the results in the corresponding folders will be overwritten.
- The operation parameter can be used to change the type of operation. Currently 2 is selected which will train and test the model.
Once you are satisfied with the settings, simply run the main.py from the root directory:
python3 main.py
Baseline model accuracy: 30% (on an average of 20 runs)
Through the analysis, it was found that the Alexnet and Resnet18 transfer learning models with pretrained weights were the best ones in terms of accuracy as well as F1 score metrics and Resnet18 in particular provided the best overall improvement upon the baseline CNN model by providing more than 30% improvement over the baseline results.