This is the code to the MICCAI 2019 contribution:
"Assessing Reliability and Challenges of Uncertainty Estimations for Medical Image Segmentation" (Alain Jungo and Mauricio Reyes)
-
Install the required Python packages (we use Python version 3.6):
pip install -r requirements.txt
-
Get the BraTS 2018 and the ISIC 2017 dataset
- Adapt the dataset paths in the
./rechun/directories.py
file before you crate the datasets and run the training. - Run the preparation scripts (
./scripts
) - Run the training scripts (
./bin-dl/train*
).- (For auxiliary feat. this requires setting others/model_dir in the
./config/train_*_auxiliary_feat.yaml
configuration files )
- (For auxiliary feat. this requires setting others/model_dir in the
- Add the the model paths to the test configuration files (
./config
, model_dir entry) - Run the test scripts (
./bin-dl/test*
) - Add the prediction paths to the
./rechun/directories.py
file - Run the evaluation script (
./bin-eval/eval_uncertainty.py
) - Run the analysis scripts (
./bin-analysis
)
Training auxiliary segm. requires additional steps due to the cross-validation of the training set. Baseline predictions are required.
-
Train all the baseline_cv models (run
./bin-dl/*_train_default.py -config_id cv[0-4]
) -
Add the the model paths to the test configuration files (
./config
) -
Run the corresponding testing scripts
-
Manually copy all CV predictions into one prediction folder
-
Prepare auxiliary_segm training and prediction:
-
BraTS:
- add the common folder to
./rechun/directories.py
(BRATS_CV_PREDICT) - run
./splits/create_brats18_dataset.py --type train_with_predictions
- add the baseline prediction folder to
./rechun/directories.py
(BRATS_BASELINE_PREDICT) - run
./splits/create_brats18_dataset.py --type test_with_predictions
- add the common folder to
-
ISIC:
- add the common folder to
./config/train_isic_auxiliary_segm.yaml
(others/prediction_dir) - add the baseline prediction folder to
./config/test_isic_auxiliary_segm.yaml
(others/prediction_dir)
- add the common folder to
-
-
Continue at "step-by-step instructions" step 3 (run training script)
The code consists of code for data preparation, training and testing of the models, and evaluation scripts.
The project is structured as follows:
-
Data preparation
./scripts
: data preparation scripts for the BraTS 2018 and ISIC 2017 datasets- The prepared data will be stored in
./in/datasets
-
Training and testing
./bin-dl
: training and testing scripts (using the .yaml configuration files in./config
)./config
: .yaml configuration files for the different training and testing runs./config/splits
: split files defining the training/validation/test splits- The models will be stored in
./out/brats
and./out/isic
- The prediction output needs to be defined in the test configuration files
./config
-
Evaluation & Analysis
-
./bin-eval
: scripts that extract the information from the test images -
./bin-analysis
: scripts for analysis and plotting -
The evaluation .csv files will be saved in
./out/eval
and the plots in./out/plots
.
-
The ./rechun/dl
, ./rechun/eval
, ./rechun/analysis
folders contain code that supports the training/testing and evaluation/analysis.
The ./common
folder contains code that is used throughout the code and could be used in other projects.
The code runs on GPU. If you would like to run on CPU, you will need to change the device parameter string parameter passed to the Context
classes in the training and testing scripts (./bin-dl
).