a b/README.md
1
# ct-net-models
2
3
![Logo](ct-net-models-logo-small.png)
4
5
## Description
6
7
This repository contains Python code to train and evaluate convolutional neural network models (CNNs)
8
on the task of multiple abnormality prediction from whole chest CT volumes.
9
Our model CT-Net83 achieves state of the art performance on this task
10
and is described in detail in our [Medical Image Analysis paper](https://doi.org/10.1016/j.media.2020.101857).
11
The paper is also available [on arXiv](https://arxiv.org/ftp/arxiv/papers/2002/2002.04752.pdf).
12
The models are implemented in PyTorch.
13
14
On the RAD-ChestCT data set of 36,316 volumes
15
from 19,993 patients, CT-Net83 achieves a test set AUROC >0.90 for 18 abnormalities,
16
with an average AUROC of 0.773 across 83 abnormalities. 
17
18
If you find this work useful in your research, please consider citing us:
19
20
Draelos R.L., et al. "Machine-Learning-Based Multiple Abnormality Prediction with Large-Scale Chest Computed Tomography Volumes." *Medical Image Analysis* (2020).
21
22
## Requirements
23
24
The requirements are specified in *ctnet_environment.yml* and include
25
PyTorch, numpy, pandas, sklearn, scipy, and matplotlib.
26
27
To create the conda environment run:
28
29
`conda env create -f ctnet_environment.yml`
30
31
The code can also be run using the Singularity container defined [in this repository](https://github.com/rachellea/research-container).
32
33
## Usage
34
35
To run a demo of the CT-Net83, CT-Net9, BodyConv, 3DConv, and ablated CT-Net models on
36
fake data, run this command:
37
38
`python main.py`
39
40
The RAD-ChestCT data set [is publicly available on Zenodo](https://zenodo.org/record/6406114).
41
42
Because the real dataset is large, currently this repository includes fake data files to enable demonstrating
43
the code and the required data formats. The fake data is located in *load_dataset/fakedata*.
44
The fake CTs were generated as follows: 
45
46
```
47
fakect = np.random.randint(low=-1000,high=1000,size=(10,10,10))
48
np.savez_compressed('FAKE000.npz',ct=fakect)
49
```
50
51
Note that 10 x 10 x 10 is too small for a real CT scan; the CT scans
52
in the RAD-ChestCT data set are on the order of 450 x 450 x 450 pixels.
53
54
## Organization
55
56
* *main.py* contains the experiment configurations needed to replicate the
57
results in the paper. The command `python main.py` will run a demo of the
58
CT-Net83, CT-Net9, BodyConv, 3DConv, and ablated CT-Net models on
59
fake data.
60
* *run_experiment.py* contains code for training and evaluting the models.
61
* *evaluate.py* contains code for calculating, organizing, and plotting performance
62
metrics including AUROC and average precision.
63
* *unit_tests.py* contains some unit tests. These tests can be run via `python unit_tests.py`
64
* *load_dataset/custom_datasets.py* contains the PyTorch Dataset class for the CT data.
65
* *load_dataset/utils.py* contains the code for preparing individual CT volumes, including
66
padding, cropping, normalizing pixel values, and performing data augmentation through
67
random flips and rotations.
68
* *load_dataset/fakedata* contains the fake data necessary to run the demo.
69
* *models/custom_models_ctnet.py* contains the CT-Net model definition.
70
* *models/custom_models_alternative.py* contains two alternative architectures,
71
BodyConv and 3DConv.
72
* *models/custom_models_ablation.py* contains the ablated variants of CT-Net.
73
74
## Comment on Data Parallelism
75
76
Currently the experiments in *main.py* are set up to replicate the paper results.
77
Several of the experiments use data parallelism which assumes that at least
78
2 GPUs are available. If you wish to run the demo on one GPU, then change batch_size to 1
79
and set data_parallel to False.
80
81
### Logo
82
83
The logo includes two Creative Commons icons from the Noun Project: [lungs](https://thenounproject.com/search/?q=chest+x+ray&i=945146) and
84
[gear](https://thenounproject.com/search/?q=AI&i=3092014).