Tools – STM32Cube.AI

Machine Learning has the embedded systems industry buzzing as new tools and capabilities become available for us developers to implement in our systems. Machine Learning on Arm Cortex-M type microcontrollers is still relatively new, but there are some very interesting tools available that make it easier for developers to integrate a trained model into their products. One such tool is ST Microelectronics STM32Cube.AI.

STM32Cube.AI is an extension pack for STM32CubeMX that enables AI on STM32 Arm(r) Cortex(R)-M processors. STM32Cube.AI doesn’t perform the training for a developer, but allows them to import a trained model and integrate it into their runtime environment. You can think of STM32Cube.AI as conversion tool that takes a neural network model and generates optimized code that can then be ran on an STM32 microcontroller.

The latest STM32Cube.AI version, 6.0, allows developers to import machine learning models from popular tools such as:

  • Keras
  • TensorFlow Lite
  • ONNX

Developers even have the choice as to whether they will run the model using the STM32Cube.AI runtime environment or instead, use the TensorFlow Lite for Microcontrollers runtime.

Getting the model into an embedded environment is the easy part. The question that often nags at developers is whether their machine learning model will successfully run on the microcontroller. After all, questions such as:

  • How many execution cycles will be required to run the machine learning model?
  • How much flash space will this machine learning model take up?
  • How much RAM space will this machine learning model take up?
  • Will the model be as accurate on target as it was during training and validation?

STM32Cube.AI has a fantastic analysis tool that can be used to answer many of these questions. For example, I trained a super simple example model from the TensorFlow Lite for Microcontrollers website that given an x value will predict the y value for a sine wave. After importing the model to STM32Mx, I was able to analyze the model and generate a report that includes the following summary:

As you can see, the summary provides me with the memory sizes utilized for this model like the weights and activations along with the number of multiply and accumulate instructions need to execute the machine learning model. (This is a super simple model so the size is in bytes! Not very realistic for a real world example).

The report also provided a useful breakdown for the model where we can see each layer in the neural network:

These are just a few little examples of what STM32Cube.AI provides for embedded systems developers who are getting ready to embark into the world of machine learning on microcontrollers. Machine learning is certainly new and quickly evolving, but STM32Cube.AI is a free tool that can help developers easily convert their machine learning models to run on a microcontroller.

Share >

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.