環境構築(apt ubutu18.04編)

OpenVINO toolkitのインストールはGUIでやらないといけないのかなと思っていたのですが、aptで取得できることに気づきましたので…
やってみてわかったのですが、これが一番簡単なインストール方法かもしれません

インストールの前に

  • インターネット環境

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

コンポーネント説明
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.3をaptを使用してセットアップします

必要なソフトウェア

  • 特になし

OpenVINO Toolkit のインストール

wget -O GPG_KEY https://apt.repos.intel.com/openvino/2020/GPG-PUB-KEY-INTEL-OPENVINO-2020?elq_cid=6195740&erpm_id=9311153

sudo apt-key add GPG_KEY 
echo "deb https://apt.repos.intel.com/openvino/2020 all main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2020.list
sudo apt update
sudo apt-get install intel-openvino-dev-ubuntu18-2020.3.194
cd /opt/intel/openvino/deployment_tools/demo/ 

ここから先は通常のインストールと同じになります

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

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

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

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

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 

aptでインストールすると楽ですね