CT Scan COVID-19 Diagnosis
🤖

CT Scan COVID-19 Diagnosis

Date
Dec 6, 2023
Tags
Machine Learning
Data Science
Data Analysis
Python

Description

COVID-19 has significantly impacted medical imaging practices, including the use of CT scans to assess lung complications in infected patients. These scans play a crucial role in diagnosing and monitoring the progression of respiratory symptoms associated with the virus. This project involves constructing a 2D Convolutional Neural Network (CNN) for the diagnosis of COVID-19 using Computed Tomography (CT) images, specifically by modifying the architecture of ResNet-18 or ResNet-50 for binary classification.
This project is part of Dr. Liang’s CSC646: Intro to Machine Learning class.

Tools

  1. PyTorch
  1. Pandas
  1. Numpy
  1. Scikit-image

Requirements

The project requires two methods to be conducted:
  1. Method 1: Train the CNN from scratch
  1. Method 2: Train the CNN using transfer learning
These methods are compared to determine the superior model and assess whether transfer learning provides benefits over training from scratch.
The test accuracy of both models must be greater than 90% and each model must be visualized using two Class Activation Mapping (CAM) methods.
Examples of CAM methods:

Data Sources

Method 1

Training, validation, and test losses and accuracies for each epoch
Training, validation, and test losses and accuracies for each epoch
Kernels of first convolutional layer
Kernels of first convolutional layer
Gradient of loss with respect to input
Gradient of loss with respect to input
GradCAM visualization
GradCAM visualization
EigenCAM visualization
EigenCAM visualization
HiResCAM visualization
HiResCAM visualization

Method 2

Training, validation, and test losses and accuracies for each epoch
Training, validation, and test losses and accuracies for each epoch
Kernels of first convolutional layer
Kernels of first convolutional layer
Gradient of loss with respect to input
Gradient of loss with respect to input
GradCAM Visualization
GradCAM Visualization
EigenCAM Visualization
EigenCAM Visualization
HiResCAM Visualization
HiResCAM Visualization

Results

notion image
In the comparison of the CNN trained from scratch and the CNN utilizing transfer learning, it is observed that both models exhibit similar performances based on the scores in the dataframe. The accuracy of the validation set is identical for both models. However, there is a dissimilarity in the accuracies of the test set, with the transfer learning model achieving a slightly higher score, approximately 0.005 greater than the model trained from scratch. Despite this difference, it can be deemed not significant. The evaluation based on accuracy alone does not reveal additional advantages for transfer learning.
Examining loss scores provides further insights. The model trained from scratch demonstrates lower loss scores, particularly on the validation set, indicating that its predictions are closer to the actual values than the transfer learning model. Moreover, sensitivity and precision scores for both models do not show substantial variations. In conclusion, considering these metrics collectively, both models are deemed to exhibit similar performances and learning capacities.
The CNN trained from scratch reached its optimal performance at epoch 19, while the transfer learning CNN achieved its best epoch at 39. This indicates that the CNN from scratch converged faster, learning underlying patterns in the data more rapidly during training compared to the transfer learning CNN.
The determination of the "better" model depends on the specific capacity, needs, and requirements of the application or task at hand. While the CNN from scratch displayed faster pattern recognition during training, both models exhibited similar performances. However, it's essential to acknowledge that training models from scratch can be time-consuming and computationally expensive. In contrast, transfer learning offers a potential advantage by reducing training time and the required computational resources.
 

👋🏻 Let’s chat!

If you are interested in working with me, have a project in mind, or just want to say hello, please don't hesitate to contact me.

Find me here 👇🏻

notion image
Please do not steal my work. It took uncountable cups of coffee and sleepless nights. Thank you.