TinyML: Getting Started with STM32 X-CUBE-AI | Digi-Key Electronics

preview_player
Показать описание
In this tutorial, Shawn shows you how to use the STMicroelectronics X-CUBE-AI add-on package to perform machine learning tasks in an STM32 microcontroller. Specifically, he shows you how to install and use the add-on in STM32CubeIDE.

First, we show you how to download and enable the X-CUBE-AI add-on package from within STM32CubeIDE. Note that this package is part of the STM32Cube.AI suite. From there, you can load your trained neural network (we will use the TensorFlow Lite, .tflite, file).

X-CUBE-AI offers a number of tools to help you evaluate and test your model. Some of these can be run on your desktop, but others require a special program to be uploaded to your microcontroller first.

The CubeMX software can then be used to auto-generate a number of source code files used to initialize your peripherals and inference engine. We then demonstrate how to interact with the X-CUBE-AI library to perform inference with a simple neural network. All of which is done in C.

Finally, we measure the required flash and RAM used to run our basic neural network as well as the time it takes to run inference. These numbers can be used to compare against other machine learning frameworks, such as TensorFlow Lite for Microcontrollers.

Before starting, we recommend you watch the following videos:

Product Links:

Related Videos:
Intro to Edge AI

Getting Started with Machine Learning Using TensorFlow and Keras

Intro to TensorFlow Lite Part 1: Wake Word Feature Extraction

Intro to TensorFlow Lite Part 2: Speech Recognition Model Training

Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi

Low-Cost Data Acquisition (DAQ) with Arduino and Binho for Machine Learning

Intro to TinyML Part 1: Training a Neural Network for Arduino in TensorFlow

Intro to TinyML Part 2: Deploying a TensorFlow Lite Model to Arduino

Edge AI Anomaly Detection Part 1: Data Collection

Edge AI Anomaly Detection Part 2: Feature Extraction and Model Training

Edge AI Anomaly Detection Part 3: Deploy Machine Learning Models to Raspberry Pi

Edge AI Anomaly Detection Part 4: Deploy TinyML Model in Arduino to ESP32

Related Project Links:

Related Articles:
What is Edge AI?

Getting Started with Machine Learning Using TensorFlow and Keras

Low-Cost Data Acquisition (DAQ) with Arduino and Binho for ML

Рекомендации по теме
Комментарии
Автор

Thank you so much!!! I am trying to use CubeAI for my Graduation Project, and your amazing video help me a lot !!! Thanks again!!!

TurtleCarriesBarbershop
Автор

That's a really cool microcontroller. It's a great time to be learning electronics :D

Electronzap
Автор

I can't find the code that you mentioned you provided in the description? Can I ask for it?

sailfromsurigao
Автор

6:58 - What is this pre-made validation program showed earlier? I got a bit lost.
8:23 - Coding with the model in `main.c`

eduardojreis
Автор

did anyone faded issue of "TOOL ERROR Didn't find op for built-in opcode "FULLY_CONNECTED" for version '9' Registration failed" while validating the model

apoorvsinghnegi
Автор

I also got into an infinite loop while debugging. I checked whats going on. I found it is due to the for loop structure that causes problem. In the for loop condition you are writing "AI_SINE_MODEL_1_SIZE" and its value is a positive integer. For loop will go into an infinite loop if the condition is just an integer. I just replaced it by a condition lets say "i<2" and it runs fine. Later on we can generate a random number with every iteration of while loop and let it calculate the sine of it. Please correct me if I am wrong. I am quite a newbie.

rickpandey
Автор

Thank you, it's a great video. Is there a tutorial for systematically learning X-CUBE-AI?

苏峰雷-td
Автор

Hey there!

I'm having an "invalid initializer error" on my sine_model.h code. It says the error is here, but I don't understand what's wrong.
The error is both here:

AI_DEPRECATED
#define AI_SINE_MODEL_IN \
ai_sine_model_inputs_get(AI_HANDLE_NULL, NULL)

And here:

AI_DEPRECATED
#define AI_SINE_MODEL_OUT \
ai_sine_model_outputs_get(AI_HANDLE_NULL, NULL)

It was a code generated by the X-Cube-AI so I don't understand what's happening.

tomatosmusic
Автор

Thank you so much. I am trying to use Cube AI, and your amazing video help me a lot.

Emailing
Автор

Is there a video explaining how to set up the serial debugger?

ZebroLebro
Автор

can you make a video about face recognition

farouktilaoui
Автор

I think XCube ai tool is no longer proprietary. 1:16
great explanation btw. Thanks

unhandledexception
Автор

Hi, I'm having the same issue reported before by another viewer (nbatch = 0).
I noticed that in the video there is this step:
```
// Pointer to our model
ai_handle sine_model = AI_HANDLE_NULL;
```
Is this correct? Also, there is another issue. In version 9.1 there is no "ai_input[0].n_batches" or "ai_output[0].n_batches". Has anyone else faced these issues?

augustoinafuco
Автор

This video looks like it took a lot of work to put together. I have a question about MVC: main.c looked to be written as a controller (interface between a model and the hardware), but I believe you referred to it as a model. Can you explain this to someone who would have taken some computer science courses at the college/university level?

poneetrahul
Автор

what do you mean ' pre-made validation program' ?

baichuan
Автор

I got too many errors. Can I get a download link for the stm32 cube ide project?

blahman
Автор

Very I'm changing this code for STM32F4Discovery, but I have doubt, How to adapt this code for 3 inputs and 1 output? Thank you?

carlosfreitas
Автор

I am always imperssed with how much things are packed in 15 minutes.

ButilkaRomm
Автор

Hi! Could I apply your awesome video using a STM32F103C8T6 board? (Help please)

POLIVERITO
Автор

It’s not IF they will drop support in the future for ASTM32, but WHEN they will? Right after the money runs out! Happy Hacking!

MrWATCHthisWAY