emlearn/emlearn
Machine Learning inference engine for Microcontrollers and Embedded devices
What it solves
emlearn 让开发者能够在微控制器和嵌入式系统上运行机器学习模型。它弥合了高级 Python 训练环境(如 scikit-learn 和 Keras)与裸金属硬件极端资源受限之间的鸿沟,这些硬件的内存和处理能力都非常有限。
How it works
该工具将已训练的 Python 模型转换为可移植、优化的 C99 代码。模型不再需要运行庞大的运行时环境,而是直接把模型的逻辑和参数翻译成 C 函数和数据结构。生成的代码随后编译进嵌入式设备的最终固件中。
Who it’s for
需要将机器学习模型部署到低功耗设备(如 ESP32、ARM Cortex M 或 AVR Atmega)的嵌入式系统工程师和开发者,且不想依赖完整操作系统或大量 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.