Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5959 Discussions

I get errors to optimize a Tensorflow model which was got by converting a Keras Model.



I installed Ubuntu 18.04.3 LTS in my pc(HP-ProDesk-400-G3-MT) and installed Intel distribution of OpenvinoToolkit, l_openvino_toolkit_p_2019.3.376.tgz( as well. I am able to run the demo application successfully to test the Openvino Toolkit installation. 

I developed a Keras model backed by a Tensorflow engine, 1.x. I developed this model using the transfer learning strategy, for that reason I used the VGG16 pre-trained model. This Keras model(model_weights_tomato_earlyblight_updated.h5) gives predictions on the testing and validation dataset. To optimize and inference this Keras model through intel distribution of OpenvinoToolkit, I converted this Keras model to TensorFlow model. I just captured the Keras session to capture the frozen graph and save the model as Tensorflow model as protocol buffer or pb format. I have attached the conversion code too. It works fine.

When I try to run the optimization for this Tensorflow model, from, /opt/intel/openvino/deployment_tools/model_optimizer/ , I get the attached errors. Could you please advise me on what to do next or anything I have missed? 

I followed the reference for optimization on the Tensorflow model guided by pooja during training and by reading the documentation too.


I have also attached the Keras Model(.h5 file, weight file), conversion code, and TensorFlow Model and errors. 





0 Kudos
1 Reply

Hi Islam, Fakrul,

Thanks for reaching out. I am able to convert the model you have attached just fine, I was able however to reproduce the issue you experienced when specifying the --input_shape flag with the values [1,224,224,3]. 

Here is the command I used to convert the model, please give it a try and let me know the results. Hope this helps!

python3 /opt/intel/openvino/deployment_tools/model_optimizer/ --input_model tomato_earlyblight_model_tensorflow.pb -b 1


Model Optimizer arguments:
Common parameters:
	- Path to the Input Model: 	/home/pse/843155/All contents/tomato_earlyblight_model_tensorflow.pb
	- Path for generated IR: 	/home/pse/843155/All contents/.
	- IR output name: 	tomato_earlyblight_model_tensorflow
	- Log level: 	ERROR
	- Batch: 	1
	- 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
[ SUCCESS ] Generated IR model.
[ SUCCESS ] XML file: /home/pse/843155/All contents/./tomato_earlyblight_model_tensorflow.xml
[ SUCCESS ] BIN file: /home/pse/843155/All contents/./tomato_earlyblight_model_tensorflow.bin
[ SUCCESS ] Total execution time: 5.09 seconds. 

Find the converted model attached as well, let me know if you have any questions.