This Repository contains code of our work on Segmenting Lung CT Images and classifying Interstitial Lung Diseases Using Deep Learning.
Lung_Classification: Contains code for lung disease classification.
Lung_Segmentation: Contains code for lung segmentation.
Figures: Plots generated for the paper
example_notebooks: Contains example notebooks for both above tasks, which can be downloaded and run with user-data.
┣ Root
┣ Lung_Classification
┃ ┣ data_helpers.py # Preprocessing and loading data for model input and evaluation
┃ ┣ dicom_utils.py # Helper script to convert dicom images to numpy arrays or pngs
┃ ┣ eval.py # Helper script for evaluating model on unseen data,and visualizing metrics and plots like ROC curve
┃ ┣ models.py # Classifier model for the classification task, plus an Autoencoder (**Under development**)
┃ ┗ train.py # Helper script for training model on data processed using data_helpers.py,and saving the model
┣ Lung_Segmentation
┃ ┣ data_helpers.py # Preprocessing and loading data for model input and evaluation
┃ ┣ eval.py # Helper script for evaluating model on unseen data
┃ ┣ loss.py # Loss functions used in the model training
┃ ┣ metrics.py # Collection of segmentation metrics including mIOU, Dice, Tversky loss and Focal loss.
┃ ┣ models.py # Segmentation models used in the paper (**Under development: Hyper-parameter tuning using RayTune**)
┃ ┣ train.py # Helper script for training model on data processed using data_helpers.py,and saving the model (Segmentation)
┃ ┣ utils.py # Miscellenous functions used as utility functions
┃ ┗ visualize_helpers.py # Script to visualize model predictions
┣ README.md
┗ requirements.txt
pip install -r requirements.txt
get_names(path)
for name in names:
final_image = convert_dcm_jpg(cdir, name)
final_image.save(out_dir + '/' + name + '.jpg')
We used a multimedia collection of cases with interstitial lung diseases (ILDs) built at the University Hospitals of Geneva (HUG). The dataset contains high-resolution computed tomography (HRCT) image series with three-dimensional annotated regions of pathological lung tissue along with clinical parameters from patients with pathologically proven diagnoses of ILDs. The library contains 128 patients affected with one of the 13 histological diagnoses of ILDs, 108 image series with more than 41liters of annotated lung tissue patterns as well as a comprehensive set of 99 clinical parameters related to ILDs. The database is available for research on request and after signature of a license agreement. A comprehensive description of the dataset can be found in this paper. For detailed instructions please visit this webpage.
Training: 256x256 reshaped validation: 256x256 reshaped
Model | Batch_Size | mIOU | DSC | Accuracy | Google Drive |
---|---|---|---|---|---|
UNET | 10 | 0.8280 | 0.8604 | 0.9848 | Download |
Attn_UNET | 10 | 0.8394 | 0.8708 | 0.9901 | Download |
R2_UNET | 10 | 0.9191 | 0.8811 | 0.9934 | Download |
Attn_R2_UNET | 10 | 0.8523 | 0.9263 | 0.9913 | Download |
precision | recall | f1-score | support | |
---|---|---|---|---|
HP | 0.97 | 0.93 | 0.95 | 82 |
IPF | 0.92 | 0.97 | 0.94 | 67 |
Accuracy | 0.95 | 149 | ||
macro avg | 0.94 | 0.95 | 0.95 | 149 |
weighted_avg | 0.95 | 0.95 | 0.95 | 149 |
precision | recall | f1-score | support | |
---|---|---|---|---|
HP | 0.97 | 0.93 | 0.95 | 82 |
IPF | 0.92 | 0.97 | 0.94 | 67 |
Accuracy | 0.95 | 149 | ||
macro avg | 0.94 | 0.95 | 0.95 | 149 |
weighted_avg | 0.95 | 0.95 | 0.95 | 149 |
Todo
Add a Variational Autoencoder implementation