TNS Demo: Get Started with Machine Learning at the Edge

How do you bring AI to edge computing? This is the subject of this first episode of The New Stack Demo, assembled by analyst and frequent TNS contributor Janakiram MSV. Based on an AI kit from Intel, we show how a device can be “trained” to recognize different vehicle types — in this case a model car and bus. A system like this could be used for calculating toll fees according to the type of vehicle that the sensor “sees”. It can be considered and edge device insofar as it doesn’t need to connect to the Internet for any additional help from data center servers.
This project is based on an Intel AI Vision X Kit, an edge device that runs an Intel Atom processor. This kit comes with a camera that can feed images to the device via a USB port (though many other webcams would work as well). An optional version of the kit, used here, includes the Intel Myriad VPU (Vision Processing Unit), to which the device offloads the inferencing duties. The device runs a version of Ubuntu Linux, and it can be easily installed with the Intel OpenVINO Toolkit.
The demo also deploys a couple of Arduino Yun microcontrollers, one to drive a number display, and another to drive two LEDs, one red and one green. They are connected to the edge device with WiFi, with MQTT acts as the message broker for this system.
In this tutorial, small model cars and buses are placed in front of the camera, which will send the image to the device. The device offloads to inferencing to the VU to determine if the vehicle is present and if it is a car or a larger truck or bus. The results are transmitted to the Yun units. One LED will glow if the vehicle type is a truck, and the other will glow if the vehicle is a car. The number on the display shows the estimated size of the vehicle.
Below is a list of items used in this project:
- Intel AI Vision X Kit (1 ea)
- Logitech C270 Webcam (1 ea)
- Arduino Yun Rev 2 Board (2 ea)
- Grove Shields for Arduino (2 ea)
- Grove Red LED (1 ea)
- Grove Green LED (1 ea)
- Grove 4-Segment Display (1 ea)
Software Setup
Machine learning can be broken up into two parts: training a model, and then using the model for inferencing. Training involves a system learning how to recognize different types of data and inferencing is applying what is learned to make decisions. In this setup, the inferencing must be done in real-time, by way of the VPU.
For the software to work with this system, the first step is to optimize a pre-existing deep learning vision recognition model to a 16-bit floating-point format that can be used by the VPU. This capability is offered by the OpenVINO Toolkit and produces two outputs, a bin file and an XML file, both of which are then used by OpenCV, an open source computer vision library integrated into the toolkit. The OpenCV file is modified to offload the inference processing to the Intel Myriad VPU.
A Python program written for this project goes through each frame to identify objects when one occurs, the program sends a message via MQTT which kicks off the OpenCV-based identification process. The results are published to an MQTT topic to which Arduino Yun devices are subscribed. When an object of interest is detected, software written for one Yun changes the display of an actuator. The other Yun lights up the appropriate LED. For the custom software for this project, please see this previous tutorial.
When it is deployed at a toll gate, the color of LED and the value shown in the display change based on the vehicle type.
Stay tuned for more to come in our new demo video podcast series.