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

Openvino环境配置与使用(window)

C++_2019-04-28_机器视觉——Opencv——Openvino_加速深度学习运行_第1张图片

第一步:安装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

C++_2019-04-28_机器视觉——Opencv——Openvino_加速深度学习运行_第2张图片

第五步:模型转换

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

C++_2019-04-28_机器视觉——Opencv——Openvino_加速深度学习运行_第3张图片

第六步:模型使用

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 .pb --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 .pbtxt --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 .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 .pbtxt --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

 

你可能感兴趣的:(机器视觉,#,机器视觉_应用工程)