I'm getting an Intel Movidius NCS 2 Neural Compute Stick next week and I want to try using it with my RPi4 2GB, so I'm going to need to install the OpenVINO toolkit, the Model Optimizer and the Open Models Zoo repository. I'm anticipating an arduous process. I've used the first version of the NCS with a PYNQ-Z2 and an Ultra96 but haven't tried it with an RPi yet. The installation of the NCSDK is pretty painless but the NCS 2 requires OpenVINO which appears to have a more complex installation. The good news is that I should be able to use OpenVINO with both NCS and NCS 2 sticks so I should be able to try this out before I get the NCS 2.
First you need to download the latest version of the OpenVINO toolkit package for Raspbian OS from the Intel Open Source Technology Center. Currently this is l_openvino_toolkit_runtime_raspbian_p_2020.2.120.tgz.
The package includes:
COMPONENT | DESCRIPTION |
---|---|
Inference Engine | This is the engine that runs the deep learning model. It includes a set of libraries for an easy inference integration into your applications. |
OpenCV | OpenCV community version compiled for Intel hardware. |
Sample Applications | A set of simple console applications demonstrating how to use Intel's Deep Learning Inference Engine in your applications. |
Installation procedure:
- Create an installation folder: sudo mkdir -p /opt/intel/openvino
- Unpack the archive: sudo tar -xf l_openvino_toolkit_runtime_raspbian_p_<version>.tgz --strip 1 -C /opt/intel/openvino
- Install External Software Dependencies: sudo apt install cmake
- Set the Environment Variables: echo "source /opt/intel/openvino/bin/setupvars.sh" >> ~/.bashrc
- Add the current Linux user to the users group: sudo usermod -a -G users "$(whoami)"
- Logout and login for command to take effect
- Add USB Rules: sh /opt/intel/openvino/install_dependencies/install_NCS_udev_rules.sh
Test the installation:
- Plug in Neural Compute Stick
- Build and Run Object Detection Sample
- Create a samples build directory: mkdir build && cd build
- Build the Object Detection Sample:
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=armv7-a" /opt/intel/openvino/deployment_tools/inference_engine/samples/c
- make -j2 object_detection_sample_ssd
- Download the pre-trained Face Detection model:
- Download the .bin file with weights: wget --no-check-certificate https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.bin
- Download the .xml file with the network topology: wget --no-check-certificate https://download.01.org/opencv/2020/openvinotoolkit/2020.2/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.xml
- Run the sample with specifying the model and a path to the input image: ./armv7l/Release/object_detection_sample_ssd_c -m face-detection-adas-0001.xml -d MYRIAD -i ~/Downloads/test.bmp
Installation failed!
Or at least I think it did. What is supposed to happen is that "The application outputs an image (out_0.bmp) with detected faced enclosed in rectangles". Well, I don't see an image file created and I don't get any error messages. The documentation isn't very helpful in that there is no sample image provided or an indication of where the expected output would go (I presume the directory you execute from but I can't find it there or anywhere else) and no indication of what the expected messaging is for a successful execution. Here's what I see:
At least it appears to be at least running something.
I did determine that it seems to want a BMP image. I gleaned that from running the command with the -h option:
I also tried running the OpenCV API Python example but unfortunately the error was not something that I can make sense of:
I sure wish Intel would provide test images and the expected outputs.
At this point I'm going to take a quick look at the source code for the C Object Detection Sample to see if I can get a clue as to what's failing. The documentation did indicate that this has been validated with the RPi3 with both Stretch and Buster. I'm running Buster on my RPi4. Since I've never tried this on an RPi before and I've never used OpenVINO, I may have to drop back to trying the NCSDK on the RPi4. If that doesn't work I may need to try both the NCSDK and OpenVINO on an RPi3. I somehow suspected that this was going to be hard, but one should always have hope . Maybe somebody out there has got this particular configuration working and can tell me what I'm doing wrong.