私的AI研究会 > OpenVINO15

OpenVINO™ Toolkit for Linux on VirtualBox

 OpenVINO™ツールキットの最新版「2021.3」を「Core™ i7-2620M」VirtualBox 上の ubuntu20.04 にインストールする。
 VirtualBox は USB デバイスを使用できるので、Windows10 上の Ununtu 仮想マシンでソフトウェアの動作を確認する。

※ 最終更新:2021/05/14 

「OpenVINO™ Toolkit for Linux 2021.3」のインストール

事前準備

OpenVINO™ Toolkit のダウンロード

 Intel® のオフィシャルサイトが確実。(最新版が入手できる)

OpenVINO™ Toolkit のインストール

  1. ダウンロードされたパッケージを解凍
    $ tar -xvzf l_openvino_toolkit_p_2021.3.394.tgz
  2. 解凍したパッケージの中にあるインストーラを起動
    $ cd l_openvino_toolkit_p_2021.3.394
    $ sudo ./install_GUI.sh
  3. 依存関係の外部パッケージをインストール
    $ cd /opt/intel/openvino_2021/install_dependencies
    $ sudo -E ./install_openvino_dependencies.sh
  4. 環境変数の設定
    $ source /opt/intel/openvino_2021/bin/setupvars.sh
    [setupvars.sh] OpenVINO environment initialized
    シェルを起動時に自動的に環境変数を設定するため 「~/.bashrc」ファイルの最後に「source /opt/intel/openvino_2021/bin/setupvars.sh」の1行を追記する。

  5. Model Optimizer の設定
    $ cd /opt/intel/openvino_2021/deployment_tools/model_optimizer/install_prerequisites
    $ sudo ./install_prerequisites.sh
  6. Pytorch をインストール (オフィシャルサイトに記述はないがあとで必要になるので..)
    オフィシャルサイト PyTorch FROM RESEARCH TO PRODUCTION にアクセスして、インストールパラメータを取得する。
    pip install torch==1.8.0+cpu torchvision==0.9.0+cpu torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
    $ pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
    Defaulting to user installation because normal site-packages is not writeable
    Looking in links: https://download.pytorch.org/whl/torch_stable.html
    Collecting torch==1.8.1+cpu
      Downloading https://download.pytorch.org/whl/cpu/torch-1.8.1%2Bcpu-cp38-cp38-linux_x86_64.whl (169.1 MB)
         |████████████████████████████████| 169.1 MB 4.4 kB/s 
    Collecting torchvision==0.9.1+cpu
      Downloading https://download.pytorch.org/whl/cpu/torchvision-0.9.1%2Bcpu-cp38-cp38-linux_x86_64.whl (13.3 MB)
         |████████████████████████████████| 13.3 MB 5.0 MB/s 
    Collecting torchaudio==0.8.1
      Downloading torchaudio-0.8.1-cp38-cp38-manylinux1_x86_64.whl (1.9 MB)
         |████████████████████████████████| 1.9 MB 1.5 MB/s 
    Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from torch==1.8.1+cpu) (1.18.5)
    Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from torch==1.8.1+cpu) (3.7.4.3)
    Requirement already satisfied: pillow>=4.1.1 in /usr/lib/python3/dist-packages (from torchvision==0.9.1+cpu) (7.0.0)
    Installing collected packages: torch, torchvision, torchaudio
      WARNING: The scripts convert-caffe2-to-onnx and convert-onnx-to-caffe2 are installed in '/home/mizutu/.local/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    Successfully installed torch-1.8.1+cpu torchaudio-0.8.1 torchvision-0.9.1+cpu
  7. scipy をインストール (オフィシャルサイトに記述はないがあとで必要になるので..)
    $ pip3 install scipy
    Defaulting to user installation because normal site-packages is not writeable
    Collecting scipy
      Downloading scipy-1.6.2-cp38-cp38-manylinux1_x86_64.whl (27.2 MB)
         |████████████████████████████████| 27.2 MB 434 kB/s 
    Requirement already satisfied: numpy<1.23.0,>=1.16.5 in /usr/local/lib/python3.8/dist-packages (from scipy) (1.18.5)
    Installing collected packages: scipy
    Successfully installed scipy-1.6.2
  8. Neural Compute Stick 2 (NCS2) の設定
    $ sudo usermod -a -G users "$(whoami)"
    
    $ sudo cp /opt/intel/openvino_2021/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/
    $ sudo udevadm control --reload-rules
    $ sudo udevadm trigger
    $ sudo ldconfig
    1. システムを再起動する。
    2. VirtualBox の USBデバイスで「Miriad...」をチェックしておく。
    3. 設定確認
      $ lsusb
      Bus 001 Device 002: ID 03e7:2485 Intel Movidius MyriadX
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
      Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
      $ id mizutu
      uid=1000(mizutu) gid=1000(mizutu) groups=1000(mizutu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),120(lpadmin),131(lxd),132(sambashare)
  9. サンプルデモの実行1 demo_security_barrier_camera.sh
    $ cd /opt/intel/openvino_2021/deployment_tools/demo
    $ ./demo_security_barrier_camera.sh
  10. サンプルデモの実行2 demo_squeezenet_download_convert_run.sh
    $ ./demo_squeezenet_download_convert_run.sh
  11. サンプルデモの実行3 demo_benchmark_app.sh
    $ ./demo_benchmark_app.sh
  12. ディスク使用量の確認
    $ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            965M     0  965M   0% /dev
    tmpfs           199M  1.4M  198M   1% /run
    /dev/sda5       251G   15G  224G   7% /
    tmpfs           994M     0  994M   0% /dev/shm
    tmpfs           5.0M  4.0K  5.0M   1% /run/lock
    tmpfs           994M     0  994M   0% /sys/fs/cgroup
    /dev/loop0       56M   56M     0 100% /snap/core18/1988
    /dev/loop1      219M  219M     0 100% /snap/gnome-3-34-1804/66
    /dev/loop2       65M   65M     0 100% /snap/gtk-common-themes/1514
    /dev/loop3       52M   52M     0 100% /snap/snap-store/518
    /dev/loop4       32M   32M     0 100% /snap/snapd/11036
    /dev/sda1       511M  4.0K  511M   1% /boot/efi
    tmpfs           199M   24K  199M   1% /run/user/1000
    およそ 15GB を使用しているよう。

  13. 推論モデルファイルの一括ダウンロード (すでに別マシンで処理済みの場合は省略..)
    時間がかかる処理。(今回およそ1時間)
    $ cd ~/openvino_models
    $ python3 /opt/intel/openvino_2021/deployment_tools/tools/model_downloader/downloader.py --all
    ダウンロードされたモデルは、./public ./intel ディレクトリ配下に格納される。
  14. パブリックモデルの一括コンバート (すでに別マシンで処理済みの場合は省略..)
    時間がかかる処理。(今回およそ2.5時間)
    $ python3 /opt/intel/openvino_2021/deployment_tools/tools/model_downloader/converter.py --all
        :
    
    [ SUCCESS ] Total execution time: 32.49 seconds. 
    [ SUCCESS ] Memory consumed: 1783 MB. 
    
    FAILED:
    cocosnet
    efficientdet-d0-tf
    efficientdet-d1-tf
    googlenet-v3-pytorch
    regnetx-3.2gf
    rexnet-v1-x1.0
     コンバートできないモデルは 6

  15. 学習済みモデルをまとめる。 (すでに別マシンで処理済みの場合はコピー..)
    このままではアクセスしにくいので、出来上がったIRモデルをディレクトリ「~/model」に移動する。
    ~/model/intel/FP16
    ~/model/intel/FP32
    ~/model/public/FP16
    ~/model/public/FP32

