Skip to content

BuildingForRaspbianStretchOS

Ilya Lavrenov edited this page Dec 26, 2022 · 19 revisions

Build for Raspbian Stretch* OS

NOTE: MYRIAD plugin and ARM CPU plugin are supported. The detailed instruction how to build ARM plugin is available in OpenVINO contrib wiki.

Table of content

Hardware Requirements

  • Raspberry Pi* 2 or 3 with Raspbian* Stretch OS (32-bit). Check that it's CPU supports ARMv7 instruction set (uname -m command returns armv7l).

    NOTE: Despite the Raspberry Pi* CPU is ARMv8, 32-bit OS detects ARMv7 CPU instruction set. The default gcc compiler applies ARMv6 architecture flag for compatibility with lower versions of boards. For more information, run the gcc -Q --help=target command and refer to the description of the -march= option.

You can compile the Inference Engine for Raspberry Pi* in one of the two ways:

Native Compilation

Native compilation of the Inference Engine is the most straightforward solution. However, it might take at least one hour to complete on Raspberry Pi* 3.

  1. Install dependencies:
  • for MYRIAD support only:
    sudo apt-get update
    sudo apt-get install -y git cmake libusb-1.0-0-dev
  • for both MYRIAD and ARM CPU plugins support:
    sudo apt-get update
    sudo apt-get install -y git cmake libusb-1.0-0-dev scons build-essential
  1. Clone needed repositories:
  • for MYRIAD support only:
git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino.git 
  • for both MYRIAD and ARM CPU plugins support:
git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino.git 
git clone --recurse-submodules --single-branch --branch=master https://github.com/openvinotoolkit/openvino_contrib.git 
  1. Go to the cloned openvino repository:
cd openvino
  1. Create a build folder:
mkdir build && cd build
  1. Build the Inference Engine:
  • for MYRIAD support only:

    cmake -DCMAKE_BUILD_TYPE=Release \
    .. && make
  • for both MYRIAD and ARM CPU plugins support:

    cmake -DCMAKE_BUILD_TYPE=Release \
          -DOPENVINO_EXTRA_MODULES=<OPENVINO_CONTRIB_PATH>/openvino_contrib/modules/arm_plugin \
          -DARM_COMPUTE_SCONS_JOBS=$(nproc --all) \
    .. && make

    NOTE: By default OpenVINO CMake scripts try to introspect the system and enable all possible functionality based on that. You can look at the CMake output and see warnings, which show that some functionality is turned off and the corresponding reason, guiding what to do to install additionally to enable unavailable functionality. Additionally, you can change CMake options to enable / disable some functionality, add / remove compilation flags, provide custom version of dependencies. Please, read CMake options for custom compilation for this information..

Cross Compilation Using Docker*

To cross-compile MYRIAD and ARM CPU plugins using pre-configured Dockerfile you can use the following instruction: Build OpenCV, OpenVINO™ and the plugin using pre- configured Dockerfile.

Additional Build Options

  • To build Python API, install libpython3-dev:armhf and python3-pip packages using apt-get; then install numpy and cython python modules via pip3, adding the following options:
    -DENABLE_PYTHON=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3.7 \
    -DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.7

(Optional) Additional Installation Steps for the Intel® Neural Compute Stick 2

NOTE: These steps are only required if you want to perform inference on the Intel® Neural Compute Stick 2 using the Inference Engine MYRIAD Plugin. See also Intel® Neural Compute Stick 2 Get Started.

For Linux, Raspbian* Stretch OS

  1. Add the current Linux user to the users group; you will need to log out and log in for it to take effect:
sudo usermod -a -G users "$(whoami)"
  1. To perform inference on Intel® Neural Compute Stick 2, install the USB rules as follows:
cat <<EOF > 97-myriad-usbboot.rules
SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"
EOF
sudo cp 97-myriad-usbboot.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo ldconfig
rm 97-myriad-usbboot.rules
Clone this wiki locally