Closed amitk-OE closed 3 months ago
Thanks you very much. I see that this feature was added in vesrion 1.21.1, and as far as I understand from the documentation it does not support the Tensorflow version I use (2.12.0). Is there a solution for applying this feature on an older version?
Since TensorFlow v2.15.0, the API specification has changed significantly with destructive changes to Keras, so backwarding the current onnx2tf code base to TensorFlow v2.14.0 and earlier API and maintaining multiple onnx2tf versions It is very costly and impractical to maintain multiple versions of onnx2tf.
Therefore, the following measures can be taken.
pip uninstall onnx2tf
pip install -e .
Thank you very much. I tried to follow your instruction from section 2 but I encounter an issue that prevents me from moving forward. The following issue happens in v.1.17.5 (using the supplied docker), before I apply any changes to the code .
A different ONNX model that includes a resize layer is attached - toy_with_constant_and_resize.onnx.zip
Following the comment in https://github.com/PINTO0309/onnx2tf/pull/628/files I added the flag "-nuo" to my command, but when I try to run "onnx2tf -i toy_with_constant_and_resize.onnx -osd -nuo" I get the following error - TypeError: Could not build a TypeSpec for KerasTensor(type_spec=TensorSpec(shape=(1, None, None, 64), dtype=tf.float32, name=None), name='tf.compat.v1.image.resize_nearest_neighbor/ResizeNearestNeighbor:0', description="created by layer 'tf.compat.v1.image.resize_nearest_neighbor'") of unsupported type <class 'keras.src.engine.keras_tensor.KerasTensor'>.
Issue Type
Others
OS
Linux
onnx2tf version number
1.1.30
onnx version number
1.12.0
onnxruntime version number
1.17.30
onnxsim (onnx_simplifier) version number
0.4.8
tensorflow version number
2.10.0
Download URL for ONNX
toy_with_constant.onnx.zip toy_with_constant_after_conversion.onnx.zip
Parameter Replacement JSON
Description
Thanks you for this great contribution!
My model, in addition to its regular output, has a constant output. I'll explain - when the model get an image as input, it returns - (1) a set of features (2) a constant array. Though it may sound as a strange practice, I find it useful to deploy the model with all the constants required for the post-process.
When running - "onnx2tf -i toy_with_constant.onnx -osd", the ONNX is changed so the constant output is removed, and the tflite output also does not contain this output.
It would be very helpful if there is way to convert the ONNX to tflite in a way that would preserve the constant output.
Thank you!