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

Original exception message: 'ascii' codec can't decode byte 0xee in position 1: ordinal not in range

ashna_12
Novice
3,348 Views

Hi all,

I was following   https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html  link to load the non-frozen models to the model optimizer. When i try

 

python3 mo_tf.py --saved_model_dir <SAVED_MODEL_DIRECTORY>

 

 

I'm getting the following error:

 

[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.load.tf.loader.TFLoader'>): Unexpected exception happened during extracting attributes for node SSH_2/ConvBN_4/bn/moving_variance/Read/ReadVariableOp.
Original exception message: 'ascii' codec can't decode byte 0xee in position 1: ordinal not in range(128)

 

Can someone help me to solve this issue.

0 Kudos
1 Solution
IntelSupport
Community Manager
3,221 Views

Hi Ashna,


OpenVINO does not officially support RetinaFace. However, you can try validating it on your end as well.


One way is to try out Intel® Distribution of OpenVINO™ Toolkit version 2020.4, which is available from today. This version enables initial support for TensorFlow 2.2.0 for computer vision use cases. Related information can be found at the following page:

https://docs.openvinotoolkit.org/2020.4/openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html#Convert_From_TF2X


Alternatively, you may also try converting using TensorFlow 1.x. For manually trained topologies for RetinaFace, it is recommended that you use TensorFlow version 1.14/1.15 with TensorFlow Object Detection API version 1.14/1.15 for SSD topologies, combined with custom layer implementation.  


More information is available at the following page:

https://docs.openvinotoolkit.org/2020.4/openvino_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html#how_to_convert_a_model


Regards,

Munesh


View solution in original post

0 Kudos
5 Replies
Munesh_Intel
Moderator
3,314 Views

Hi Ashna,

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

 

Regards,

Munesh.

0 Kudos
ashna_12
Novice
3,300 Views

@Munesh_Intel 

I was using  https://github.com/peteryuX/retinaface-tf2 link for retinaface face detection. The model was saved in SavedModel format. The command which I used for converting to IR was :

 

python3 mo_tf.py --saved_model_dir /home/g2-test/Opt_AI/ASHNA/FMD-tf/old/openvino_fmd_tf --output_dir /home/g2-test/Opt_AI/ASHNA/FMD-tf/old/output/

 

When i run this, following are the error I'm getting:

 

Model Optimizer arguments:
Common parameters:
- Path to the Input Model: None
- Path for generated IR: /home/g2-test/Opt_AI/ASHNA/FMD-tf/old/output/
- 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
- Use the config file: None
Model Optimizer version: 
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/g2-test/anaconda3/envs/openvino/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.load.tf.loader.TFLoader'>): Unexpected exception happened during extracting attributes for node SSH_2/ConvBN_4/bn/moving_variance/Read/ReadVariableOp.
Original exception message: 'ascii' codec can't decode byte 0xee in position 1: ordinal not in range(128)

 

Following are the versions used:

OpenVino = 2020.3

OS = Ubuntu 18.04

Python = 3.7.4

Tensorflow = 1.13.1

CMake = 3.10.2

I'm attaching the model summary with this.

Hope to hear from you.

0 Kudos
Munesh_Intel
Moderator
3,269 Views

Hi Ashna,

Please take note that RetinaFace (ResNet50, MobileNetV2 trained) is implemented in Tensorflow 2.0+, whereas OpenVINO Model Optimizer only supports up to TensorFlow r1.15.

For your information, the error 'ascii codec can't decode byte' generally happens when you try to convert a Python 2.x str that contains non-ASCII to a Unicode string without specifying the encoding of the original string.

Alternatively, I would suggest you try using the following face detector models from Open Model Zoo, which are based on MobileNetV2 as a backbone:

  • face-detection-0100
  • face-detection-0102
  • face-detection-0104
  • face-detection-0105
  • face-detection-retail-0005

These are available in the <OPENVINO_INSTALL_DIR>/deployment_tools/open_model_zoo/models/intel folder.

 

Regards,

Munesh

0 Kudos
ashna_12
Novice
3,245 Views
 

@Munesh_Intel 

So, if I change the TF version to 1.x, I can convert Retinaface to IR format. Right?

0 Kudos
IntelSupport
Community Manager
3,222 Views

Hi Ashna,


OpenVINO does not officially support RetinaFace. However, you can try validating it on your end as well.


One way is to try out Intel® Distribution of OpenVINO™ Toolkit version 2020.4, which is available from today. This version enables initial support for TensorFlow 2.2.0 for computer vision use cases. Related information can be found at the following page:

https://docs.openvinotoolkit.org/2020.4/openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html#Convert_From_TF2X


Alternatively, you may also try converting using TensorFlow 1.x. For manually trained topologies for RetinaFace, it is recommended that you use TensorFlow version 1.14/1.15 with TensorFlow Object Detection API version 1.14/1.15 for SSD topologies, combined with custom layer implementation.  


More information is available at the following page:

https://docs.openvinotoolkit.org/2020.4/openvino_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html#how_to_convert_a_model


Regards,

Munesh


0 Kudos
Reply