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.

Model Optimizer convert failed

Pu__Hui
Beginner
595 Views

Hi, when I convert my own model to IR, it occurs such errors:

[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:85 ]  Shape is not defined for output 0 of "ExpandDims".
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:111 ]  Cannot infer shapes or values for node "ExpandDims".
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:112 ]  Not all output shapes were inferred or fully defined for node "ExpandDims". For more information please refer to Model Optimizer FAQ, question #40.
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:113 ]
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:114 ]  It can happen due to bug in custom shape infer function <function tf_expand_dims_infer at 0x7f1812ccc158>.
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:115 ]  Or because the node inputs have incorrect values/shapes.
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ infer:116 ]  Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ 2018-05-04 14:22:09,623 ] [ DEBUG ] [ infer:120 ]  Node "ExpandDims" attributes: {'pb': name: "ExpandDims"
op: "ExpandDims"
input: "x_in"
input: "ExpandDims/dim"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "Tdim"
  value {
    type: DT_INT32
  }
}
, 'precision': 'FP32', 'op': 'ExpandDims', 'shape_attrs': ['shape', 'window', 'stride', 'output_shape', 'pad'], 'is_const_producer': False, 'infer': <function tf_expand_dims_infer at 0x7f1812ccc158>, 'IE': [('layer', [('id', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc0f28>), 'name', 'precision', 'type'], [('data', ['epsilon', 'min', 'max', ('axis', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1048>), 'tiles', ('dim', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc10d0>), 'num_axes', ('pool-method', 'pool_method'), 'group', 'rounding_type', ('exclude-pad', 'exclude_pad'), 'operation', 'out-size', 'power', 'shift', 'alpha', 'beta', 'coords', 'classes', 'num', ('local-size', 'local_size'), 'region', 'knorm', 'num_classes', 'keep_top_k', 'variance_encoded_in_target', 'code_type', 'share_location', 'nms_threshold', 'confidence_threshold', 'background_label_id', 'top_k', 'eta', 'visualize', 'visualize_threshold', 'save_file', 'output_directory', 'output_name_prefix', 'output_format', 'label_map_file', 'name_size_file', 'num_test_image', 'prob', 'resize_mode', 'height', 'width', 'height_scale', 'width_scale', 'pad_mode', 'pad_value', 'interp_mode', 'img_size', 'img_h', 'img_w', 'step', 'step_h', 'step_w', ('offset', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1158>), 'variance', 'flip', 'clip', ('min_size', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc11e0>), ('max_size', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1268>), ('aspect_ratio', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc12f0>), 'decrease_label_id', 'normalized', ('type', 'norm_type'), 'eps', 'across_spatial', 'value', 'mean', 'std', 'sparse', 'variance_norm', 'channel_shared', 'negative_slope', 'engine', 'num_filter', ('type', 'sample_type'), ('order', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1378>), 'pooled_h', 'pooled_w', 'spatial_scale', 'cls_threshold', 'max_num_proposals', 'iou_threshold', 'min_bbox_size', 'feat_stride', 'pre_nms_topn', 'post_nms_topn', ('type', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1400>), ('value', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1488>), ('output', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1510>), ('input_nodes_names', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1598>), ('output_tensors_names', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1620>), ('real_input_dims', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc16a8>), ('protobuf', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1730>), {'custom_attributes': None}, ('stride-x', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc17b8>), ('stride-y', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1840>), ('kernel-x', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc18c8>), ('kernel-y', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1950>), ('kernel-x', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc19d8>), ('kernel-y', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1a60>), ('dilation-x', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1ae8>), ('dilation-y', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1b70>), ('pad-x', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1c80>), ('pad-y', <function spatial_getter.<locals>.<lambda> at 0x7f1811dc1d90>), ('scale', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1e18>), ('stride', <function update_ie_fields.<locals>.<lambda> at 0x7f1811dc1ea0>), 'crop_width', 'crop_height', 'write_augmented', 'max_multiplier', 'augment_during_test', 'recompute_mean', 'write_mean', 'mean_per_pixel', 'mode', 'bottomwidth', 'bottomheight', 'chromatic_eigvec', 'kernel_size', 'max_displacement', 'stride_1', 'stride_2', 'single_direction', 'do_abs', 'correlation_type', 'antialias', 'resample_type', 'factor', 'coeff'], []), '@ports', '@consts'])], 'is_output_reachable': True, 'name': 'ExpandDims', 'kind': 'op', 'is_undead': False, 'is_partial_inferred': False, 'dim_attrs': ['channel_dims', 'batch_dims', 'spatial_dims', 'axis']}
[ 2018-05-04 14:22:09,623 ] [ ERROR ] [ main:227 ]  Stopped shape/value propagation at "ExpandDims" node. For more information please refer to Model Optimizer FAQ, question #38.
[ 2018-05-04 14:22:09,624 ] [ DEBUG ] [ main:228 ]  Traceback (most recent call last):
  File "/opt/intel/computer_vision_sdk_2018.0.234/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 100, in partial_infer
    'For more information please refer to Model Optimizer FAQ, question #40.', node_name)
