Skip to content

Build 3D CNN to predict the presence of viral pneumonia in CT scans

License

Notifications You must be signed in to change notification settings

n1ghtf4l1/doctor-spork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doctor-spork

3D Image Classification from CT scans

3D CNN to predict the presence of viral pneumonia in CT scans

In this project, I have built a 3D convolutional neural network to predict the presence of viral pneumonia in computer tomography scans. 2D CNNs are commonly used to process RGB images (3 channels). A 3D CNN is simply the 3D equivalent: it takes as input a 3D volume or a sequence of 2D frames (e.g. slices in a CT scan), 3D CNNs are a powerful model for learning representations for volumetric data.

Dataset

A subset of the MosMedData: Chest CT Scans with COVID-19 Related Findings. This dataset consists of lung CT scans with COVID-19 related findings, as well as without such findings. Using the associated radiological findings of the CT scans as labels, I have built a classifier to predict presence of viral pneumonia. This task is a binary classification problem.

Run the following piece of code in jupyter notebook to access the dataset:

# Download url of normal CT scans.
url = "https://github.com/hasibzunair/3D-image-classification-tutorial/releases/download/v0.2/CT-0.zip"
filename = os.path.join(os.getcwd(), "CT-0.zip")
keras.utils.get_file(filename, url)

# Download url of abnormal CT scans.
url = "https://github.com/hasibzunair/3D-image-classification-tutorial/releases/download/v0.2/CT-23.zip"
filename = os.path.join(os.getcwd(), "CT-23.zip")
keras.utils.get_file(filename, url)

# Make a directory to store the data.
os.makedirs("MosMedData")

# Unzip data in the newly created directory.
with zipfile.ZipFile("CT-0.zip", "r") as z_fp:
    z_fp.extractall("./MosMedData/")

with zipfile.ZipFile("CT-23.zip", "r") as z_fp:
    z_fp.extractall("./MosMedData/")

It will create a folder MosMedData that should have 2 folders i.e CT-0 & CT-23 which should contain files in the Nifti format with .nii extension. Follow jupyter notebook from here.

References