chenxi116 / TF-deeplab

Tensorflow implementation of DeepLabv2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TF-deeplab

This is a Tensorflow implementation of DeepLab, compatible with Tensorflow 1.2.1.

Currently it supports both training and testing the ResNet 101 version by converting the caffemodel provided by Jay.

Note that the current version is not multi-scale, i.e. only uses the original resolution branch and discarding all layers of 0.5 and 0.75 resolution.

The caffemodel2npy.py is modified from here, and the deeplab_model.py is modified from here.

Example Usage

  • Download the prototxt and caffemodel provided by Jay
  • Convert caffemodel to npy file
python caffemodel2npy.py deploy.prototxt ../deeplab/ResNet101/init.caffemodel ./model/ResNet101_init.npy
python caffemodel2npy.py deploy.prototxt ../deeplab/ResNet101/train_iter_20000.caffemodel ./model/ResNet101_train.npy
python caffemodel2npy.py deploy.prototxt ../deeplab/ResNet101/train2_iter_20000.caffemodel ./model/ResNet101_train2.npy
  • Convert npy file to tfmodel
python npy2tfmodel.py 0 ./model/ResNet101_init.npy ./model/ResNet101_init.tfmodel
python npy2tfmodel.py 0 ./model/ResNet101_train.npy ./model/ResNet101_train.tfmodel
python npy2tfmodel.py 0 ./model/ResNet101_train2.npy ./model/ResNet101_train2.tfmodel
  • Test on a single image
python deeplab_main.py 0 single
  • Test on the PASCAL VOC2012 validation set (you will also want to look at the matlab folder and run EvalSegResults.m after you run the following command)
python deeplab_main.py 0 test
  • To train on the PASCAL VOC2012 train_aug, run
python deeplab_main.py 0 train

Performance

The converted DeepLab ResNet 101 model achieves mean IOU of 73.296% on the validation set of PASCAL VOC2012. Again, this is only with the original resolution branch, which is likely to be the reason for the performance gap (according to the paper this number should be around 75%).

TODO

  • Incorporating 0.5 and 0.75 resolution

About

Tensorflow implementation of DeepLabv2

License:Apache License 2.0


Languages

Language:Python 70.7%Language:MATLAB 29.3%