Search code examples
openvino

Shapes are not consistent


I run the mo (model optimizer in openvino toolkit) as below:

mo --input_model ../models/middlebury_d400.pb --input_shape [1,352,704,6]

And get the error messages as following:

Model Optimizer arguments:
Common parameters:
    - Path to the Input Model:  /home/paul/tf2.x/hitnet-test/openvino/../models/middlebury_d400.pb
    - Path for generated IR:    /home/paul/tf2.x/hitnet-test/openvino/.
    - IR output name:   middlebury_d400
    - Log level:    ERROR
    - Batch:    Not specified, inherited from the model
    - Input layers:     Not specified, inherited from the model
    - Output layers:    Not specified, inherited from the model
    - Input shapes:     [1,352,704,6]
    - Source layout:    Not specified
    - Target layout:    Not specified
    - Layout:   Not specified
    - Mean values:  Not specified
    - Scale values:     Not specified
    - Scale factor:     Not specified
    - Precision of IR:  FP32
    - Enable fusing:    True
    - User transformations:     Not specified
    - Reverse input channels:   False
    - Enable IR generation for fixed input shape:   False
    - Use the transformations config file:  None
Advanced parameters:
    - Force the usage of legacy Frontend of Model Optimizer for model conversion into IR:   False
    - Force the usage of new Frontend of Model Optimizer for model conversion into IR:  False
TensorFlow specific parameters:
    - Input model in text protobuf format:  False
    - Path to model dump for TensorBoard:   None
    - List of shared libraries with TensorFlow custom layers implementation:    None
    - Update the configuration file with input/output node names:   None
    - Use configuration file used to generate the model with Object Detection API:  None
    - Use the config file:  None
OpenVINO runtime found in:  /opt/intel/openvino_2022/python/python3.8/openvino
OpenVINO runtime version:   2022.1.0-7019-cdb9bec7210-releases/2022/1
Model Optimizer version:    2022.1.0-7019-cdb9bec7210-releases/2022/1
[ WARNING ]  Changing Const node '6284' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6286' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6288' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6292' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6290' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6298' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6278' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6294' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6280' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6296' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6282' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node '6300' data type from int64 to <class 'numpy.float32'> for Mul operation
[ WARNING ]  Changing Const node 'shared/refinement_l2/Slice/where_max_ends_is_needed_input_port_0/value' data type from int64 to <class 'numpy.int32'> for Equal operation
[ ERROR ]  Check 'data_pshape[i].compatible(indices_pshape[i])' failed at core/shape_inference/include/gather_shape_inference.hpp:80:
While validating node 'v0::Gather Gather_4901 (level5/level_init/Reshape_2/Transpose[0]:f32{1,96,192,400}, level5/level_init/GatherV2_1/Cast_1[0]:i32{1,1,96,192}, level5/level_init/GatherV2_1/axis[0]:i64{}) -> ()' with friendly_name 'Gather_4901':
Shapes {1,96,192,400} and {1,1,96,192} are not consistent. data and indices must have equal or intersecting sizes until batch_dims

[ ERROR ]  offline transformations step has failed.

for the middlebury_d400.pb you may wget it from:

wget -P . -N https://storage.googleapis.com/tensorflow-graphics/models/hitnet/de
fault_models/middlebury_d400.pb

Please advise how to fix the above error. Thank you.


Solution

  • Run Model Optimizer with additional parameter, --disable_nhwc_to_nchw that disables the default translation from NHWC to NCHW during the TensorFlow model conversion.