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

Covering a custom tf trained model to openvino IR

Saravi
Beginner
1,743 Views

I tried to convert a tensorflow trained model to IR but I am geting the follow exception

mo.utils.error.Error: Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.load.tf.loader.TFLoader'>): Unexpected exception happened during extracting attributes for node Const.
Original exception message: 'ascii' codec can't decode byte 0xc6 in position 1: ordinal not in range(128)
python mo_tf.py --log_level DEBUG --saved_model_dir /home/babak/projects/pp/pp/modeltf1/
[ 2020-09-23 13:24:39,114 ] [ DEBUG ] [ main:114 ]  Namespace(batch=None, data_type='float', disable_fusing=None, disable_gfusing=None, disable_nhwc_to_nchw=False, disable_resnet_optimization=False, disable_weights_compression=False, enable_concat_optimization=False, extensions='/home/babak/src/openvino/model-optimizer/extensions', finegrain_fusing=None, framework='tf', freeze_placeholder_with_value=None, generate_deprecated_IR_V7=False, input=None, input_checkpoint=None, input_meta_graph=None, input_model=None, input_model_is_text=False, input_shape=None, keep_shape_ops=True, log_level='DEBUG', mean_values=(), model_name=None, move_to_preprocess=None, output=None, output_dir='/home/babak/src/openvino/model-optimizer/.', progress=False, reverse_input_channels=False, saved_model_dir='/home/babak/projects/pp/pp/modeltf1/', saved_model_tags=None, scale=None, scale_values=(), silent=False, static_shape=False, stream_output=False, tensorboard_logdir=None, tensorflow_custom_layer_libraries=None, tensorflow_custom_operations_config_update=None, tensorflow_object_detection_api_pipeline_config=None, tensorflow_use_custom_operations_config=None, transformations_config=None)
[ 2020-09-23 13:24:39,115 ] [ DEBUG ] [ main:115 ]  Model Optimizer started
[ 2020-09-23 13:24:39,115 ] [ DEBUG ] [ main:130 ]  Output model name would be saved_model{.xml, .bin}
Model Optimizer arguments:
Common parameters:
	- Path to the Input Model: 	None
	- Path for generated IR: 	/home/babak/src/openvino/model-optimizer/.
	- IR output name: 	saved_model
	- Log level: 	DEBUG
	- 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: 	None
	- 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
	- Use the config file: 	None
Model Optimizer version: 	unknown version
[ 2020-09-23 13:24:40,326 ] [ DEBUG ] [ main:208 ]  Placeholder shapes : None
[ INFO ]  Importing extensions from: /home/babak/src/openvino/model-optimizer/mo
[ INFO ]  New subclass: <class 'extensions.ops.parameter.Parameter'>
[ INFO ]  Registered a new subclass with key: Parameter
[ INFO ]  New subclass: <class 'mo.ops.const.Const'>

I have attached the debug results and really appreciate any help.

Thanks,

Babak

Labels (1)
0 Kudos
9 Replies
Munesh_Intel
Moderator
1,729 Views

Hi Babak,


Please share more information about your model, is it an object detection/classification model, layers in use, command given to Model Optimizer to convert the trained model to Intermediate Representation (IR), and environment details (versions of OpenVINO, OS, TensorFlow, Python, CMake, etc.).


Regards,

Munesh.


0 Kudos
Saravi
Beginner
1,726 Views

Thank you Munesh for your reply,

I have solved that issue by freezing the graph and save it.

But I have new issue with unsupported layer  when I ran optimizer.

I can not find any good document to explain how to create a tensorflow extension. there are just document on how o create extension for caffe 

https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Extending_Model_Optimizer_with_New_Primitives.html

I appropriate if you could help me on this issue.

Thanks,
Babak

0 Kudos
Munesh_Intel
Moderator
1,711 Views

Hi Babak,

We are currently looking into the issue, and will get back to you.


Regards,

Munesh


0 Kudos
Saravi
Beginner
1,707 Views
0 Kudos
Munesh_Intel
Moderator
1,694 Views

Hi Babak,


Please refer to the following article, “How to Convert a Model with Custom Layers in the OpenVINO™ toolkit”.

https://www.intel.com/content/www/us/en/support/articles/000057426/software/development-software.html


Regards,

Munesh


0 Kudos
Saravi
Beginner
1,683 Views

Thanks Munesh for your help,

As I mentioned before when I follow these article it goes to the following page

https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Extending_Model_Optimizer_with_New_Primitives.html

This article shows how to cover and register a caffe layer and there is no explanation for tensorflow layer.

I have followed it to create a tensorflow scater_nd op but the model optimizer still complaining about registering the infer function which this does not show how to do it.

Best ,

Babak

 

0 Kudos
Munesh_Intel
Moderator
1,671 Views

Hi Babak,


We will look into the issue again, and get back to you soon.


Regards,

Munesh


0 Kudos
Munesh_Intel
Moderator
1,661 Views

Hi Babak,


Since you are looking to implement ScatterND layer, please refer to the following 2 Pull Requests (that are already a part of OpenVINO Master branch):

Implementation of ScatterNDUpdate as part of opset4 in Model Optimizer - https://github.com/openvinotoolkit/openvino/pull/584

Implementation of ScatterNDUpdate in mkldnn - https://github.com/openvinotoolkit/openvino/pull/909


Regards,

Munesh


0 Kudos
Munesh_Intel
Moderator
1,634 Views

Hi Babak,


This thread will no longer be monitored since we have provided references. If you need any additional information from Intel, please submit a new question.


Regards,

Munesh


0 Kudos
Reply