Skip to content

Unable to convert to ONXX using Frozen.pb file and also using --checkpoint. Please Help [Urgent] #1981

Open
@rabaig

Description

@rabaig

Hello,

I am using the latest branch of tensorflow-onnx. I got struck and I need help and I am working on critical project.

My DeepLearning model generates checkpoint files and I tried to use the below command.

python -m tf2onnx.convert --checkpoint ./OCR_240000model.ckpt.meta --inputs input_img:0 --outputs DetResults:0 --output model.onnx

I got the error : AssertionError: DetResults is not in graph

Below is the detailed log
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/runpy.py:125: RuntimeWarning: 'tf2onnx.convert' found in sys.modules after import of package 'tf2onnx', but prior to execution of 'tf2onnx.convert'; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
Traceback (most recent call last):
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tf2onnx/convert.py", line 692, in
main()
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tf2onnx/convert.py", line 232, in main
graph_def, inputs, outputs = tf_loader.from_checkpoint(args.checkpoint, args.inputs, args.outputs)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tf2onnx/tf_loader.py", line 383, in from_checkpoint
frozen_graph = freeze_session(sess, input_names=input_names, output_names=output_names)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tf2onnx/tf_loader.py", line 305, in freeze_session
graph_def = convert_variables_to_constants(sess, graph_def, output_node_names)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 245, in convert_variables_to_constants
inference_graph = extract_sub_graph(input_graph_def, output_node_names)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 181, in extract_sub_graph
_assert_nodes_are_present(name_to_node, dest_nodes)
File "/home/jungyoonkim/anaconda3/envs/tensor/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 137, in _assert_nodes_are_present
assert d in name_to_node, "%s is not in graph" % d
AssertionError: DetResults is not in graph

I convert my checkpoints files to frozen.pb file and later I used the below command

python -m tf2onnx.convert --input FPN_Res152D_OCR_20222406_v1_Frozen.pb --inputs input_img:0 --outputs DetResults:0 --opset 11 --output model.onnx

I got the below error:

2022-06-26 21:46:34,344 - ERROR - Tensorflow op [cond/mul/Switch: Switch] is not supported
2022-06-26 21:46:34,344 - ERROR - Tensorflow op [cond/floordiv/Switch: Switch] is not supported
2022-06-26 21:46:34,344 - ERROR - Tensorflow op [cond/cond/Merge: Merge] is not supported
2022-06-26 21:46:35,788 - ERROR - Tensorflow op [postprocess_fastrcnn/PyFunc_32: PyFunc] is not supported

Though model get converted to ONXX with errors and internal optimizations but need help to resolve this issues.

Awaiting for your acknowledgment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unsupported opsIssues related to unsupported operators

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions