TIDL on BeagleBone AI

Texas Instruments Deep Learning API and examples ported onto BeagleBone AI's default Debian distribution image and mjpg-streamer filters.

Categories: Beginner

Introduction

This project will document getting started with the
Texas Instruments Deep Learning (TIDL) library
on BeagleBone AI. For these examples, we’ll be using pre-trained models with live data streams from a web camera captured by
mjpg-streamer
for network-based development (rather than desktop keyboard-monitor-and-mouse development common on non-
embedded
platforms).

It is pretty cool that no tools need to be installed on the host computer and no monitor needs to be installed on BeagleBone AI. The mjpg-streamer software creates a video pipe that can be opened in any browser with access to the server running on BeagleBone AI.

The repository of examples is at
https://github.com/beagleboard/cloud9-examples
under the BeagleBone/AI/tidl folder. The Classification example is largely completed and the Segmentation example is under development. You’ll also see a ‘dummy’ example that simply provides a live video stream without any processing.

Upgrade the software libraries on your BeagleBone AI

Visit
https://beagleboard.org/upgrade
for instructions to:

  • Get on an Ethernet, WiFi or USB gadget based Internet connection,
  • Update the Debian packages in your distro,
  • Update your the cloud9-examples repository to the latest, and
  • Update your Linux kernel and boot scripts.

Make sure the TIDL library and examples are installed

sudo apt update

sudo apt install -y ti-tidl mjpg-streamer-opencv-python

Try out the classification example

  • Open up BeagleBone/AI/tidl/classification.tidl.cpp in the Cloud9 IDE editor by browsing the "Workspace" and double-clicking the file,
  • Click the "Run" button,
  • Change the "Runner" to "C or C++ (Beagle Makefile)" in the "Run Configuration" window,
  • Click the new "Run" button in the "Run Configuration" window,
  • Type the password "temppwd" and press Enter,
  • Click "BeagleBone -> MJPG-Streamer".

Stopping the demo can be done by clicking the "Stop" button in the "Run Configuration" window.

More examples are being created now.

About the implementation

Debian, not Processor SDK or Yocto

The TIDL API library and examples are published and included in TI’s Processor SDK, which is essentially a different
Linux distribution
provided by TI. The
BeagleBoard.org
provided Debian distribution integrates these same components.

The
TIDL API documentation
will make numerous references to the Processor SDK and occasional mentions of components like "Matrix" that are not part of our implementation. However, all the parts about the TIDL itself and the components it utilizes, like OpenCL, are still completely accurate as TIDL is integrated into the
BeagleBoard.org
Debian images.

Many of the integrated components can be found in Robert Nelson’s repository of customized Debian packages at:

https://github.com/rcn-ee/repos

Getting rid of the monitor and streaming video via the browser

A fork of
mjpg-streamer
added support for OpenCV-based plugins via C/C++ or Python. This made it easy to not rely on having a local monitor displaying video data often used in popular deep learning models. Our goal is to help you make embedded electronics, not a desktop computer, and this development method much better aligns with our network-based running-on-BeagleBone IDE and self-hosted development tools. The TIDL examples that were previously written for OpenCV GUI output are to be re-written for this project as mjpg-streamer filters.

You can still run the OpenCV GUI demos using the keyboard-monitor-and-mouse approach.

Integration into the Cloud9 IDE

The primary integration components into the Cloud9 IDE are the
runner
and the
Makefile
. These tie the distribution implementation into something that can be utilized by a click of the "Run" button. A set of typical libraries and an execution model are setup based on the ".tidl" before the ".cpp" in the filename. All projects are assumed to be only a single source file.

Join the community and contribute your own examples

BeagleBoard.org
is a collaborative community of Linux, open source and open hardware enthusiasts. We want to see you succeed and be enabled to teach others what you’ve learned.

Forum and Mailing List:
beagleboard.org/discuss

Live Chat:
beagleboard.org/chat

Example repo:
github.com/beagleboard/cloud9-examples

Comments are not currently available for this post.