Install the Intel® Distribution of OpenVINO™ Toolkit for Raspbian* OS (樹莓派系統)

Install the Intel® Distribution of OpenVINO™ Toolkit for Raspbian* OS (樹莓派系統)

https://software.intel.com/en-us/articles/OpenVINO-Install-RaspberryPI

December 19, 2018

Intel® Distribution of OpenVINO™ Toolkit - Documentation - Featured Documentation
https://software.intel.com/en-us/openvino-toolkit/documentation/featured

在這裏插入圖片描述

Installation Guides -> Raspbian

The Intel® Distribution of OpenVINO™ toolkit was formerly known as the Intel® Computer Vision SDK.

Introduction

This guide applies to 32-bit Raspbian* 9 OS, which is an official OS for Raspberry Pi* boards.

IMPORTANT:

  • All steps in this guide are required unless otherwise stated.
  • The Intel® Distribution of OpenVINO™ toolkit for Raspbian* OS includes the MYRIAD plugin only. You can use it with the Intel® Movidius™ Neural Compute Stick (Intel® NCS) or the Intel® Neural Compute Stick 2 plugged in one of USB ports.

Your installation is complete when these are all completed:
(1) Install the Intel® Distribution of OpenVINO™ toolkit.
(2) Set the environment variables.
(3) Add USB rules.
(4) Run the Object Detection Sample and the Face Detection Model (for OpenCV*) to validate your installation.

About the Intel® Distribution of OpenVINO™ Toolkit

The Intel® Distribution of OpenVINO™ toolkit quickly deploys applications and solutions that emulate human vision. Based on Convolutional Neural Networks (CNN), the toolkit extends computer vision (CV) workloads across Intel® hardware, maximizing performance. The Intel Distribution of OpenVINO toolkit includes the Intel® Deep Learning Deployment Toolkit (Intel® DLDT).

Included in the Installation Package

The Intel Distribution of OpenVINO toolkit for Raspbian OS is an archive with pre-installed header files and libraries. The following components are installed by default:

Component Description
Inference Engine This is the engine that runs the deep learning model. It includes a set of libraries for an easy inference integration into your applications.
OpenCV* version 4.0 OpenCV* community version compiled for Intel® hardware.
Sample Applications A set of simple console applications demonstrating how to use the Inference Engine in your applications.

System Requirements

Hardware:

  • Raspberry Pi* board with ARMv7-A CPU architecture
  • One of Intel® Movidius™ Visual Processing Units (VPU):
    • Intel® Movidius™ Neural Compute Stick
    • Intel® Neural Compute Stick 2

Operating Systems:

  • Raspbian* Stretch, 32-bit
stretch [stretʃ]:vt. 伸展,張開,使用,消耗,使竭盡所能,使全力以赴 vi. 伸展,足夠買 n. 伸展,延伸

Installation Steps

The guide assumes you downloaded the Intel Distribution of OpenVINO toolkit for Raspbian. If you do not have a copy of the toolkit package file, download the latest version here and then return to this guide to proceed with the installation.
https://download.01.org/openvinotoolkit/2018_R5/packages/l_openvino_toolkit_ie_p_2018.5.445.tgz
l_openvino_toolkit_ie_p_2018.5.445.tgz - 39 MB

在這裏插入圖片描述

NOTE: The Intel Distribution of OpenVINO toolkit for Raspbian OS is distributed without installer so you need to perform extra steps comparing to the Intel® Distribution of OpenVINO™ toolkit for Linux* OS.
https://software.intel.com/en-us/articles/OpenVINO-Install-Linux

Install the Package

(1) Open the Terminal* or your preferred console application.
(2) Go to the directory in which you downloaded the Intel Distribution of OpenVINO toolkit. This document assumes this is your ~/Downloads directory. If not, replace ~/Downloads with the directory where the file is located.

cd ~/Downloads/

By default, the package file is saved as l_openvino_toolkit_ie_p_<version>.tgz.

(3) Unpack the archive:

tar -xf l_openvino_toolkit_ie_p_<version>.tgz

(4) Modify the setupvars.sh script by replacing <INSTALLDIR> with the absolute path to the installation folder:

sed -i "s|<INSTALLDIR>|$(pwd)/inference_engine_vpu_arm|" inference_engine_vpu_arm/bin/setupvars.sh

Now the Intel Distribution of OpenVINO toolkit is ready to be used. Continue to the next sections to configure the environment and set up USB rules.

[email protected]:~ $ cd /home/pi/Downloads/
[email protected]:~/Downloads $ ll
bash: ll: 未找到命令
[email protected]:~/Downloads $ ls -l
總用量 39996
-rw-r--r-- 1 pi pi 40954634 1月  14 20:37 l_openvino_toolkit_ie_p_2018.5.445.tgz
[email protected]:~/Downloads $ 
[email protected]:~/Downloads $ chmod 777 l_openvino_toolkit_ie_p_2018.5.445.tgz 
[email protected]:~/Downloads $ ls -l
總用量 39996
-rwxrwxrwx 1 pi pi 40954634 1月  14 20:37 l_openvino_toolkit_ie_p_2018.5.445.tgz
[email protected]:~/Downloads $ tar -xf l_openvino_toolkit_ie_p_2018.5.445.tgz 
[email protected]:~/Downloads $ ls -l
總用量 40000
drwxr-xr-x 8 pi pi     4096 12月 14 03:27 inference_engine_vpu_arm
-rwxrwxrwx 1 pi pi 40954634 1月  14 20:37 l_openvino_toolkit_ie_p_2018.5.445.tgz
[email protected]:~/Downloads $ 
[email protected]:~/Downloads $ sed -i "s|<INSTALLDIR>|$(pwd)/inference_engine_vpu_arm|" inference_engine_vpu_arm/bin/setupvars.sh
[email protected]:~/Downloads $ 

