Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6404 Discussions

Model Optimiser Failure for Multiple Output Ports

Schulz__Daniel
Beginner
454 Views

Hi There,

I'm currently trying to convert a Tensorflow model to a Neural Compute Stick which contains a multi-dimensional reduction block, using mo.py

I experience the following error:

[ ERROR ]  -------------------------------------------------
[ ERROR ]  ----------------- INTERNAL ERROR ----------------
[ ERROR ]  Unexpected exception happened.
[ ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID (<class 'extensions.middle.ConvertGroupedStridedSlice.ConvertGroupedStridedSlice'>)": After re-inference of conv2_block1_2_reduce/strided_slice/Split node, old and new shapes do not match. Old shapes: [array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1])], new shapes: [array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4])].
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 273, in apply_replacements
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/middle/pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/extensions/middle/ConvertGroupedStridedSlice.py", line 205, in find_and_replace_pattern
    split.create_node_with_data(inputs=[input_data], data_nodes=final_data_nodes_list)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/ops/op.py", line 257, in create_node_with_data
    [data_node.shape for data_node in data_nodes])
AssertionError: After re-inference of conv2_block1_2_reduce/strided_slice/Split node, old and new shapes do not match. Old shapes: [array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1])], new shapes: [array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4])].

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

Traceback (most recent call last):
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/main.py", line 302, in main
    return driver(argv)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/main.py", line 251, in driver
    is_binary=not argv.input_model_is_text)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 134, in tf2nx
    class_registration.apply_replacements(graph, class_registration.ClassType.MIDDLE_REPLACER)
  File "/opt/intel/openvino_2019.2.242/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 299, in apply_replacements
    )) from err
Exception: Exception occurred during running replacer "REPLACEMENT_ID (<class 'extensions.middle.ConvertGroupedStridedSlice.ConvertGroupedStridedSlice'>)": After re-inference of conv2_block1_2_reduce/strided_slice/Split node, old and new shapes do not match. Old shapes: [array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1]), array([ 1, 56, 56, 32,  1])], new shapes: [array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4]), array([ 1, 56, 56, 32,  1,  4])].

[ ERROR ]  ---------------- END OF BUG REPORT --------------
[ ERROR ]  -------------------------------------------------

Having had a look through the stack trace (split.create_node_with_data(inputs=[input_data], data_nodes=final_data_nodes_list) from ConvertGroupedStridedSlice.py (approx. line 200) -> create_node_with_data from model_optimizer/mo/ops/op.py (line 157) -> to line 185 - it seems I've hit the 'TODO' case of having multiple output ports. If we see the model summery and relevant part of the graph I'm using:

...

conv2_block1_2_conv (DepthwiseC (None, 56, 56, 512) 4608 conv2_block1_2_pad[0][0] __________________________________________________________________________________________________

reshape_1 (Reshape) (None, 56, 56, 32, 4 0 conv2_block1_2_conv[0][0] __________________________________________________________________________________________________ conv2_block1_2_reduce (Lambda) (None, 56, 56, 32, 4 0 reshape_1[0][0] __________________________________________________________________________________________________

reshape_2 (Reshape) (None, 56, 56, 128) 0 conv2_block1_2_reduce[0][0] __________________________________________________________________________________________________

...

For greater clarity, here are the relevant sub-graphs from tensorboard:

conv2_block1_2_reduce.png

Since "old_data_shape" is [ 1 56 56 32  1], rather than the expected [ 1 56 56 32  4], there is the assertion error. Is this due to the editing/removing of connections from the old_data_nodes (in ConvertGroupedStridedSlice.py from lines 182)?

Any help would be greatly appreciated!

0 Kudos
5 Replies
Shubha_R_Intel
Employee
454 Views

Dear Schulz, Daniel,

I am looking into this. Thanks for your patience !

Shubha

 

0 Kudos
Shubha_R_Intel
Employee
454 Views

Dear Schulz, Daniel,

Multiple output ports are definitely supported by Model Optimizer. To know more about this issue I need access to your model. Can you attach it as a *.zip ? Please tell me the exact MO command you used. Also if you would prefer to send the model to me privately, that is also fine. Just let me know and I will PM you.

I see that you are using OpenVino 2019R2 which I appreciate.

Looking forward to hearing from you.

Shubha

0 Kudos
Schulz__Daniel
Beginner
454 Views

Hi Shubha,

Thank you.

I can PM you the model - let me know how to go about this.

Thanks,

Daniel

0 Kudos
Shubha_R_Intel
Employee
454 Views

Dear Schulz, Daniel,

Please respond to the PM i just sent you and attach your model as a *.zip.

thanks !

Shubha

 

0 Kudos
Schulz__Daniel
Beginner
454 Views

Would anyone from Intel be able to give a hand regarding this?

Still having the same issue...

0 Kudos
Reply