项目作者: MTLab

项目描述 :
pytorch to caffe by onnx
高级语言: Python
项目地址: git://github.com/MTLab/onnx2caffe.git
创建时间: 2018-05-25T12:55:20Z
项目社区:https://github.com/MTLab/onnx2caffe

开源协议:MIT License

下载


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

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

How to use

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

  1. 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