Introduction
This user manual provides the guidelines to build step-by-step a complete Artificial Intelligence (AI) IDE-based project for
STM32 microcontrollers with automatic conversion of pre-trained Neural Networks (NN) and integration of the generated
optimized library. It describes the X-CUBE-AI Expansion Package that is fully integrated with the STM32CubeMX tool. This user
manual also describes optional add-on AI test applications or utilities for AI system performance and validation.
The main part of the document is a hands-on learning to generate quickly an STM32 AI-based project. A NUCLEO-F746ZG
development kit and several models for Deep Learning (DL) from the public domain are used as practical examples. Any STM32
development kits or customer boards based on a microcontroller in the STM32F3, STM32F4, STM32G4, STM32L4, STM32L4+,
STM32L5, STM32F7, STM32H7, STM32WB or STM32WL Series can also be used with minor adaptations.
The next part of the document details and describes the use of the X-CUBE-AI for AI performance and validation add-on
applications. It covers also internal aspects such as the generated NN library. Additionally, more information (command-line
support, supported toolboxes and layers, reported metrics) are available from the Documentation folder in the installed
package.
Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI)
UM2526
User manual
UM2526 - Rev 7 - March 2021
For further information contact your local STMicroelectronics sales office.
www.st.com
1 General information
The X-CUBE-AI Expansion Package is dedicated to AI projects running on STM32 Arm
®
Cortex
®
-M-based
MCUs.
The descriptions in the current revision of the user manual are based on:
X-CUBE-AI 6.0.0
Embedded inference client API 1.1.0
Command-line interface 1.4.1
The pre-trained Keras DL model used for the example in this document is:
https://github.com/Shahnawax/HAR-CNN-Keras: Human Activity Recognition using CNN in Keras
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
1.1 What is STM32Cube?
STM32Cube is an STMicroelectronics original initiative to significantly improve designer's productivity by reducing
development effort, time, and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube includes:
A set of user-friendly software development tools to cover project development from conception to
realization, among which are:
STM32CubeMX, a graphical software configuration tool that allows the automatic generation of C
initialization code using graphical wizards
STM32CubeIDE, an all-in-one development tool with peripheral configuration, code generation, code
compilation, and debug features
STM32CubeProgrammer (STM32CubeProg), a programming tool available in graphical and command-
line versions
STM32CubeMonitor (STM32CubeMonitor, STM32CubeMonPwr, STM32CubeMonRF,
STM32CubeMonUCPD) powerful monitoring tools to fine-tune the behavior and performance of STM32
applications in real-time
STM32Cube MCU and MPU Packages, comprehensive embedded-software platforms specific to each
microcontroller and microprocessor series (such as STM32CubeF7 for the STM32F7 Series), which include:
STM32Cube hardware abstraction layer (HAL), ensuring maximized portability across the STM32
portfolio
STM32Cube low-layer APIs, ensuring the best performance and footprints with a high degree of user
control over hardware
A consistent set of middleware components such as RTOS, USB, FAT file system, graphics and
TCP/IP
All embedded software utilities with full sets of peripheral and applicative examples
STM32Cube Expansion Packages, which contain embedded software components that complement the
functionalities of the STM32Cube MCU and MPU Packages with:
Middleware extensions and applicative layers
Examples running on some specific STMicroelectronics development boards
1.2
How does X-CUBE-AI complement STM32Cube?
X-CUBE-AI extends STM32CubeMX by providing an automatic NN library generator optimized in computation
and memory (RAM and Flash) that converts pre-trained Neural Networks from most used DL frameworks (such
as Keras, TensorFlow
Lite and ONNX) into a library that is automatically integrated in the final user project. The
project is automatically setup, ready for compilation and execution on the STM32 microcontroller.
X-CUBE-AI also extends STM32CubeMX by adding, for the project creation, specific MCU filtering to select the
right devices that fit specific criteria requirements (such as RAM or Flash memory size) for a user's NN.
UM2526
General information
UM2526 - Rev 7
page 2/67