This article will set up your Raspberry Pi* 4 Model B with Raspbian 10 and the tools needed to use the Intel® Neural Compute Stick 2. If your device is already set up and running Raspbian 10, then download and compile the toolkit and its dependencies to verify your installation.
Make sure you have the following:
- Raspberry Pi 4
- Non-e-marked USB-C 5V 3A power supply
- AT LEAST 16 GB microSD Card
- Micro HDMI* adapter or cable
- HDMI* cable
- HDMI monitor
- USB keyboard
- USB mouse
- Intel® Neural Compute Stick 2
- Computer with compatible microSD* reader
The Raspberry Pi Foundation provides Raspbian for use with the Pi. Select and download a Raspbian 10 image. We recommend choosing the Raspbian Buster with desktop (without additional programs) or the Raspbian Buster Lite images for use with the Intel® Distribution of OpenVINO™ toolkit.
For writing the image to the microSD card, use balenaEtcher, an image writing program:.
Download and install the program:
- Open the program.
- Select the downloaded Raspbian image.
- Connect and select your microSD card.
- Press Flash to begin the writing process.
- Insert the microSD card into the slot on the underside of the Pi board.
- Plugin your keyboard, mouse (if using a desktop version), and micro HDMI adapter or cable attached to your monitor.
- Provide power through the USB-C port.
Your Pi will boot up to a desktop, asking you to confirm some settings before restarting the device. As soon as setup is finished, you’re ready to go.
Your board is now set up to build and run the Intel® Distribution of OpenVINO™ toolkit. Your next step is to review the OpenCV Installation section below and then follow the instructions here to install dependencies, grab the source code, and build and verify the toolkit itself. Remember to follow the OpenCV Installation instructions below rather than the instructions in the article linked above.
Installation and Build Notes
The article linked above asks you to download OpenCV from source directly from OpenCV’s public GitHub repository. However, as of 7/18/2019, the current repository fails to build on Raspbian 10. Instead, download the stable OpenCV-4.1.0 and build from that source package. Commands are below to build and install OpenCV from that package in a folder called OpenVINO on the current user’s home directory. This will also build the Python* 3 libraries for OpenCV:
cd ~/OpenVINO wget https://github.com/opencv/opencv/archive/4.1.0.zip unzip 4.1.0.zip cd opencv-4.1.0 mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/ -DPYTHON3_EXECUTABLE=/usr/lib/python3.7 –DPYTHON_INCLUDE_DIR=/usr/include/python3.7 –DPYTHON_INCLUDE_DIR2=/usr/include/arm-linux-gnueabihf/python3.7m –DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so .. make && make install
This will build a compatible version of OpenCV. You can continue on to build the Deep Learning Deployment Toolkit at this point. Don't forget to set the OpenCV_DIR environment variable to the install location of OpenCV:
To verify the correct version of OpenCV, use the commands below. These commands require the OpenCV Python 3 wrapper, which is built with the commands above:
python3 >>> import cv2 >>> cv2.__version__
The command should return ‘4.1.0’.
OpenVINO should build correctly on your Raspberry Pi 4 if you've built the correct version of OpenCV. However, an issue with the GCC* compiler's default settings may cause runtime issues. To solve this, build the toolkit with the following CMake flag:
Your full CMake command should look like the following:
cd ~/dldt/inference-engine mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS='-march=armv7-a' \ -DENABLE_MKL_DNN=OFF \ -DENABLE_CLDNN=OFF \ -DENABLE_GNA=OFF \ -DENABLE_SSE42=OFF \ -DTHREADING=SEQ \ .. make
Your board is now set up to build and run the Intel® Distribution of OpenVINO™ toolkit. Make sure that you’ve verified the correct version of OpenCV above and then follow the instructions at this page to install dependencies, grab the source code, and build and verify the toolkit itself.
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.