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.

unable to convert ssd_mobilenet_v2_coco model with new height and width using openvino 2020.1

nistala__krishna_vam
590 Views

I was trying to convert ssd_mobilenet_v2_coco model with input_shape=[1,480,640,3] using openvino 2020.1 using this command mo.py --framework=tf --data_type=FP16  --framework=tf --data_type=FP16 --output_dir=<Training_dir> --model_name=ssd_mobilenet_v2_coco --reverse_input_channels --keep_shape_ops --input=image_tensor --transformations_config=D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_v2_support.json --tensorflow_object_detection_api_pipeline_config=<Training_dir>\exported_model\pipeline.config --input_model=<Training_dir>\exported_model\frozen_inference_graph.pb --log_level=DEBUG --batch=1 but it works for custom model.

Error:\

[ 2020-04-15 12:04:27,554 ] [ DEBUG ] [ infer:129 ]  Partial infer for Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select
[ 2020-04-15 12:04:27,554 ] [ DEBUG ] [ infer:130 ]  Op: Select
[ 2020-04-15 12:04:27,554 ] [ DEBUG ] [ infer:131 ]  Inputs:
[ 2020-04-15 12:04:27,554 ] [ DEBUG ] [ infer:31 ]  input[0]: shape = [100], value = [ True  True  True  True  True  True  True  True  True  True  True  True
  True  True  True  True...
[ 2020-04-15 12:04:27,554 ] [ DEBUG ] [ infer:31 ]  input[1]: shape = [100], value = <UNKNOWN>
[ 2020-04-15 12:04:27,555 ] [ DEBUG ] [ infer:31 ]  input[2]: shape = [100], value = [-1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1. -1.
 -1. -1. -1. -1. -1. -1....
[ ERROR ]  Cannot infer shapes or values for node "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select".
[ ERROR ]
[ ERROR ]
[ ERROR ]  It can happen due to bug in custom shape infer function <function Select.infer at 0x00000193EEEFB6A8>.
[ ERROR ]  Or because the node inputs have incorrect values/shapes.
[ ERROR ]  Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ 2020-04-15 12:04:27,559 ] [ DEBUG ] [ infer:196 ]  Node "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select" attributes: {'_out_ports': {0: {'control_flow': False}}, 'IE': [('layer', [('id', <function Op.substitute_ie_attrs.<locals>.<lambda> at 0x00000193EFDFF730>), 'name', 'type', 'version'], [('data', [], []), '@ports', '@consts'])], 'is_const_producer': False, '_in_ports': {0: {'control_flow': False}, 1: {'control_flow': False}, 2: {'control_flow': False}}, 'name': 'Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select', 'dim_attrs': ['spatial_dims', 'axis', 'channel_dims', 'batch_dims'], 'type_infer': <function Select.type_infer at 0x00000193EEEFB730>, 'kind': 'op', 'is_output_reachable': True, 'format': 'tf', 'pb': name: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select"
op: "Select"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Less"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Gather/GatherV2_1"
input: "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/mul"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
, 'in_ports_count': 3, 'is_partial_inferred': False, 'op': 'Select', 'out_ports_count': 1, 'shape_attrs': ['shape', 'output_shape', 'stride', 'window', 'pad'], 'infer': <function Select.infer at 0x00000193EEEFB6A8>, 'type': 'Select', 'is_undead': False}
[ ANALYSIS INFO ]  Your model looks like TensorFlow Object Detection API Model.
Check if all parameters are specified:
        --tensorflow_use_custom_operations_config
        --tensorflow_object_detection_api_pipeline_config
        --input_shape (optional)
        --reverse_input_channels (if you convert a model to use with the Inference Engine sample applications)
Detailed information about conversion of this model can be found at
https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select" node.
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38.
[ 2020-04-15 12:04:27,561 ] [ DEBUG ] [ main:324 ]  Traceback (most recent call last):
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\middle\passes\infer.py", line 134, in partial_infer
    node.infer(node)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\extensions\ops\select.py", line 56, in infer
    assert condition_node.value.size == 1
AssertionError

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

Traceback (most recent call last):
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 287, in apply_transform
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\middle\pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\extensions\middle\PartialInfer.py", line 32, in find_and_replace_pattern
    partial_infer(graph)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\middle\passes\infer.py", line 198, in partial_infer
    refer_to_faq_msg(38)) from err
mo.utils.error.Error: Stopped shape/value propagation at "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select" node.
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38.

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

