TensorFlow Lite for Microcontrollers is a framework designed for running machine learning models on microcontrollers.
This repository contains precompiled TensorFlow Lite for Microcontroller examples that have been ported to run on Silicon Labs devices. The repository also includes the Silicon Labs Gecko SDK (GSDK), which provides a full integration of the TensorFlow Lite for Microcontrollers library by including it as a third-party component.
The examples/
folder contains examples that have been generated to run on the Thunderboard Sense 2 and the EFR32xG24 Dev Kit. Each example includes a precompiled binary that can be programmed directly onto the kit, together with the example source code. You can find the following examples in this repository:
- Hello World - Demonstrates the absolute basics of TensorFlow Lite for Microcontrollers by running a neural network that replicates a sine function.
- Micro Speech - Captures audio with a microphone to detect the words "yes" and "no"
- Magic Wand - Captures accelerometer data to classify different physical gestures
- An EFR32xG24 Dev Kit or a Thunderboard Sense 2 development kit
- Simplicity Commander to flash the application onto the kit
If you want to build the examples from source you need to install the build tools to build from the command line
Clone this repository with its submodules using the following command
git clone --recursive https://github.com/Siliconlabs/tflite-micro-efr32-examples.git
To flash a precompiled binary to the device, first navigate to the example you want to flash (e.g. examples/efr32xg24_dev_kit/micro_speech
) and flash the binary to the device using Simplicity Commander with the following command. Replace <path_to_commander>
with the path to the Simplicity Commander executable.
<path_to_commander> flash precompiled_binary/tflite_micro_micro_speech.s37
If you want to modify the source code, you have to build the examples. To do this, navigate to the folder that contains the example you want to build for your kit (e.g. examples/efr32xg24_dev_kit/micro_speech/
) and build the example by running the following command. Replace <path_to_gcc>
to the location where the GNU Arm Embedded Toolchain is installed.
make -f tflite_micro_micro_speech.Makefile release ARM_GCC_DIR=<path_to_gcc>
Flash the compiled application to the device using Simplicity Commander with the following command. Replace <path_to_commander>
with the path to the Simplicity Commander executable.
$ <path_to_commander> flash build/release/tflite_micro_micro_speech.s37
These examples, along with other machine learning examples, can be found as sample applications in the GSDK. See the sample applications list for a full overview. From the GSDK the sample applications can be generated for any compatible board. The easiest way to get started with TensorFlow Lite for Microcontrollers in the Gecko SDK is by installing Simplicity Studio 5, which will set up your development environment and walk you through the installation of the Gecko SDK.
The Tensorflow Lite Micro shipped in the Gecko SDK is updated at a regular interval, the current version can be found here
These examples are generally covered under the Apache 2.0 license. Some files use different licensing terms. If so, they will be clearly marked in the beginning of the file.
The Silicon Labs Gecko SDK has its own license, see gecko_sdk/licence.txt
.