Onnx2tf

Latest version: v1.26.3

Safety actively analyzes 688323 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 43 of 85

1.7.20

- Correction of accuracy check logic breakage due to operation merging process
- [[TODO] Add simple optimization logic to the model 230](https://github.com/PINTO0309/onnx2tf/issues/230)

What's Changed
* Correction of accuracy check logic breakage due to operation merging process by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/232


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.19...1.7.20

1.7.19

- `Mul`, `Div`, `Sub`, `Add`
- Merge two consecutive identical OPs into one
- Replace `Div` with `Mul` to maximize performance of hardware dedicated to multiply-and-accumulate operations
- However, `BatchNormalization` and `Add`, `Sub`, `Mul`, `Div` are not fused.
- Before - onnx
![image](https://user-images.githubusercontent.com/33194443/223016838-d607618d-46aa-4829-86f8-314a8f2ed815.png)
- After - tflite
![image](https://user-images.githubusercontent.com/33194443/223016708-e89d13d7-2a0f-4e0d-a692-3036c016118b.png)

![image](https://user-images.githubusercontent.com/33194443/223037657-fe62fdb9-79f8-4ffd-b91f-8b86aeba7df5.png)

1. `Mul` -> `Mul` to `Single-Mul` : `10 * 5 * 8 -> 10 * 40`
2. `Mul` -> `Div` to `Single-Mul` : `10 * 5 / 8 -> 10 * 0.625`
3. `Div` -> `Mul` to `Single-Mul` : `10 / 5 * 8 -> 10 * 1.6`
4. `Div` -> `Div` to `Single-Mul` : `10 / 5 / 8 -> 10 * 0.025`
5. `Sub` -> `Sub` to `Single-Sub` : `10 - 5 - 8 -> 10 - 13`
6. `Sub` -> `Add` to `Single-Sub` : `10 - 5 + 8 -> 10 + 3`
7. `Add` -> `Add` to `Single-Add` : `10 + 5 + 8 -> 10 + 13`
8. `Add` -> `Sub` to `Single-Add` : `10 + 5 - 8 -> 10 - 3`

- [[TODO] Add simple optimization logic to the model 230](https://github.com/PINTO0309/onnx2tf/issues/230)

What's Changed
* Merge two consecutive identical OPs into one by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/231


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.18...1.7.19

1.7.18

- Improvement of tflite's I/O OP name rewriting process and I/O order control process
- Writing input/output information to tflite as `signature_defs`.
- Rewrite binaries so that input/output names match ONNX using `concrete_function`.
- `-coion / --copy_onnx_input_output_names_to_tflite` output tflite with options so that the signature is embedded in the tflite by default.
![image](https://user-images.githubusercontent.com/33194443/222949934-05067344-e8a6-40d5-94a1-e7bd96e83e87.png)
- onnx
![image](https://user-images.githubusercontent.com/33194443/222954383-46631e2b-11bf-4e17-95f4-322f8859a342.png)
- tflite
![image](https://user-images.githubusercontent.com/33194443/222955387-bd996fff-ca24-4530-9213-35fdbe674800.png)

https://github.com/PINTO0309/onnx2tf/releases/download/1.1.28/version-RFB-640.onnx
bash
onnx2tf -i version-RFB-640.onnx -coion

python
import numpy as np
import tensorflow as tf

interpreter = tf.lite.Interpreter(
model_path="saved_model/version-RFB-640_float32.tflite"
)
tf_lite_model = interpreter.get_signature_runner()
test_data = tf.convert_to_tensor(
value=np.ones(
shape=[1,480,640,3],
dtype=np.float32
)
)
tt_lite_output = tf_lite_model(
input=test_data,
)
print("[TFLite] Model Predictions:", tt_lite_output)


[TFLite] Model Predictions:
{'boxes': array([[[ 1.3372814e-04, 8.5677393e-04, 1.3687836e-02, 2.6055152e-02],
[-2.9060002e-03, -1.7406903e-03, 1.7976686e-02, 4.0702272e-02],
[-5.9925802e-03, -8.2277283e-03, 2.4591457e-02, 5.8303714e-02],
...,
[ 8.6583459e-01, 8.3152449e-01, 1.0436372e+00, 1.0488608e+00],
[ 8.2547259e-01, 7.7981573e-01, 1.0946229e+00, 1.1140716e+00],
[ 7.7743149e-01, 7.2188163e-01, 1.1553301e+00, 1.1767489e+00]]],
dtype=float32),
'scores': array([[[0.9121739 , 0.08782604],
[0.9121672 , 0.0878328 ],
[0.9121579 , 0.08784208],
...,
[0.9487316 , 0.05126836],
[0.96191823, 0.03808172],
[0.96088 , 0.03912005]]], dtype=float32)}

- Ref: https://www.tensorflow.org/lite/guide/signatures
- [[TODO] Improvement of tflite's I/O OP name rewriting process and I/O order control process 228](https://github.com/PINTO0309/onnx2tf/issues/228)
- [ONNX model input & output names are not preserved in TensorFlow & TensorFlow Lite models 178](https://github.com/PINTO0309/onnx2tf/issues/178)

What's Changed
* `-coion / --copy_onnx_input_output_names_to_tflite` output tflite with options so that the signature is embedded in the tflite by default. by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/229


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.17...1.7.18

1.7.17

- Prevent `saved_model` (.pb) bloat
- Before
![20230304205404](https://user-images.githubusercontent.com/33194443/222903514-407ae1b0-92bb-4fc6-aa54-d02e8bec112d.png)
- After
![20230304220423](https://user-images.githubusercontent.com/33194443/222903517-49c0b791-d095-40a1-8e55-ed1b40a26caf.png)

![image](https://user-images.githubusercontent.com/33194443/222905816-322d9995-7659-423f-b408-9bd8f7e4b1bf.png)

What's Changed
* Prevent saved_model (.pb) bloat by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/227


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.16...1.7.17

1.7.16

- `Softmax`
- Suppress automatic `FlexTraspose` extrapolation behavior by `Softmax` in TensorFlow
- Automatic extrapolation of `FlexTranspose` by `Softmax` occurs when the rank of the input tensor to `Softmax` is 7 or more dimensions and the `axis` is not the last dimension.
- Before
![20230304162845](https://user-images.githubusercontent.com/33194443/222882402-038b04e7-9c08-4c5e-b764-f8ba690c41db.png)
- After
![image](https://user-images.githubusercontent.com/33194443/222884060-35f875ba-3fad-4121-acfa-d39387348d5a.png)
![image](https://user-images.githubusercontent.com/33194443/222883790-59552c7d-13e3-4241-b976-2ba4da03f55a.png)

What's Changed
* Suppress automatic `FlexTraspose` extrapolation behavior by `Softmax` in TensorFlow by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/226


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.15...1.7.16

1.7.15

- `Softmax`
- Fixed `Softmax` accuracy check bug
- `Pow`
- Reduced `Pow` calculation error

- `Unimatch`
![image](https://user-images.githubusercontent.com/33194443/222872869-d7d17090-3f59-481d-9b49-f99f71ff2509.png)

- [[TODO] [unimatch] Creation of JSON for unimatch accuracy error resolution 203](https://github.com/PINTO0309/onnx2tf/issues/203)

What's Changed
* Fixed `Softmax` accuracy check bug and reduced `Pow` calculation error by PINTO0309 in https://github.com/PINTO0309/onnx2tf/pull/225


**Full Changelog**: https://github.com/PINTO0309/onnx2tf/compare/1.7.14...1.7.15

Page 43 of 85

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.