Traceback (most recent call last):
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 314, in main
    return driver(argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 281, in driver
    ret_res = emit_ir(prepare_ir(argv), argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 226, in prepare_ir
    graph = mo_tf.driver(argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\pipeline\tf.py", line 111, in driver
    class_registration.ClassType.BACK_REPLACER
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 324, in apply_replacements
    num_transforms=len(replacers_order))
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\logger.py", line 124, in wrapper
    function(*args, **kwargs)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 303, in apply_transform
    )) from err
mo.utils.error.Error: Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/Select" node.
 

 

0 Kudos
6 Replies
nikhil__aditya
Beginner
590 Views

Replace the parameter --transformations_config with --tensorflow_use_custom_operations_config and specify the same directory. 

0 Kudos
nikhil__aditya
Beginner
590 Views

Hi there,

it's a simple issue here. Just replace --transformations_config with --tensorflow_use_custom_operations_congif. And let me know if it works.

 

Thank you, 

Aditya Nikhil

0 Kudos
JAVIERJOSE_A_Intel
590 Views

Hi nistala, krishna vamsi,

 

Thanks for reaching out.

We noticed you did not include the --tensorflow_use_custom_operations_config flag in the model optimizer command. Try to run the command again adding the flag mentioned before and see if the issue persists.

 

Regards,

Javier A.

0 Kudos
nistala__krishna_vam
590 Views

Hi Javier,

I am using openvino version 2020.1. As far as I see it is provided that "--tensorflow_use_custom_operations_config" flag  has been renamed to "--transformations_config". The old command line parameter is deprecated and will be removed in the future release(provide in this (link)[https://docs.openvinotoolkit.org/2020.1/_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html]).so I have not used.

*Do u want me to change replace  --transformations_config with --tensorflow_use_custom_operations_config

 

Thanks in advance

 

 

 

0 Kudos
nistala__krishna_vam
590 Views

Hi javier,

I have done the changes as per your suggestion that is " --tensorflow_custom_operations_config=<INSTALL_DIR>\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_v2_support.json" but now it is crashing at 

[ 2020-04-18 18:33:17,847 ] [ DEBUG ] [ class_registration:281 ]  Run replacer <class 'extensions.front.tf.tensorflow_custom_operations_config_update.TensorflowCustomOperationsConfigUpdate'>
[ 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.front.tf.tensorflow_custom_operations_config_update.TensorflowCustomOperationsConfigUpdate'>)": 'Postprocessor/Shape'
[ ERROR ]  Traceback (most recent call last):
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 287, in apply_transform
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\middle\pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\extensions\front\tf\tensorflow_custom_operations_config_update.py", line 59, in find_and_replace_pattern
    replacement_desc.update_custom_replacement_attributes(graph)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\custom_replacement_config.py", line 234, in update_custom_replacement_attributes
    matched_nodes = sub_graph_between_nodes(graph, start_points, end_points)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\graph.py", line 166, in sub_graph_between_nodes
    if graph.node[node_name].get('op', '') == 'Parameter':
  File "C:\Users\invamskr\AppData\Roaming\Python\Python35\site-packages\networkx\classes\reportviews.py", line 178, in __getitem__
    return self._nodes
KeyError: 'Postprocessor/Shape'

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

Traceback (most recent call last):
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 314, in main
    return driver(argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 281, in driver
    ret_res = emit_ir(prepare_ir(argv), argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\main.py", line 226, in prepare_ir
    graph = mo_tf.driver(argv)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\pipeline\tf.py", line 111, in driver
    class_registration.ClassType.BACK_REPLACER
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 324, in apply_replacements
    num_transforms=len(replacers_order))
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\logger.py", line 124, in wrapper
    function(*args, **kwargs)
  File "D:\Intel_NCS2\Intel_NCS2_Drivers\openvino\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 309, in apply_transform
    )) from err
Exception: Exception occurred during running replacer "REPLACEMENT_ID (<class 'extensions.front.tf.tensorflow_custom_operations_config_update.TensorflowCustomOperationsConfigUpdate'>)": 'Postprocessor/Shape'

0 Kudos
JAVIERJOSE_A_Intel
590 Views

Hi nistala, krishna vamsi,

 

We tried to reproduce your issue using the .pb and .config files from TensorFlow Model Zoo, and we converted the model successfully using the command that you provided us in the original post.

Could you please provide us the exact model you used? Also, did you modify the config files?

 

Regards,

Javier A.

0 Kudos
Reply