fanq15 / caffe_to_torch_to_pytorch

149 stars 42 forks source link
caffe2torch torch2pytorch

Convert caffe to pytorch

Convert caffe to torch

Convert torch to pytorch

Install torch

install loadcaffe

Convert caffe to torch

th caffemodel_to_t7.lua

Convert torch to pytorch

python convert_torch.py -m vgg16_torch.t7

Two file will be created vgg16_torch.py vgg16_torch.pth

Load the .pth model in python

model = vgg16_torch.vgg16_torch model.load_state_dict(torch.load('vgg16_torch.pth')) model.eval() ...



# Acknowledgement
* The caffe to torch code is modified from [https://github.com/jcjohnson/pytorch-vgg](https://github.com/jcjohnson/pytorch-vgg)

* The torch to pytorch code is borrowed from [https://github.com/clcarwin/convert_torch_to_pytorch](https://github.com/clcarwin/convert_torch_to_pytorch)