Five Key Steps to Get Started with Embedded AI

     In this article, we discussed the essential steps which are necessary to realise 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.

These are

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

Let’s discuss them one by one.

    1. Data Capturing – In data capturing step, we capture the environmental data via sensors. It is used to train the neural network. It can be the data obtained from the sensors 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 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

    2. Data Cleaning and Labeling – The next step is Data Cleaning and Data labelling. 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

    3. Training 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.

    4. Convert the model to C code – 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 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.

    5. Infer the Result – In the last 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 *

© 2019 EMBEDDED INSIDER |