Questions tagged [tf2onnx]
31 questions
4
votes
1 answer
ONNX with custom ops from TensorFlow in Java
in order to make use of Machine Learning in Java, I'm trying to train a model in TensorFlow, save it as ONNX file and then use the file for inference in Java. While this works fine with simple models, it's getting more complicated using…

nf3lix
- 58
- 4
3
votes
1 answer
Convert TensorFlow to ONNX: Current implementation of RFFT or FFT only allows ComplexAbs as consumer not {'Imag', 'Real'}
I am trying to convert this TensorFlow model to onnx. But I get an error message:
> python -m tf2onnx.convert --saved-model .\spice --output model.onnx --opset 11 --verbose
...
2023-04-08 18:33:10,811 - ERROR - tf2onnx.tfonnx: Tensorflow op [Real:…

mihca
- 997
- 1
- 10
- 29
2
votes
1 answer
Export tensorflow model to ONNX and specify variable names
I have a tensorflow model written through model subclassing and I want to export it to ONNX format. This is simple enough with the script attached. However, the name of the input variable to the ONNX model is args_0. How can I rename it?
import…

Gianluca Micchi
- 1,584
- 15
- 32
2
votes
1 answer
Cannot convert TensorFlow (Keras) model to ONNX
I'm trying to convert a saved TensorFlow model to the ONNX format, but am getting the following error.
in _load_nodes
slot_variable = optimizer_object.add_slot(
AttributeError: '_UserObject' object has no attribute 'add_slot'
I used Keras (2.6)…

Igor Ševo
- 5,459
- 3
- 35
- 80
1
vote
0 answers
load/convert onnx model into pytorch
I need to use GNNExplainer which requires pytorch model.
However, my GNN model is written in keras libraries.
I tried to use this library to load my onnx model and convert into pytorch. Can Anyone help me to resolve this errors?
Here are the errors…

AliHamzaIub13
- 34
- 8
1
vote
2 answers
I trained a model in torch and then convert it to caffe and after that to tf. How to convert it now to onnx?
I trained a Resnet model in torch.
Then, I converted it to caffe and to tflite.
now I want to convert it to onnx.
How can I do it?
I try that command:
python3 -m tf2onnx.convert --tflite resnet.lite --output resnet.lite.onnx --opset 13…

Shirly
- 38
- 6
1
vote
1 answer
How to convert TensorFlow 2 saved model to be used with OpenCV dnn.readNet
I am struggling to find a way to convert my trained network using TensorFlow 2 Object detection API to be used with OpenCV for deployment purposes. I tried two methods for that but without success.
Could someone help me resolve this issue or propose…

KamalLagh
- 25
- 6
1
vote
1 answer
Import onnx models to tensorflow2.x?
I created a modified lenet model using tensorflow that looks like this:
img_height = img_width = 64
BS = 32
model = models.Sequential()
model.add(layers.InputLayer((img_height,img_width,1), batch_size=BS))
model.add(layers.Conv2D(filters=32,…

subspring
- 690
- 2
- 7
- 23
1
vote
2 answers
Getting error in installing tf2onnx on pip
I am trying to convert my .pb model to .onnx and for that I am installing tf2onnx using pip. However, doing that I keep getting following error
C:\Users\HC>pip install -U tf2onnx
Collecting tf2onnx
Using cached tf2onnx-1.9.3-py3-none-any.whl (435…

Mahi_G
- 29
- 1
- 2
1
vote
1 answer
Having issues installing/running tf2onnx
I'm trying to get Tf2onnx to run so that I can convert a saved_model.pb file to onnx format. Nothing is really working out. I have tried installing it with the pip install git+https://github.com/onnx/tensorflow-onnx command but same issue.

Isaac Padberg
- 200
- 8
1
vote
2 answers
Load onnx model in opencv dnn
I get the following error while loading onnx model (downloaded from here) in OpenCV-C++ (4.6.0-dev) using the given code. What am I doing wrong? Please help me to solve this problem.
[ERROR:0@0.003]…

fisakhan
- 704
- 1
- 9
- 27
0
votes
0 answers
ValueError: make_sure failure: Opset 11 is required for half_pixel_centers=True for node model/up_sampling2d_1/resize/ResizeNearestNeighbor
I want my Keras model to be converted to ONNX opset 10, but the error keeps showing up.
What do I do?
I tried changing the interpolation to bilinear but it still threw me an error. I also tried to use the resize function and I got this…
0
votes
0 answers
Tensorflow custom layer rbf_for_tf2 to ONNX
I'm trying to convert a model with tf2onnx that is using a custom RBF layer in Tensorflow 2. It throws me this error and I'm not sure if it's related to tf2onnx or the implementation of the layer. Anyone had a similar issue?
TF 2.12.1
tf2onnx:…
0
votes
0 answers
How to interpret parameters of ONNX model in c#
I have created a Tensoflow model in Python and exported it to an ONNX model to use in C#. The problem is that I don't know how to interpret the input and output parameters of the model in C#. I've seen some posts for specific situations, but for my…
0
votes
1 answer
Onnx model converted with tf2onnx runs on CPU only in python
I'm trying to use the model from the repository (on google drive) with onnx instead of tensorflow.
I converted it with:
python3 -m tf2onnx.convert --graphdef mars-small128.pb --output mars-small128_nchw.onnx --inputs-as-nchw "images:0" --inputs…

Dmitry
- 160
- 9