emlearn/emlearn
Machine Learning inference engine for Microcontrollers and Embedded devices
What it solves
emlearn allows developers to run machine learning models on microcontrollers and embedded systems. It bridges the gap between high-level Python training environments (like scikit-learn and Keras) and the extreme resource constraints of bare-metal hardware, where memory and processing power are very limited.
How it works
The tool converts trained Python models into portable, optimized C99 code. Instead of running a heavy runtime environment, the model's logic and parameters are translated directly into C functions and data structures. This generated code is then compiled into the final firmware of the embedded device.
Who it’s for
Embedded systems engineers and developers who need to deploy ML models to low-power devices (such as ESP32, ARM Cortex M, or AVR Atmega) without needing a full operating system or large amounts of RAM.
Highlights
- Ultra-low footprint: Supports models starting from 2kB of FLASH and 50 bytes of RAM.
- Broad model support: Converts Random Forests, Decision Trees, Multi-Layer Perceptrons (MLP), and Gaussian Naive Bayes.
- Hardware agnostic: Works on any device with a C99 compiler, including Arduino and Zephyr.
- Zero dynamic allocation: The generated C code avoids dynamic memory allocation to ensure stability on embedded devices.
- Integrated utilities: Includes built-in tools for FFT, IIR filters, and model size estimation.