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 など)へ ML モデルをデプロイしたい組み込みシステムエンジニアや開発者向けで、フル OS や大量の 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.