OpenVINO™ ツールキット サンプルデモのインストール~

 詳しくは ここ を参照。
 オフィシャルサイト Open Model Zoo Demos の手順で付属のデモを構築する。

OpenVINO™ Toolkit に付属するデモソフト

▼ 「2021.3」に付属するデモソフト一覧

Neural Compute Stick 2 (NCS2) エラー

 Virtual Box 上の ubuntu で MYRIAD (NCS2) デバイスを使用するアプリケーションで下記エラーとなる。

[ ERROR ] Can not init Myriad device: NC_ERROR

Open Model Zoo Demos を動かす

3D Human Pose Estimation Python* Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
fps13.56.61.13.91.51.42.5

Action Recognition Python* Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
Data totaifps1152146998464212275
ms0.871010121.566.6611.3
Encoder totalfps235951117521.41058.7
ms4.310.5915.746.864.58.3
Decoder totalfps44202.5537.91033.6
ms23504001912664.516.3
Render totalfps27152.026.64.663.29.72
ms376749438215166101

Object Detection Python* Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
Latency(ms)219.24316575151526233010867
fps4.52.50.21.90.40.31.1

Human Pose Estimation Python* Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
USER_SPECIFIDE modeFPS17.39.21.20.51.91.40.7
Latency (ms)44.1104714236534591345
MIN_LATENCY modeFPS19.99.51.23.91.71.72.7
Latency (ms)48.1101701236.5563561347

