環境構築(ubuntu18.04編)

インストールの前に

  • インターネット環境

※2020.06.04追記:OpenVINO 2020.3 LTS Release も同様の手順で入る事を確認済です
※2020.07.21追記:OpenVINO 2020.4 Release も同様の手順で入る事を確認済です

インストールされるコンポーネント

コンポーネント説明
Model OptimizerThis tool imports, converts, and optimizes models, which were trained in popular frameworks, to a format usable by Intel tools, especially the Inference Engine.
Popular frameworks include Caffe*, TensorFlow*, MXNet*, and ONNX*.
Inference Engine
ディープラーニングエンジン
アプリケーション組み込みライブラリ
Drivers and runtimes for OpenCL™ version 2.1Enables OpenCL on the GPU/CPU for Intel® processors
Intel® Media SDKOffers access to hardware accelerated video codecs and frame processing
OpenCVIntel Hardware用にコンパイルされたOpenCV
Sample Applications推論エンジンを使用するためのコンソールデモアプリケーション
DemosA set of console applications that demonstrate how you can use the Inference Engine in your applications to solve specific use-cases
Additional ToolsA set of tools to work with your models
Documentation for PreTrained ModelsDocumentation for the pre-trained models available in the Open Model Zoo repo

プラットフォーム

ハードウェアの制限

  • 6th-10th Generation Intel® Core™
  • Intel® Xeon® v5 family
  • Intel® Xeon® v6 family
  • Intel® Neural Compute Stick 2

OS

  • Ubuntu 18.04.x long-term support (LTS), 64-bit
  • CentOS 7.4, 64-bit (for target only)
  • Yocto Project v3.0, 64-bit (for target only and requires modifications)

ソフトウェアのインストール

今回はUbuntu18.04にOpenVINO toolkit 2020.2をセットアップします
CPUスペックは、Intel(R) Atom(TM) Processor E3950 @ 1.60GHzとなります

必要なソフトウェア

  • CMake 3.4 or higher
  • Python 3.5 or higher

OpenVINO ToolKIT のダウンロード

こちらから登録を行い、ダウンロードして下さい

OpenVINO Toolkit のインストール

openvino@ubuntu$ ls l_openvino_toolkit_p_2020.2.120.tgz

openvino@ubuntu$ tar -xvzf l_openvino_toolkit_p_2020.2.120.tgz

openvino@ubuntu$ cd l_openvino_toolkit_p_2020.2.120/

#コマンドラインインストール
openvino@ubuntu$ sudo ./install.sh
 Welcome
 --------------------------------------------------------------------------------
 Welcome to the Intel® Distribution of OpenVINO™ toolkit 2020.2 for Linux*
 --------------------------------------------------------------------------------
 The Intel installation wizard will install the Intel® Distribution of OpenVINO™
 toolkit 2020.2 for Linux* to your system.
 

 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).
 

 Before installation please check system requirements:
 https://docs.openvinotoolkit.org/2020.2/_docs_install_guides_installing_openvino
 _linux.html#system_requirements
 and run following script to install external software dependencies:
 

 sudo -E ./install_openvino_dependencies.sh
 

 Please note that after the installation is complete, additional configuration
 steps are still required.
 

 For the complete installation procedure, refer to the Installation guide:
 https://docs.openvinotoolkit.org/2020.2/_docs_install_guides_installing_openvino
 _linux.html.
 

 You will complete the following steps:
    1.  Welcome
    2.  End User License Agreement
    3.  Prerequisites
    4.  Configuration
    5.  Installation
    6.  First Part of Installation is Complete
 

 --------------------------------------------------------------------------------
 Press "Enter" key to continue or "q" to quit:  

基本的には、Enterで進めていくとインストールされます
途中で、必要なアプリケーションなどのチェックが入りますので、
もし不足している場合は、画面に従いインストールが必要になります

