Home

Awesome

SegNet

SegNet implementation & experiments written in Chainer

This is an unofficial implementation of SegNet. This implementation doesn't use L-BFGS for optimization. This uses Adam with the default settings.

Requirements

Download Dataset

bash experiments/download.sh

This shell script performs download CamVid dataset from SegNet-Tutorial repository owned by the original auther of the SegNet paper.

Calculate dataset mean

python lib/calc_mean.py

It produces train_mean.npy and train_std.npy to normalize inputs during training and also train_freq.csv to weight the softmax cross entropy loss.

Training

CUDA_VISIBLE_DEVICES=0 bash experiments/train.sh

You can specify which GPU you want to use by using CUDA_VISIBLE_DEVICES environment variable. Or if you directory use train.py instead of prepared training shell scripts in experimetns dir, you can easily specify the GPU ID by using --gpu argment.

About train.sh

To use the preliminarily calculated coefficients to weight the softmax cross entropy in class-wise manner, add --use_class_weight option to the above command.

What the shell script train.sh do is a simple sequential training process. Once the first training for a most outer encoder-decoder pair, start the training for the next inner pair from the saved model state of the previous training process.

If you would like to change the training settings and hyper parameters, please see the output of python train.py --help to check the argments it can take.

Prediction

Use predict.py to create prediction results on the test dataset. The below script executes the prediction script for all result dirs.

python experiments/batch_predict.py

Evaluation

python experiments/batch_evaluate.py

Results

The below table shows the evaluation results. Each column means:

Please find the more detailed results here: experiments/README.md

The bold numbers are better than the paper result, and bold and italic ones are the top scores in this table.

ModelOptClass weightStandardizationData Aug.# conv channelsEnd-to-EndClass avg.Global avg.
SegNet - 4 layer (from paper)L-BFGSOriginal??64Pairwise62.984.3
chainer-segnetAdam (alpha=0.0001)YesYesYes128Pairwise69.886.0
chainer-segnetAdam (alpha=0.0001)OriginalYesYes64Pairwise68.682.2
chainer-segnetAdam (alpha=0.0001)OriginalYesYes64Finetune68.583.3
chainer-segnetAdam (alpha=0.0001)YesNoYes64Pairwise68.082.3
chainer-segnetAdam (alpha=0.0001)OriginalYesYes128Pairwise67.386.5
chainer-segnetAdam (alpha=0.0001)YesYesYes128Finetune67.386.4
chainer-segnetAdam (alpha=0.0001)YesNoYes64Finetune66.983.5
chainer-segnetAdam (alpha=0.0001)OriginalYesYes128Finetune66.386.2
chainer-segnetAdam (alpha=0.0001)YesYesYes64Finetune65.582.9
chainer-segnetAdam (alpha=0.0001)OriginalYesYes64Finetune65.180.5
chainer-segnetAdam (alpha=0.0001)OriginalYesYes64Pairwise64.879.8
chainer-segnetMomentumSGD (lr=0.0001)YesYesYes64Pairwise64.876.9
chainer-segnetMomentumSGD (lr=0.0001)YesYesYes64Finetune64.779.8
chainer-segnetAdam (alpha=0.0001)YesYesYes64Pairwise64.481.1
chainer-segnetAdam (alpha=0.0001)YesYesYes64End-to-End62.682.3
chainer-segnetAdam (alpha=0.0001)NoNoYes64Pairwise58.986.9
chainer-segnetAdam (alpha=0.0001)NoYesYes64Finetune58.085.5
chainer-segnetAdam (alpha=0.0001)NoNoYes64Finetune57.287.0
chainer-segnetAdam (alpha=0.0001)NoYesYes64Pairwise56.385.8
chainer-segnetAdam (alpha=0.0001)YesYesNo64Pairwise56.283.9
chainer-segnetAdam (alpha=0.0001)YesYesNo64Finetune54.183.3
chainer-segnetAdam (alpha=0.0001)YesYesNo64End-to-End47.080.6

Discussion

License

MIT License (see LICENSE file).

Reference

Vijay Badrinarayanan, Alex Kendall and Roberto Cipolla "SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation." arXiv preprint arXiv:1511.00561, 2015. PDF

Official Implementation with Caffe