Skip to content

ran337287/caffe_to_pytorch

 
 

Repository files navigation

forked from marvis/pytorch-caffe, and details of usage on https://github.com/marvis/pytorch-caffe, This repository does some modifications on supported layers.

caffe2pytorch

This tool aims to load caffe prototxt and weights directly in pytorch without explicitly converting model from caffe to pytorch.

Usage

use the model and weight directly in pytorch, and save the model as.pth file

Download caffemodel of resnet50, unzip it to model. Then

python caffe_pytorch.py

Supported Layers

We modify the convolution and deconvolution layer, so their kernel size can be int of kernel_size or tuple of(kernel_h, kernel_w) Each layer in caffe will have a corresponding layer in pytorch.

  • Convolution
  • InnerProduct
  • BatchNorm
  • Scale
  • ReLU
  • Pooling
  • Reshape
  • Softmax
  • Accuracy
  • SoftmaxWithLoss
  • Dropout
  • Eltwise
  • Normalize
  • Permute
  • Flatten
  • Slice
  • Concat
  • PriorBox
  • LRN : gpu version is ok, cpu version produce big difference
  • DetectionOutput: support batchsize=1, num_classes=1 forward
  • Crop
  • Deconvolution
  • MultiBoxLoss

About

load caffe prototxt and weights directly in pytorch, and convert caffemodel into .pth

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%