Raspberry Pi4 / Ubuntu 20.10 (aarch64): OpenVINO-2021.3, OpenCV-4.5.2-openvino


Environment

2021-03-26時点の内容。

  • Raspberry Pi4 + Intel Neural Compute Stick 2 (NCS2)
  • OpenVINO 2021.3
  • OpenCV 4.5.2-openvino

install Ubuntu 20.10 using Raspberry Pi Imager

Use Raspberry Pi Imager

build OpenCV 4.5.2-openvino

source tree

git clone --depth 1 -b 4.5.2-openvino https://github.com/opencv/opencv.git opencv-4.5.2-openvino

build

sudo apt install libtbb-dev libjpeg-dev libtiff-dev libwebp-dev

mkdir opencv-4.5.2-openvino/build
cd opencv-4.5.2-openvino/build

source /opt/intel/bin/setupvars.sh

cmake \
    -DCMAKE_INSTALL_PREFIX=/opt/intel/openvino/opencv \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_INF_ENGINE=ON \
    -DENABLE_CXX11=ON \
    -DWITH_TBB=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3.8 \
    -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.8.so \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 ..

make -j 4
sudo make install

build OpenVINO 2021.3

source tree

sudo apt install git-lfs cython3

git clone -b 2021.3 https://github.com/openvinotoolkit/openvino.git openvino-2021.3
cd openvino-2021.3
git submodule update --init --recursive

build

cd openvino-2021.3
./install_build_dependencies.sh

mkdir build
cd build

cmake \
    -DCMAKE_INSTALL_PREFIX=/opt/intel/openvino \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_SSE42=OFF \
    -DTHREADING=SEQ \
    -DENABLE_GNA=OFF \
    -DENABLE_PYTHON=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3.8 \
    -DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.8.so \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.8 \
     ..

make -j 4
sudo make install

source /opt/intel/bin/setupvars.sh

sudo openvino-2021.3/scripts/install_dependencies/install_NCS_udev_rules.sh

patch this.

*** setupvars.sh.orig   2020-12-17 12:28:59.000000000 +0900
--- setupvars.sh    2020-12-17 12:29:34.000000000 +0900
***************
*** 18,23 ****
--- 18,24 ----
  BASE_DIR="$( dirname "$SCRIPT_DIR" )"

  INSTALLDIR="${BASE_DIR}"
+ INSTALLDIR=/opt/intel/openvino

environment valiable

source /opt/intel/openvino/bin/setupvars.sh
export ngraph_DIR=/opt/intel/openvino/deployment_tools/ngraph/cmake
export OpenCV_DIR=/opt/intel/openvino/opencv 
export PYTHONPATH=$OpenCV_DIR/lib/python3.8/site-packages:$PYTHONPATH

※ お互いに依存しているので OpenCV → OpenVINO →OpenCVでビルド&インストールすること。

Run with Intel Neural Compurte Stick 2 (NCS2)

Benchmark Raspberry pi 3B, 4B (Raspberry Pi OS 32bit), 4B (Ubuntu 20.10 64bit)
is here.

Using Benchmark C++ Tool.

Reference