This repository contains code and results for COVID-19 classification assignment by Deep Learning Spring 2020 course offered at Information Technology University, Lahore, Pakistan. This assignment is only for learning purposes and is not intended to be used for clinical purposes.
The code was run on Google Colab using Pytorch.
The dataset used is a binary dataset containing 2 classes: "Infected" and "Normal". The infected class has images of chest X-rays of Pneumonia and Covid-19 infected people while the normal class has normal chest x-ray images.
The dataset can be found by following the below link: https://drive.google.com/a/itu.edu.pk/uc?id=1-HQQciKYfwAO3oH7ci6zhg45DduvkpnK
The dataset can be found by following the below link: https://drive.google.com/file/d/1eytbwaLQBv12psV8I-aMkIli9N3bf8nO/view?usp=sharing
The pretrained version of VGG16 on Imagenet dataset was used.
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) was set to OFF. Only the final 2 FC layers were fine-tuned.
The trained model can be found at models/vgg16/exp1/vgg16_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) except the last convolution layer was set to OFF. So, last convolutional layer and the final 2 FC layers were fine-tuned.
The trained model can be found at models/vgg16/exp2/vgg16_1C_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) except the last 6 convolution layer was set to OFF. So, last 6 convolutional layers and the final 2 FC layers were fine-tuned.
The trained model can be found at models/vgg16/exp3/vgg16_6C_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- All of the network was fine-tuned.
The trained model can be found at models/vgg16/exp4/vgg16_AC_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The pretrained version of Resnet18 on Imagenet dataset was used.
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) was set to OFF. Only the final 2 FC layers were fine-tuned.
The trained model can be found at models/Resnet18/exp1/vgg16_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) except the last layer (group of further convolutional layers) was set to OFF. So, last convolutional layer and the final 2 FC layers were fine-tuned.
The trained model can be found at models/Resnet18/exp2/vgg16_1C_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- The training of the convolution layers (feature layers) except the last 3 layers (each layer is a group of further convolutional layers) was set to OFF. So, last 3 convolutional layers and the final 2 FC layers were fine-tuned.
The trained model can be found at models/Resnet18/exp3/vgg16_6C_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
The following changes were made:
- The FC layers were removed. They were replaced with two layers. One having 470 neurons and other 2 (the output layer).
- All of the network was fine-tuned.
The trained model can be found at models/Resnet18/exp4/vgg16_AC_2FC.pth
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
The testing confusion matrix is given below:
In this experiment the pretrained VGG16 was taken and was fine-tuned end to end. Only the last layer was changed in order to predict 3 classes. This was taken as a multilabel classification. BCEWithLogitsLoss was used.
The trained model can be found at https://drive.google.com/open?id=1i25ZmybjtOLiWvRx636wkDZRT97Ev89a
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
In this experiment the pretrained VGG16 was taken and was fine-tuned end to end. Only the last layer was changed in order to predict 3 classes. This was taken as a multilabel classification. Focal Loss was used.
The trained model can be found at https://drive.google.com/open?id=1i25ZmybjtOLiWvRx636wkDZRT97Ev89a
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
In this experiment the pretrained Resnet18 was taken and was fine-tuned end to end. Only the last layer was changed in order to predict 3 classes. This was taken as a multilabel classification. BCEWithLogitsLoss was used.
The trained model can be found at https://drive.google.com/open?id=1i25ZmybjtOLiWvRx636wkDZRT97Ev89a
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below:
In this experiment the pretrained resnet18 was taken and was fine-tuned end to end. Only the last layer was changed in order to predict 3 classes. This was taken as a multilabel classification. Focal Loss was used.
The trained model can be found at https://drive.google.com/open?id=1i25ZmybjtOLiWvRx636wkDZRT97Ev89a
The training and validation accuracies and loss are given as:
The training confusion matrix is given below:
The validation confusion matrix is given below: