Embedded Machine Learning Core Decision Tree Classifier

Click on the top “STMicroelectronics China” to follow us

Embedded Machine Learning Core Decision Tree Classifier

Embedded Machine Learning Core Decision Tree Classifier

The market share of artificial intelligence applications is steadily growing. To this end, STMicroelectronics offers a wide range of product portfolios to easily implement multi-level artificial intelligence applications.In this article, we mainly focus on the embedded artificial intelligence (also known as MLC) in new sensors and clarify how users can utilize this AI core to develop ultra-low power “edge-to-edge” AI applications.

Let’s start with the following question: What is edge artificial intelligence?

In the past, artificial intelligence applications required many computational resources, so data from sensors had to be transmitted to the cloud for processing, and then the results were sent back locally. The whole process was both time-consuming and power-consuming, and it was not suitable for situations lacking internet connectivity. Thus, edge artificial intelligence was born. With dedicated hardware on the MCU, AI processing capabilities are becoming stronger, moving the “artificial intelligence” core from the cloud to the local MCU, resulting in better performance in terms of latency and power consumption.

Embedded Machine Learning Core Decision Tree Classifier

A brand new series of sensors recently launched by STMicroelectronics (identified by the letter X at the end of the name) allows the sensors to run artificial intelligence algorithms (based on decision tree classifiers) entirely within the sensor core, without any computational load on the local MCU. This further promotes the development of “edge artificial intelligence” technology. Therefore, we refer to it as “edge-to-edge” artificial intelligence.

Assuming you are interested in developing an application that uses sensor data (from accelerometers, gyroscopes, etc.) and employs artificial intelligence technology to detect human activities (such as walking, running, standing still, etc.) or perform gesture recognition. In a cloud-based AI solution, data must be sent to the cloud for inference, waiting for a response after a period of time. This means a significant amount of energy has to be spent on data transmission (up to 50mA if internet connectivity is available), and there will be a considerable delay when receiving output results. An innovative solution can utilize the MCU’s capabilities to process data (“edge artificial intelligence”), but sensor data transmission is necessary. If your goal is a low-power solution, embedding MLC within the sensor is the best choice. Data transmission from the sensor to the MCU incurs no power consumption, and the optimized ASIC limits the current consumption of the MLC core to around ~10uA, while the latency can be ignored.

Returning to the application itself, this means that the sensor can run human activity or gesture recognition applications by itself: you only need to program the MLC sensor, turn on the sensing element, and output the AI-based scene classification results as simple register values for the application MCU to make decisions (for example, changing the behavior of the application, enabling or disabling low-power mode, etc.).

Embedded Machine Learning Core Decision Tree Classifier

As mentioned earlier, the artificial intelligence of the sensor is based on the “decision tree” classifier, which has been introduced in previous articles. Different devices have similar machine learning core resources available, and each sensor can run up to 8 different decision trees in parallel (a total of 256 or 512 nodes).

Embedded Machine Learning Core Decision Tree Classifier

The decision trees are based on trained artificial intelligence models (supervised learning) and require a dataset to train the model. Once the data is available, decision trees can be built, and finally, the decision trees can be programmed into the sensor’s MLC. For these 5 key steps, STMicroelectronics provides the UNICO-GUI tool to assist developers in data collection and code generation, and to upload the code into the sensor, thus achieving the desired MLC.

Step 1: Capture Data

You can choose STMicroelectronics’ boards for data collection activities (there are many boards available from STMicroelectronics on the market), and STMicroelectronics recommends using the FP-SNS-DATALOG1 firmware to collect data, ensuring the consistency and formatting of the collected data. Once the data is ready for processing, you can start the UNICO-GUI.

Embedded Machine Learning Core Decision Tree Classifier

Data Annotation

Step 2: Data Labeling and Feature Configuration

This means assigning a name/label to each dataset obtained during the data collection activity. Based on your dataset and choices, decision tree model training can be performed to distinguish the selected classes. The UNICO-GUI tool can import many types of datasets.

Additionally, users define the working mode of the sensor during the collection phase, and most importantly, select the features that will be used by the decision trees to classify the classes. Features are essentially an “analysis” of the sensor data; the decision tree will use the features to choose one class or another. An example in this regard is using the “standard deviation” or “peak-to-peak” features of the XL signal to understand whether the user is stationary or in motion. Clearly, there are many selectable features that can be combined to achieve the optimal decision tree for the application. For more detailed information on feature selection and understanding the decision tree creation process, please refer to STMicroelectronics Design Tip 0139.

Embedded Machine Learning Core Decision Tree Classifier

Build Decision Tree

Step 3: Build Decision Tree

This step generates settings and identifies constraints during the dataset training process to build a decision tree capable of recognizing the types of motion data to be detected.

Embedded Machine Learning Core Decision Tree Classifier

Model Deployment

Step 4: Sensor Code Generation

Once the decision tree is created, it needs to be “translated” into the sensor MLC language. The user will receive a file that contains everything necessary for their application to run on the ST MEMS sensor equipped with MLC!

Step 5

Once the device is programmed, the defined trained decision tree can be used to process the results from the machine learning core in the application.

If you are interested in learning more about the application of MLC in MEMS sensors, you can visit the ST MLC webpage or the ST MLC GitHub page, which provide a wealth of ready-to-use applications and configuration examples to guide you step by step through the entire process from data collection to real-time functionality checks of MLC.

Embedded Machine Learning Core Decision Tree Classifier We will curate a series of AI-themed articles detailing STMicroelectronics’ efforts in the Deep Edge AI field.
Embedded Machine Learning Core Decision Tree Classifier This article is the third in this series, and you can also follow the public account to view other two articles in the AI technology series.

Previous Readings

AI Technology Topic II | Machine Learning Model Design Process and MEMS MLC
AI Technology Topic | Overview of STMicroelectronics Artificial Intelligence Solutions
END
Embedded Machine Learning Core Decision Tree Classifier
Embedded Machine Learning Core Decision Tree Classifier
Click “Read the original text”, to see more STM32 AI related news

Leave a Comment