/HDC-Net

HDC-Net: Hierarchical Decoupled Convolution Network for Brain Tumor Segmentation

Primary LanguagePythonApache License 2.0Apache-2.0

HDC-Net: Hierarchical Decoupled Convolution Network for Brain Tumor Segmentation

This repository is the work of "HDC-Net: Hierarchical Decoupled Convolution Network for Brain Tumor Segmentation" based on pytorch implementation.The multimodal brain tumor dataset (BraTS 2018) could be acquired from here.

HDC-Net

Architecture of HDC-Net

Requirements

  • python 3.6
  • pytorch 0.4 or 1.0
  • nibabel
  • pickle
  • imageio
  • pyyaml

Implementation

Download the BraTS2018 dataset and change the path:

experiments/PATH.yaml

the dataset structure:

BraTS_2018/MICCAI_BraTS_2018_Data_Training/HGG/Brats18_2013_2_1:
├── MICCAI_BraTS_2018_Data_Training
    ├── HGG
        ├── Brats18_2013_2_1
            ├── Brats18_2013_2_1_flair.nii.gz
            ├── Brats18_2013_2_1_seg.nii.gz
            ├── Brats18_2013_2_1_t1.nii.gz
            ├── Brats18_2013_2_1_t1ce.nii.gz
            ├── Brats18_2013_2_1_t2.nii.gz
        ├── Brats18_2013_2_2
            ├── Brats18_2013_2_2_flair.nii.gz
            ├── Brats18_2013_2_2_seg.nii.gz
            ├── Brats18_2013_2_2_t1.nii.gz
            ├── Brats18_2013_2_2_t1ce.nii.gz
            ├── Brats18_2013_2_2_t2.nii.gz
        ├── ...
    ├── LGG
        ├── Brats18_2013_0_1
            ├── Brats18_2013_0_1_flair.nii.gz
            ├── Brats18_2013_0_1_seg.nii.gz
            ├── Brats18_2013_0_1_t1.nii.gz
            ├── Brats18_2013_0_1_t1ce.nii.gz
            ├── Brats18_2013_0_1_t2.nii.gz
        ├── Brats18_2013_1_1
            ├── Brats18_2013_1_1_flair.nii.gz
            ├── Brats18_2013_1_1_seg.nii.gz
            ├── Brats18_2013_1_1_t1.nii.gz
            ├── Brats18_2013_1_1_t1ce.nii.gz
            ├── Brats18_2013_1_1_t2.nii.gz
    ├── ...
├── MICCAI_BraTS_2018_Data_Validation
    ├── Brats18_CBICA_AAM_1
        ├── Brats18_CBICA_AAM_1_flair.nii.gz
        ├── Brats18_CBICA_AAM_1_t1.nii.gz
        ├── Brats18_CBICA_AAM_1_t1ce.nii.gz
        ├── Brats18_CBICA_AAM_1_t2.nii.gz
    ├── Brats18_CBICA_ABT_1
        ├── Brats18_CBICA_ABT_1_flair.nii.gz
        ├── Brats18_CBICA_ABT_1_t1.nii.gz
        ├── Brats18_CBICA_ABT_1_t1ce.nii.gz
        ├── Brats18_CBICA_ABT_1_t2.nii.gz
    ├── ...
  • shape(240, 240, 155)
  • spacing(1, 1, 1)
  • origin(0, -239, 0)
  • direction=identity matrix
  • label{0,1,2,4}

Data preprocess

generate all.txt and test.txt

python data2txt.py -i "BraTS_2018/MICCAI_BraTS_2018_Data_Training" -o "all.txt" 
python data2txt.py -i "BraTS_2018/MICCAI_BraTS_2018_Data_Validation" -o "test.txt"

generate train.txt and val.txt or k-fold train_{}.txt and val_{}.txt

# train/val
python split_train_val.py -i "/mnt/data/datasets/BraTS_2018/MICCAI_BraTS_2018_Data_Training/all.txt" -k 5 -o 1 

# k-fold
python split_train_val.py -i "/mnt/data/datasets/BraTS_2018/MICCAI_BraTS_2018_Data_Training/all.txt" -k 5 -o 0

Training

Sync bacth normalization is used so that a proper batch size is important to obtain a decent performance. Multiply gpus training with batch_size=10 is recommended.The total training time is about 12 hours and the average prediction time for each volume is 2.3 seconds when using randomly cropped volumes of size 128×128×128 and batch size 10 on two parallel Nvidia Tesla K40 GPUs for 800 epochs.

python train_all.py --gpu="0" --cfg="HDC_Net" --batch_size=10

Test

You could obtain the resutls as paper reported by running the following code:

python test.py --mode=2 --is_out=True --verbose=True --use_TTA=False --postprocess=True --snapshot=True --restore="model_last.pth" --cfg="HDC_Net" --gpu="0"

Then make a submission to the online evaluation server.

Citation

If you use our code or model in your work or find it is helpful, please cite the paper:

@ARTICLE{9103199, 
title={HDC-Net: Hierarchical Decoupled Convolution Network for Brain Tumor Segmentation},
author={Z. {Luo} and Z. {Jia} and Z. {Yuan} and J. {Peng}},
journal={IEEE Journal of Biomedical and Health Informatics}, 
year={2020}}

Acknowledge

  1. DMFNet
  2. BraTS2018-tumor-segmentation
  3. Synchronized-BatchNorm-PyTorch

result

model_last

Dice_ET: 0.74589
Dice_WT: 0.87299
Dice_TC: 0.74824

TODO

  • add DDP