openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.84k stars 2.18k forks source link

[Bug] Error converting Google AutoML to OpenVino using mo #11600

Closed RogerMor closed 2 years ago

RogerMor commented 2 years ago
System information (version)

System 1:

System 2:

Detailed description

Error when converting the model exported from Google AutoML to OPENVINO using mo --saved_model_dir "saved_model_path"

Obtained Error:

[ ERROR ] Error while emitting attributes for layer key (id = 0). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.

[ 2022-04-28 09:00:30,353 ] [ DEBUG ] [ main:551 ]  Traceback (most recent call last):
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 243, in serialize_element
    value = attr[1](node)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/ops/parameter.py", line 60, in <lambda>
    ('element_type', lambda node: np_data_type_to_destination_type(node.data_type)),
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/middle/passes/convert_data_type.py", line 80, in np_data_type_to_destination_type
    raise Error('Data type "{}" is not supported'.format(np_data_type))
openvino.tools.mo.utils.error.Error: Data type "<class 'str'>" is not supported

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 330, in serialize_node_attributes
    serialize_element(graph, node, s, parent_element, edges, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 249, in serialize_element
    raise Error(
openvino.tools.mo.utils.error.Error: Cannot emit value for attribute element_type for layer key. Internal attribute template: ('element_type', <function Parameter.supported_attrs.<locals>.<lambda> at 0x7fdbac5ed280>).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 330, in serialize_node_attributes
    serialize_element(graph, node, s, parent_element, edges, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 268, in serialize_element
    serialize_node_attributes(graph, node, subelements, element, edges, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 332, in serialize_node_attributes
    raise Error(
openvino.tools.mo.utils.error.Error: Error while emitting attributes for layer key (id = 0). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 444, in serialize_node
    serialize_node_attributes(graph, node, node.IE, layers, edges, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 332, in serialize_node_attributes
    raise Error(
openvino.tools.mo.utils.error.Error: Error while emitting attributes for layer key (id = 0). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 533, in main
    ret_code = driver(argv)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 491, in driver
    ret_res = emit_ir(graph, argv)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/main.py", line 423, in emit_ir
    prepare_emit_ir(graph=graph,
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/pipeline/common.py", line 245, in prepare_emit_ir
    generate_ie_ir(graph=graph,
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 606, in generate_ie_ir
    serialize_network(graph, net, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 567, in serialize_network
    serialize_node(graph, node, layers, edges, unsupported)
  File "/dischdd/Pervasive/anaconda3/envs/openvino_env/lib/python3.8/site-packages/openvino/tools/mo/back/ie_ir_ver_2/emitter.py", line 446, in serialize_node
    raise Error(str(e).replace('<SUB-ELEMENT>', '{} (id = {})'.format(node.soft_get('name'), node.id))) from e
openvino.tools.mo.utils.error.Error: Error while emitting attributes for layer key (id = 0). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.
Steps to reproduce

Train an object detection model (by default) with Google AutoML in Google Cloud Platform (https://cloud.google.com/vision/automl/object-detection/docs):

image

Create new dataset selecting "Object Detection"

image

Import dataset following the instructions:

image

Once the dataset is imported train new model:

image

And select the Edge option:

image

Follow the instructions in web to start training the model.

Once the model is trained go to Test & Use and export the model for Container:

image

which creates a TesnorFlow Saved Model

Finally:

Once we have the saved_model we use the mo for optimizing as following:

$mo --saved_model_dir saved_model_path

obtaining as a result:

[ ERROR ] Error while emitting attributes for layer key (id = 0). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.

and the full log:

log4.txt

This last step has been tested in both environments system1 and system2 reported at the begining of the issue

Comments

There are around some partial information for old OpenVino releases but I have not find any documentation for OpenVino 2022.1 to adress this issue

jgespino commented 2 years ago

@RogerMor Google AutoML models are not supported by OpenVINO. Please take a look at the list of Public Pre-Trained Models Device Support. I recommend re-training one of these models and use the transformations_config file for object detection api models.

RogerMor commented 2 years ago

Thanks a lot again!