Beyond Sensing - Developing UP Squared based Computer Vision Projects

ID 675476
Updated 6/22/2018
Version Latest
Public

author-image

By

Introduction

UP Squared (UP2) board is the latest in the line of IoT Hardware offerings from Intel. With a preloaded Ubuntu* 16.04 LTS OS running on a x86 Apollo Platform, support for more than a thousand sensors via the API’s provided by Intel MRAA and UPM libraries, and native integration with Arduino Create* to ensure code written on one device is accessible via the cloud to any device, this versatile kit ensures accelerated IoT solution prototyping and deployment. Refer to Alternative Platforms to the Intel® Joule™ Module to know more about how UP2 compares with the previous offering of Intel - the Joule module.

What’s more, UP2 offers clear tutorial to connect wide range cloud connectors such as Microsoft Azure*, Amazon Web Services (AWS)*, and Google Cloud Platform* service, and because of it’s similarity to Raspberry Pi*’s GP-bus layout, it ensures a smooth experience when shifting from the RPi.

OpenVINO™ toolkit

The Open Visual Inference and Neural Network Optimization (OpenVINO™) is a toolkit for developing applications and solutions that emulate human vision. Based on convolutional neural networks (CNN), this SDK extends workloads across Intel® architecture, and maximizes performance. The UP2 board in this instance can be used to create solutions from smart cameras and video surveillance to robotics, autonomous vehicles, and more.

Features:

  • Unleash convolutional neural ​network (CNN) based deep learning inference on the edge using a common API. 
  • Supports heterogeneous execution across OpenVINO toolkit accelerators—CPU, GPU, Intel® Movidius™ Neural Compute Stick (NCS), and Intel® FPGA
  • Speeds time-to-market via a library of functions and preoptimized kernels.
  • Includes optimized calls for CV standards, including OpenCV, OpenCL™, and OpenVX*.

Install OpenVINO™ on Host Device

Intel® Distribution of OpenVINO™ toolkit is available after registering here. You are given the option of selecting the operating systems. When you register OpenVINO toolkit you will receive an email with the serial number to use during installation.

In this article the host development computer (UP2 Board) is equipped Apollo Lake Intel® Celeron® Processor N3350, 2 GB DDR4 RAM, and Ubuntu 18.04 LTS. The version of OpenVINO is OpenVINO 2018 R1.2 Release . Once the OpenVINO toolkit is downloaded to your development computer, refer to Installing the OpenVINO toolkit for Linux* for additional information on installing OpenCL™ NEOdriver components, Intel® Media SDK, enabling code samples, etc. For 16.04 LTS refer to the steps as listed above, for 18.04 they are a few tweaks to be made, as mentioned below.

Pre-Installation

In install_cv_sdk_dependencies.sh, replace the previous entry of downloading libraries with this:

libpng-dev libcairo2-dev libpango1.0-dev libglib2.0-dev libgtk2.0-dev libgstreamer1.0-dev libswscale-dev libavcodec-dev libavformat-dev cmake libusb-1.0-0-dev

Basically, we’d be replacing libpng12-dev to libpng-dev and libgstreamer0.10-dev to libgstreamer1.0-dev, i.e. the libraries that on their own are now incompatible with 18.04 LTS.

Post-Installation

In install_NEO_OCL_driver.sh, either add a new entry or replace the existing entry of 16.0. I chose to do the latter with a short message of my own as well.

grep -q -E "18.04" /etc/lsb-release && 
UBUNTU_VERSION="18.04"                                         
if [[ -z $UBUNTU_VERSION ]]; 
then                                                                                              
   echo "MESSAGE: this script is now supported on 18.04 as well." >&2

Run a Sample Program

In this section we will test our development environment by running the Intel® Deep Learning Deployment Toolkit to perform a classification task with the SqueezeNet model. This demo downloads a public SqueezeNet model, installs all prerequisites to run the Model Optimizer, converts the model to an Intermediate Representation, runs the sample image, in this case cars.png and shows the label & confidence for top 10 categories.

Of course, we’re going to make changes here as well, to introduce Ubuntu 18.04 compatibility.

  1. Go to deployment_tools/inference_engine/lib, and run the following commands to create a new folder for 18.04.
mkdir ubuntu_18.04/
cp -r ubuntu_16.04/ ubuntu_18.04/

2. Go to deployment_tools/inference_engine/share/InferenceEngineConfig.cmake and add an entry for 18.04 as follows:

elseif (${os_name} STREQUAL "Ubuntu 18.04")
   set(_OS_PATH "ubuntu_18.04/")

Since you’re already are making it compatible, why not include this little change as well:

message(FATAL_ERROR "${os_name} is not supported. List of supported OS: Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04, CentOS 7")

3. Finally, go inside demo_squeezenet_download_convert_run.sh, replace the previous entry with this

sudo -E apt -y install python3-pip virtualenv cmake libpng-dev libcairo2-dev libpango1.0-dev libglib2.0-dev libgtk2.0-dev libgstreamer1.0-0 libswscale-dev libavcodec-dev libavformat-dev

UP2 Board with Ubuntu* 18.04 LTS and OpenVINO™

Conclusion

OpenVINO is a great framework for getting up to speed quickly with developing applications and solutions that emulate human vision. Based on Convolutional Neural Networks (CNNs), the toolkit extends CV workloads across Intel® Architecture, maximizing performance. Hopefully this short primer will assist you in fully utilizing it’s capabilities on your UP2 board, or any Ubuntu 18.04 LTS machine.