tflite2onnx - Convert TensorFlow Lite models to ONNX
tflite2onnx converts TensorFlow Lite (TFLite) models (*.tflite) to ONNX models (*.onnx),
with data layout and quantization semantic properly handled (check the introduction blog for detail).
Highlights
-
If you'd like to convert a TensorFlow model (frozen graph
*.pb,SavedModelor whatever) to ONNX, trytf2onnx. Or, you can firstly convert it to a TFLite (*.tflite) model, and then convert the TFLite model to ONNX. -
Microsoft has implemented another TensorFlow Lite to ONNX model converter in
tf2onnxat Feb 2021 (we open sourcedtflite2onnxin May 2020).tf2onnxseems to able to convert Quantization just like us, and it seems able to convert RNN networks which we are not supported yet. Please trytf2onnx --tfliteiftflite2onnxmissing any functionality.
Installation
Install via pip pip install tflite2onnx.
Or install from source to get latest features (please try out with virtualenv):
- Download the repo:
git clone https://github.com/zhenhuaw-me/tflite2onnx.git && cd tflite2onnx - Build the package:
./scripts/build-wheel.sh - Install the built package:
pip install assets/dist/tflite2onnx-*.whl
Or you can just add the code tree to your $PYTHONPATH.
(Command line tool is not avaiable in this mode.)
export PYTHONPATH=$(pwd):${PYTHONPATH}
Usage
Python Interface
import tflite2onnx
tflite_path = '/path/to/original/tflite/model'
onnx_path = '/path/to/save/converted/onnx/model'
tflite2onnx.convert(tflite_path, onnx_path)
tflite2onnx now supports explicit layout, check the
test example.
Command Line
tflite2onnx /path/to/original/tflite/model /path/to/save/converted/onnx/model
Documentation
- FAQ
- Release note
- Contribution guide
- Introduction blog - the background, design and implementation
- How to enable a new operator
- Data layout semantic
Contributing
- If something seems wrong to you, report bugs.
- If some operators are not supported yet, you may request a new operator.
- It would be great if you can help to enable new operators, please join us with How to enable a new operator.
- Feel free to open any other related discussions.
Check contribution guide for more.
License
Apache License Version 2.0.
Metadata
Release files for tflite2onnx 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tflite2onnx-0.4.1.tar.gz | 29.3 kB | Without provenance | Details for tflite2onnx-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tflite2onnx-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for tflite2onnx-0.4.1-py3-none-any.whl |
Total release size: 71.4 kB
Release files / tflite2onnx-0.4.1.tar.gz
| Download URL | tflite2onnx-0.4.1.tar.gz |
|---|---|
| Size | 29.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a17d18398a87e40bf25df7c190b6fa9533dab3812431690e858f87ee2b697022
|
|
BLAKE2b-256 checksum How to use checksums |
829047beb443f16ce9264213bec1776fda2c168367ebc992a88039df19f87023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.14
|
Release files / tflite2onnx-0.4.1-py3-none-any.whl
| Download URL | tflite2onnx-0.4.1-py3-none-any.whl |
|---|---|
| Size | 42.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef310782d970220cef8ba407bdbcdf4c18f787a176fc16325ef7da08df3c503a
|
|
BLAKE2b-256 checksum How to use checksums |
91d221041386acdfbe76bfbaaf46b799e3af3a1ae69f3c9fe633c78273e7eacd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.14
|
Security for tflite2onnx 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.