This project is to use fully convolutional networks to do object segmentation from images. This project is primarily used for organ segmentations from CT images, but it could also transfer to do general object segnmentations from any type of images based on given labeled images.
This project is written by Python 2.7 and tensorflow 0.12.
This project uses the weights used in VGG16. The weights and pretrained parameters are stored in a numpy file.The .npy file for [VGG16] to be downloaded before using this needwork. You can find the file here: ftp://mi.eng.cam.ac.uk/pub/mttt2/models/vgg16.npy
Install Python 2 / Install annaconda 2
Install tensorflow 0.12
git https://github.com/yya007/BodySegmentation.git
cd BodySegmentation
python setup.py
Then, move the VGG16.npy to the bigfile folder
The network folder is for storing trained network with different settings and epoch number.
The res folder is for storing results by evaluating the performance of network
The Data3D folder is for storing train and test data. In test and train folder, all input images are divided into two category: seg and img. Each subject should in .mat form and named as sub_[four digit index with 1 indexing].mat with dimension 512,512,512
For exmaple, the label of first train object should in /Data3D/test/Seg/sub_0001.mat
and in this mat file ['seg'] has dimension of 512,512,512.
python run.py train [random/norandom] [number_of_classes]
will keep train from last trained networks with same parameters
python run.py evaluate [random/norandom] [number_of_classes]
will evaluate the last unevaluate network with same parameters
python plot.py [corresponding result address]
For example, if you want to plot the box plot of randomrun_0
(the model after first epoch with random shuffle) under res
folder
python plot.py ../res/randomrun_0
Then you will get the box plot of dice similarity of each organs between ground truth and predication made by model.
setpkgs -a tensorflow_0.12
First setup:
setpkgs -a anaconda2
conda create --name FCN python=2.7
source activate FCN
pip install keras
pip install protobuf
pip install matplotlib
pip install pillow
If already setup environment:
source activate FCN
setpkgs -a git
git https://github.com/yya007/BodySegmentation.git
scp -r [your machine address]:[folder in local machine] [target folder on ACCRE]
request GPU node:
salloc --account=p_masi_gpu --partition=maxwell --ntasks=4 --nodes=1 --gres=gpu:2 --time=5:00:00 --mem=40G
cd /scatch/...
python run.py
sample slurm files are in ACCRE folder
Email [email protected]