This project is designed to use transfer learning to classify COVID-19 by lung CT scan. The pre-train weight and the following models in Keras applications is being applied :
- ResNet50V2
- Xception
- DenseNet201
- MobileNetV2
This project is originally designed for "INFORMS 2020 QSR Data Challenge - CT Scan Diagnosis for COVID-19". The dataset is provided by competition organizer. To accesss dataset, you can follow the guildline in challenge website or here.
Number of COVID : 251
Number of NonCOVID : 292
Total data : 543
CT COVID(left), CT Non-COVID(right)
Model | Percision | Sensitivity | Specificity | F1 score | Accuracy |
---|---|---|---|---|---|
ResNet50V2 | 0.94 | 0.94 | 0.93 | 0.94 | 0.94 |
Xception | 0.91 | 0.90 | 0.925 | 0.91 | 0.91 |
DenseNet201 | 0.96 | 0.96 | 0.93 | 0.96 | 0.96 |
MobileNetV2 | 0.94 | 0.95 | 0.925 | 0.94 | 0.94 |
def load_train():
dir = "Images-processed" # your file directory
covid_dir = dir+"/CT_COVID/"
noncovid_dir = dir+"/CT_NonCOVID/"
def estimate(X_train, y_train, back_bone):
IMAGE_WIDTH = 224 # Image width
IMAGE_HEIGHT = 224 # Image height
input_shape = (IMAGE_WIDTH, IMAGE_HEIGHT, 3) # (width, height, channel) channel = 3 ---> RGB
batch_size = 8 # Batch size
epochs = 40 # Number of epochs
ntrain = 0.8 * len(X_train) # Split data with 80/20 train/validation
nval = 0.2 * len(X_train)
X_train, X_val, y_train, y_val = train_test_split( # 20% validation set
x, y_train, test_size=0.20, random_state=2)
Step 1. Execute Model.py in terminal.
python3 Model.py
Step 2. Select transfer learning model by input model's name. For example, in the following, we choose ResNet50V2 as the transfer learning model.
select transfer learning model:
1.ResNet50V2 2.Xception 3.DenseNet201 4.MobileNetV2 :
ResNet50V2
demo.ipynb : Example of transfer learning model using DenseNet201
Chun Yu Wu - ericchunyuwu@gmail.com
Kao-Feng Hsieh - hsiehkaofeng@gmail.com