Giter Club home page Giter Club logo

covid-seg's Introduction

A Deep Ensemble Learning Approach to Lung CT Segmentation for COVID-19 Severity Assessment

Training

python main_train.py --config <config_path> --exp_name <exp_name> --run_name <run_name> --tag_name <tag_name> --batch_size <batch_size>
--num_epochs <epochs1 epochs2 epochs3> --seed <training_seed> --visible_gpu <gpu_num> --checkpoint_subdir <checkpoint_path> --log_subdir <log_path> 
--Starting_ckpt <num> --Weights_Cross_Entropy_Loss <w1 w2 w3 w4> --Weights_Dice_Loss <w1 w2 w3 w4> --Weights_Coeff <lambda> --quiet

Training variables

--config

Path to the configuration file.

The configuration file contains most of the variables necessary for running - hyperparameters model, locally relative path, etc. Please insert the following path in the config file to run training:

  1. data_path: the path to the data directory
  2. train_folders: a list contains 3 lists -
    a. The first list is of folders with raw CT data
    b. The second list is of folders with lung masks
    c. The third list is of folders with full masks
    *The three lists need to be of the same length and to correspond with each other, e.g., the i-th element of each list is a folder of CT, lung-segmentation & full segmentation of the same images.
    For example the following folders:
data_path
|-- ct_folder_A
|   |-- file_1.nii
|   |-- file_2.nii
|   `-- file_3.nii
|-- lung_mask_folder_A
|   |-- file_1.nii
|   |-- file_2.nii
|   `-- file_3.nii
|-- full_mask_folder_A
|   |-- file_1.nii
|   |-- file_2.nii
|   `-- file_3.nii
|-- ct_folder_B
|   |-- file_1.nii
|   `-- file_2.nii
|-- lung_mask_folder_B
|   |-- file_1.nii
|   `-- file_2.nii
`-- full_mask_folder_B
    |-- file_1.nii
    `-- file_2.nii

will be resolved into the list of lists:
[["ct_folder_A", "ct_folder_B"],
["lung_mask_folder_A", "lung_mask_folder_B"],
["full_mask_folder_A", "full_mask_folder_B"]].
Notice that within each folders triplet, the files are sorted correspondingly. 3. test_folders: same as train_folders for the test files. If a segmentation does not exist, replace its corresponding value with null. 4. results_dir: the path to an output directory, all outputs will be saved in that directory under the experiment name. 5. checkpoint_dir: used for loading a trained model. 6. Starting_ckpt: if null - initializes from scratch, if -1 initializes the latest checkpoint, otherwise - initialize the specific checkpoint number provided (assuming the file exists). 7. log_dir: the path to the directory for logs.

--exp_name

Experiment name

--run_name

A run name for tensorboard usage

--tag_name

A tag name for tensorboard usage

--batch_size

Batch size in training

--num_epochs

Number of epochs in training

--seed

If not set, random seed

--visible_gpu

Set the available GPU for running

--checkpoint_subdir

Set the path to the subdirectory to save checkpoints

--log_subdir

set the path to the subdirectory to save logs

--Starting_ckpt

To continue training, Restores checkpoints, -1 for latest

--Weights_Cross_Entropy_Loss

Set Weights for CE loss, during runtime the weights are normalized to the sum of one

--Weights_Dice_Loss

Set Weights for Dice loss, during runtime the weights are normalized to the sum of one

--Weights_Coeff

Set Lambda Coeff between CE & Dice losses

--quiet

for debug usage, if the flag is set - use minimal debug outputs.

*All of the arguments' default values can be provided in the config file.

Evaluation using One Model

python main_inference.py --config <config_path> --visible_gpu <gpu_num> --checkpoint_dir <checkpoint_path> --save_output <output_path>

Evaluation variables

--config

Same as described in the training variables.

--visible_gpu

Set the available GPU for running

--checkpoint_dir

Set the path for the trained model checkpoints, load the last checkpoint

--save_output

Set the path for the output directory, save model prediction in the hierarchy of the test data path

Evaluation using Model Ensemble

python main_inference.py --config <config_path> --visible_gpu <gpu_num> --checkpoint_dir <checkpoint_path> --ensemble_from <path1 path2 path3 ...> --save_output <output_path> --ensemble

Evaluation variables

--config

Same as described in the training variables.

--visible_gpu

Set the available GPU for running

--checkpoint_dir

Mother directory for all ensemble experiments.

--ensemble_from

Set the path for the trained models' checkpoints used from the ensemble, load the last checkpoint. The mother directory is checkpoint_dir. Each directory of the experiment must contain a "Checkpoints" folder with the corresponding model checkpoints.

--save_output

Set the path for the output directory, save model prediction in the hierarchy of the test data path.

SUMC Data & Additional Annotations

The SUMC data and additional annotations from the paper are provided under the tags of this repository - Data

Citation

If you find either the code or the data useful for your research, cite our paper:

@inproceedings{benhaim2022covidseg,
title={A Deep Ensemble Learning Approach to Lung CT Segmentation for COVID-19 Severity Assessment},
author={Ben-Haim, Tal and Sofer, Ron Moshe and Ben-Arie, Gal and Shelef, Ilan and Riklin-Raviv, Tammy},
booktitle={IEEE International Conference on Image Processing (ICIP)},
year={2022}
}

covid-seg's People

Contributors

talbenha avatar

Stargazers

Kimani Kanyutu P. avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.