Gesture Recognition Python* Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
fps14.38.70.95X1.90.75X
fps14.58.80.94X1.90.75X

Handwritten Text Recognition Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
Average throughput(ms)2776034353866274227881195

Text Detection C++ Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
detection model inferencems1021851154685107914221275
fps9.85.40.871.460.930.700.78
detection model postprocessingms40.469148154111161225
fps24.714.46.766.509.06.224.44
recognition model inferencems7.114.610376.077.379.178.7
fps14068.79.7013.212.912.612.7
recognition model postprocessingms0.0070.010.0150.040.0120.0350.034
fps136364917316334823160813282823029265

Crossroad Camera C++ Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
detection time(ms)3050.1312.2275.3342389422
fps32143,13.63.02.662.36

Human Pose Estimation C++ Demo

デモの実行

速度比較

 ※「2021.3」で変更あり。比較データ無し。

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
SYNCOpwnCV cap/render timems59.6363716.5--
Wallclock timems45100710248510--
fps13101.44.11.93--
Detection timems4595677205503--
fps22101.54.01.8--
ASYNCOpwnCV cap/render timems914693628--
Wallclock timems509571242536--
fps19101.4242.0--

Object Detection C++ Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
Latency(ms)2245259.3145.1162297361
fps73.042.37.513.011.86.112.7

Smart Classroom C++ Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
fps2112132.31.752.50

Pedestrian Tracker C++ Demo

デモの実行

Super Resolution C++ Demo

デモの実行

Single Human Pose Estimation Demo (top-down pipeline)

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
summary (fps)0.90.70.10.50.20.10.6
estimation (fps)5.62.40.31.60.50.51.0
detection (fps)109.969.19.122.214.37.310.8

Interactive Face Detection C++ Demo

デモの実行

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
throughput (fps)19.39.160.450.61.91.361.60

Gaze Estimation Demo

デモの実行

速度比較]

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
Overeli (fps)110635514911
Interface (fps)20210657161219

Security Barrier Camera C++ Demo

デモの実行]

速度比較

項目Core™
i5-10210
Hyper-V Core™
i7-6700
Celeron®
J4005
Celeron®
J4005 + NCS2
Hyper-v Core™
i7-2620M
VirtualBox Core™
i7-2620M
VirtualBox Core™
i7-2620M + NCS2
fps164.510611.724.725.914.820.6

テスト環境

 

更新履歴

参考資料


Last-modified: 2021-05-19 (水) 07:32:57