Set the Environment Variables

You must update several environment variables before you can compile and run Intel Distribution of OpenVINO toolkit applications. Run the following script to temporarily set the environment variables:

source inference_engine_vpu_arm/bin/setupvars.sh
[email protected]:~/Downloads $ source inference_engine_vpu_arm/bin/setupvars.sh
[setupvars.sh] OpenVINO environment initialized
[email protected]:~/Downloads $ 

(Optional) The Intel Distribution of OpenVINO environment variables are removed when you close the shell. As an option, you can permanently set the environment variables as follows:

(1) Open the .bashrc file in <user_directory>:

vi <user_directory>/.bashrc

(2) Add this line to the end of the file:

source ~/Downloads/inference_engine_vpu_arm/bin/setupvars.sh

(3) Save and close the file: press Esc and type :wq.
(4) To test your change, open a new terminal.
You will see the following:

[setupvars.sh] OpenVINO environment initialized
[email protected]:~/Downloads $ vim /home/pi/.bashrc
bash: vim: 未找到命令
[email protected]:~/Downloads $ 
[email protected]:~/Downloads $ sudo apt-get install vim
正在讀取軟件包列表... 完成
正在分析軟件包的依賴關係樹       
正在讀取狀態信息... 完成       
將會同時安裝下列軟件:
  vim-runtime
建議安裝:
  ctags vim-doc vim-scripts
下列【新】軟件包將被安裝:
  vim vim-runtime
升級了 0 個軟件包,新安裝了 2 個軟件包,要卸載 0 個軟件包,有 0 個軟件包未被升級。
需要下載 5,407 kB/6,198 kB 的歸檔。
解壓縮後會消耗 30.2 MB 的額外空間。
您希望繼續執行嗎? [Y/n] Y
獲取:1 http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian stretch/main armhf vim-runtime all 2:8.0.0197-4+deb9u1 [5,407 kB]       
已下載 5,407 kB,耗時 16秒 (324 kB/s)     
正在選中未選擇的軟件包 vim-runtime。
(正在讀取數據庫 ... 系統當前共安裝有 80757 個文件和目錄。)
正準備解包 .../vim-runtime_2%3a8.0.0197-4+deb9u1_all.deb  ...
正在添加 vim-runtime 導致 /usr/share/vim/vim80/doc/help.txt 轉移到 /usr/share/vim/vim80/doc/help.txt.vim-tiny
正在添加 vim-runtime 導致 /usr/share/vim/vim80/doc/tags 轉移到 /usr/share/vim/vim80/doc/tags.vim-tiny
正在解包 vim-runtime (2:8.0.0197-4+deb9u1) ...
正在選中未選擇的軟件包 vim。
正準備解包 .../vim_2%3a8.0.0197-4+deb9u1_armhf.deb  ...
正在解包 vim (2:8.0.0197-4+deb9u1) ...
正在處理用於 man-db (2.7.6.1-2) 的觸發器 ...
正在設置 vim-runtime (2:8.0.0197-4+deb9u1) ...
正在設置 vim (2:8.0.0197-4+deb9u1) ...
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/vim (vim)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/vimdiff (vimdiff)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/rvim (rvim)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/rview (rview)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/vi (vi)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/view (view)
update-alternatives: 使用 /usr/bin/vim.basic 來在自動模式中提供 /usr/bin/ex (ex)
[email protected]:~/Downloads $ 
[email protected]:~/Downloads $ vim /home/pi/.bashrc 
[email protected]:~/Downloads $ 

/home/pi/.bashrc

......
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# forever
source ~/Downloads/inference_engine_vpu_arm/bin/setupvars.sh
# strong

在這裏插入圖片描述

Add USB Rules

(1) Add the current Linux user to the users group:

sudo usermod -a -G users "$(whoami)"

Log out and log in for it to take effect.

將當前 Linux 用戶添加到 users group:sudo usermod -a -G users "$(whoami)"
打開新窗口的起始用戶是 pi,出現 [setupvars.sh] OpenVINO environment initialized 是對於 pi 用戶來說的。如果在新窗口中用 root 執行程序,並沒有成功加載 [setupvars.sh] OpenVINO environment initialized,需要再執行一遍 source /home/pi/Downloads/inference_engine_vpu_arm/bin/setupvars.sh,才能給 root 用戶配置好 OpenVINO environment initialized。

(2) To perform inference on the Intel® Movidius™ Neural Compute Stick or Intel® Neural Compute Stick 2, install the USB rules as follows:

