How can I use the machine learning library MicroML to perform simple inference on an ESP32?

Hello guys, how can I use the machine learning library MicroML to perform simple inference on an ESP32? My goal is to predict a simple numerical outcome based on a set of sensor readings, I was able to generate the c code prediction but unsure on what step to take next can anyone help me
from sklearn.linear_model import LinearRegression
import numpy as np
from micromlgen import port

# Example data
X = np.array([[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]])
y = np.array([10, 20, 30, 40])

# Train the model
model = LinearRegression().fit(X, y)

# Generate C code for the model
c_code = port(model)
print(c_code)
from sklearn.linear_model import LinearRegression
import numpy as np
from micromlgen import port

# Example data
X = np.array([[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6], [4, 5, 6, 7]])
y = np.array([10, 20, 30, 40])

# Train the model
model = LinearRegression().fit(X, y)

# Generate C code for the model
c_code = port(model)
print(c_code)
@Middleware & OS @Helper
Solution:
Hello @Enthernet Code , after Creating a c code of the model and include it into your ESP32 project as model.h. In your Arduino sketch, read from sensors, then call the function for prediction from the generated code, This project tutorial will guide you https://dev.to/tkeyo/tinyml-machine-learning-on-esp32-with-micropython-38a6...
DEV Community
TinyML: Machine Learning on ESP32 with MicroPython
Detecting gestures from time-series data with ESP32, accelerometer, and MicroPython in near...
Jump to solution
3 Replies
Enthernet Code
Enthernet Code6mo ago
attachment 0
Solution
wafa_ath
wafa_ath6mo ago
Hello @Enthernet Code , after Creating a c code of the model and include it into your ESP32 project as model.h. In your Arduino sketch, read from sensors, then call the function for prediction from the generated code, This project tutorial will guide you https://dev.to/tkeyo/tinyml-machine-learning-on-esp32-with-micropython-38a6
DEV Community
TinyML: Machine Learning on ESP32 with MicroPython
Detecting gestures from time-series data with ESP32, accelerometer, and MicroPython in near...
Enthernet Code
Enthernet Code6mo ago
Thanks @wafa_ath would apply this report my progress back
Want results from more Discord servers?
Add your server