Skip to content

chenxi116/pytorch-deeplab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytorch-deeplab

This repository contains codes for converting DeepLab ResNet 101 trained in caffe to pytorch model.

First, you need to have pycaffe and pytorch. Secondly, you should download the caffe models from http://liangchiehchen.com/projects/DeepLabv2_resnet.html. Put them in data folder.

Then,

python convert2.py data/init.caffemodel model/deeplab101_init.pth
python convert2.py data/train_iter_20000.caffemodel model/deeplab101_trainaug.pth
python convert2.py data/train2_iter_20000.caffemodel model/deeplab101_trainvalaug.pth

The models generated by convert2.py expect RGB image ranging [0, 1]. You can use standard trn.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225]).

You can train on train_aug and evaluate on val of PASCAL VOC2012 by

python deeplab_main.py 0 train
python deeplab_main.py 0 eval

During evaluation you will also need to run EvalSegResults.m in the matlab folder to compute the mean IOU.

Acknowledgement

A large part of the code is borrowed from https://github.com/ruotianluo/pytorch-resnet

Performance

The converted DeepLab ResNet 101 model achieves mean IOU of 75.382% on the validation set of PASCAL VOC2012. Note that this is only with the original resolution branch, without the 0.5 and 0.75 resolution.