ONNX model converter to TensorFlow/TFLite/Keras, addressing Transpose issues
Top 43.6% on sourcepulse
This tool converts ONNX models to TensorFlow, TensorFlow Lite, and Keras formats, specifically addressing the "Transpose extrapolation problem" in onnx-tensorflow
. It's designed for developers and researchers working with ONNX models who need to deploy them on TensorFlow-compatible platforms, offering optimizations and workarounds for common conversion issues.
How It Works
The converter aims to minimize or eliminate unnecessary Transpose
operations, which are often introduced by other ONNX-to-TensorFlow converters when handling NCHW to NHWC format changes. It achieves this through a custom conversion process, decomposing complex operations into primitive TensorFlow operations and incorporating various model optimization techniques. The tool supports handling multi-dimensional inputs beyond the typical 4D, offering flexibility for diverse model architectures.
Quick Start & Requirements
pip install -U onnx==1.17.0 onnxruntime==1.18.1 onnx-graphsurgeon tensorflow==2.19.0 onnx2tf
(and other listed dependencies). Docker images are also available.flatc
binary is also needed for certain operations.onnx2tf -i <input_onnx_file> -o <output_folder>
Highlighted Details
-cotof
, -cotoa
) to compare ONNX and TensorFlow outputs.Maintenance & Community
The project is actively maintained by PINTO0309, with a focus on daily bug fixes and optimizations. The README encourages users to search issues for solutions and welcomes pull requests.
Licensing & Compatibility
The repository does not explicitly state a license in the README. Compatibility for commercial use or closed-source linking would require clarification on the licensing terms.
Limitations & Caveats
The tool's author notes that some complex models may still require manual parameter adjustments via JSON files (-prf
) to resolve conversion issues. The project's development is highly iterative, with frequent changes, and the author advises users to try older versions if encountering new problems. The tool is primarily developed and tested by a single individual, which may impact the bus factor.
1 week ago
1 day