注意:OpenVINO官方的安装说明非常详细。
请参考:https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_windows.html
本博客是记录家里windows10安装openVINO的过程;
-1、下载OpenVINO
官网的下载链接:可能很卡,本博客给出文章所涉及的openvino安装文件
w_openvino_toolkit_p_2019.3.379.exe
-2、安装OpenVINO
双击w_openvino_toolkit_p_2019.3.379.exe执行安装;
如果是使用默认安装位置的话,是安装在"C:\Program Files (x86)\IntelSWTools\"文件夹下,我自己是选择安装到D盘,即:
D:\D02_AppLearn\D02A10_OpenVINO\installer
如上提示我,如果需要使用VS2019作为IDE,那么我需要安装CMake3.14。
另外检测到没有Intel GPU,注意此GPU非彼GPU,这里是指的Intel自家的集成显卡(核显),似乎Intel也在做自己的独显GPU,不过目前这里就是指的是核显。
另外这个警告可以无视,因为有GPU运行的异步,不一定赶得上CPU的异步,CPU性能还是相当重要的!
-3、初始化OpenVINO
在cmd终端进行初始化。
C:\Users\Administrator>D:
D:\>cd D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>setupvars.bat
Python 3.7.3
ECHO 处于关闭状态。
PYTHONPATH=D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\open_model_zoo\tools\accuracy_checker;
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3.7;
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3;
[setupvars.bat] OpenVINO environment initialized
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>
如上图openVINO初始化成功了。由于我想使用的python版本的OpenVINO,
下面需要安装openVINO涉及的python三方包。
-4、安装OpenVINO依赖的python三方包
在安装文件夹下./IntelSWTools/openvino_2019.3.379/deployment_tools/model_optimizer/requirements_tf.txt
对应我的本机:D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\requirements_tf.txt
使用清华镜像源进行快速安装:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ tensorflow==1.14.0
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ networkx==2.2
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ defusedxml==0.6.0
安装完成后查看python的三方包:
-5、测试OpenVINO推理包是否可以导入
C:\Users\Administrator>D:
D:\>cd D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>setupvars.bat
Python 3.7.3
ECHO 处于关闭状态。
PYTHONPATH=D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\open_model_zoo\tools\accuracy_checker;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3.7;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3;
[setupvars.bat] OpenVINO environment initialized
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from openvino.inference_engine import IENetwork, IECore
>>>
如上图可以正常导入推理机:from openvino.inference_engine import IENetwork, IECore
-6、使用OpenVINO运行YOLOV3或者Tiny_yolo模型。
本博客将给出优化后的网络和权重,可以直接加载得到结果,另外将提供一个“玩具总动员”视频。
-----------------------------------------------------------------------------------------------------------------------------------------
---附注---
另外cv2在OpenVINO安装阶段,安装到OpenVINO中,在执行初始化后,就可以导入cv2了。如下:
python -c "import sys; print(sys.executable)"
python -c "import cv2"
C:\Users\Administrator>python -c "import sys; print(sys.executable)"
D:\D00_Python3\D00A2_python3.7.3\install\python.exe
C:\Users\Administrator>python -c "import cv2"
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'cv2'
C:\Users\Administrator>
如果进行OpenVINO初始化后,可以导入到cv2,如下:
D:
D:\>cd D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>setupvars.bat
python -c "import cv2; print(cv2.__version__)"
C:\Users\Administrator>python -c "import sys; print(sys.executable)"
D:\D00_Python3\D00A2_python3.7.3\install\python.exe
C:\Users\Administrator>python -c "import cv2"
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'cv2'
C:\Users\Administrator>D:
D:\>cd D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>setupvars.bat
Python 3.7.3
ECHO 处于关闭状态。
PYTHONPATH=D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\open_model_zoo\tools\accuracy_checker;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3.7;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3;
[setupvars.bat] OpenVINO environment initialized
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>python -c "import cv2; print(cv2.__version__)"
4.1.2-openvino
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>
-----------------------------------------------------------------------------------------------------------------------------------------
下面将使用官方的脚本、制定CPU进行运行:
-a、脚本:
.\IntelSWTools\openvino_2019.3.379\inference_engine\demos\python_demos\object_detection_demo_yolov3_async\object_detection_demo_yolov3_async.py
(即我的本机:D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\inference_engine\demos\python_demos\object_detection_demo_yolov3_async\object_detection_demo_yolov3_async.py)
-b、由于本计算机只有CPU,需要指定设备的输入参数为CPU,并制定指令集
.\IntelSWTools\openvino_2019.3.379\deployment_tools\inference_engine\bin\intel64\Release\cpu_extension_avx2.dll
(即我的本机:D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\inference_engine\bin\intel64\Release\cpu_extension_avx2.dll)
-c、将视频以及脚本、模型放入如下文件夹内:
E:\E02_HomeWork\E02_A1_OpenVINO
-d、运行如下代码:
初始化openVINO后,进入脚本文件夹(E:\E02_HomeWork\E02_A1_OpenVINO)下运行如下代码:
python object_detection_demo_yolov3_async.py -i ./movie.mp4 -m ./IR_tiny_yolo/road_tiny.xml -d CPU -l "D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\inference_engine\bin\intel64\Release\cpu_extension_avx2.dll"
如下:
C:\Users\Administrator>d:
D:\>cd D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>setupvars.bat
Python 3.7.3
ECHO 处于关闭状态。
PYTHONPATH=D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\open_model_zoo\tools\accuracy_checker;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3.7;D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\python\python3;
[setupvars.bat] OpenVINO environment initialized
D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\bin>E:
E:\>cd E:\E02_HomeWork\E02_A1_OpenVINO
E:\E02_HomeWork\E02_A1_OpenVINO>python object_detection_demo_yolov3_async.py -i ./movie.mp4 -m ./IR_tiny_yolo/road_tiny.xml -d CPU -l "D:\D02_AppLearn\D02A10_OpenVINO\installer\IntelSWTools\openvino_2019.3.379\deployment_tools\inference_engine\bin\intel64\Release\cpu_extension_avx2.dll"
[ INFO ] Creating Inference Engine...
[ INFO ] Loading network files:
./IR_tiny_yolo/road_tiny.xml
./IR_tiny_yolo/road_tiny.bin
[ INFO ] Preparing inputs
MFX: Can't initialize session
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference...
To close the application, press 'CTRL+C' here or switch to the output window and press ESC key
To switch between sync/async modes, press TAB key in the output window
[ INFO ] Layer detector/yolo-v3-tiny/Conv_12/BiasAdd/YoloRegion parameters:
[ INFO ] classes : 10
[ INFO ] num : 3
[ INFO ] coords : 4
[ INFO ] anchors : [10.0, 14.0, 23.0, 27.0, 37.0, 58.0]
[ INFO ] Layer detector/yolo-v3-tiny/Conv_9/BiasAdd/YoloRegion parameters:
[ INFO ] classes : 10
[ INFO ] num : 3
[ INFO ] coords : 4
[ INFO ] anchors : [81.0, 82.0, 135.0, 169.0, 344.0, 319.0]
[ INFO ] Layer detector/yolo-v3-tiny/Conv_12/BiasAdd/YoloRegion parameters:
[ INFO ] classes : 10
[ INFO ] num : 3
[ INFO ] coords : 4
[ INFO ] anchors : [10.0, 14.0, 23.0, 27.0, 37.0, 58.0]
......
运行界面:
本提供提供复现的视频以及脚本、权重。
https://download.csdn.net/download/jn10010537/12519639
https://download.csdn.net/download/jn10010537/12519625