Skip to content

Latest commit

 

History

History
357 lines (202 loc) · 22.7 KB

modelConvert.md

File metadata and controls

357 lines (202 loc) · 22.7 KB

Note: This is not one convertor for all frameworks, but a collection of different converters. Because of these different frameworks, the awesome convertors of deep learning models for different frameworks occur. It should be noted that I did not test all the converters, so I could not guarantee that each was available. But I also hope this convertor collection may help you!

The sheet below is a overview of all convertors in github (not only contain official provided and more are user-self implementations). I just make a little work to collect these convertors. Also, hope everyone can support this project to help more people who're also crazy because of various frameworks.

convertor mxnet caffe caffe2 CNTK theano/lasagne neon pytorch torch keras darknet tensorflow chainer coreML/iOS
mxnet - MMdnn MXNet2Caffe Mxnet2Caffe None MMdnn None None MMdnn None MMdnn None MMdnn None mxnet-to-coreml MMdnn
caffe mxnet/tools/caffe_converter ResNet_caffe2mxnet MMdnn - CaffeToCaffe2 crosstalkcaffe/CaffeConverter MMdnn caffe_theano_conversion caffe-model-convert caffe-to-theano caffe2neon MMdnn pytorch-caffe-darknet-convert pytorch-resnet googlenet-caffe2torch mocha caffe_weight_converter caffe2keras nn_tools keras caffe2keras Deep_Learning_Model_Converter MMdnn pytorch-caffe-darknet-convert MMdnn nn_tools caffe-tensorflow None CoreMLZoo apple/coremltools MMdnn
caffe2 None None - ONNX None None ONNX None None None None None None
CNTK MMdnn MMdnn ONNX - None None ONNX MMdnn None MMdnn None MMdnn None MMdnn
theano/lasagne None None None None   -   None None None None None None None None
neon None None None None None - None None None None None None None
pytorch None pytorch2caffe pytorch-caffe-darknet-convert onnx-caffe2 ONNX None None - None pytorch2keras nn-transfer pytorch-caffe-darknet-convert pytorch2keras (over Keras) None onnx-coreml
torch None fb-caffe-exts/torch2caffe mocha trans-torch th2caffe None None None None convert_torch_to_pytorch - None None None None torch2coreml torch2ios
keras MMdnn MMdnn nn_tools None MMdnn None None MMdnn nn-transfer None - None nn_tools convert-to-tensorflow keras_to_tensorflow keras_to_tensorflow MMdnn None apple/coremltoolsmodel-converters keras_models MMdnn
darknet None pytorch-caffe-darknet-convert None None None None pytorch-caffe-darknet-convert None None   -   darkflow lego_yolo None None
tensorflow MMdnn MMdnn nn_tools None crosstalk MMdnn None None pytorch-tf MMdnn None model-converters nn_tools convert-to-tensorflow MMdnn None - None tfcoreml MMdnn
chainer None None None None None None chainer2pytorch None None None None - None
coreML/iOS None None None None None None None None None None None None -

Brief Intro of Convertors

Open Neural Network Exchange

General framework for converting between all kinds of neural networks

ONNX is an effort to unify converters for neural networks in order to bring some sanity to the NN world. Released by Facebook and Microsoft. More info here.

MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch and CoreML.

MXNet convertor

Convert to MXNet model.

A few deep learning models converted from various formats to CoreMLs format. Models currently available:

  • SqueezeNet
  • VGG19 Please feel free to create a pull request with additional models.

Key topics covered include the following:

This is a tool to convert the deep-residual-networks from caffe model to mxnet model. The weights are directly copied from caffe network blobs.

Caffe convertor

Convert to Caffe model.

Convert PyTorch model to Caffemodel.

Convert MXNet model to Caffe model.

Convert MXNet model to Caffe model.

Convert torch model to/from caffe model easily.

Some handy utility libraries and tools for the Caffe deep learning framework, which has ** A library for converting pre-trained Torch models to the equivalent Caffe models.**

Convert between pytorch, caffe and darknet models. Caffe darknet models can be load directly by pytorch.

Translating Torch model to other framework such as Caffe, MxNet ...

A torch-nn to caffe converter for specific layers.

a neural network convertor for models among caffe tensorflow keras

Caffe2 convertor

Convert to Caffe2 model.

This is an official convertor, which not only provoide a script also an ipython notebook as below:

Convert PyTorch to Caffe2 (making it especially easy to deploy on mobile devices)

CNTK convertor

Convert to CNTK model.

The tool will help you convert trained models from Caffe to CNTK.

Convert trained models: giving a model script and its weights file, export to CNTK model.

crosstalk is from CNTK contrib.

Theano/Lasagne convertor

Convert to Theano/Lasagne model.

This is part of a project for CS231N at Stanford University, written by Ankit Kumar, Mathematics major, Class of 2015

This is a repository that allows you to convert pretrained caffe models into models in Lasagne, a thin wrapper around Theano. You can also convert a caffe model's architecture to an equivalent one in Lasagne. You do not need caffe installed to use this module.

Currently, the following caffe layers are supported:

* Convolution
* LRN
* Pooling
* Inner Product
* Relu
* Softmax

