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.