ONNX -> TFLite, TensorFlow, Keras, TFJS, CoreML 変換
実装している機能が多すぎるので、この記事に表現していない変換オプションはREADMEを参照。TransformerやSTTやTTSやその他もろもろの一発変換に対応したつもり。onnx-tensorflow より推論効率が高いモデルを生成できる。また、onnx-tensorflowよりも対応しているオペレーションの種類が多い。
コントリビューター
コード量(code = 行)
cloc .
419 text files.
414 unique files.
174 files ignored.
----------------------------------------
Language files blank comment code
----------------------------------------
YAML 7 42 79 586
Dockerfile 1 6 3 38
----------------------------------------
SUM: 340 5320 6719 42974
----------------------------------------
onnx==1.13.1
simple_onnx_processing_tools
tensorflow==2.13.0rc0
ghcr.io/pinto0309/onnx2tf:latest
pip
pip install onnx2tf -U
wget https://github.com/PINTO0309/onnx2tf/releases/download/0.0.2/resnet18-v1-7.onnx
2-2. 基本の「き」
TFLite を出力。
2-3. 基本の「ほ」
TFLite変換 + 完全体の saved_model を出力。
onnx2tf -i resnet18-v1-7.onnx -osd
2-4. 基本の「ん」
onnx2tf -i resnet18-v1-7.onnx -cotof
2-5. Keras
.h5 はイロイロと問題があるので、現状最新のフォーマット keras_v3 フォーマットで出力。
onnx2tf -i resnet18-v1-7.onnx -okv3
.h5 を生成するとき。
https://www.imdb.com/es/list/ls599679681/
https://www.imdb.com/es/list/ls599679681/copy/
onnx2tf -i resnet18-v1-7.onnx -oh5
# Custom flatc binary for Ubuntu 20.04+
# https://github.com/PINTO0309/onnx2tf/issues/196
wget https://github.com/PINTO0309/onnx2tf/releases/download/1.7.3/flatc.tar.gz \
&& tar -zxvf flatc.tar.gz \
&& sudo chmod +x flatc \
&& sudo mv flatc /usr/bin/
# Custom flatc binary for Windows
# Set the environment variable paths appropriately on your own.
# https://github.com/PINTO0309/onnx2tf/issues/196
https://github.com/PINTO0309/onnx2tf/releases/download/1.7.3/flatc.exe
onnx2tf -i resnet18-v1-7.onnx -coion