sh inference_engine_vpu_arm/install_dependencies/install_NCS_udev_rules.sh
[setupvars.sh] OpenVINO environment initialized
[email protected]:~ $ cd ~/Downloads/
[email protected]:~/Downloads $ sudo usermod -a -G users "$(whoami)"
[email protected]:~/Downloads $ sh inference_engine_vpu_arm/install_dependencies/install_NCS_udev_rules.sh
Update udev rules so that the toolkit can communicate with your neural compute stick
[install_NCS_udev_rules.sh] udev rules installed
[email protected]:~/Downloads $ 

Build and Run Object Detection Sample

Follow the next steps to run pre-trained Face Detection network using samples from Intel Distribution of OpenVINO toolkit:

(1) Go to the folder with samples source code:

cd inference_engine_vpu_arm/deployment_tools/inference_engine/samples

(2) Create build directory:

mkdir build && cd build

(3) Build the Object Detection Sample:

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a"
make -j2 object_detection_sample_ssd

(4) Download the pre-trained Face Detection model or copy it from a host machine:
(4.1) To download the .bin file with weights:

wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin

(4.2) To download the .xml file with the network topology:

wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml

(5) Run the sample with specified path to the model:

./armv7l/Release/object_detection_sample_ssd -m face-detection-adas-0001.xml -d MYRIAD -i <path_to_image>

