Implement slightly different caffe-segnet in tensorflow
Branch: master
Clone or download
Latest commit 5b52411 Oct 31, 2017


Implement slightly different (see below for detail) SegNet in tensorflow, successfully trained segnet-basic in CamVid dataset.

Due to indice unravel still unavailable in tensorflow, the original upsampling method is temporarily replaced simply by deconv( or conv-transpose) layer (without pooling indices). You can follow the issue here: (The current workaround for unpooling layer is a bit slow because it lacks of GPU support.)

for model detail, please go to


tensorflow 1.0 Pillow (optional, for write label image) scikit-image


Update to tf 1.0

Finally get some time to refactor a bit, removing some un-used function and remove the hard-coded file path Now the model should be easy to config. The parameters can be found in

I planned to add more feature such as dilation, multi-resolution, sequential learning..etc. Making it more like a "basic" segmentation toolbox and support more dataset as well. Therefore the model and documentation will be changed accordingly in the future.

More utility function will be added and some messed coding style will be fixed. Any feature request is also welcomed.


see also training:

python --log_dir=path_to_your_log --image_dir=path_to_CamVid_train.txt --val_dir=path_to_CamVid_val.txt --batch_size=5


python --finetune=path_to_saved_ckpt --log_dir=path_to_your_log --image_dir=path_to_CamVid_train.txt --val_dir=path_to_CamVid_val.txt --batch_size=5


python --testing=path_to_saved_ckpt --log_dir=path_to_your_log --test_dir=path_to_CamVid_train.txt --batch_size=5 --save_image=True

You can set default path and parameters in line 6~18. note: in --testing you can specify whether to save predicted images, currently only save one image for manually checking, will be configured to be more flexible.


This Implement default to use CamVid dataset as described in the original SegNet paper, The dataset can be download from author's github in the CamVid folder

example format:

"path_to_image1" "path_to_corresponded_label_image1",

"path_to_image2" "path_to_corresponded_label_image2",

"path_to_image3" "path_to_corresponded_label_image3",