Convert neural networks into optimized Code for STM32

Tuesday, January 29, 2019

 

Thanks to a new set of Artificial Intelligence (AI) solutions from ST you now have the possibility to map and run pre-trained Artificial Neural Networks (ANN) on the broad STM32 microcontroller portfolio. The STM32Cube.AI is an extension pack of the widely used STM32CubeMX configuration and code generation tool enabling AI on STM32 Arm® Cortex®-M-based microcontrollers. To access it, download and install the STM32CubeMX (version 5.0.1 onwards)

 

Artificial Neural Network mapping made simple with the STM32Cube.AI

  • Interoperable with popular deep learning training tools
  • Compatible with many IDEs and compilers
  • Sensor and RTOS agnostic
  • Allows multiple Artificial Neural Networks to be run on a single STM32 MCU
  • Full support for ultra-low-power STM32 MCUs

 

Boost your productivity

Use the power of Deep Learning to enhance signal processing performance and increase productivity in your STM32 application. Create and map Artificial Neural Networks onto your STM32 (optimised code automatically generated) instead of building hand-crafted code.

 

Here are 5 steps to deploy a Neural Network using STM32Cube.AI:

1. Capture Data

Capture a sufficient amount of representative data about the phenomenon that is being modelled.

This usually involves placing sensors on or near the object being monitored in order to record its state and changes over the time. Examples of physical parameters include acceleration, temperature, sound, and visual depending on your application.

ST provides tools that help in data capture and labelling such as our ST BLE Sensor smartphone application which acts as a remote control for the SensorTile form-factor, battery powered platform. The SensorTile is equipped with motion and environmental sensors, a microcontroller, SD Card connector and Bluetooth connectivity

 

2. Clean, label Data and Build ANN topology

Creating an Artificial Neural Network requires labelled data that has been acquired from sensors and pre-processing.

For so-called "supervised learning", the data sets must be characterized so that the different outputs can be classified correctly. This classified set is the "ground truth" that will be used to train the ANN and then validate it.

The developer must decide on the type of topology the ANN should have in order to best be able to learn from the data and provide useful output for the target application. Usually developers employ popular off-the-shelf deep learning frameworks to architect and train Artificial Neural Network topologies.

ST works with a number of Partners who provide Artificial Neural Network engineering services and support with dedicated data scientists and Artificial Neural Network architects.

 

3. Train the ANN model

Training the ANN involves passing the data sets through the Neural Network in an iterative manner so that the Network's outputs can minimize desirable error criteria. ANN definition, training, and testing is typically performed using off-the-shelf Deep Learning frameworks. This is usually done on a powerful computing platform, with virtually unlimited memory and computational power, to allow many iterations in a short period of time. The result of this training is the pre-trained Artificial Neural Network.

The STM32Cube.AI tool offers simple and efficient interoperability with popular Deep Learning training tools widely used by the Artificial Intelligence developer community. The output of these tools can be directly imported into the STM32Cube.AI.

 

4. Convert ANN into optimized code for the STM32 MCU

The next step is to embed the pre-trained ANN into an MCU (optimised code minimizing complexity and memory requirements).

This part is very easy and intuitive thanks to the STM32Cube.AI software tool. The STM32Cube.AI is fully integrated into STM32 software development ecosystem as an extension of the widely used STM32CubeMX tool.

It allows fast, automatic conversion of pre-trained ANNs into optimised code that can run on an MCU. The tool guides users through the selection of the right MCU and provides rapid feedback on the performance of the Neural Network in the chosen MCU, with validation running both on your PC and the target STM32 MCU.

 

5. Process & analyse new data using trained ANN

Finally, deploy the ANN embedded in an MCU in your application.

 

Here ST also makes it easier for designers to quickly prototype their innovative application thanks to integrated software packages - Function Packs. These packs are end-to-end examples embedding a combination of low-level drivers, middleware libraries and sample applications assembled into a single software package. Developers can easily start from these examples and make modifications to fit their specific application. Two examples enabled for AI are the Audio and Motion capture & processing Function Packs.

 

Developers can also get support and exchange ideas in the AI forum of STM32 Community.

 

For more information please contact:

Robin Scholes
Field Application Engineer
Altron Arrow
0119239668
+27 (0) 83 226 6019

rscholes@arrow.altech.co.za

011 923 9600/ 011 923 9668

 

 

 

Contact Us

Units J16 Centurion Business Park

Bosmansdam Road

Milnerton, 7441

 

Email Address:

Tel: (021) 555-1884 | Fax: (021) 555-1763

Suite AF. 2/3 Ensign Square 4 Sookhai Place Derby Downs Office Park

University Road

Westville

Durban, 3630

 

Email Adress:

Tel: (031) 279-1660 | Fax: (031) 267-3798

53-57 Yaldwyn Road

Hughes Extension

Jet Park 1459

 

Email Address:

Tel: (011) 923-9600 | Fax: (011) 923-9884

Quality Management

Arrow Electronics