Installing ONNX

ONNX can be installed from binaries, Docker or source. Instructions can be found at https://github.com/onnx/onnx

Importing and Exporting from Frameworks

ONNX support is integrated into different frameworks and deep learning tools:

Caffe2

Installing

Caffe2 bindings live in the https://github.com/onnx/onnx-caffe2 repo.

  • It can be installed as a separate package: pip install onnx-caffe2.
Exporting ONNX Models

To export models, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/Caffe2OnnxExport.ipynb.

Importing ONNX Models

To export models, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/OnnxCaffe2Import.ipynb.

Cognitive Toolkit

Installing

ONNX support is built into Cognitive Toolkit! Just follow the installation instructions at https://docs.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your-machine

Exporting ONNX Models

Follow the steps at https://github.com/onnx/tutorials/blob/master/tutorials/CntkOnnxExport.ipynb

Importing ONNX Models

Follow the steps at https://github.com/onnx/tutorials/blob/master/tutorials/CntkOnnxImport.ipynb

MXNet

Installing

MXNet bindings live in the https://github.com/onnx/onnx-mxnet repo. It can be installed as a separate package: pip install onnx-mxnet

Exporting ONNX Models

Export functionality for MXNet is coming soon!

Importing ONNX Models

To import models, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/OnnxMxnetImport.ipynb.

PyTorch

Installing

The ONNX exporter is a part of PyTorch — no installation required! You can check out the documentation at http://pytorch.org/docs/master/onnx.html

Exporting ONNX Models

To export models, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/PytorchExportBasic.ipynb.

Importing ONNX Models

PyTorch does not currently have support for importing ONNX models. We're open to contributions!

Convertors for additional frameworks and tools

CoreML

We have an early stage CoreML converter that can be found at https://github.com/onnx/onnx-coreml. We'd love for you to help improve it. To import into CoreML, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/OnnxCoremlImport.ipynb.

TensorFlow

We have an early stage TensorFlow-to-ONNX converter that can be found at https://github.com/onnx/onnx-tensorflow. We'd love for you to help improve it. To import into TensorFlow, you can follow the tutorial at https://github.com/onnx/tutorials/blob/master/tutorials/OnnxTensorflowImport.ipynb.

Ready for More?

More Tutorials

Explore additional functionality and advanced features in other tutorials at https://github.com/onnx/tutorials.

Model Zoo

Try out all the ONNX models contributed by the community in our model zoo or add your own for others to use!

Contributing

Contribute to ONNX or add support for your tool! You can start by exploring our contribution guide.