Article ID: 000090906 Content Type: Error Messages Last Reviewed: 06/13/2023

Unable to Convert Keras H5 Model to Intermediate Representation (IR) Format without Specifying the Input Shape

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Specify input shape when converting Keras H5 model into IR format.

Description
  • Converted Keras H5 model using the following command:

    mo --saved_model_dir model/

  • Encountered the following error:

    [ ERROR ] Shape [-1 30 30 3] is not fully defined for output 0 of "conv2d_input".

    Use --input_shape with positive integers to override model input shapes.

  • Could not determine the value for the --input_shape parameter.
Resolution

Input shape values are in the order of [N,H,W,C] for TensorFlow* models. The meaning for each letter are as follows:

LetterMeaning
NNumber of images in the batch
HHeight of the image
WWidth of the image
CNumber of channels of the image (ex: 3 for RGB, 1 for grayscale…)

 

Convert the Keras H5 model using the following command:

python3 mo --saved_model_dir <path_to_model> --input_shape [1,30,30,3]

Related Products

This article applies to 1 products