I have tried the above suggested tf2onnx solution, but to no avail. Gives the following error.
I am still wondering is there any news about importing tf2 saved model format to opencv dnn ?
C:\Python36_64\lib\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))
2021-12-14 15:26:12,660 - WARNING - ‘–tag’ not specified for saved_model. Using --tag serve
Traceback (most recent call last):
File “C:\Python36_64\lib\runpy.py”, line 193, in _run_module_as_main
“main”, mod_spec)
File “C:\Python36_64\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “C:\Python36_64\lib\site-packages\tf2onnx\convert.py”, line 633, in
main()
File “C:\Python36_64\lib\site-packages\tf2onnx\convert.py”, line 236, in main
use_graph_names=args.use_graph_names)
File “C:\Python36_64\lib\site-packages\tf2onnx\tf_loader.py”, line 615, in from_saved_model
tag, signatures, concrete_function, large_model, use_graph_names)
File “C:\Python36_64\lib\site-packages\tf2onnx\tf_loader.py”, line 552, in _from_saved_model_v2
imported = tf.saved_model.load(model_path, tags=tag) # pylint: disable=no-value-for-parameter
File “C:\Python36_64\lib\site-packages\tensorflow\python\saved_model\load.py”, line 864, in load
result = load_internal(export_dir, tags, options)[“root”]
File “C:\Python36_64\lib\site-packages\tensorflow\python\saved_model\load.py”, line 903, in load_internal
ckpt_options, options, filters)
File “C:\Python36_64\lib\site-packages\tensorflow\python\saved_model\load.py”, line 162, in init
self._load_all()
File “C:\Python36_64\lib\site-packages\tensorflow\python\saved_model\load.py”, line 259, in _load_all
self._load_nodes()
File “C:\Python36_64\lib\site-packages\tensorflow\python\saved_model\load.py”, line 448, in _load_nodes
slot_variable = optimizer_object.add_slot(
AttributeError: ‘_UserObject’ object has no attribute ‘add_slot’