Need help with onnx2caffe?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

MTLab
314 Stars 99 Forks MIT License 6 Commits 25 Opened issues

Description

pytorch to caffe by onnx

Services available

!
?

Need anything else?

Contributors list

# 170,263
Python
pytorch
caffe
onnx
3 commits
# 235,718
pytorch
Applica...
C++
C
1 commit

Convert pytorch to Caffe by ONNX

This tool converts pytorch model to Caffe model by ONNX
only use for inference

Dependencies

  • caffe (with python support)
  • pytorch 0.4 (optional if you only want to convert onnx)
  • onnx

we recomand using protobuf 2.6.1 and install onnx from source

git clone --recursive https://github.com/onnx/onnx.git
cd onnx 
python setup.py install

How to use

run test.py to make sure it has been installed correctly
To convert onnx model to caffe:

python convertCaffe.py ./model/MobileNetV2.onnx ./model/MobileNetV2.prototxt ./model/MobileNetV2.caffemodel

Current support operation

  • Conv
  • ConvTranspose
  • BatchNormalization
  • MaxPool
  • AveragePool
  • Relu
  • Sigmoid
  • Dropout
  • Gemm (InnerProduct only)
  • Add
  • Mul
  • Reshape
  • Upsample
  • Concat
  • Flatten

TODO List

  • [ ] support all onnx operations (which is impossible)
  • [ ] merge batchnormization to convolution
  • [ ] merge scale to convolution

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.