5 Key Steps to Get Started with Embedded AI

In this article, we discussed the essential steps which are necessary to realize the concept of embedded AI or edge AI in stm32. There are necessarily five key steps behind the implementation of a neural network into a microcontroller. Let’s see the key steps to start embedded AI, I will discuss them one by one.

  1. Data Capturing.
  2. Data Cleaning and Labeling.
  3. Raining a Neural Network Model.
  4. Conversion of a NN Model into optimized C code for the microcontroller.
  5. Infer the new data using a trained Neural Network on MCU

 

Data Capturing

In the data capturing step, we capture the environmental data via sensors. It is used to train the neural network. The data obtained from the sensors were placed to monitor any physical parameter like acceleration, temperature, sound, and visual scene depending on the end application.

We can either directly capture the data by interfacing the sensor onto the microcontroller and can log data in the SD card connected to the microcontroller or we can send it by using Wi-Fi or BLE module to our Mobile phones or PC

Data Cleaning and Labeling

The next step is Data Cleaning and Data labeling. Usually, in the first step, we capture the raw data. It can be in hex or binary form and not arranged in such a way so that we can train the neural network directly on it. We need to re-arrange this data according to the expectation of our Neural Network model.

We may need to apply some filters on it to mitigate the noise from the data or may need to change from frequency to time or time to the frequency domain. With this, we also know that in supervised learning, we label the different data before feeding it to the Neural network.

So we need to assign various labels to the data we have captured so that the neural network can learn which information belongs to which scenario.

Raining a Neural Network Model

In the third step, we train the neural network on the data we have prepared in the previous actions. We also need to design a neural network using Keras, Tensorflow, or Caffe APIs in a python script. We separate the captured data into training, test, and validation data to train and evaluate the neural network. Then, we have to generate a confusion matrix to know about the performance of a model to predict the real scenarios.

If you want to start Embedded AI, you can check this course Getting Started with Embedded AI | Edge AI“. This course Explained a demo application to recognize fault of a small DC motor by analyzing vibrational pattern via Embedded/EdgeAI

Conversion of a NN Model into optimized C code for the microcontroller

Also, in the fourth step, we need to convert the trained NN model into the C code by using the STMicroelectronics stm32cubeMX tool which integrates the X-CUBE-AI package in it. This package generates the related network files containing the necessary APIs required to infer the scenario on live data captured by sensors connected to the microcontroller.

Infer the new data using a trained Neural Network on MCU

After this step, we can interface the sensors with the stm32 and can integrate the sensor code to the generated C code of the trained model. Then we can feed the live data from the sensors to the neural network inside the microcontroller by using generated APIs via STM32CubeMX. After following these five fundamental steps, we can infer the real-time data from any sensor and can perform any real-time action inside a microcontroller.

Leave a Reply

Your email address will not be published. Required fields are marked *