onnx/tensorflow-onnx

Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX

What it solves

It enables the conversion of machine learning models from the TensorFlow ecosystem into the ONNX (Open Neural Network Exchange) format. This allows models trained in TensorFlow, Keras, TensorFlow.js, or TFLite to be run on different runtimes and hardware accelerators that support ONNX, bypassing the limitations of being locked into a single framework.

How it works

The tool provides a command-line interface (CLI) and a Python API to map TensorFlow operators to their ONNX equivalents. It supports multiple input formats, including SavedModel, checkpoints, graphdef files, TFLite, and TensorFlow.js models. Users can specify the target ONNX opset version to ensure compatibility with their specific runtime and can apply workarounds for specific target platforms (e.g., Windows ML).

Who it’s for

ML engineers and developers who need to deploy TensorFlow-based models to diverse environments or runtimes (such as ONNX Runtime) without retraining the model.

Highlights

  • Broad Format Support: Converts models from TensorFlow 2.x, Keras, TFLite, and TensorFlow.js.
  • Flexible Conversion: Offers both a CLI for quick conversions and a Python API for integration into workflows.
  • Opset Control: Allows users to specify the ONNX opset version (supporting opset-14 to 18).
  • Large Model Handling: Supports the external tensor storage format to convert models exceeding 2 GB.
  • Customization: Provides options to handle custom operators, transpose image formats (NHWC to NCHW), and apply platform-specific workarounds.

Related

  • Project
  • Project
  • Project
  • Project
  • Project