{"id":13526356,"url":"https://github.com/Microsoft/MMdnn","last_synced_at":"2025-04-01T07:32:06.238Z","repository":{"id":41293805,"uuid":"100464123","full_name":"microsoft/MMdnn","owner":"microsoft","description":"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.","archived":false,"fork":false,"pushed_at":"2024-05-29T15:42:28.000Z","size":37216,"stargazers_count":5811,"open_issues_count":337,"forks_count":965,"subscribers_count":180,"default_branch":"master","last_synced_at":"2025-03-30T21:38:37.675Z","etag":null,"topics":["caffe","cntk","coreml","darknet","keras","model-converter","mxnet","onnx","pytorch","tensorflow","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"docs/supported.jpg","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-16T08:03:52.000Z","updated_at":"2025-03-25T14:32:51.000Z","dependencies_parsed_at":"2022-08-10T02:00:45.338Z","dependency_job_id":"adeed5b0-4cc2-4cc2-8e16-4a33d1a7828d","html_url":"https://github.com/microsoft/MMdnn","commit_stats":{"total_commits":778,"total_committers":90,"mean_commits":8.644444444444444,"dds":0.7840616966580977,"last_synced_commit":"5cf01b2b4a8ce3a6e2b9c74b9e4cc55798429bef"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMMdnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMMdnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMMdnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FMMdnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/MMdnn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246600770,"owners_count":20803481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caffe","cntk","coreml","darknet","keras","model-converter","mxnet","onnx","pytorch","tensorflow","visualization"],"created_at":"2024-08-01T06:01:28.450Z","updated_at":"2025-04-01T07:32:03.680Z","avatar_url":"https://github.com/microsoft.png","language":"Python","readme":"# ![MMdnn](https://ndqzpq.dm2304.livefilestore.com/y4mF9ON1vKrSy0ew9dM3Fw6KAvLzQza2nL9JiMSIfgfKLbqJPvuxwOC2VIur_Ycz4TvVpkibMkvKXrX-N9QOkyh0AaUW4qhWDak8cyM0UoLLxc57apyhfDaxflLlZrGqiJgzn1ztsxiaZMzglaIMhoo8kjPuZ5-vY7yoWXqJuhC1BDHOwgNPwIgzpxV1H4k1oQzmewThpAJ_w_fUHzianZtMw?width=35\u0026height=35\u0026cropmode=none) MMdnn\n\n[![PyPi Version](https://img.shields.io/pypi/v/mmdnn.svg)](https://pypi.org/project/mmdnn/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Linux](https://travis-ci.org/Microsoft/MMdnn.svg?branch=master)](https://travis-ci.org/Microsoft/MMdnn)\n\nMMdnn is a comprehensive and cross-framework tool to convert, visualize and diagnose deep learning (DL) models.\nThe \"MM\" stands for model management, and \"dnn\" is the acronym of deep neural network.\n\nMajor features include:\n\n- \u003ca href=\"#conversion\"\u003e**Model Conversion**\u003c/a\u003e\n\n  - We implement a universal converter to convert DL models between frameworks, which means you can train a model with one framework and deploy it with another.\n\n- **Model Retraining**\n\n  - During the model conversion, we generate some code snippets to simplify later retraining or inference.\n\n- **Model Search \u0026 Visualization**\n\n  - We provide a [model collection](mmdnn/models/README.md) to help you find some popular models.\n  - We provide a \u003ca href=\"#visualization\"\u003emodel visualizer\u003c/a\u003e to display the network architecture more intuitively.\n\n- **Model Deployment**\n\n  - We provide some guidelines to help you deploy DL models to another hardware platform.\n    - [Android](https://github.com/Microsoft/MMdnn/wiki/Deploy-your-TensorFlow-Lite-Model-in-Android)\n    - [Serving](https://github.com/Microsoft/MMdnn/wiki/Tensorflow-Serving-Via-Docker)\n    \n  - We provide a guide to help you accelerate inference with TensorRT.\n    - [TensorRT](https://github.com/Microsoft/MMdnn/wiki/Using-TensorRT-to-Accelerate-Inference)\n  \n\n## Related Projects\n\nTargeting at openness and advancing state-of-art technology, [Microsoft Research (MSR)](https://www.microsoft.com/en-us/research/group/systems-and-networking-research-group-asia/) and [Microsoft Software Technology Center (STC)](https://www.microsoft.com/en-us/ard/company/introduction.aspx) had also released few other open source projects:\n\n* [OpenPAI](https://github.com/Microsoft/pai) : 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.\n* [FrameworkController](https://github.com/Microsoft/frameworkcontroller) : an open source general-purpose Kubernetes Pod Controller that orchestrate all kinds of applications on Kubernetes by a single controller.\n* [NNI](https://github.com/Microsoft/nni) : a lightweight but powerful toolkit to help users automate Feature Engineering, Neural Architecture Search, Hyperparameter Tuning and Model Compression.\n* [NeuronBlocks](https://github.com/Microsoft/NeuronBlocks) : an NLP deep learning modeling toolkit that helps engineers to build DNN models like playing Lego. The main goal of this toolkit is to minimize developing cost for NLP deep neural network model building, including both training and inference stages.\n* [SPTAG](https://github.com/Microsoft/SPTAG) : Space Partition Tree And Graph (SPTAG) is an open source library for large scale vector approximate nearest neighbor search scenario.\n\nWe encourage researchers, developers and students to leverage these projects to boost their AI / Deep Learning productivity.\n\n## Installation\n\n### Install manually\n\nYou can get a stable version of MMdnn by\n\n```bash\npip install mmdnn\n```\nAnd make sure to have [Python](https://www.python.org/) installed\nor you can try the newest version by\n\n```bash\npip install -U git+https://github.com/Microsoft/MMdnn.git@master\n```\n\n### Install with docker image\n\nMMdnn provides a docker image, which packages MMdnn and Deep Learning frameworks that we support as well as other dependencies.\nYou can easily try the image with the following steps:\n\n1. Install Docker Community Edition(CE)\n\n    [_Learn more about how to install docker_](https://github.com/Microsoft/MMdnn/blob/master/docs/InstallDockerCE.md)\n\n1. Pull MMdnn docker image\n    ```bash\n    docker pull mmdnn/mmdnn:cpu.small\n    ```\n\n1. Run image in an interactive mode\n\n    ```bash\n    docker run -it mmdnn/mmdnn:cpu.small\n    ```\n\n## Features\n\n### \u003ca name=\"conversion\"\u003eModel Conversion\u003c/a\u003e\n\nAcross 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.\n\n\u003cimg src=\"https://raw.githubusercontent.com/Microsoft/MMdnn/master/docs/supported.jpg\" width=\"633\" \u003e\n\nWe provide a model converter to help developers convert models between frameworks through an intermediate representation format.\n\n#### Support frameworks\n\n\u003e [Note] You can click the links to get detailed README of each framework.\n\n- [Caffe](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/caffe/README.md)\n- [Microsoft Cognitive Toolkit (CNTK)](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/cntk/README.md)\n- [CoreML](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/coreml/README.md)\n- [Keras](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/keras/README.md)\n- [MXNet](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/mxnet/README.md)\n- [ONNX](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/onnx/README.md) (Destination only)\n- [PyTorch](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/pytorch/README.md)\n- [TensorFlow](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/tensorflow/README.md) (Experimental) (We highly recommend you read the README of TensorFlow first)\n- [DarkNet](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/darknet/README.md) (Source only, Experiment)\n\n#### Tested models\n\nThe model conversion between currently supported frameworks is tested on some **ImageNet** models.\n\nModels | Caffe | Keras | TensorFlow | CNTK | MXNet | PyTorch  | CoreML | ONNX\n:-----:|:-----:|:-----:|:----------:|:----:|:-----:|:--------:|:------:|:-----:|\n[VGG 19](https://arxiv.org/abs/1409.1556.pdf) | √ | √ | √ | √ | √ | √ | √ | √\n[Inception V1](https://arxiv.org/abs/1409.4842v1) | √ | √ | √ | √ | √ | √ | √ | √\n[Inception V3](https://arxiv.org/abs/1512.00567)  | √ | √ | √ | √ | √ | √ | √ | √\n[Inception V4](https://arxiv.org/abs/1512.00567)  | √ | √ | √ | o | √ | √ | √ | √\n[ResNet V1](https://arxiv.org/abs/1512.03385)                               |   ×   |   √   |     √      |   o  |   √   |    √ | √ | √\n[ResNet V2](https://arxiv.org/abs/1603.05027)                               |   √   |   √   |     √      |   √  |   √   | √ | √ | √\n[MobileNet V1](https://arxiv.org/pdf/1704.04861.pdf)                        |   ×   |   √   |     √      |   o  |   √   |    √       | √ | √ | √\n[MobileNet V2](https://arxiv.org/pdf/1704.04861.pdf)                        |   ×   |   √   |     √      |   o  |   √   |    √       | √ | √ | √\n[Xception](https://arxiv.org/pdf/1610.02357.pdf)                            |   √   |   √   |     √      |   o  |   ×   |    √ | √ | √ | √\n[SqueezeNet](https://arxiv.org/pdf/1602.07360)                              |   √   |   √   |     √      |   √  |   √   |    √ | √ | √ | √\n[DenseNet](https://arxiv.org/abs/1608.06993)                                |   √   |   √   |     √      |   √  |   √   |    √       | √ | √\n[NASNet](https://arxiv.org/abs/1707.07012)                                  |   x   |   √   |     √      |   o  |   √   | √ | √ | x\n[ResNext](https://arxiv.org/abs/1611.05431)                                 |   √   |   √   |     √      |   √  |   √   | √ | √ | √ | √ | √\n[voc FCN](https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf) |       |       |     √      |   √  |       |\nYolo3                                                                       |       |   √   |            |   √  |\n\n#### Usage\n\nOne command to achieve the conversion. Using TensorFlow **ResNet V2 152** to PyTorch as our example.\n\n```bash\n$ mmdownload -f tensorflow -n resnet_v2_152 -o ./\n$ 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\n```\n\nDone.\n\n#### On-going frameworks\n\n- Torch7 (help wanted)\n- Chainer (help wanted)\n\n#### On-going Models\n\n- Face Detection\n- Semantic Segmentation\n- Image Style Transfer\n- Object Detection\n- RNN\n\n---\n\n### \u003ca name=\"visualization\"\u003eModel Visualization\u003c/a\u003e\n\nWe provide a [local visualizer](mmdnn/visualization) to display the network architecture of a deep learning model.\nPlease refer to the [instruction](mmdnn/visualization/README.md).\n\n---\n\n## Examples\n\n### Official Tutorial\n\n- [Keras \"inception V3\" to CNTK](https://github.com/Microsoft/MMdnn/blob/master/docs/keras2cntk.md) and [related issue](https://github.com/Microsoft/MMdnn/issues/19)\n\n- [TensorFlow slim model \"ResNet V2 152\" to PyTorch](https://github.com/Microsoft/MMdnn/blob/master/docs/tf2pytorch.md)\n\n- [Mxnet model \"LResNet50E-IR\" to TensorFlow](https://github.com/Microsoft/MMdnn/issues/85) and [related issue](https://github.com/Microsoft/MMdnn/issues/135)\n\n### Users' Examples\n\n- [MXNet \"ResNet-152-11k\" to PyTorch](https://github.com/Microsoft/MMdnn/issues/6)\n\n- [Another Example of MXNet \"ResNet-152-11k\" to PyTorch](https://blog.paperspace.com/convert-full-imagenet-pre-trained-model-from-mxnet-to-pytorch/)\n\n- [MXNet \"ResNeXt\" to Keras](https://github.com/Microsoft/MMdnn/issues/58)\n\n- [TensorFlow \"ResNet-101\" to PyTorch](https://github.com/Microsoft/MMdnn/issues/22)\n\n- [TensorFlow \"mnist mlp model\" to CNTK](https://github.com/Microsoft/MMdnn/issues/11)\n\n- [TensorFlow \"Inception_v3\" to MXNet](https://github.com/Microsoft/MMdnn/issues/30)\n\n- [Caffe \"voc-fcn\" to TensorFlow](https://github.com/Microsoft/MMdnn/issues/29)\n\n- [Caffe \"AlexNet\" to TensorFlow](https://github.com/Microsoft/MMdnn/issues/10)\n\n- [Caffe \"inception_v4\" to TensorFlow](https://github.com/Microsoft/MMdnn/issues/26)\n\n- [Caffe \"VGG16_SOD\" to TensorFlow](https://github.com/Microsoft/MMdnn/issues/27)\n\n- [Caffe \"SqueezeNet v1.1\" to CNTK](https://github.com/Microsoft/MMdnn/issues/48)\n\n---\n\n## Contributing\n\nMost contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.microsoft.com.\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n### Intermediate Representation\n\nThe intermediate representation stores the **network architecture** in **protobuf binary** and **pre-trained weights** in **NumPy** native format.\n\n\u003e [Note!] Currently the IR weights data is in NHWC (channel last) format.\n\nDetails are in [ops.txt](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/common/IR/ops.pbtxt) and [graph.proto](https://github.com/Microsoft/MMdnn/blob/master/mmdnn/conversion/common/IR/graph.proto). New operators and any comments are welcome.\n\n### Frameworks\n\nWe 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](https://github.com/Microsoft/MMdnn/wiki/Contribution-Guideline).\n\n## Authors\n\nYu Liu (Peking University): Project Developer \u0026 Maintainer\n\nCheng CHEN (Microsoft Research Asia): Caffe, CNTK, CoreML Emitter, Keras, MXNet, TensorFlow\n\nJiahao YAO (Peking University): CoreML, MXNet Emitter, PyTorch Parser; HomePage\n\nRu ZHANG (Chinese Academy of Sciences): CoreML Emitter, DarkNet Parser, Keras, TensorFlow frozen graph Parser; Yolo and SSD models; Tests\n\nYuhao ZHOU (Shanghai Jiao Tong University): MXNet\n\nTingting QIN (Microsoft Research Asia): Caffe Emitter\n\nTong ZHAN (Microsoft): ONNX Emitter\n\nQianwen WANG (Hong Kong University of Science and Technology): Visualization\n\n## Acknowledgements\n\nThanks to [Saumitro Dasgupta](https://github.com/ethereon), the initial code of *caffe -\u003e IR converting* is references to his project [caffe-tensorflow](https://github.com/ethereon/caffe-tensorflow).\n\n## License\nLicensed under the [MIT](LICENSE) license.\n","funding_links":[],"categories":["Conversion","\u003ca name=\"Tools\"\u003e\u003c/a\u003e13. Tools","Others","MMdnn","Model Storage Optimisation","其他_机器学习与深度学习","Model serialisation formats","Useful PyTorch Tools","\u003ca name=\"Tools\"\u003e\u003c/a\u003e9. Tools"],"sub_categories":["Synthetic Data","13.1 Converter","DNN conversion framework","NLP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMicrosoft%2FMMdnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMicrosoft%2FMMdnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMicrosoft%2FMMdnn/lists"}