I’ve been looking to use the amazing Intel Neural Stick 2 for a while, and one of the 1st ideas that I have was to check how fast my Raspberry Pi 4 can run using this device.
The Intel team released a nice step by step process installation for Raspberry Pi. And it works great, there are a couple of minor glitches that you need to figure out, like the latest package version, everything else works great.
Note: I downloaded my openvino toolkit from here (https://download.01.org/opencv/2019/openvinotoolkit/R3/), and the downloaded file is (l_openvino_toolkit_runtime_raspbian_p_2019.3.334.tgz).
Once installed, the 1st python sample is a face recognition one. This sample analyzes a image file using OpenCV to detect faces, and creates a new output file with the detected images. As I said, is very straight forward.
So, I decided to create a new python sample to run live face detection using the camera feed and also display the FPS. This is the output code:
The code is very straight forward and the main matters are
- It uses 2 models from the Intel Zoo to perform the face detection: face-detection-adas-0001.xml and face-detection-adas-0001.bin
- Lines 22 and 23 are key to define that OpenCV will load and use the models in the Intel device
- I use imutils to resize the image to 640×480. Feel free to use any other library for this, even OpenCV
- Also, it works also with smaller resolutions, however 640×480 is good for this demo
And the final app running analyzing almost 8 frames per second (8 FPS).
Which is almost 10 times faster that the 0.7 FPS without Intel NCS2
And, I already wrote about running Visual Studio Code in the Raspberry Pi (see references) is an amazing experience. I did all my Python in VSCode coding remote accesing my device via VNC. Python runs like a charm!
You can download the code from https://github.com/elbruno/rpiopenvino/tree/master/facedetection
My posts on Raspberry Pi ⚡🐲⚡
Dev posts for Raspberry Pi
- How to grant permissions to a folder after git clone, to perform dotnet restore on a Raspberry Pi
- How to install .Net Core 3.1 in a Raspberry Pi 4
- Installing Visual Studio Code in a Raspberry Pi 4, run as root, fix black screen
- How to install .Net Core in a Raspberry Pi 4 and test with Hello World
- Build and Run C# NetCore projects in a Raspberry Pi 4 with Visual Studio Code
- Let’s do some Git dev in Raspberry Pi 4 (GitHub and Azure DevOps!)
- Install OpenCV
- Install Python 🐍 Virtual Environments in Raspberry Pi
- Setup SSH passwordless access to remote work with Docker 🐳
- Manage Docker 🐳 as a non-root user
- Build Docker 🐳 images from Visual Studio Code remotely using a Raspberry Pi
Tools and Apps for Raspberry Pi
- Where is my Task Manager in RaspberryPi? Let’s try htop
- Multi-monitor 📺 in Raspberry Pi 4 rocks !
- Double Commander on RaspberryPi4, because files are important
- How to install Docker 🐳 in a Raspberry Pi 4
- Installing Visual Studio Code in a Raspberry Pi
- Installing Visual Studio Code in a Raspberry Pi, run as root, fix black screen (Updated)
- 6 commands to install OpenCV for Python 🐍 in a Raspberry Pi 4
Setup the device
- 1st Setup without monitor 📺: auto connect to WiFi 📶, enable SSH, update and more
- Setup without monitor: enable VNC
- How to enable auto start with HDMI safe mode
- Running a Python 🐍 script in a Python Virtual Environment on reboot / startup
- Setup Wifi on Ubuntu