This tool converts pytorch model to Caffe model by ONNX
only use for inference
- 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)
To convert onnx model to caffe:
python convertCaffe.py --conf-path ${CONFIG}.hocon
- Conv
- ConvTranspose
- BatchNormalization
- MaxPool
- AveragePool
- Relu
- Sigmoid
- Dropout
- Gemm (InnerProduct only)
- Add
- Mul
- Reshape
- Upsample
- Flatten
- PRelu
- 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