mo.utils.error.Error: Not all output shapes were inferred or fully defined for node "ExpandDims". For more information please refer to Model Optimizer FAQ, question #40.

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

Traceback (most recent call last):
  File "/opt/intel/computer_vision_sdk_2018.0.234/deployment_tools/model_optimizer/mo/main.py", line 222, in main
    return driver(argv)
  File "/opt/intel/computer_vision_sdk_2018.0.234/deployment_tools/model_optimizer/mo/main.py", line 190, in driver
    mean_scale_values=mean_scale)
  File "/opt/intel/computer_vision_sdk_2018.0.234/deployment_tools/model_optimizer/mo/pipeline/tf.py", line 143, in tf2nx
    partial_infer(graph)
  File "/opt/intel/computer_vision_sdk_2018.0.234/deployment_tools/model_optimizer/mo/middle/passes/infer.py", line 123, in partial_infer
    'For more information please refer to Model Optimizer FAQ, question #38.') from err
mo.utils.error.Error: Stopped shape/value propagation at "ExpandDims" node. For more information please refer to Model Optimizer FAQ, question #38.

How can I solve the problem? Thanks so much!

0 Kudos
4 Replies
Seunghyuk_P_Intel
595 Views

Hi Pu Hui,

What is the base model of your model and can you share your model and ckcp for better investigation?

If you don't want to upload here, you can upload files in any cloud storage and send information to my company email.

Regards,

Peter.

 

0 Kudos
Pu__Hui
Beginner
595 Views

Hi Peter,

Thanks for your reply, the base of my model is inception V1.

At first  I have converted inception V1 successfully, that means the CVSDK environment is correct. Then I try to convert my model which based on inception V1, but it occurs above errors.

Could you give me some advices? Thanks so much!

Pu Hui.

0 Kudos
Zhen_Z_Intel
Employee
595 Views

Hi Pu Hui,

If the shape is not defined for specific node 'ExpandDims', please try to use --input-shape to override model input shapes. Thanks.

Best regards,
Fiona

0 Kudos
Junwei_Y_Intel
Employee
595 Views

Fiona Z. (Intel) wrote:

Hi Pu Hui,

If the shape is not defined for specific node 'ExpandDims', please try to use --input-shape to override model input shapes. Thanks.

Best regards,
Fiona

Hi Fiona,

I have encountered the same problem as the poster did. However using input_shape wouldn't help.

I am wondering what the reason is to set the flag "input_shape", as the input is usually a placeholder with predefined shape (e.g. [32, 32, 3] for a typical image). I can see that the 'ExpandDims' op is trying to expand the dimension of input (e.g. from [32, 32, 3] to [1, 32, 32, 3]) after preprocessing the image so as to be able to feed into the neural network. But I just have no idea why the shape of 'ExpandDims' cannot be inferred from previous ops. Any advice would be highly appreciated.

Best regards,
Junwei

0 Kudos
Reply