#必要であればここで別端末を利用してソフトウェアをインストールします
openvino@ubuntu$ sudo apt-get install cmake
defaultのまま設定をすすめていくと、

 First Part of Installation is Complete
 --------------------------------------------------------------------------------
 The first part of Intel® Distribution of OpenVINO™ toolkit 2020.2 for Linux*
 has been successfully installed in 
 /opt/intel/openvino_2020.2.120.
 

 ADDITIONAL STEPS STILL REQUIRED: 
 

 Open the Installation guide at:
  https://docs.openvinotoolkit.org/2020.2/_docs_install_guides_installing_openvin
 o_linux.html 
 and follow the guide instructions to complete the remaining tasks listed below:
 

  • Set Environment variables 
  • Configure Model Optimizer 
  • Run the Verification Scripts to Verify Installation and Compile Samples
 

 --------------------------------------------------------------------------------
 Press "Enter" key to quit:  

インストール完了です

外部依存ソフトウェアのインストール

openvino@ubuntu$ cd /opt/intel/openvino/install_dependencies/
openvino@ubuntu$ sudo -E ./install_openvino_dependencies.sh 
 

 This script installs the following OpenVINO 3rd-party dependencies:
   1. GTK+, FFmpeg and GStreamer libraries used by OpenCV
   2. libusb library required for Myriad plugin for Inference Engine
   3. build dependencies for OpenVINO samples
   4. build dependencies for GStreamer Plugins
  
環境により異なりますが、上記ライブラリが自動的にインストールされます

環境変数の設定

openvino@ubuntu$ source /opt/intel/openvino/bin/setupvars.sh

#ログイン時に環境変数を有効にする場合
vi <user_directory>/.bashrc
#最終行に下記を追加
source /opt/intel/openvino/bin/setupvars.sh 

Model Optimizer の設定

openvino@ubuntu$ cd /opt/intel/openvino/deployment_tools/model_optimizer/install_prerequisites
 openvino@ubuntu$ sudo ./install_prerequisites.sh

インストールのチェック

openvino@ubuntu$ cd /opt/intel/openvino/deployment_tools/demo
openvino@ubuntu$ ./demo_squeezenet_download_convert_run.sh 

Demo check

openvino@ubuntu$ cd /opt/intel/openvino/deployment_tools/demo
openvino@ubuntu$ ./demo_security_barrier_camera.sh

2020.1リリースよりも若干早くなっているようです

GPU関連モジュールインストール

openvino@ubuntu$ cd /opt/intel/openvino/install_dependencies/
openvino@ubuntu$ sudo -E su
root@ubuntu# ./install_NEO_OCL_driver.sh

ここで過去にOpenVINOをインストールしていた場合、依存関係で下記のようなエラーが発生します

 dpkg: dependency problems prevent removal of intel-igc-core:
  intel-igc-opencl depends on intel-igc-core (= 1.0.2597).
 

 dpkg: error processing package intel-igc-core (--purge):
  dependency problems - not removing
 Errors were encountered while processing:
  intel-igc-core
 ERROR: unable to remove intel-igc-core
        please resolve it manually and try to launch the script again. 

intel-igc-openclがintel-igc-coreに依存関係があるためで、この場合は手動でintel-igc-openclを削除しましょう(下記コマンド参照)

dpkg -r intel-igc-opencl

Demo check

openvino@ubuntu$ cd /opt/intel/openvino/deployment_tools/demo
openvino@ubuntu$ ./demo_security_barrier_camera.sh -d GPU

CPUと比較して3倍弱のスピードが出ています

Neural Compute Stick2 の使用

#usersグループにカレントユーザーを加えます 
$ sudo usermod -a -G users "$(whoami)"

#NCS2用のルールをコピーし、リブートします
$ sudo cp /opt/intel/openvino/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger
$ sudo ldconfig 

2020.1と同様にGPUと同等程度の速さとなりました

お疲れ様でした
インストールはこれで完了です