Giter VIP home page Giter VIP logo

onnx-tensorflow's Introduction

Tensorflow Backend and Frontend for ONNX

Build Status

To convert models between Tensorflow and ONNX:

Use CLI:

Command Line Interface Documentation

From Tensorflow to ONNX: onnx-tf convert -t onnx -i /path/to/input.pb -o /path/to/output.onnx

From ONNX to Tensorflow: onnx-tf convert -t tf -i /path/to/input.onnx -o /path/to/output.pb

Convert programmatically:

From Tensorflow to ONNX

From ONNX to Tensorflow

ONNX model inference with Tensorflow backend:

import onnx
from onnx_tf.backend import prepare

onnx_model = onnx.load("input_path")  # load onnx model
output = prepare(onnx_model).run(input)  # run the loaded model

More tutorials:

Running an ONNX model using Tensorflow

Exporting a Tensorflow Model to ONNX

Production Installation:

ONNX-TF requires ONNX (Open Neural Network Exchange) as an external dependency, for any issues related to ONNX installation, we refer our users to ONNX project repository for documentation and help. Notably, please ensure that protoc is available if you plan to install ONNX via pip.

The specific ONNX release version that we support in the master branch of ONNX-TF can be found here. This information about ONNX version requirement is automatically encoded in setup.py, therefore users needn't worry about ONNX version requirement when installing ONNX-TF.

To install the latest version of ONNX-TF via pip, run pip install onnx-tf.

Because users often have their own preferences for which variant of Tensorflow to install (i.e., a GPU version instead of a CPU version), we do not explicitly require tensorflow in the installation script. It is therefore users' responsibility to ensure that the proper variant of Tensorflow is available to ONNX-TF. Moreoever, we require Tensorflow version >= 1.5.0.

Development:

Coverage Status:

ONNX-Tensorflow Op Coverage Status

API:

ONNX-Tensorflow API

Installation:

  • Install ONNX master branch from source.
  • Install Tensorflow>=1.5.0.
  • Run git clone [email protected]:onnx/onnx-tensorflow.git && cd onnx-tensorflow.
  • Run pip install -e ..

Folder Structure:

  • onnx_tf main source code file.
  • test test files.

Code Standard:

  • Format code:
pip install yapf
yapf -rip --style="{based_on_style: google, indent_width: 2}" $FilePath$
  • Install pylint:
pip install pylint
wget -O /tmp/pylintrc https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/pylintrc
  • Check format:
pylint --rcfile=/tmp/pylintrc myfile.py

Documentation Standard:

http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html

To test:

To perfom unit tests, run python -m unittest discover test. Testing requires significant hardware resources, but nonetheless, we highly recommend that users run through the complete test suite before deploying onnx-tf. The complete test suite typically takes between 15 and 45 minutes to complete, depending on hardware configurations.

Test Help:

https://docs.python.org/2/library/unittest.html

Authors:

Arpith Jacob (IBM Research)

Tian Jin (IBM Research)

Gheorghe-Teodor Bercea (IBM Research)

Wenhao Hu (LeapMind)

onnx-tensorflow's People

Contributors

arpith-jacob avatar ashedko avatar bddppq avatar chinhuang007 avatar djsutherland avatar fumihwh avatar jsigee87 avatar lucasmahieu avatar ruimashita avatar talc23 avatar tengyifei avatar tjingrant avatar tkng avatar weikexin avatar winnietsang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.