I have a some problem with convert AttentionOCR to ONNX. I use this model on TF1.
I use this code for convert ONNX.
import tensorflow as tf
import tf2onnx
saved_model_dir = "convert/aocr-model"
onnx_model_path = "aocr_model.onnx"
with tf.compat.v1.Session(graph=tf.Graph()) as sess:
tf.compat.v1.saved_model.loader.load(sess, ["serve"], saved_model_dir)
sess.run(tf.compat.v1.global_variables_initializer())
output_node_names = ["prediction", "probability"]
frozen_graph_def = tf.compat.v1.graph_util.convert_variables_to_constants(
sess,
sess.graph_def,
output_node_names
)
input_names = ["input_image_as_bytes:0"]
output_names = ["prediction:0", "probability:0"]
onnx_model = tf2onnx.convert.from_graph_def(
frozen_graph_def,
input_names=input_names,
output_names=output_names,
output_path=onnx_model_path
)
print(f"{onnx_model_path}")
Error:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Node 'cond/ExpandDims' has an _output_shapes attribute inconsistent with the GraphDef for output #0: Shapes must be equal rank, but are 1 and 0
Thanks in advance.
I try use tf2onnx and MO in OpenVINO, but doesnt have succes
New contributor
Jool is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.