0
$\begingroup$

I am working on a project that requires training a neural network with humidity and temperature values. After spending a while googling on how to run a neural network on ESP32 (Wemos LOLIN D32 Pro), I came to the conclusion that off-board training and then uploading would be the best option. But I didn't get any resource on doing that.

How can I upload a trained neural network model(TensorFlow, scikit-learn ...) to an ESP32 board?

$\endgroup$
0
$\begingroup$

If you develop and train you model with tensorflow you can probably (only experimental releases, no guarantees) use Tensorflow lite to deploy your neural network models. The idea is to train usig Tensorflow, export the serialized model and import that in TF Lite. You can see the intended workflow for deployin models here.

TF Lite is meant for Android and iOS devices, but it has experimental support for other devices (incl. running bare metal on microcontroller). There is also a tutorial for Raspberry Pis.

An alternative route would be to use Matlab. It has a Statistics and Machine Learning toolbox and a seperate Deep Learning Toolbox. However, this it not enough, you will also need the Matlab Coder toolbox. The Matlab Coder toolbox can generate c/c++ source code for (trained) neural network models that can run without external library dependencies and therefore can be easily ported to any platform. Costs invoving the needed Matlab toolboxes are signifcant comparted to the free open source solutions.

$\endgroup$
  • $\begingroup$ Can I do it in SciLab or GNU Octave, as an alternative to MatLab? $\endgroup$ – subha26 Mar 12 at 8:58
  • $\begingroup$ I have only heard of SciLab / Octave, but I would say that it is unlikely that they have both NN and code generation $\endgroup$ – 50k4 Mar 12 at 11:13
  • $\begingroup$ You could try opennn.net but the options (e.g available training algorithms) are limited $\endgroup$ – 50k4 Mar 12 at 11:13
0
$\begingroup$

You can printout your weights and bias value from your model in TensorFlow, PyTorch or other deep learning library. If you want to convert your model to ESP32, you must create your own code to define your feed forward network. It's very simple, like create a matrix multiplication program and also create your own activation function. Then, you take weights and bias value from your trained model and define manually in your code as variable or constant. It is should works.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.