This repository contains the implementation of paper "Multi-label detection of ophthalmic disorders using InceptionResNetV2 on multiple datasets".
Recently, AI-based methods have been extensively used to help in the process of diagnosing eye diseases due to their prevalence. The available implementation can diagnose 8 different eye dieases from a medical fundus image of the eye.
Clone the repo:
git clone https://github.com/Asiyeh-Bahaloo/eye_disease.git
Then cd into the repository:
cd eye_disease
This project has a proper docker-compose and docker-file for both development and production purposes. If you are familiar with Docker and have it installed, run the command below:
sudo docker-compose -f docker-compose.dev.yml up
If you are more used to Python environments, then you can install all the dependencies with:
pip install -r requirements.dev.txt
Now, you can generate a detailed document about the implementation with:
cd docs/sphinx
sphinx-build -b html ./source ./build
Every training and validation experiment has its own script in the script folder. They work in the same manner, so here is an example to train the model:
python scripts/train_xception_imp.py \
--batch_size 32 --epochs 0 --pre_epochs=100 --patience 8 --loss "binary_crossentropy" \
--imgnetweights "True" --data_train "/data/ODIR-5K_Training_Dataset" --data_val "path_to_ODIR-5K_VAL_Dataset" \
--train_label "path_to_odir_train.csv" --val_label "path_to_odir_val.csv" \
--result "path_to_save_results" --learning_rate 0.05 \
--LR_type "other" --LR_decay_rate 0.95 --LR_decay_step 50 \
--decay_rate 1e-6 --momentum_rate 0.9 --nesterov_flag "True" \
--exp "exp name" --bg_scale 350 --shape 224 --keep_AR "False" \
--data_frac 1 --ES_mode "min" --ES_monitor "val_loss" --ES_verbose 1 \
--Auth_name "Your Name" --desc "experiment_desciption" \
--dropout_rate 0.25 --weight_decay_rate 0.3
This project uses MLflow to keep records of experiments. So after training, you can call the Mlflow UI to see the important diagrams:
mlflow ui --backend-store-uri path_to_mlflow_folder
The proposed architecture is shown in the image below: We trained and compared five different base models for this experiment:
- VGG16
- VGG19
- Resnet_V2
- Inception_V3
- Xception Please read the paper for more information about the methodology.
We have used and combined two datasets to train our models:
-
ODIR_2019 dataset (download):
This dataset is a real-life set of patient information collected by Shanggong Medical Technology Co., Ltd. from different hospitals and medical centers in China. In these institutions, fundus images are captured by various cameras on the market, such as Canon, Zeiss, and Kowa, resulting in varied image resolutions. -
Cataract dataset (download): Cataract and normal eye images dataset for cataract detection.
After exploring datasets, we used some preprocessing techniques to improve images:
- Resize images: We resized images to 224*224 pixels.
- Remove padding: We removed the padding around the fundus image and cropped the uninformative area to better detect lesions.
- Ben Graham Method: Ben Graham (the Kaggle competition's winner) shares insightful ways to improve lighting conditions. Here, we applied his idea, and we could see many important details in the eyes much better.
The Resnet_V2 model with XGboost head has performed the best among other models, with a validation final score of 0.677%. Here is the evaluation result with 5896 training images and 655 validation images. For more details about configuration details, please refer to the paper.
Training:
accuracy | auc | loss | precision | recall |
---|---|---|---|---|
0.9511 | 0.9771 | 0.1249 | 0.8721 | 0.7449 |
Validation:
accuracy | auc | loss | precision | recall |
---|---|---|---|---|
0.8403 | 0.7779 | 0.5965 | 0.3778 | 0.3559 |