leohsuofnthu / Pytorch-IterativeFCN

Pytorch implementation of the paper Iterative fully convolutional neural networks for automatic vertebra segmentation accepted in MIDL2018.
61 stars 24 forks source link
convolutional-neural-networks ct-images midl-conference paper pytorch pytorch-implementation segmentation spine

Iterative fully convolutional neural networks for automatic vertebra segmentation

This is a Pytorch implementation of the paper Iterative fully convolutional neural networks for automatic vertebra segmentation accepted in MIDL2018. This paper provides and automatic mechanism for precise vertebrae segmentation on CT images. I create this project for polishing up my knowledge of deep learning in medical image. There is an updated version Iterative fully convolutional neural networks for automatic vertebra segmentation and identificationin 2019 with similiar structure. For the reason of computational cost, I decided to implement the early version in 2018.

Model

This is the model illustration from the paper. This model contains a similiar shape like 3D U-Net but with constant channel in every layer and a extend branch for classification propose. There are 2 inputs for this model, inclusing image patch and correspond instanace memory patches. Instance Memory is used to remind the model to segment the first 'unsegmented vertebrae' so as to make sure the vertebrae are segmented one by one.

ad

Dataset and Pre-processsing

1. Dataset

I choose one of the dataset used in the paper, The spine segmentation challenge in CSI2014. The dataset can be obtain in the Dataset 2 posted on SpineWeb

2. Data preprocessing

The preprocessing steps of each CT images and corresponded masks(both train and test set) includes:

3. Illustration of training patches.

A normal set of a training patches is showned as follows:

ad

Since our model using slide window to segment the vertebrae, we need to teach it to produce empty prediction when their is no vertebrae in the image or all vertebrae are segmented and recorded in instnace memory:

ad

Training Detail

I apply the same setting as suggested in papers:

I trained this model on Google Colab, which has similiar CUDA Memory(12GB) with NVIDIA TITANX. The provided pretrained weight here is trained only with around 25000 iterations. The initial learning rate at 1e-3 from 1 to 10000 iterations, 1e-4 for 10001 to 20000 and 1e-5 for the rest of iterations, which is different from paper that using 1e-3 for whole training.

Segmentation Result

The following are some segmentation result from both train and test data.

(1)Visual Result

ad

(2)Averge Dice Coefficient

Result Paper
0.918 0.958

P.S. None of refine technique for preprocessing and postprocessing are used in this repo.

Usage

Setup the Environment

The requirment.txt are provided in the repo

pip install -r requirements.txt

Preprocessing the CSI dataset

python -m data.preprocessing --dataset 'the root path of CSI dataset'

Start Training

python train.py --dataset 'the directory of preprocessed CSI dataset'

Instance Segmentation

python instance_segmentation.py --test_dir 'the directory of test images' --weights 'pretrained weights'

Evaluation the Dice Coefficient with labels

python eval.py --label_dir 'directory of test labels' --pred_dir 'the directory of prediction segmetnation'

Authors

Reference

Thanks to the information from following sources and kind answer from the paper authors: