Overview#
Introduction#
The Silicon Labs AI/ML extension provides APIs for running TensorFlow Lite Micro models on Series 2 (EFR32) and SiWx917 devices, with optional hardware acceleration through the Matrix Vector Processor (MVP). This reference covers the public APIs for model lifecycle, feature generation, and the sensor drivers commonly used to feed inference.
Use this guide together with the Machine Learning developer documentation for getting started, sample applications, and migration notes.
Model inference#
At the center of the SDK is the model handle API in Machine Learning model APIs and structures. A single sl_ml_model_handle_t holds the flatbuffer, operator resolver, and tensor arena buffers for one deployed model.
Typical flow:
Construct or populate an
sl_ml_model_handle_twith the flatbuffer, resolver, and arena buffers (auto-generated by the ML compiler).Call
sl_ml_model_init()to load the model and allocate tensors.Write input tensors, then call
sl_ml_model_run()for each inference.Call
sl_ml_model_deinit()when the model is no longer needed (or before reloading the same handle).
Include the model header from application code:
#include "sl_ml_tflite_micro_model.h"
Feature generation#
Before inference, raw sensor data is usually converted into the feature layout the model was trained with.
Audio Feature Generator — Mel-filterbank features from a microphone stream for audio classification. Split the signal into overlapping windows, apply an FFT, run mel-scaled filters, and take the log of the filterbank energy. Use
sl_ml_audio_feature_generation_fill_tensor()to write features directly into a TFLM input tensor.Image Feature Generator — Crop and normalize camera frames for image classification. Initialize with
sl_ml_image_feature_generation_init(), then callsl_ml_image_feature_generation_fill_tensor()when a new frame is ready.
Match feature-generator configuration to the training pipeline (window size, FFT length, image crop, mean/std normalization, and so on). Sample apps under aiml_app/ show end-to-end setups for both audio and vision.
Sensor drivers#
These drivers acquire the streams that feature generators and models consume:
Microphone — PDM and I2S microphone capture and sound-level helpers on EFR32.
Microphone I2S Driver for Machine Learning — I2S microphone driver for SiWx917 (Si91x).
IMU - Inertial Measurement Unit — Inertial measurement unit (accelerometer / gyroscope) orientation and motion data for sensor-based models.
Choose the microphone API that matches the target SoC. The audio feature generator depends on the platform mic driver component selected in the SLC project.
Using the APIs in a project#
Add the AI/ML extension and the relevant SLC components (
machine_learning,fe_audio, image feature generation, mic, or IMU as needed).Generate and build the project for your board (for example
brd2601borbrd2605a/brd2605b).Include the public headers for the modules you use and follow the init → run → deinit pattern for models and feature generators.
Browse the module pages in the navigation for full function lists, parameter contracts, and examples embedded in the headers.