|
1 | 1 | # [ONNX](https://github.com/onnx/onnx) tutorials |
2 | 2 |
|
3 | | -## Importing and Exporting from frameworks |
| 3 | +[Open Neural Network Exchange (ONNX)](http://onnx.ai/) is an open standard format of machine learning models to offer interoperability between various AI frameworks. With ONNX, AI develpers could choose the best framework for training and switch to different one for shipping. |
| 4 | + |
| 5 | +ONNX is supported by [a community of partners](https://onnx.ai/supported-tools), and more and more AI frameworks are buiding ONNX support including PyTorch, Caffe2, Microsoft Cognitive Toolkit and Apache MXNet. |
| 6 | + |
| 7 | +## Getting ONNX models |
| 8 | + |
| 9 | +* Choose a pre-trained ONNX model from the [ONNX Model Zoo](https://github.com/onnx/models). A lot of pre-trained ONNX models are provided for common scenarios. |
| 10 | +* Convert models from mainstream frameworks. More tutorials are below. |
4 | 11 |
|
5 | 12 | | Framework / tool | Installation | Exporting to ONNX (frontend) | Importing ONNX models (backend) | |
6 | 13 | | --- | --- | --- | --- | |
|
9 | 16 | | [Cognitive Toolkit (CNTK)](https://www.microsoft.com/en-us/cognitive-toolkit/) | [built-in](https://docs.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your-machine) | [Exporting](tutorials/CntkOnnxExport.ipynb) | [Importing](tutorials/OnnxCntkImport.ipynb) | |
10 | 17 | | [Apache MXNet](http://mxnet.incubator.apache.org/) | part of mxnet package [docs](http://mxnet.incubator.apache.org/api/python/contrib/onnx.html) [github](https://github.com/apache/incubator-mxnet/tree/master/python/mxnet/contrib/onnx) | [Exporting](tutorials/MXNetONNXExport.ipynb) | [Importing](tutorials/OnnxMxnetImport.ipynb) | |
11 | 18 | | [Chainer](https://chainer.org/) | [chainer/onnx-chainer](https://github.com/chainer/onnx-chainer) | [Exporting](tutorials/ChainerOnnxExport.ipynb) | coming soon | |
12 | | -| [TensorFlow](https://www.tensorflow.org/) | [onnx/onnx-tensorflow](https://github.com/onnx/onnx-tensorflow) | [Exporting](tutorials/OnnxTensorflowExport.ipynb) | [Importing](tutorials/OnnxTensorflowImport.ipynb) [experimental] | |
| 19 | +| [TensorFlow](https://www.tensorflow.org/) | [onnx/onnx-tensorflow](https://github.com/onnx/onnx-tensorflow) and [onnx/tensorflow-onnx](https://github.com/onnx/tensorflow-onnx) | [Exporting](tutorials/OnnxTensorflowExport.ipynb) | [Importing](tutorials/OnnxTensorflowImport.ipynb) [experimental] | |
13 | 20 | | [Apple CoreML](https://developer.apple.com/documentation/coreml) | [onnx/onnx-coreml](https://github.com/onnx/onnx-coreml) and [onnx/onnxmltools](https://github.com/onnx/onnxmltools) | [Exporting](https://github.com/onnx/onnxmltools) | [Importing](tutorials/OnnxCoremlImport.ipynb) | |
14 | 21 | | [SciKit-Learn](http://scikit-learn.org/) | [onnx/onnxmltools](https://github.com/onnx/onnxmltools) | [Exporting](https://github.com/onnx/onnxmltools) | n/a | |
15 | 22 | | [ML.NET](https://github.com/dotnet/machinelearning/) | [built-in](https://docs.microsoft.com/en-us/dotnet/api/microsoft.ml.models.onnxconverter.convert?view=ml-dotnet#definition) | [Exporting](https://github.com/dotnet/machinelearning/blob/master/test/Microsoft.ML.Tests/OnnxTests.cs) | [Importing](https://github.com/dotnet/machinelearning/blob/master/test/Microsoft.ML.OnnxTransformTest/OnnxTransformTests.cs#L186) | |
16 | 23 | | [Menoh](https://github.com/pfnet-research/menoh) | [pfnet-research/menoh](https://github.com/pfnet-research/menoh) | n/a | [Importing](tutorials/OnnxMenohHaskellImport.ipynb) | |
17 | 24 | | [MATLAB](https://www.mathworks.com/) | [onnx converter on matlab central file exchange](https://www.mathworks.com/matlabcentral/fileexchange/67296) | [Exporting](https://www.mathworks.com/help/deeplearning/ref/exportonnxnetwork.html) | [Importing](https://www.mathworks.com/help/deeplearning/ref/importonnxnetwork.html) | |
18 | 25 |
|
19 | | -## End-to-end tutorials |
| 26 | +* Use services like [Azure Custom Vision service](https://docs.microsoft.com/en-us/azure/cognitive-services/Custom-Vision-Service/custom-vision-onnx-windows-ml) that generate customized ONNX models for your data |
20 | 27 |
|
21 | | -* [Docker image for Caffe2/PyTorch tutorials](pytorch_caffe2_docker.md) |
22 | | -* [Caffe/Keras/CoreML Docker Converter Image](https://hub.docker.com/r/microsoft/onnxconverter/) |
23 | | -* [Converting SuperResolution model from PyTorch to Caffe2 and deploying on mobile device](tutorials/PytorchCaffe2SuperResolution.ipynb) |
24 | | -* [Transferring SqueezeNet from PyTorch to Caffe2 and to Android app](tutorials/PytorchCaffe2MobileSqueezeNet.ipynb) |
25 | | -* [Serving PyTorch Models on AWS Lambda with Caffe2 & ONNX](https://machinelearnings.co/serving-pytorch-models-on-aws-lambda-with-caffe2-onnx-7b096806cfac) |
26 | | -* [Serving ONNX models with MXNet Model Server](tutorials/ONNXMXNetServer.ipynb) |
27 | | -* [Converting Style Transfer model from PyTorch to CoreML and deploying to an iPhone](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive) |
28 | | -* [Convert a PyTorch model to Tensorflow using ONNX](tutorials/PytorchTensorflowMnist.ipynb) |
29 | | -* [MXNet to ONNX to ML.NET with SageMaker, ECS and ECR](https://cosminsanda.com/posts/mxnet-to-onnx-to-ml.net-with-sagemaker-ecs-and-ecr/) - external link |
| 28 | +## End-to-end tutorials |
30 | 29 |
|
| 30 | +* For preparation |
| 31 | + * [Docker image for Caffe2/PyTorch/ONNX tutorials](pytorch_caffe2_docker.md) |
| 32 | + * [Caffe/Keras/CoreML Docker Converter Image](https://hub.docker.com/r/microsoft/onnxconverter/) |
| 33 | + |
| 34 | +* For serving |
| 35 | + * [Serving ONNX models with MXNet Model Server](tutorials/ONNXMXNetServer.ipynb) |
| 36 | + |
| 37 | +* For conversion |
| 38 | + * [Convert a PyTorch model to Tensorflow using ONNX](tutorials/PytorchTensorflowMnist.ipynb) |
| 39 | + |
| 40 | +* From conversion to deployment |
| 41 | + * [Converting SuperResolution model from PyTorch to Caffe2 with ONNX and deploying on mobile device](tutorials/PytorchCaffe2SuperResolution.ipynb) |
| 42 | + * [Transferring SqueezeNet from PyTorch to Caffe2 with ONNX and to Android app](tutorials/PytorchCaffe2MobileSqueezeNet.ipynb) |
| 43 | + * [Converting Style Transfer model from PyTorch to CoreML with ONNX and deploying to an iPhone](https://github.com/onnx/tutorials/tree/master/examples/CoreML/ONNXLive) |
| 44 | + * [Serving PyTorch Models on AWS Lambda with Caffe2 & ONNX](https://machinelearnings.co/serving-pytorch-models-on-aws-lambda-with-caffe2-onnx-7b096806cfac) |
| 45 | + * [MXNet to ONNX to ML.NET with SageMaker, ECS and ECR](https://cosminsanda.com/posts/mxnet-to-onnx-to-ml.net-with-sagemaker-ecs-and-ecr/) - external link |
| 46 | + |
31 | 47 | ## ONNX tools |
32 | 48 |
|
33 | 49 | * [Verifying correctness and comparing performance](tutorials/CorrectnessVerificationAndPerformanceComparison.ipynb) |
34 | 50 | * [Visualizing an ONNX model](tutorials/VisualizingAModel.md) (useful for debugging) |
| 51 | +* [Netron: a viewer for ONNX models](https://github.com/lutzroeder/Netron) |
35 | 52 | * [Example of operating on ONNX protobuf](https://github.com/onnx/onnx/blob/master/onnx/examples/Protobufs.ipynb) |
36 | 53 |
|
37 | 54 | ## Contributing |
|
0 commit comments