[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ ./armv7l/Release/object_detection_sample_ssd -m face-detection-adas-0001.xml -d MYRIAD -i /home/pi/Downloads/test_data/ZhiHua_Zhou.jpg

[setupvars.sh] OpenVINO environment initialized
[email protected]:~ $ cd ~/Downloads/
[email protected]:~/Downloads $ cd inference_engine_vpu_arm/deployment_tools/inference_engine/samples
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples $ ls -l
總用量 140
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 benchmark_app
-rwxr-xr-x 2 pi pi 2275 12月 14 03:14 build_samples.sh
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 calibration_tool
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 classification_sample
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 classification_sample_async
-rw-r--r-- 2 pi pi 5102 12月 14 03:14 CMakeLists.txt
drwxr-xr-x 5 pi pi 4096 12月 14 03:27 common
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 crossroad_camera_demo
drwxr-xr-x 6 pi pi 4096 12月 14 03:27 end2end_video_analytics
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 hello_autoresize_classification
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 hello_classification
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 hello_request_classification
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 hello_shape_infer_ssd
drwxr-xr-x 4 pi pi 4096 12月 14 03:27 human_pose_estimation_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 interactive_face_detection_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 lenet_network_graph_builder
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 mask_rcnn_demo
drwxr-xr-x 3 pi pi 4096 12月 14 03:27 multichannel_face_detection
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 object_detection_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 object_detection_demo_ssd_async
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 object_detection_demo_yolov3_async
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 object_detection_sample_ssd
drwxr-xr-x 4 pi pi 4096 12月 14 03:27 pedestrian_tracker_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 perfcheck
drwxr-xr-x 6 pi pi 4096 12月 14 03:27 python_samples
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 security_barrier_camera_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 segmentation_demo
drwxr-xr-x 4 pi pi 4096 12月 14 03:27 smart_classroom_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 speech_sample
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 style_transfer_sample
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 super_resolution_demo
drwxr-xr-x 2 pi pi 4096 12月 14 03:27 text_detection_demo
drwxr-xr-x 3 pi pi 4096 12月 14 03:27 thirdparty
drwxr-xr-x 3 pi pi 4096 12月 14 03:27 validation_app
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples $ 


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples $ mkdir build && cd build
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ 


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a"
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- /etc/*-release distrib: Raspbian 9
-- Found InferenceEngine: /home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/lib/raspbian_9/armv7l/libinference_engine.so (Required is at least version "1.5") 
-- Performing Test HAVE_CPUID_INFO
-- Performing Test HAVE_CPUID_INFO - Failed
-- OMP Release lib: OMP_LIBRARIES_RELEASE-NOTFOUND
-- OMP Debug lib: OMP_LIBRARIES_DEBUG-NOTFOUND
CMake Warning at /home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/share/InferenceEngineConfig.cmake:31 (message):
  Intel OpenMP not found.  Intel OpenMP support will be disabled.
  IE_THREAD_SEQ is defined
Call Stack (most recent call first):
  /home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/share/ie_parallel.cmake:78 (ext_message)
  /home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/src/extension/CMakeLists.txt:28 (set_ie_threading_interface_for)


-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include fnmatch.h
-- Looking for C++ include fnmatch.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Looking for strtoll
-- Looking for strtoll - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ ls -l
總用量 188
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 armv7l
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 benchmark_app
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 calibration_tool
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 classification_sample
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 classification_sample_async
-rw-r--r-- 1 pi pi 14728 1月  15 20:46 CMakeCache.txt
drwxr-xr-x 5 pi pi  4096 1月  15 20:46 CMakeFiles
-rw-r--r-- 1 pi pi  6178 1月  15 20:46 cmake_install.cmake
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 common
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 crossroad_camera_demo
drwxr-xr-x 5 pi pi  4096 1月  15 20:46 end2end_video_analytics
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 hello_autoresize_classification
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 hello_classification
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 hello_request_classification
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 hello_shape_infer_ssd
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 human_pose_estimation_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 ie_cpu_extension
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 interactive_face_detection_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 lenet_network_graph_builder
-rw-r--r-- 1 pi pi 24973 1月  15 20:46 Makefile
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 mask_rcnn_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 multichannel_face_detection
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 object_detection_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 object_detection_demo_ssd_async
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 object_detection_demo_yolov3_async
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 object_detection_sample_ssd
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 pedestrian_tracker_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 perfcheck
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 security_barrier_camera_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 segmentation_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 smart_classroom_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 speech_sample
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 style_transfer_sample
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 super_resolution_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 text_detection_demo
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 thirdparty
drwxr-xr-x 3 pi pi  4096 1月  15 20:46 validation_app


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ make -j2 object_detection_sample_ssd
Scanning dependencies of target format_reader
Scanning dependencies of target ie_cpu_extension
[  0%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_argmax.cpp.o
[  0%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/MnistUbyte.cpp.o
[  4%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/bmp.cpp.o
[  8%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/format_reader.cpp.o
[ 12%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_base.cpp.o
[ 16%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/opencv_wraper.cpp.o
[ 20%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_ctc_greedy.cpp.o
[ 24%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_detectionoutput.cpp.o
[ 24%] Linking CXX shared library ../../armv7l/Release/lib/libformat_reader.so
[ 24%] Built target format_reader
[ 24%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_gather.cpp.o
Scanning dependencies of target gflags_nothreads_static
[ 28%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags.cc.o
[ 32%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_grn.cpp.o
[ 36%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_interp.cpp.o
[ 40%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_reporting.cc.o
[ 44%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_list.cpp.o
[ 44%] Building CXX object thirdparty/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_completions.cc.o
[ 44%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_mvn.cpp.o
[ 48%] Linking CXX static library ../../armv7l/Release/lib/libgflags_nothreads.a
[ 48%] Built target gflags_nothreads_static
[ 52%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_normalize.cpp.o
[ 56%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_pad.cpp.o
[ 56%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_powerfile.cpp.o
[ 60%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_priorbox.cpp.o
[ 64%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_priorbox_clustered.cpp.o
[ 68%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_proposal.cpp.o
[ 68%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_psroi.cpp.o
[ 72%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_region_yolo.cpp.o
[ 76%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_reorg_yolo.cpp.o
[ 80%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_resample.cpp.o
[ 80%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_simplernms.cpp.o
[ 84%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_spatial_transformer.cpp.o
[ 88%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/simple_copy.cpp.o
[ 92%] Linking CXX shared library ../armv7l/Release/lib/libcpu_extension.so
[ 92%] Built target ie_cpu_extension
Scanning dependencies of target object_detection_sample_ssd
[ 96%] Building CXX object object_detection_sample_ssd/CMakeFiles/object_detection_sample_ssd.dir/main.cpp.o
[100%] Linking CXX executable ../armv7l/Release/object_detection_sample_ssd
[100%] Built target object_detection_sample_ssd


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
--2019-01-15 20:52:06--  https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
正在解析主機 download.01.org (download.01.org)... 27.148.138.230, 2600:1417:9:192::ae6, 2600:1417:9:1ad::ae6
正在連接 download.01.org (download.01.org)|27.148.138.230|:443... 已連接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:90009 (88K) [text/xml]
正在保存至: “face-detection-adas-0001.xml”

face-detection-adas-0001.xml                        100%[================================================================================================================>]  87.90K  40.3KB/s    in 2.2s    

2019-01-15 20:52:09 (40.3 KB/s) - 已保存 “face-detection-adas-0001.xml” [90009/90009])

[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ 


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
--2019-01-15 20:51:41--  https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
正在解析主機 download.01.org (download.01.org)... 27.148.138.230
正在連接 download.01.org (download.01.org)|27.148.138.230|:443... 已連接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:2105988 (2.0M) [application/octet-stream]
正在保存至: “face-detection-adas-0001.bin”

face-detection-adas-0001.bin         100%[====================================================================>]   2.01M  3.18MB/s    in 0.6s    

2019-01-15 20:52:02 (3.18 MB/s) - 已保存 “face-detection-adas-0001.bin” [2105988/2105988])


[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ ./armv7l/Release/object_detection_sample_ssd -m face-detection-adas-0001.xml -d MYRIAD -i /home/pi/Downloads/test_data/ZhiHua_Zhou.jpg
[ INFO ] InferenceEngine: 
	API version ............ 1.4
	Build .................. 19154
Parsing input parameters
[ INFO ] Files were added: 1
[ INFO ]     /home/pi/Downloads/test_data/ZhiHua_Zhou.jpg
[ INFO ] Loading plugin

	API version ............ 1.5
	Build .................. 19154
	Description ....... myriadPlugin
[ INFO ] Loading network files:
	face-detection-adas-0001.xml
	face-detection-adas-0001.bin
[ INFO ] Preparing input blobs
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ WARNING ] Image is resized from (251, 376) to (672, 384)
[ INFO ] Batch size is 1
[ INFO ] Start inference (1 iterations)
[ INFO ] Processing output blobs
[0,1] element, prob = 0.956055    (52.3938,102.629)-(196.584,264.375) batch id : 0 WILL BE PRINTED!
[1,1] element, prob = 0.0217285    (-1.29453,-0.516357)-(12.0261,24.4639) batch id : 0
[2,1] element, prob = 0.0193481    (15.3811,7.12573)-(42.4359,48.1475) batch id : 0
[3,1] element, prob = 0.0182037    (6.03601,83.3057)-(61.8615,232.246) batch id : 0
[4,1] element, prob = 0.0175934    (29.6285,6.42578)-(47.5221,39.3579) batch id : 0
[5,1] element, prob = 0.0172577    (227.836,311.742)-(254.922,390.32) batch id : 0
[6,1] element, prob = 0.0171967    (139.227,114.012)-(191.682,236.836) batch id : 0
[7,1] element, prob = 0.0171204    (166.925,-23.6377)-(245.117,133.105) batch id : 0
[8,1] element, prob = 0.0170746    (186.289,128.516)-(224.037,220.68) batch id : 0
[9,1] element, prob = 0.0169373    (110.732,58.4287)-(133.711,90.7412) batch id : 0
[10,1] element, prob = 0.0165405    (182.49,194.059)-(192.785,221.965) batch id : 0
[11,1] element, prob = 0.0164948    (129.667,58.4746)-(149.276,88.7676) batch id : 0
[12,1] element, prob = 0.0164032    (82.4207,233.348)-(90.8772,251.34) batch id : 0
[13,1] element, prob = 0.0162811    (190.211,170.283)-(199.035,189.102) batch id : 0
[14,1] element, prob = 0.0162354    (244.137,353.418)-(251,375.816) batch id : 0
[15,1] element, prob = 0.0160522    (14.7453,38.2793)-(38.3302,96.6621) batch id : 0
[16,1] element, prob = 0.015976    (13.5734,11.3369)-(26.8403,44.7051) batch id : 0
[17,1] element, prob = 0.015976    (238.499,327.715)-(253.451,380.406) batch id : 0
[18,1] element, prob = 0.0159302    (186.412,164.867)-(203.815,207.094) batch id : 0
[19,1] element, prob = 0.015686    (21.892,0.172119)-(34.6841,16.925) batch id : 0
[20,1] element, prob = 0.015686    (182.612,165.877)-(195.849,213.52) batch id : 0
[21,1] element, prob = 0.0156403    (25.3696,18.7725)-(41.7312,57.7861) batch id : 0
[22,1] element, prob = 0.0156403    (87.5068,83.2598)-(109.567,120.162) batch id : 0
[23,1] element, prob = 0.0156403    (192.417,170.191)-(224.282,228.574) batch id : 0
[24,1] element, prob = 0.0155182    (98.7822,51.7734)-(127.706,96.7539) batch id : 0
[25,1] element, prob = 0.0154266    (29.0464,61.2285)-(36.7676,80.5059) batch id : 0
[26,1] element, prob = 0.0154266    (24.8794,46.4033)-(39.709,89.8232) batch id : 0
[27,1] element, prob = 0.0154266    (175.136,21.71)-(231.268,168.723) batch id : 0
[28,1] element, prob = 0.0153732    (35.2356,93.0361)-(43.7534,115.572) batch id : 0
[29,1] element, prob = 0.0153732    (10.0958,125.303)-(57.2961,298.156) batch id : 0
[30,1] element, prob = 0.0152969    (22.5508,29.0308)-(30.6703,48.0557) batch id : 0
[31,1] element, prob = 0.0152969    (22.1525,75.916)-(43.11,126.588) batch id : 0
[32,1] element, prob = 0.0152969    (179.671,184.328)-(195.604,226.922) batch id : 0
[33,1] element, prob = 0.0152969    (233.964,229.125)-(268.648,446.867) batch id : 0
[34,1] element, prob = 0.0152512    (17.9702,18.6233)-(34.439,58.9795) batch id : 0
[35,1] element, prob = 0.015213    (30.5324,0.625366)-(45.8369,19.4609) batch id : 0
[36,1] element, prob = 0.015213    (27.8208,72.3818)-(37.5642,97.3965) batch id : 0
[37,1] element, prob = 0.015213    (34.4083,100.977)-(47.3383,131.27) batch id : 0
[38,1] element, prob = 0.0151367    (85.791,203.973)-(101.601,248.035) batch id : 0
[39,1] element, prob = 0.0150909    (22.7193,62.1006)-(30.8694,80.9189) batch id : 0
[40,1] element, prob = 0.0150909    (37.2272,87.4824)-(51.5665,120.529) batch id : 0
[41,1] element, prob = 0.0150909    (-5.1015,231.879)-(19.0272,302.012) batch id : 0
[42,1] element, prob = 0.0150146    (63.853,104.098)-(84.688,135.309) batch id : 0
[43,1] element, prob = 0.0149689    (30.272,80.2305)-(50.5554,130.168) batch id : 0
[44,1] element, prob = 0.0149689    (185.799,182.768)-(202.222,225.453) batch id : 0
[45,1] element, prob = 0.0149689    (-3.80698,232.797)-(28.74,427.039) batch id : 0
[46,1] element, prob = 0.0149002    (189.353,177.168)-(199.403,204.707) batch id : 0
[47,1] element, prob = 0.0147781    (195.113,194.609)-(204.918,222.148) batch id : 0
[48,1] element, prob = 0.0147781    (55.0901,125.945)-(90.8772,179.188) batch id : 0
[49,1] element, prob = 0.01474    (35.7258,75.5488)-(42.5278,96.3867) batch id : 0
[50,1] element, prob = 0.01474    (33.4891,64.2578)-(45.1322,102.904) batch id : 0
[51,1] element, prob = 0.0147018    (40.4443,93.8164)-(48.4106,111.258) batch id : 0
[52,1] element, prob = 0.0146255    (16.1165,14.0793)-(24.7262,34.5615) batch id : 0
[53,1] element, prob = 0.0145035    (178.69,131.178)-(195.358,169.732) batch id : 0
[54,1] element, prob = 0.0144653    (28.4336,56.5469)-(49.6975,111.717) batch id : 0
[55,1] element, prob = 0.0144653    (125.868,66.3691)-(142.781,103.822) batch id : 0
[56,1] element, prob = 0.014389    (20.6205,13.3794)-(32.1716,35.1353) batch id : 0
[57,1] element, prob = 0.014389    (183.348,155.137)-(210.556,229.676) batch id : 0
[58,1] element, prob = 0.014389    (-3.3627,257.766)-(17.1276,344.055) batch id : 0
[59,1] element, prob = 0.0143509    (61.0955,111.441)-(77.6409,152.199) batch id : 0
[60,1] element, prob = 0.0143509    (39.1575,238.121)-(68.8779,299.074) batch id : 0
[61,1] element, prob = 0.014267    (27.162,12.7253)-(39.3413,34.2861) batch id : 0
[62,1] element, prob = 0.014267    (106.503,62.6973)-(115.205,81.6074) batch id : 0
[63,1] element, prob = 0.014267    (92.5317,88.9512)-(105.033,113.186) batch id : 0
[64,1] element, prob = 0.014267    (24.6036,64.6709)-(39.9235,103.18) batch id : 0
[65,1] element, prob = 0.0142288    (111.835,159.268)-(122.007,175.424) batch id : 0
[66,1] element, prob = 0.0142288    (74.7607,57.373)-(97.0664,86.6562) batch id : 0
[67,1] element, prob = 0.0141907    (20.789,41.6758)-(32.2329,68.2051) batch id : 0
[68,1] element, prob = 0.0141907    (29.3834,92.21)-(36.8595,111.809) batch id : 0
[69,1] element, prob = 0.0141907    (8.08887,8.60596)-(21.126,38.5317) batch id : 0
[70,1] element, prob = 0.0141907    (224.282,17.6479)-(239.234,51.3145) batch id : 0
[71,1] element, prob = 0.0141907    (38.2383,69.7656)-(51.781,105.475) batch id : 0
[72,1] element, prob = 0.0141907    (25.9824,100.059)-(39.8928,132.555) batch id : 0
[73,1] element, prob = 0.0141907    (172.195,117.684)-(190.824,156.055) batch id : 0
[74,1] element, prob = 0.0141907    (-4.09805,-9.59277)-(18.0774,51.085) batch id : 0
[75,1] element, prob = 0.0141144    (100.253,60.6777)-(109.077,79.1289) batch id : 0
[76,1] element, prob = 0.0141144    (58.8894,224.352)-(77.7634,255.562) batch id : 0
[77,1] element, prob = 0.0141144    (76.1702,224.535)-(97.3728,256.48) batch id : 0
[78,1] element, prob = 0.0140839    (0.090004,1.16467)-(7.69055,20.8379) batch id : 0
[79,1] element, prob = 0.0140839    (28.9698,29.4668)-(37.2578,48.2852) batch id : 0
[80,1] element, prob = 0.0140839    (176.852,179.371)-(187.392,207.645) batch id : 0
[81,1] element, prob = 0.0140839    (107.729,63.4316)-(126.603,103.914) batch id : 0
[82,1] element, prob = 0.0140839    (100.314,82.3418)-(120.904,114.838) batch id : 0
[83,1] element, prob = 0.0140839    (193.397,331.754)-(228.694,378.938) batch id : 0
[84,1] element, prob = 0.0140076    (29.1077,0.183594)-(37.5029,16.925) batch id : 0
[85,1] element, prob = 0.0140076    (48.1962,88.6758)-(64.7109,119.887) batch id : 0
[86,1] element, prob = 0.0139694    (45.4386,90.374)-(55.3046,112.268) batch id : 0
[87,1] element, prob = 0.0139694    (184.206,179.188)-(193.52,206.359) batch id : 0
[88,1] element, prob = 0.0139694    (190.701,199.934)-(197.564,221.23) batch id : 0
[89,1] element, prob = 0.0139694    (75.3735,228.758)-(86.2812,251.523) batch id : 0
[90,1] element, prob = 0.0139694    (18.9353,14.5498)-(47.2463,66.7822) batch id : 0
[91,1] element, prob = 0.0139694    (95.228,54.252)-(114.592,85.8301) batch id : 0
[92,1] element, prob = 0.0139694    (71.6968,207.094)-(89.7129,243.078) batch id : 0
[93,1] element, prob = 0.0139694    (6.67944,189.836)-(50.4635,280.164) batch id : 0
[94,1] element, prob = 0.0139694    (35.6033,182.4)-(74.4543,279.43) batch id : 0
[95,1] element, prob = 0.0138702    (106.503,31.7158)-(114.96,47.7803) batch id : 0
[96,1] element, prob = 0.0138702    (11.5588,60.1729)-(18.4144,82.0205) batch id : 0
[97,1] element, prob = 0.0137558    (34.1326,57.1436)-(43.8147,82.9385) batch id : 0
[98,1] element, prob = 0.0137558    (53.0372,108.504)-(61.3099,126.129) batch id : 0
[99,1] element, prob = 0.0137558    (19.8851,81.8369)-(33.3972,121.172) batch id : 0
[100,1] element, prob = 0.0137558    (75.0671,83.9941)-(96.76,115.756) batch id : 0
[101,1] element, prob = 0.0137558    (55.6416,112.451)-(70.8389,152.475) batch id : 0
[102,1] element, prob = 0.0137558    (-2.67331,-50.167)-(28.6787,140.816) batch id : 0
[103,1] element, prob = 0.0137177    (40.7507,30.9355)-(49.146,49.5244) batch id : 0
[104,1] element, prob = 0.0137177    (17.6791,62.4219)-(34.6841,103.455) batch id : 0
[105,1] element, prob = 0.0137177    (60.5439,132.371)-(78.4375,171.66) batch id : 0
[106,1] element, prob = 0.0137177    (-23.5772,293.934)-(57.3574,382.977) batch id : 0
[107,1] element, prob = 0.0136414    (63.3628,119.244)-(74.5156,143.111) batch id : 0
[108,1] element, prob = 0.0136414    (178.936,200.117)-(185.799,221.781) batch id : 0
[109,1] element, prob = 0.0136414    (6.53008,0.0229492)-(20.7124,24.4409) batch id : 0
[110,1] element, prob = 0.0136414    (181.264,144.58)-(196.461,191.305) batch id : 0
[111,1] element, prob = 0.0136414    (70.655,245.281)-(91.49,276.859) batch id : 0
[112,1] element, prob = 0.0136414    (194.133,206.91)-(227.959,259.418) batch id : 0
[113,1] element, prob = 0.0136032    (48.717,103.914)-(64.7109,135.125) batch id : 0
[114,1] element, prob = 0.0135269    (57.48,31.5781)-(66.5493,50.0293) batch id : 0
[115,1] element, prob = 0.0135269    (195.113,179.096)-(205.163,203.973) batch id : 0
[116,1] element, prob = 0.0135269    (14.707,0.826172)-(27.2386,29.3291) batch id : 0
[117,1] element, prob = 0.0135269    (23.6538,32.9321)-(43.5083,76.0996) batch id : 0
[118,1] element, prob = 0.0135269    (60.5746,207.094)-(76.8442,246.016) batch id : 0
[119,1] element, prob = 0.0135269    (71.5742,191.305)-(102.459,250.789) batch id : 0
[120,1] element, prob = 0.0134888    (94.4314,61.917)-(103.501,80.3682) batch id : 0
[121,1] element, prob = 0.0134888    (21.2486,71.418)-(31.9572,98.0391) batch id : 0
[122,1] element, prob = 0.0134888    (35.8177,107.953)-(43.7841,125.578) batch id : 0
[123,1] element, prob = 0.0134888    (101.724,70.7754)-(132.118,119.061) batch id : 0
[124,1] element, prob = 0.0134888    (180.039,202.32)-(194.746,245.648) batch id : 0
[125,1] element, prob = 0.0134277    (93.7573,76.7881)-(102.949,94.5508) batch id : 0
[126,1] element, prob = 0.0134277    (195.113,211.684)-(205.408,238.488) batch id : 0
[127,1] element, prob = 0.0134277    (69.3069,228.391)-(79.7244,252.258) batch id : 0
[128,1] element, prob = 0.0134277    (36.308,24.0278)-(51.9342,62.3301) batch id : 0
[129,1] element, prob = 0.0133896    (34.439,28.9849)-(42.8955,47.7344) batch id : 0
[130,1] element, prob = 0.0133896    (40.2299,75.0439)-(49.1766,98.4062) batch id : 0
[131,1] element, prob = 0.0133896    (83.7075,94.3672)-(112.631,142.469) batch id : 0
[132,1] element, prob = 0.0133896    (24.0828,308.07)-(43.876,343.32) batch id : 0
[133,1] element, prob = 0.0133896    (215.458,254.828)-(283.846,411.617) batch id : 0
[134,1] element, prob = 0.0133133    (112.202,62.7891)-(121.639,80.873) batch id : 0
[135,1] element, prob = 0.0132828    (64.282,33.001)-(72.8611,50.9014) batch id : 0
[136,1] element, prob = 0.0132446    (189.966,158.074)-(198.79,176.434) batch id : 0
[137,1] element, prob = 0.0132446    (21.4631,312.844)-(31.1146,333.039) batch id : 0
[138,1] element, prob = 0.0132446    (216.684,6.67822)-(232.371,39.8857) batch id : 0
[139,1] element, prob = 0.0132446    (31.0073,48.0098)-(46.2046,87.3906) batch id : 0
[140,1] element, prob = 0.0132446    (19.64,98.6816)-(33.9794,130.443) batch id : 0
[141,1] element, prob = 0.0132446    (206.266,4.03906)-(251.245,179.922) batch id : 0
[142,1] element, prob = 0.0131683    (82.7271,70.6836)-(103.439,101.619) batch id : 0
[143,1] element, prob = 0.0131683    (79.2954,203.238)-(94.2476,245.832) batch id : 0
[144,1] element, prob = 0.0131378    (135.795,75.3652)-(144.129,95.0098) batch id : 0
[145,1] element, prob = 0.0131378    (64.7109,218.477)-(72.6772,237.203) batch id : 0
[146,1] element, prob = 0.0131378    (101.111,93.2197)-(133.099,144.121) batch id : 0
[ INFO ] Image out_0.bmp created!

total inference time: 165.57
Average running time of one iteration: 165.57 ms

Throughput: 6.03973 FPS

[ INFO ] Execution successful
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $

在這裏插入圖片描述

Run Face Detection Model Using OpenCV* API

To validate OpenCV* installation, you may try to run OpenCV’s deep learning module with Inference Engine backend. Here is a Python* sample, which works with Face Detection model:

(1) Download the pre-trained Face Detection model or copy it from a host machine:
(1.1) To download the .bin file with weights:

wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
--2019-01-15 20:51:41--  https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
正在解析主機 download.01.org (download.01.org)... 27.148.138.230
正在連接 download.01.org (download.01.org)|27.148.138.230|:443... 已連接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:2105988 (2.0M) [application/octet-stream]
正在保存至: “face-detection-adas-0001.bin”

face-detection-adas-0001.bin         100%[====================================================================>]   2.01M  3.18MB/s    in 0.6s    

2019-01-15 20:52:02 (3.18 MB/s) - 已保存 “face-detection-adas-0001.bin” [2105988/2105988])

[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $

(1.2) To download the .xml file with the network topology:

wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ wget --no-check-certificate https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
--2019-01-15 20:52:06--  https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
正在解析主機 download.01.org (download.01.org)... 27.148.138.230, 2600:1417:9:192::ae6, 2600:1417:9:1ad::ae6
正在連接 download.01.org (download.01.org)|27.148.138.230|:443... 已連接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:90009 (88K) [text/xml]
正在保存至: “face-detection-adas-0001.xml”

face-detection-adas-0001.xml                        100%[================================================================================================================>]  87.90K  40.3KB/s    in 2.2s    

2019-01-15 20:52:09 (40.3 KB/s) - 已保存 “face-detection-adas-0001.xml” [90009/90009])

(2) Create a new Python file named as openvino_fd_myriad.py and copy the following script there:

import cv2 as cv

# Load the model 
net = cv.dnn.readNet('face-detection-adas-0001.xml', 'face-detection-adas-0001.bin') 

# Specify target device 
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)
      
# Read an image 
frame = cv.imread('/path/to/image')
      
# Prepare input blob and perform an inference 
blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U) 
net.setInput(blob) 
out = net.forward()
      
# Draw detected faces on the frame 
for detection in out.reshape(-1, 7): 
    confidence = float(detection[2]) 
    xmin = int(detection[3] * frame.shape[1]) 
    ymin = int(detection[4] * frame.shape[0]) 
    xmax = int(detection[5] * frame.shape[1]) 
    ymax = int(detection[6] * frame.shape[0])

    if confidence > 0.5:
        cv.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))

# Save the frame to an image file 
cv.imwrite('out.png', frame) 

(3) Run the script:

python3 openvino_fd_myriad.py

In this script, OpenCV* loads the Face Detection model in the Intermediate Representation (IR) format and an image. Then it runs the model and saves an image with detected faces.

trouble shooting

[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ python3 openvino_fd_myriad.py
  File "openvino_fd_myriad.py", line 13
    blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U) net.setInput(blob) 
                                                                           ^
SyntaxError: invalid syntax
[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $

官方的源代碼:

......
# Prepare input blob and perform an inference 
blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U) net.setInput(blob) 
out = net.forward()

添加換行:

......
# Prepare input blob and perform an inference 
blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U) 
net.setInput(blob) 
out = net.forward()

/home/pi/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build/openvino_fd_myriad.py

import cv2 as cv

# Load the model 
net = cv.dnn.readNet('face-detection-adas-0001.xml', 'face-detection-adas-0001.bin') 

# Specify target device 
net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)
      
# Read an image 
frame = cv.imread('/home/pi/Downloads/test_data/ZhiHua_Zhou.jpg')
      
# Prepare input blob and perform an inference 
blob = cv.dnn.blobFromImage(frame, size=(672, 384), ddepth=cv.CV_8U) 
net.setInput(blob) 
out = net.forward()
      
# Draw detected faces on the frame 
for detection in out.reshape(-1, 7): 
    confidence = float(detection[2]) 
    xmin = int(detection[3] * frame.shape[1]) 
    ymin = int(detection[4] * frame.shape[0]) 
    xmax = int(detection[5] * frame.shape[1]) 
    ymax = int(detection[6] * frame.shape[0])

    if confidence > 0.5:
        cv.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))

# Save the frame to an image file 
cv.imwrite('out.png', frame) 

[email protected]:~/Downloads/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build $ python3 openvino_fd_myriad.py

在這裏插入圖片描述

backend ['bæk,ɛnd]:n. 後端
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章