A dockerized deep-learning model for image segmentation of MOST, based on CDeep3M. The model was verified for brain tumors segmentation in BraTS too.
Thanks for the great work from CDeep3M!
-
fully tested with Ubunti 16.04 and Docker version 18.06.1-ce
-
clone the repo to local directory
git clone https://github.com/cakuba/DDeep3m.git
- to build the Docker image for cuda-9 and cudnn-7
cd cuda-9.0-cudnn7-devel
docker build -t cuda9-cudnn7 .
- to build the DDeep3M image
cd ../ddeep3m
docker build -t ddeep3m .
- to check the DDeep3M image
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ddeep3m latest 1dc19b05aa93 24 hours ago 4.4GB
NOTE:
(1) depending on the bandwidth of network connection, the building process might take up to ~30 mins. So a little patience is appreciated.
(2) if something goes wrong during building the image, the quickest solution is to remove the temporary container and image, and then, re-run the above command.
- run the DDeep3M image and obtain an interactive bash prompt in the container
nvidia-docker run -it ddeep3m:latest bash
- enter the default working directory in the container
cd /usr/local/src/cdeep3m-1.6.2
- obtain the MOST sample data
wget 'https://1drv.ms/u/s!Av8_YAWBQpg7enAkjXEdJ8mw37Q'
unzip ddeep3m_most_dataset.zip
- pre-process the training data of SOMA with augmentation
./PreprocessTrainingData.m ./most/soma/train/images ./most/soma/train/labels ./soma_augmented/
- run the model with training data
./runtraining.sh --numiterations 10 ./soma_augmented/ ./soma_trainout
- predict the test data with trained model
./runprediction.sh ./soma_trainout ./most/soma/test/images ./soma_predictout/
- set up a new directory in the container
cd /usr/local/src
mkdir model
cd model
- obtain the pre-trained model weight trained for SOMA in MOST
wget 'https://1drv.ms/u/s!Av8_YAWBQpg7eZMDQ0OMwGG3qTk'
or the model weight trained for VESSEL in MOST
wget 'https://1drv.ms/u/s!Av8_YAWBQpg7ePVrPZeUSB7RmPo'
or the model weight trained for brain tumors in BraTS19
wget 'https://1drv.ms/u/s!Av8_YAWBQpg7gQDeF6w9_1lnaMZE'
or directly to download the model weight for soma, vessel and brain tumors.
- untar the model weight file
tar -zxvf ddeep3m_MOST_soma_30k.tar.gz
- use the pre-trained model to predict the new data
cd /usr/local/src
./runprediction.sh ./model/most_soma_30k ./most/soma/test/images ./soma_predictout/
In case you want to use DDeep3M with your own dataset, here are the steps you might want to follow:
- organize the directory of your own dataset as
data/
train/
images/
x001.png
x002.png
...
labels/
x001.png
x002.png
...
valid/
images/
x001.png
x002.png
...
labels/
x001.png
x002.png
...
- for image stack, use either ImageJ to generate a sequence of images with PNG format, or use IMOD program to extract images continously with "mrc2tif" command as suggested here:
mkdir -p train/images
mkdir train/labels
mrc2tif -p train.tif train/images/x
mrc2tif -p labels.tif train/labels/x
- to train the model with your own data
cd /usr/local/src/cdeep3m-1.6.2
./PreprocessTrainingData.m ./data/train/images ./data/train/labels ./augmented/
./runtraining.sh --numiterations 10 ./augmented/ ./trainout
DDeep3M is proposed and maintained by researchers from WIT/WTU and HUST.
See LICENSE for DDeep3M