The recent COVID-19 pandemic is a major threat to the global population. The healthcare sectors are struggling to cope with rising daily cases due to limited medical supply and lack of facilities. Therefore, there is a need for an alternative efficient diagnosis method for detecting COVID-19. Usually, patients with COVID-19 have a characteristic abnormality in the chest radiography. The use of Chest X-rays not only identifies these abnormalities but also results in a faster diagnosis. In this project, with the aid of transfer learning methods, a convolutional neural network (CNN) architecture-based VGG16 model pre-trained on the ImageNet dataset is used to diagnose patients with COVID-19. The proposed model is trained and tested using a publicly available chest X-ray database. A python-based graphical user interface (GUI) is developed to classify a given chest X-ray either as COVID positive or COVID negative. By proper hyper-parameter tuning, the model is able to provide a training accuracy of 98.72%.
3. 1.Objective
i.To use tranfer learning method to solve binary classification
probem of classifying chest X-ray images as COVID-19 or
normal.
ii.To develope a GUI that will use the trained model to
predict a new chest X-ray image as COVID-19 or normal.
4. 2.Algorithm 1
Binary classification of chest X-ray images as COVID-19 positive or normal
i.Load dataset:
●
Run the python program in terminal and pass the dataset as commandline
argument (python train.py --dataset dataset).
ii.Pre-processing:
●
Read the images in dataset (cv2.imread()).
●
Swap color channels of images (cv2.COLOR_BGR2RGB)
●
Resize the images to 224x224 pixels (cv2.resize)
●
Perform one-hot encoding on the labels.(LabelBinarizer())
●
Store the images and labels in numpy arrays.
5. iii.Model architecture:
●
Define hyperparameters- learning rate, batch size, and number of epochs.
●
Partition the dataset into training and testing sets.(train_test_split())
●
Load the VGG16 as base model with weights pre-trained on ImageNet and excluding the
ImageNet classifier on top
●
Construct the new model to be placed on top of base model.
●
Freeze the base model inorder to stop updating the layers in base model during the
process of training.
iv.Model evaluation:
●
Compile the model with ADAM optimizer and binsry crossentropy as loss function.
●
Train model with training dataset and evaluate with testing dataset.
●
Plot training loss and accuracy on dataset vs number of epochs.
●
Plot the confusion matrix.
●
Save the model on disk.
6. Algorithm 2
Classification of new chest X-ray images as COVID-19 positive or normal by GUI:
i.Image selection:
●
Run the python program in terminal and pass the previously saved model as a
commandline argument (python gui.py --model model)
●
Press the “Load ” button in the GUI to browse for the location of new chest X-ray
image we want to predict.
ii.Pre-processing:
●
Read the image from its path location (cv2.imread()).
●
Swap color channels of images (cv2.COLOR_BGR2RGB)
●
Resize the images to 224x224 pixels (cv2.resize)
●
Change the image to numpy array.
iii.Label prediction:
●
Predict the label for the new image by passing it to previously evaluated model.
●
Display the new image and its predicted label. (cv2.imshow())
7. 3.Dataset
Figure 1. Chest X-ray image for (a) normal person, and (b) COVID-19 person.
#COVID-19 positive #COVID-19 negative
Dataset 1 (Large) 219 1341
Dataset 2 (Small) 25 25
8. 4.Model architecture
Figure 2. Architecture of VGG16 model
Figure 3. Schematic representation for diagnosis of COVID-19 from chest X-ray image
9. Layer Type Output shape Activation
Input image Input layer [224,224,3] -
VGG16 Functional [7,7,512] ReLU
Average Pooling Average [3,3,512] -
Flatten - 4608 -
Fully connected - 64 ReLU
Fully connected - 2 Softmax
Table 1: Architecture of modified VGG16 model
Hyperparameters:
●
Learning rate=
●
Batch size= 8
●
Number of epochs= 25
10− 3
12. Figure 4. GUI to classify any chest X-ray image as
COVID -19 positive or negative
Figure 5. Chest X-ray image classification result by the GUI for,
(a) COVID-19 positive, and (b) COVID-19 negative
13. 6.Future work
1. GPU programming to handle more computation.
2. Visual explanation of Deep learning networks predictions.
3. Identify specific biomarkers for COVID-19 in chest X-rays.