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 Onnx and CoreML.
Перейти к файлу
rainLiuplus b9c11b4949
Merge pull request #471 from LourensT/patch-1
minor edits and minor clarifications
2018-12-24 10:48:54 +08:00
docs minor edits and minor clarifications 2018-10-26 23:49:05 +02:00
mmdnn Merge pull request #472 from bkblanton/master 2018-12-24 10:48:06 +08:00
requirements Add facenet tests from tensorflow_frozen to tensorflow, keras and mxnet (#412) 2018-09-21 14:19:39 +08:00
tests tf embedding -> tf, pytorch (#456) 2018-10-26 12:32:25 +08:00
.gitignore ignore package-lock 2018-01-22 03:43:09 +00:00
.travis.yml Reduce Caffe python3 test to fit the time budget. 2018-09-07 09:05:45 +00:00
ISSUE_TEMPLATE.md Update ISSUE_TEMPLATE.md 2018-01-17 16:25:01 +08:00
LICENSE Initial commit 2017-08-16 01:03:58 -07:00
README.md Fixed some typos in README.md (#473) 2018-10-28 22:41:21 +08:00
_config.yml Set theme jekyll-theme-cayman 2018-08-31 11:31:56 +08:00
setup.py Add PyPi badge, fix setup (#461) 2018-10-19 21:58:37 +08:00
test.sh Seperate tests into files. 2018-08-28 01:05:06 +00:00

README.md

MMdnn MMdnn

PyPi Version License Linux

A comprehensive, cross-framework solution to convert, visualize and diagnose deep neural network models. The "MM" in MMdnn stands for model management and "dnn" is an acronym for the deep neural network.

Major features

  • Find model

  • Conversion

    • We implement a universal converter to convert DNN models between frameworks, which means you can train on one framework and deploy on another.
  • Retrain

    • In the converter, we can generate some training/inference code snippet to simplify the retrain/evaluate work.
  • Deployment

    • We provide some guidelines to help you deploy your models to another hardware platform.

    • We provide a guide to help you accelerate inference with TensorRT.

Targeting at openness and advancing state-of-art technology, Microsoft Research (MSR) had also released few other open source projects.

  • OpenPAI: an open source platform that provides complete AI model training and resource management capabilities, it is easy to extend and supports on-premise, cloud and hybrid environments in various scale.
  • NNI: An open source AutoML toolkit for neural architecture search and hyper-parameter tuning.

We encourage researchers and students to leverage these projects to accelerate the AI development and research.

Installation

Install manually

You can get a stable version of MMdnn by

pip install mmdnn

And make sure to have Python installed or you can try the newest version by

pip install -U git+https://github.com/Microsoft/MMdnn.git@master

Install with docker image

MMdnn provides a docker image, which packages MMdnn, deep learning frameworks we support and other dependencies in one image. You can easily get the image in several steps:

  1. Install Docker Community Edition(CE)

    Learn more about how to install docker

  2. Pull MMdnn docker image

    docker pull mmdnn/mmdnn:cpu.small
    
  3. Run image in an interactive mode

    docker run -it mmdnn/mmdnn:cpu.small
    

Features

Model Conversion

Across the industry and academia, there are a number of existing frameworks available for developers and researchers to design a model, where each framework has its own network structure definition and saving model format. The gaps between frameworks impede the inter-operation of the models.

We provide a model converter to help developers convert models between frameworks through an intermediate representation format.

Support frameworks

[Note] You can click the links to get detail README of each framework

Tested models

The model conversion between currently supported frameworks is tested on some ImageNet models.

Models Caffe Keras TensorFlow CNTK MXNet PyTorch CoreML ONNX
VGG 19
Inception V1
Inception V3
Inception V4 o
ResNet V1 × o
ResNet V2
MobileNet V1 × o
MobileNet V2 × o
Xception o ×
SqueezeNet
DenseNet
NASNet x o x
ResNext
voc FCN
Yolo3

Usage

One command to achieve the conversion. Using TensorFlow ResNet V2 152 to PyTorch as our example.

$ mmdownload -f tensorflow -n resnet_v2_152 -o ./
$ mmconvert -sf tensorflow -in imagenet_resnet_v2_152.ckpt.meta -iw imagenet_resnet_v2_152.ckpt --dstNodeName MMdnn_Output -df pytorch -om tf_resnet_to_pth.pth

Done.

On-going frameworks

  • Torch7 (help wanted)
  • Chainer (help wanted)

On-going Models

  • Face Detection
  • Semantic Segmentation
  • Image Style Transfer
  • Object Detection
  • RNN

Model Visualization

You can use the MMdnn model visualizer and submit your IR json file to visualize your model. In order to run the commands below, you will need to install requests, keras, and TensorFlow using your favorite package manager.

Use the Keras "inception_v3" model as an example again.

  1. Download the pre-trained models
$ mmdownload -f keras -n inception_v3
  1. Convert the pre-trained model files into an intermediate representation
$ mmtoir -f keras -w imagenet_inception_v3.h5 -o keras_inception_v3
  1. Open the MMdnn model visualizer and choose file keras_inception_v3.json

vismmdnn


Examples

Official Tutorial

Users' Examples


Contributing

Intermediate Representation

The intermediate representation stores the network architecture in protobuf binary and pre-trained weights in NumPy native format.

[Note!] Currently the IR weights data is in NHWC (channel last) format.

Details are in ops.txt and graph.proto. New operators and any comments are welcome.

Frameworks

We are working on other frameworks conversion and visualization, such as PyTorch, CoreML and so on. We're investigating more RNN related operators. Any contributions and suggestions are welcome! Details in Contribution Guideline.

License

Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Authors

Cheng CHEN (Microsoft Research Asia): Project Manager; Caffe, CNTK, CoreML Emitter, Keras, MXNet, TensorFlow

Jiahao YAO (Peking University): CoreML, MXNet Emitter, PyTorch Parser; HomePage

Ru ZHANG (Chinese Academy of Sciences): CoreML Emitter, DarkNet Parser, Keras, TensorFlow frozen graph Parser; Yolo and SSD models; Tests

Yuhao ZHOU (Shanghai Jiao Tong University): MXNet

Tingting QIN (Microsoft Research Asia): Caffe Emitter

Tong ZHAN (Microsoft): ONNX Emitter

Qianwen WANG (Hong Kong University of Science and Technology): Visualization

Acknowledgements

Thanks to Saumitro Dasgupta, the initial code of caffe -> IR converting is references to his project caffe-tensorflow.