Skip to content

troyliu0105/onnx2caffe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
  • Slice

TODO List

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

About

pytorch to caffe by onnx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%