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.
6401 Discussions

OpenVino Model Optimizer-Shape [-1 -1 -1 1] is not fully defined for output 0 of "image"

rachel_r_Intel
Employee
1,335 Views

I am trying to help convert trained tensorflow model hfnet, I have no idea about more information about this model(I don't know the --input_shape parameter).this is the folder structure.

.
├── hfnet
│   ├── checkpoint
│   ├── config.yaml
│   ├── events.out.tfevents.1541966416.lo-s4-033
│   ├── log
│   ├── model.ckpt-83096.data-00000-of-00001
│   └── model.ckpt-83096.index
└── saved_models
    └── hfnet
        ├── saved_model.pb
        └── variables
            ├── variables.data-00000-of-00001
            └── variables.index

command:

python3 mo_tf.py --saved_model_dir /home/intel/hfnet/saved_models/hfnet/

I get the following error:

Common parameters:
	- Path to the Input Model: 	None
	- Path for generated IR: 	/opt/intel/openvino_2019.3.376/deployment_tools/model_optimizer/.
	- IR output name: 	saved_model
	- 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: 	Not specified, inherited from the model
	- Mean values: 	Not specified
	- Scale values: 	Not specified
	- Scale factor: 	Not specified
	- Precision of IR: 	FP32
	- Enable fusing: 	True
	- Enable grouped convolutions fusing: 	True
	- Move mean values to preprocess section: 	False
	- Reverse input channels: 	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
	- Operations to offload: 	None
	- Patterns to offload: 	None
	- Use the config file: 	None
Model Optimizer version: 	2019.3.0-408-gac8584cb7
[ ERROR ]  Shape [-1 -1 -1  1] is not fully defined for output 0 of "image". Use --input_shape with positive integers to override model input shapes.
[ ERROR ]  Cannot infer shapes or values for node "image".
[ ERROR ]  Not all output shapes were inferred or fully defined for node "image". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
[ ERROR ]  
[ ERROR ]  It can happen due to bug in custom shape infer function <function Parameter.__init__.<locals>.<lambda> at 0x7fc05e765598>.
[ 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).
[ ERROR ]  Run Model Optimizer with --log_level=DEBUG for more information.
[ ERROR ]  Not all output shapes were inferred or fully defined for node "image". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "image" 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. 
Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Not all output shapes were inferred or fully defined for node "image". 
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #40. 
Stopped shape/value propagation at "image" 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. 

Any help?Thanks

0 Kudos
2 Replies
Monique_J_Intel
Employee
1,335 Views

Hi Rachel,

You can analyze your model using summarize graph tool and that should be able to tell you information about your inputs and outputs. The python tool is in /opt/intel/openvino/deployment_tools/model_optimizer/mo/utils/. To understand how to run it type summarize_graph.py -h.

Also taking a look at the github and knowing Tensorflow extensively your input tensor is in the form of [Batch,Height,Width,Channels] with color channels being 1.

So if you know that you'll only be processing 1 image at a time and you know the height and width of the test images you can fill this in for example  if your image resolution is 300x300 then try 

python3 mo_tf.py --saved_model_dir /home/intel/hfnet/saved_models/hfnet/ --input_shape [1,300,300,1] 

Let me know if this helps.

Kind Regards,

Monique Jones

0 Kudos
daisyyang
Beginner
1,233 Views

Hi Monique,

Thanks for sharing your idea. I got the same error as Rachel, but I'm trying to convert an onnx model. Looks like summarize_graph tool is only for TensorFlow model? Do you know is there any tool can get the input shape of an onnx model?

Thanks,

Daisy

0 Kudos
Reply