Home

Awesome

TensorFlow Lite Micro for Espressif Chipsets

Component Registry

Build Status

Build TypeStatus
Examples BuildCI

How to Install

ESP-IDF Support Policy

We keep track with the ESP-IDF's support period policy mentioned here.

Currently ESP-IDF versions release/v4.4 and above are supported by this project.

Install the ESP IDF

Follow the instructions of the ESP-IDF get started guide to setup the toolchain and the ESP-IDF itself.

The next steps assume that this installation is successful and the IDF environment variables are set. Specifically,

Using the component

Run the following command in your ESP-IDF project to install this component:

idf.py add-dependency "esp-tflite-micro"

Building the example

To get the example, run the following command:

idf.py create-project-from-example "esp-tflite-micro:<example_name>"

Note:

Available examples are:

Set the IDF_TARGET

idf.py set-target esp32p4

To build the example, run:

idf.py build

Load and run the example

To flash (replace /dev/ttyUSB0 with the device serial port):

idf.py --port /dev/ttyUSB0 flash

Monitor the serial output:

idf.py --port /dev/ttyUSB0 monitor

Use Ctrl+] to exit.

The previous two commands can be combined:

idf.py --port /dev/ttyUSB0 flash monitor

ESP-NN Integration

ESP-NN contains optimized kernel implementations for kernels used in TFLite Micro. The library is integrated with this repo and gets compiled as a part of every example. Additional information along with performance numbers can be found here.

Performance Comparison

A quick summary of ESP-NN optimisations, measured on various chipsets:

TargetTFLite Micro Examplewithout ESP-NNwith ESP-NNCPU Freq
ESP32-P4Person Detection1395ms73ms360MHz
ESP32-S3Person Detection2300ms54ms240MHz
ESP32Person Detection4084ms380ms240MHz
ESP32-C3Person Detection3355ms426ms160MHz

Note:

Detailed kernelwise performance can be found here.

Sync to latest TFLite Micro upstream

As per the upstream repository policy, the tflite-lib is copied into the components directory in this repository. We keep updating this to the latest upstream version from time to time. Should you, in any case, wish to update it locally, you may run the scripts/sync_from_tflite_micro.sh script.

Contributing

License

This component and the examples are provided under Apache 2.0 license, see LICENSE file for details.

TensorFlow library code and third_party code contains their own license specified under respective repos.