Skip to content

Chest X-Ray Image classification using PyTorch.

License

Notifications You must be signed in to change notification settings

zwimpee/CXResnet

Repository files navigation

CXResnet

This project is an attempt to produce an image classification model that can distinguish between chest X-rays labeled as either normal, pneumonia, or COVID-19. Although performance would likely be optimal using a pretrained model, the model to be trained here will have an architecture built from custom components created through subclassing PyTorch's nn.Module.

Requirements

  • determine complete set of dependencies

Usage

  • create useage guide for reproducing and modifying project

Project procedures and results


Motivation and Background

The COVID-19 pandemic has presented seemingly all areas of society with a host of new and unprecedented challenges, many of which are faced in the healthcare field. While many people living in developed countries are fortunate enough to have relatively easy access to testing, those living in developing or impoverished countries may not be afforded this same luxury.

The virus, however, does not discriminate, and therefore additional tools are needed to aid in diagnosing infected patients when the number of tests available are limited (or perhaps even nonexistent). This project explores the use of neural network image classification models as a potential tool in such situations.

With that being said it is important to acknowledge that a predictive model by itself might not be the most useful tool for healthcare professionals, even for a model with excellent predictive power. This is especially true for a neural network model by itself, which can leave much to be desired with respect to the interpretability of the results. Therefore the primary goals for this project is to provide both a predictive model with a nontrivial degree of predictive power, and an intuitive communication of what the model "sees" when making its predictions. The latter will be achieved using the Captum library for PyTorch model interpretability.

For those without any prior medical training such as myself, it might be useful to know some basics on reading chest X-rays. Here are some resources I used while working on this project for those who might be interested.


Data wrangling

  • Summarize data sources, and processing

Model Architecture

  • Get simple visual representation of model architecture

Training

Tracked Model Training

alt text


Testing

Classification ReportConfusion Matrix
Class Precision Recall F1-Score Support
COVID 0.95 0.94 0.94 256
Normal 0.92 0.96 0.94 654
Pneumonia 0.97 0.95 0.96 935

Confusion Matrix

Performance Metrics
Metric Score
Accuracy 0.9507
Balanced Accuracy 0.9481
Balanced Accuracy Weighted 0.9507
ROC AUC 0.9919
Macro F1-Score 0.9479
Micro Average F1 0.9507
  • Discuss model performance on holdout test data

Insight and Interpretability

  • Show and discuss results of input attribution obtained using Captum

alt text alt text


References

This reference's dataset files are licensed under CC BY 4.0

SAIT, UNAIS; k v, Gokul Lal; Prajapati, Sunny; Bhaumik, Rahul; Kumar, Tarun; S, Sanjana; Bhalla , Kriti
(2020), “Curated Dataset for COVID-19 Posterior-Anterior Chest Radiography Images (X-Rays).”,
Mendeley Data, V1, doi: 10.17632/9xkhgts2s6.1
Cleverley Joanne, Piper James, Jones Melvyn M.
The role of chest radiography in confirming covid-19 pneumonia
BMJ 2020; 370 :m2426
A Characteristic Chest Radiographic Pattern in the Setting of COVID-19 Pandemic
David L. Smith, John-Paul Grenier, Catherine Batte, and Bradley Spieler
Radiology: Cardiothoracic Imaging 2020 2:5
Rousan, L.A., Elobeid, E., Karrar, M. et al.
Chest x-ray findings and temporal lung changes in patients with COVID-19 pneumonia.
BMC Pulm Med 20, 245 (2020). https://doi.org/10.1186/s12890-020-01286-5

About

Chest X-Ray Image classification using PyTorch.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages