Skip To Main Content
Support Knowledge Base

Building Open Source OpenVINO™ Toolkit for Debian* OS and Intel® Neural Compute Stick 2

Content Type: Install & Setup   |   Article ID: 000094846   |   Last Reviewed: 02/27/2025
Note
  • All steps are required in the installation.
  • These steps have been tested with Raspberry Pi 4* board and Debian* Bullseye, 64-bit.
  • An Internet connection is required to follow the steps in this guide.
  • The article was verified using the 2022.1 release of the open-source distribution of the OpenVINO™ toolkit.

The OpenVINO™ toolkit quickly deploys applications and solutions that emulate human vision. The toolkit extends computer vision (CV) workloads across Intel® hardware based on Convolutional Neural Networks (CNN), which maximizes performance. These steps generally follow this article about Intel® Neural Compute Stick 2 and Open Source OpenVINO™ toolkit, but they include specific changes to get everything running on your board.

This guide provides you with steps for building open-source distribution of the OpenVINO™ toolkit for Raspbian* OS and to use with Intel® Neural Compute Stick 2 (Intel® NCS2).

Click on the topic for details:

System requirements
Note

This guide assumes you have your Raspberry Pi* board up and running with an operating system listed below.

Hardware

  • Raspberry Pi* 4 (Raspberry Pi* 3 Model B+ should work.)
  • At least an 16GB microSD Card
  • Intel® Neural Compute Stick 2
  • Ethernet Internet connection or compatible wireless network
  • Dedicated DC Power Adapter

Target operating system

Debian* Bullseye, 64-bit

Setting up your build environment
Note

This guide contains commands that need to be executed as root or sudo access to install correctly.

Make sure your device software is up to date:

sudo apt update && sudo apt upgrade -y

Installing build tools

sudo apt install build-essential libclang-11-dev clang-11 clang-format-9 libssl-dev cmake

Installing OpenCV

Intel® OpenVINO™ toolkit uses the power of OpenCV* to accelerate vision-based inferencing. While the CMake process for Intel® OpenVINO™ toolkit downloads OpenCV* if no version is installed for supported platforms, you must build OpenCV from source.

pip install opencv-python

sudo apt-get install python3-opencv

Downloading source code and installing dependencies
Note

We recommend specifying the latest and stable branch or tag when cloning repository from openvinotoolkit GitHub page instead of directly cloning the master branch by default.

The open-source version of Intel® OpenVINO™ toolkit is available through GitHub. The repository folder is titled openvino.

cd ~/


git clone --recurse-submodules --single-branch --branch=2022.1.0 https://github.com/openvinotoolkit/openvino.git

Intel® OpenVINO™ toolkit has a number of build dependencies. The install_build_dependencies.sh script fetches them for you. If any issues arise when trying to run the script, you must install each dependency individually.

Run the script to install the dependencies for Intel® OpenVINO™ toolkit:

cd openvino


sed -i 's/raspbian/debian/g' install_build_dependencies.sh


sudo ./install_build_dependencies.sh

If the script finished successfully, you are ready to build the toolkit. If something has failed at this point, make sure that you install any listed dependencies and try again.

Building

To build the Python API wrapper, install all additional packages listed as below:

python3 -m pip install --upgrade pip


python3 -m pip install clang==11.0 pyaml


python3 -m pip install -r ~/openvino/src/bindings/python/src/compatibility/openvino/requirements-dev.txt


python3 -m pip install -r ~/openvino/src/bindings/python/wheel/requirements-dev.txt

Note

Use the -DENABLE_PYTHON=ON option. To specify an exact Python version, use the following options:

-DPYTHON_EXECUTABLE=`which python3.9` \
-DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.9.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.9

Use the -DCMAKE_INSTALL_PREFIX={BASE_dir}/openvino_dist to specify the directory for the CMake building to build in:

for example, -DCMAKE_INSTALL_PREFIX=~/openvino_dist

The toolkit uses a CMake building system to guide and simplify the building process. To build both the inference engine and the MYRIAD plugin for Intel® Neural Compute Stick 2, use the following commands:

Note

Remove all the backslashes (\) when running the commands below. The backslashes are used to inform that these commands are not separated.

cd ~/openvino


mkdir build && cd build


cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=~/openvino_dist \
-DENABLE_INTEL_MYRIAD=ON \
-DENABLE_INTEL_CPU=OFF \
-DENABLE_INTEL_GPU=OFF \
-DENABLE_CLDNN=OFF \
-DENABLE_AUTO=OFF \
-DENABLE_MULTI=OFF \
-DENABLE_HETERO=OFF \
-DENABLE_TEMPLATE=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_OV_ONNX_FRONTEND=OFF \
-DENABLE_OV_PADDLE_FRONTEND=OFF \
-DENABLE_OV_TF_FRONTEND=OFF \
-DENABLE_NCC_STYLE=OFF \
-DENABLE_SSE42=OFF \
-DTHREADING=SEQ \
-DENABLE_OPENCV=OFF \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=$(which python3.9) \
-DPYTHON_LIBRARY=/usr/lib/aarch64-linux-gnu/libpython3.9.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.9 ..

 

make -j4
 

sudo make install

If the make command fails because of an issue with an OpenCV library, make sure that you’ve told the system where your installation of OpenCV is. If the build completes at this point, Intel® OpenVINO™ toolkit is ready to run. It should be noted that builds are placed in the ~/openvino/bin/aarch64/Release folder.

Verifying installation

After successfully completing the inference engine build, you should verify that everything is set up correctly. To verify that the toolkit and Intel® Neural Compute Stick 2 work on your device, complete the following steps:

  1. Run the sample program benchmark_app to confirm that all libraries load correctly.
  2. Download a trained model.
  3. Select an input for the neural network.
  4. Configure the Intel® Neural Compute Stick 2 Linux* USB driver.
  5. Run object_detection_sample_ssd with selected model and input.

Sample applications

The Intel® OpenVINO™ toolkit includes some sample applications that utilize the Inference Engine and Intel® Neural Compute Stick 2. One of the programs is benchmark_app, which can be found in:

~/openvino/bin/aarch64/Release

Run the following commands to test benchmark_app:

cd ~/openvino/bin/aarch64/Release

./benchmark_app -h

It should print a help dialog, describing the available options for the program.

Downloading a model

The program needs a model to pass the input through. You can obtain models for Intel® OpenVINO™ toolkit in IR format by:

  • Using the Model Optimizer to convert an existing model from one of the supported frameworks into IR format for the Inference Engine
  • Using the Model Downloader tool to download from the Open Model Zoo
  • Download the IR files directly from storage.openvinotookit.org

For our purposes, downloading directly is easiest. Use the following commands to grab a person-vehicle-bike detection model:

cd ~/Downloads

wget https://storage.openvinotoolkit.org/repositories/open_model_zoo/2022.1/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16/person-vehicle-bike-detection-crossroad-0078.bin

wget https://storage.openvinotoolkit.org/repositories/open_model_zoo/2022.1/models_bin/3/person-vehicle-bike-detection-crossroad-0078/FP16/person-vehicle-bike-detection-crossroad-0078.xml

Note

The Intel® Neural Compute Stick 2 requires models that are optimized for the 16-bit floating point format known as FP16. Your model, if it differs from the example, may require conversion using the Model Optimizer to FP16.

Input for the neural network

The last item needed is input for the neural network. For the model we’ve downloaded, you need an image with 3 channels of color. Download the necessary files to your board:

cd ~/Downloads
wget https://cdn.pixabay.com/photo/2018/07/06/00/33/person-3519503_960_720.jpg -O person.jpg

Configuring the Intel® Neural Compute Stick 2 Linux USB Driver

Some udev rules need to be added to allow the system to recognize Intel® NCS2 USB devices.

Note

If the current user is not a member of the users group, run the following command and reboot your device.

sudo usermod -a -G users "$(whoami)"

Set up the OpenVINO™ environment:

source ~/openvino_dist/setupvars.sh

To perform inference on the Intel® Neural Compute Stick 2, install the USB rules by running the install_NCS_udev_rules.sh script:

sh ~/openvino_dist/install_dependencies/install_NCS_udev_rules.sh

The USB driver should be installed correctly now. If the Intel® Neural Compute Stick 2 is not detected when running demos, restart your device and try again.

Running benchmark_app

When the model is downloaded, an input image is available, and the Intel® Neural Compute Stick 2 is plugged into a USB port, use the following command to run the benchmark_app:

cd ~/openvino/bin/aarch64/Release

./benchmark_app -i ~/Downloads/person.jpg -m ~/Downloads/person-vehicle-bike-detection-crossroad-0078.xml -d MYRIAD

This will run the application with the selected options. The -d flag tells the program which device to use for inferencing. -MYRIAD activates the MYRIAD plugin, utilizing the Intel® Neural Compute Stick 2. After the command successfully executes, the terminal will display statistics for inferencing and produce an image output.

INFO ] First inference took 267.43 ms
[Step 11/11] Dumping statistics report
Count: 12 iterations
Duration: 1620.69 ms
Latency:
Median: 532.82 ms
AVG: 494.30 ms
MIN: 278.83 ms
MAX: 557.00 ms
Throughput: 7.40 FPS


If the application ran successfully on your Intel® NCS2, OpenVINO™ toolkit and Intel® Neural Compute Stick 2 are set up correctly for use on your device.

Run the benchmark_app Python application:

source ~/openvino_dist/setupvars.sh

cd ~/openvino/tools/benchmark_tool

python3 benchmark_app.py -i ~/Downloads/person.jpg -m ~/Downloads/person-vehicle-bike-detection-crossroad-0078.xml -d MYRIAD

If the application ran successfully on your Intel® NCS2, the nGraph module is binding correctly to the Python.

Environment variables

You must update several environment variables before you can compile and run OpenVINO toolkit applications. Run the following script to temporarily set the environment variables:

source ~/openvino_dist/setupvars.sh

**(Optional)** The OpenVINO environment variables are removed when you close the shell. As an option, you can permanently set the environment variables as follows:

echo "source ~/openvino_dist/setupvars.sh" >> ~/.bashrc

To test your change, open a new terminal. You will see the following:

[setupvars.sh] OpenVINO environment initialized

This completes the build procedure for the open-source distribution of OpenVINO™ toolkit for Raspbian* OS and usage with Intel® Neural Compute Stick 2.

 

 

 

Related Products

This article applies to 2 products.