Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting scikit-learn ML Models into C language for Microcontrollers [closed]

I am evaluating various ML models using scikit-learn package. I am validating Logistic Regression, SVM and Random Forest Classifier which is avaialble on sci-kit learn. In the first step, I am working on these using Python.

I would like to deploy these classifier algorithms and the trained ML model into a microcontroller. I would need to convert my ML algorithm in scikit-learn from Python to C or C++ and then flash the code into my MCU.

I looked over the internet and I could not find any librabries of scikit-learn packages written in C/C++ language.

If it is not directly possible to migrate with scikit-learn, are there any ML Classifier libraries (Logistic Regression, SVM, Random Forest Classifier) written in C language?

like image 625
TECHKEY Avatar asked Sep 03 '25 17:09

TECHKEY


1 Answers

What you're looking for is an edge ML solution. I'm not aware of any way to directly on indirectly deploy a scikit-learn model on a microcontroller, but The sklearn-porter project, micromlgen or emlearn might be just what you're looking for. There's also plenty of other interesting work going on. One thing you definitely should have a look at is Tensorflow Lite for Microcontrollers. Other options include Microsoft's Embedded Learning Library or Edge ML Library.

For ARM devices you should also look into CMSIS-NN library and even more specifically into X-CUBE-AI extension pack if you're using an stm32 device.

like image 59
gstukelj Avatar answered Sep 05 '25 06:09

gstukelj