Convert models from Caffe to Theano format.

Convert a Caffe Model to a Theano Model. This currently works on AlexNet, but should work for any Caffe model that only includes layers that have been impemented.

Neon convertor  

Convert to Neon model.

Tools to convert Caffe models to neon's serialization format.

This repo contains tools to convert Caffe models into a format compatible with the neon deep learning library. The main script, "decaffeinate.py", takes as input a caffe model definition file and the corresponding model weights file and returns a neon serialized model file. This output file can be used to instantiate the neon Model object, which will generate a model in neon that should replicate the behavior of the Caffe model.

PyTorch convertor  

Convert to PyTorch model.

Convert resnet trained in caffe to pytorch model.

Convert torch t7 model to pytorch model and source.

chainer2pytorch implements conversions from Chainer modules to PyTorch modules, setting parameters of each modules such that one can port over models on a module basis.

Convert between pytorch, caffe and darknet models. Caffe darknet models can be load directly by pytorch.

Convert between Keras and PyTorch models.

Torch convertor  

Convert to Torch model.

Converts bvlc_googlenet.caffemodel to a Torch nn model.

Want to use the pre-trained GoogLeNet from the BVLC Model Zoo in Torch? Do you not want to use Caffe as an additional dependency inside Torch? Use these two scripts to build the network definition in Torch and copy the learned weights from the Caffe model.

Convert torch model to/from caffe model easily.

Keras convertor  

Convert to Keras model.

This is a Caffe-to-Keras weight converter, i.e. it converts .caffemodel weight files to Keras-2-compatible HDF5 weight files. It can also export .caffemodel weights as Numpy arrays for further processing.

This converter converts the weights of a model only (not the model definition), which has the great advantage that it doesn't break every time it encounters an unknown layer type like other converters to that try to translate the model definition as well. The downside, of course, is that you'll have to write the model definition yourself.

The repository also provides converted weights for some popular models.

Note: This converter has been adapted from code in Marc Bolaños fork of Caffe. See acks for code provenance.

This is intended to serve as a conversion module for Caffe models to Keras models.

Please, be aware that this module is not regularly maintained. Thus, some layers or parameter definitions introduced in newer versions of either Keras or Caffe might not be compatible with the converter. Pull requests welcome!

a neural network convertor for models among caffe tensorflow keras

Keras' fork with several new functionalities. Caffe2Keras converter, multimodal layers, etc. https://github.com/MarcBS/keras

This fork of Keras offers the following contributions:

Caffe to Keras conversion module Layer-specific learning rates New layers for multimodal data Contact email: [email protected]

GitHub page: https://github.com/MarcBS

MarcBS/keras is compatible with: Python 2.7 and Theano only.

a simple tool to translate caffe model to keras model.

Convert between Keras and PyTorch models.

Convert pytorch models to Keras.

Darknet convertor  

Convert to Darknet model.

Convert between pytorch, caffe and darknet models. Caffe darknet models can be load directly by pytorch.

TensorFlow convertor  

Convert to TensorFlow model.

crosstalk is from CNTK.

Tools for converting Keras models for use with other ML frameworks (coreML, TensorFlow).

a neural network convertor for models among caffe tensorfloe keras

Convert Caffe models to TensorFlow.

Converts a variety of trained models to a frozen tensorflow protocol buffer file for use with the c++ tensorflow api. C++ code is included for using the frozen models.

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices.

Tensorflow code to to retrain yolo on a new dataset using weights from darknet

This repository contains experiments of transfer learning using YOLO on a new synthetical LEGO data set ROUGH AND UNDOCUMENTED!

Convert keras models to tensorflow frozen graph for use on cell phones, etc.

General code to convert a trained keras model into an inference tensorflow model.

Converting a pretrained pytorch model to tensorflow

Convert pytorch models to Tensorflow (via Keras)

Chainer convertor  

Convert to Chainer model.

coreML convertor  

Convert to coreML model.

Convert trained models created with third-party machine learning tools to the Core ML model format.

If your model is created and trained using a supported third-party machine learning tool, you can use Core ML Tools to convert it to the Core ML model format. Table 1 lists the supported models and third-party tools.

Model type Supported models Supported tools
Neural networks Feedforward, convolutional, recurrent Caffe v1
Keras 1.2.2+
Tree ensembles Random forests, boosted trees, decision trees scikit-learn 0.18
XGBoost 0.6
Support vector machines Scalar regression, multiclass classification scikit-learn 0.18
LIBSVM 3.22
Generalized linear models Linear regression, logistic regression scikit-learn 0.18
Feature engineering Sparse vectorization, dense vectorization, categorical processing scikit-learn 0.18
Pipeline models Sequentially chained models scikit-learn 0.18

Convert MXNet models into Apple CoreML format. This tool helps convert MXNet models into Apple CoreML format which can then be run on Apple devices.

This tool helps convert Torch7 models into Apple CoreML format which can then be run on Apple devices.

Torch7 Library - Convert NN Models To iOS Format.

Small lib to serialise Torch7 Networks for iOS. Supported Layers include Fully Connected, Pooling and Convolution Layers at present. The library stores the weights & biases (if any) for each layer necesarry for inference on iOS devices.