Skip to content

kakusikun/onnx2caffe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 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

  • python 3.5.2
  • pycaffe (with python3 support)
  • pytorch 1.0.0
  • onnx 1.4.1
  • protobuf 3.6.1
  • pyhocon 0.3.50 (for config)

How to use

To convert onnx model to caffe:

python convertCaffe.py --conf-path ${CONFIG}.hocon

Current support operation

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

TODO List

  • Remove Constant, Shape, Unsqueeze, Squeeze ops in onnx and concatenate prototxt after removing these ops
  • Transfer attribute value of Constant to Reshape
  • Concat layer
    • the common usage of pytorch view operation, the Concat before the Reshape is redundant for caffe
  • merge batchnormization to convolution
  • merge scale to convolutionv

About

pytorch to caffe by onnx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%