Get started with Google's TensorFlow on Spresense

TensorFlow is Google’s open-source software library for machine learning that developers and researchers can use for a range of application areas. The well-known and widely spread library comes in different flavors ready to run on various operating systems and hardware. Specifically, the TensorFlow Lite for Microcontrollers (TFLM) version is designed to run on microcontroller systems where the hardware resources are more limited compared to larger computerized systems. The footprint of TFLM is typically in the order of only 10’s of kB.

Now you can develop solutions with TensorFlow for the Spresense microcontroller board from Sony. What you get is a combination of a leading machine learning ecosystem with a high performance microcontroller running at super low power consumption. The Spresense board was designed with camera vision and hi-res audio inputs as core features which open up for a substantial set of use cases. Pete Warden, Research Engineer on Google’s TensorFlow team, shares his view on that TFLM is now available for use with the Spresense board: “It’s great to see this kind of compute capability tightly integrated into a low power sensor, the combination will help make machine learning accessible to developers in medical, agriculture, industrial monitoring and many other areas where a small form factor and energy are strong constraints”.

The development of TFLM has been a tight collaboration between Google and Arm to optimize the functionality while keeping the footprint to a minimum. Fredrik Knutsson, Team Lead at Arm, explains how TFLM has been optimized for the ARM processor architecture: “Arm’s open source CMSIS-NN library provides high performance implementations of common neural network functions for Arm Cortex-M processors. Arm’s engineers have worked closely with the TensorFlow team to develop optimized versions of the TensorFlow Lite kernels in the CMSIS-NN library, delivering extremely fast performance on Arm Cortex-M cores like Spresense”.

How to get started with TensorFlow on Spresense

The easiest and quickest way to get started with TensorFlow on Spresense is to run one of the examples. There is one hello_world example that shows the basic steps and functionality, there is a micro_speech example using Spresense’ audio abilities and there is the person_detection example utilizing the Spresense camera for real-time facial recognition. The two latter examples demonstrate how to link visual and audio sensors to the inputs of TensorFlow models.

Below are the general steps to run the examples:

  1. Set up the Spresense SDK: Getting started with TensorFlow for Spresense
  2. Download the Spresense repository including the examples
  3. Build and Flash the binary into Spresense main board
  4. Run the example

Missed the “TensorFlow for Spresense” webinar form October 14? You can watch it here.