C++_2019-04-28_机器视觉——Opencv——Openvino_加速深度学习运行全部署过程

本文详细介绍了在Windows上配置OpenVINO环境的步骤,包括前置条件、安装过程、环境部署、案例测试、模型转换及模型使用。通过OpenVINO可以加速深度学习模型的运行,提供了具体的命令格式示例和参考资料链接。

Openvino环境配置与使用(window)

第一步:安装Openvino前的环境需求:

    vs2015以上
    cmake3.4以上
    python3.5以上
openvino安装(openvino的安装附带着opencv4的捆绑安装哦):
    openvino序列号:C9PJ-FP9CSFT8
https://docs.openvinotoolkit.org/2019_R1/_docs_install_guides_installing_openvino_windows.html

第二步:安装openvino:

    正常装
    添加路径到全局变量去C:\Program Files (x86)\IntelSWTools\openvino\bin\setupvars.bat

第三步:openvino环境部署:

运行:
C:\Program Files (x86)\IntelSWTools\openvino_2019.1.087\deployment_tools\model_optimizer\install_prerequisites\install_prerequisites.bat

第四步:openvino案例测试

两个案例:
C:\Program Files (x86)\IntelSWTools\openvino_2019.1.087\deployment_tools\demo\demo_squeezenet_download_convert_run.bat

C:\Program Files (x86)\IntelSWTools\openvino_2019.1.087\deployment_tools\demo\demo_security_barrier_camera.bat

第五步:模型转换

openvino转换模型:
位置不可以:C:\Program Files (x86)\IntelSWTools\openvino_2019.1.087\deployment_tools\model_optimizer
位置可行:自己的工程文件路径
【frozen_inference_graph.pb和pipeline.config模型】转换【IR模型】
命令格式:

python "mo_tf.py" 
--input_model="frozen_inference_graph.pb" 
--tensorflow_use_custom_operations_config "ssd_v2_support.json" 
--tensorflow_object_detection_api_pipeline_config "pipeline.config" 
--reverse_input_channels

具体实现——成功案例****成功生成:**.xml和**.bin文件**** 

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" --input_model="D:\DongDemo\CPP\openvino\ssd_inception_v2_coco_2018_01_28/frozen_inference_graph.pb" --tensorflow_use_custom_operations_config "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_support.json" --tensorflow_object_detection_api_pipeline_config "D:\DongDemo\CPP\openvino\ssd_inception_v2_coco_2018_01_28/pipeline.config" --reverse_input_channels

第六步:模型使用

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

半成功案例:
模型:pb + tensorflow api——暂时可以生成bin文件不能生成xml文件
python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" --input_model "C:\Users\Administrator\Desktop\DONG\Openvino\model_translate\frozen_inference_graph.pb" --tensorflow_use_custom_operations_config "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_support.json" --tensorflow_object_detection_api_pipeline_config "C:\Users\Administrator\Desktop\DONG\Openvino\model_translate\ssd_mobilenet_v1_raccoon.config"
出现问题:
[ ERROR ]  Error while emitting attributes for layer FeatureExtractor/MobilenetV1/zeros/Output_0/Data__const (id = 66). It usually means that there is unsupported pattern around this node or unsupported combination of attributes.
# 尝试记录
D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate

模型:pb + tensorflow api
python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" 
--input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\frozen_inference_graph.pb" 
--tensorflow_use_custom_operations_config "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_support.json" 
--tensorflow_object_detection_api_pipeline_config "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\ssd_mobilenet_v1_raccoon.config"
--input_shape [1,600,500,3] 
--mean_values [127.5,127.5,127.5] 


python "mo.py" 
--input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\frozen_inference_graph.pb" 
--tensorflow_use_custom_operations_config "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/extensions/front/tf/ssd_support.json" 
--output="detection_boxes,detection_scores,num_detections" 
--tensorflow_object_detection_api_pipeline_config "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\ssd_mobilenet_v1_raccoon.config"


模型:pb
mo_tf.py --input_model <INFERENCE_GRAPH>.pb --input_checkpoint <INPUT_CHECKPOINT>

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" 
--input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\frozen_inference_graph.pb" 
--input_checkpoint "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\"


模型:pbtxt(基于opencv CPP)
mo_tf.py --input_model <INFERENCE_GRAPH>.pbtxt --input_checkpoint <INPUT_CHECKPOINT> --input_model_is_text

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" 
--input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\label_map.pbtxt" 
--input_checkpoint "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\"
--input_model_is_text


模型:model.ckpt-xxx.meta
mo_tf.py --input_meta_graph <INPUT_META_GRAPH>.meta

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" 
--input_meta_graph "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\train\model.ckpt-40956.meta" 


模型:pbtxt
mo_tf.py --input_model <INFERENCE_GRAPH>.pbtxt --input_checkpoint <INPUT_CHECKPOINT> --input_model_is_text

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" 
--input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\train\graph.pbtxt"
--input_checkpoint "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\train\"
--input_model_is_text

模型:pbtxt
python mo_tf.py --input_model inception_v1.pbtxt --input_model_is_text -b 1

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" --input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\train\graph.pbtxt" --input_model_is_text -b 1

python "C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer/mo_tf.py" --input_model "D:\DongDemo\PYTHON\demo_object_detection\my_train\demo_1\model_translate\label_map.pbtxt" --input_model_is_text -b 1

参考:

https://docs.openvinotoolkit.org/2019_R1/_docs_install_guides_installing_openvino_windows.html

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智能之心

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值