【问题标题】:OpenVINO Convert TF Model to IR file IssueOpenVINO 将 TF 模型转换为 IR 文件问题
【发布时间】:2019-09-27 10:55:54
【问题描述】:

我正在尝试将 tensorflow 模型转换为 OpenVINO IR 文件。 我从以下地址下载了一个预训练好的模型:

http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz

然后我提取文件得到一个名为“frozen_inference_graph.pb”的.pb文件 然后我在OpenVINO文件夹中使用了转换命令

“IntelSWTools\openvino_2019.2.275\deployment_tools\model_optimizer\”

如下:

python mo_tf.py --input_model frozen_inference_graph.pb

但我收到以下错误消息。 如何修改任何内容来解决此问题?

Model Optimizer arguments:
Common parameters:
    - Path to the Input Model:  <my folder>\frozen_inference_graph.pb
    - Path for generated IR:    <my OpenVINO folder>\IntelSWTools\openvino_2019.2.275\deployment_tools\model_optimizer\.
- IR output name:   frozen_inference_graph
- 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.2.0-436-gf5827d4

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\framework\dtypes.py:458: 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)])

[ ERROR ]  Shape [-1 -1 -1  3] is not fully defined for output 0 of "image_tensor". Use --input_shape with positive integers to override model input shapes.
[ ERROR ]  Cannot infer shapes or values for node "image_tensor".
[ ERROR ]  Not all output shapes were inferred or fully defined for node "image_tensor".  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 0x000002032A17D378>.
[ 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 ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "image_tensor" 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. 

Process finished with exit code 1

我尝试了许多其他 tensorflow 模型,但都有相同的问题。 我使用了从 1.2.01.14.0 的不同 tensorflow 版本,但相同。

关于形状的关键词似乎是主要原因。但是我怎样才能添加一些东西来避免这个问题呢?

Shape [-1 -1 -1  3] is not fully defined for output 0 of "image_tensor". Use --input_shape with positive integers to override model input shapes.

希望IR文件能正确生成。

【问题讨论】:

    标签: openvino


    【解决方案1】:

    Openvino 模型优化器 (mo_tf.py) 需要更多参数。请同时传递以下内容。

    python mo_tf.py --output_dir --input_model \mask_rcnn_inception_v2_coco_2018_01_28\frozen_inference_graph.pb --tensorflow_use_custom_operations_config extensions\front\tf\mask_rcnn_support.json --tensorflow_object_detection_api_pipeline_config \mask_rcnn_inception_v2_coco_2 .config

    mask_rcnn_inception_v2_coco模型可以从https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md下载

    更多详情请参考:https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow.html

    【讨论】:

    • 感谢 Aswathy!这个附加参数确实解决了我的问题。但也请在官方帮助页面上为其他人更新此说明,因为他们可能会遇到此类问题。
    猜你喜欢
    • 1970-01-01
    • 2022-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多