- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I generated a .pb model using Keras and tensorflow (version 1.14.0-rc1) with transfer learning method using ResNet50.
Below the command used to generate the model .pb:
#saved_model_path = tf.contrib.saved_model.save_keras_model(model, "checkpoint/Flowers_saved_models")
Using a different VirtualMachine with OpenVino R1.1 (last version that include TF V. 1.13.1), I execute the following OpenVino model optimizer command to convert the mentioned .pb model to OpenVino IR (.xml & .bin):
#sudo python3 mo_tf.py --input_model /home/datavolume_ovc2/Flowers_saved_model.pb --model_name Flowers_RSN50_FP16 --data_type FP16.
This operation (by model optimizer) generated the following error:
[ FRAMEWORK ERROR ] Cannot load input model: TensorFlow cannot read the model file: "/home/datavolume_ovc2/Flowers_saved_model.pb" is incorrect TensorFlow model file.
Below all error message.
Where is the problem?
Is it the different TF version used Training data vs TF used with OpenVino?
Do you have suggestions to solve this kind of problems?
Thank you
Complete error message from OpenVino Model_Optimizer:
root@05e96c575d0a:/opt/intel/openvino_2019.1.144/deployment_tools/model_optimizer# python3 mo_tf.py --input_model /home/datavolume_ovc2/Flowers_saved_model.pb --model_name Flowers_RSN50_FP16 --data_type FP16
Model Optimizer arguments:
Common parameters:
- Path to the Input Model: /home/datavolume_ovc2/Flowers_saved_model.pb
- Path for generated IR: /opt/intel/openvino_2019.1.144/deployment_tools/model_optimizer/.
- IR output name: Flowers_RSN50_FP16
- 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: FP16
- 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.1.1-83-g28dfbfd
[ FRAMEWORK ERROR ] Cannot load input model: TensorFlow cannot read the model file: "/home/datavolume_ovc2/Flowers_saved_model.pb" is incorrect TensorFlow model file.
The file should contain one of the following TensorFlow graphs:
1. frozen graph in text or binary format
2. inference graph for freezing with checkpoint (--input_checkpoint) in text or binary format
3. meta graph
Make sure that --input_model_is_text is provided for a model in text format. By default, a model is interpreted in binary format. Framework error details: Error parsing message.
For more information please refer to Model Optimizer FAQ (<INSTALL_DIR>/deployment_tools/documentation/docs/MO_FAQ.html), question #43.
root@05e96c575d0a:/opt/intel/openvino_2019.1.144/deployment_tools/model_optimizer#
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Shubha,
Sorry, I added your code at the end of my training code after saving the model but there are not output neither errors.
I also created a dedicated python code attached k_2_TF adding your code without results.
Please, could you be more explicit how to use your code?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Shubha,
I reviewed all codes.
I have created a new model training data images with transfer learning method using ResNet50 with Keras 2.2 e TF 1.12.
I saved the models using different formats: checkpoint, .h5, hdf5, h5 + json
I tried WITHOUT success converting these graph file to the TF .pb.
For the conversion, I used the tool "keras_to_tensorflow", from the following link:
https://github.com/amir-abdi/keras_to_tensorflow
I run these tools with Python 3.5 & Python 2.7.
Attached the file with output ERROR.
I saved the model also using the following command to generate directly a .pb file after training data:
$ saved_model_path = tf.contrib.saved_model.save_keras_model(model, "checkpoint/Diseases_Tr_RN50_saved_models")
I used openvino model_optimizer to convert this .pb file to IR using the following command WITHOUT Success:
$ sudo python3 mo_tf.py --input_model /home/cosma/Downloads/checkpoint_Model_Plant_Diseases/saved_model.pb --input_model_is_text --output_dir /home/cosma/Downloads/checkpoint_Model_Plant_Diseases --model_name Plant_Diseases_RN50_FP16 --data_type FP16
The error is still the same I had when I opened this case:
[ FRAMEWORK ERROR ] Cannot load input model: TensorFlow cannot read the model file: "/home/cosma/Downloads/checkpoint_Model_Plant_Diseases/saved_model.pb" is incorrect TensorFlow model file.
At the end, I cannot use OpenVino because I'm stuck trying without success to convert a model from Keras + TF 1.12 .h5/hdf5/checkpoint to .pb and from .pb to IR using OV model_optimizer (last version).
I have the doubt that Intel Frameworks for AI have some limits with models coded using Keras.
Is keras supported?
Does OpenVino work only with frozen models created by Intel?
What is your opinion?
Thank you for your support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Cosma,
Congrats ! If you can share the details of how you solved your problem with the OpenVino Community, that would be great !
Thanks,
Shubha
![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »