cancel
Showing results for 
Search instead for 
Did you mean: 

Machine learning using stm32h755 chip

slodh
Associate II

I am trying to integrate the a neural network machine learning model into the stm32h755 chip. I downloaded the stmCubeMx, installed X-Cube-Ai, selected the core, added the network using tflite file and then generated the code. I can't find the ai_model_data.c, ai_model_data.h, ai_model.h and some other important files. Could you please provide a detailed steps by step process to integrate the Neural Network in an ALREADY created/ EXISTING project?

1 ACCEPTED SOLUTION

Accepted Solutions
Julian E.
ST Employee

Hello @slodh ,

If you have an already existing CubeMX project. Open your .ioc file with cubeMX and add X-Cube-AI as you would for a new project:

JulianE_3-1727776357772.png

Then:

JulianE_1-1727774410207.png

  1. Click cubeAI in the middleware and software packs
  2. Click add network
  3. Select as tflite
  4. Look for your model
  5. Analyse the model

Then you generate the Code.

Because you activated X-Cube-AI, you can access the documentation by clicking help>X-Cube-AI Documentation:

JulianE_2-1727774602022.png

In there, in the Embedded Inference Client API, you will find a getting started - Minimal application code.

I think that you can start by adding that to your main.c and see how it goes first.

 

Another thing you can do is use ST Edge AI Developer Cloud to generate a working application in a few click and look at it to see how it is made. To do so:

  1. Go to ST Edge AI Developer Cloud
  2. Import your tflite model
  3. Pass/skip everystep until the last one
  4. Select the NUCLEO-H755ZI-Q as it also has a STM32H755
  5. Click to generate the STM32CubeIDE project

The code generate simply integrate the model given and do an inference with a random input (of the size of the input in the model) and output through serial, some information like the inference time.

 

I hope it helps.

Julian

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

9 REPLIES 9
Julian E.
ST Employee

Hello @slodh ,

If you have an already existing CubeMX project. Open your .ioc file with cubeMX and add X-Cube-AI as you would for a new project:

JulianE_3-1727776357772.png

Then:

JulianE_1-1727774410207.png

  1. Click cubeAI in the middleware and software packs
  2. Click add network
  3. Select as tflite
  4. Look for your model
  5. Analyse the model

Then you generate the Code.

Because you activated X-Cube-AI, you can access the documentation by clicking help>X-Cube-AI Documentation:

JulianE_2-1727774602022.png

In there, in the Embedded Inference Client API, you will find a getting started - Minimal application code.

I think that you can start by adding that to your main.c and see how it goes first.

 

Another thing you can do is use ST Edge AI Developer Cloud to generate a working application in a few click and look at it to see how it is made. To do so:

  1. Go to ST Edge AI Developer Cloud
  2. Import your tflite model
  3. Pass/skip everystep until the last one
  4. Select the NUCLEO-H755ZI-Q as it also has a STM32H755
  5. Click to generate the STM32CubeIDE project

The code generate simply integrate the model given and do an inference with a random input (of the size of the input in the model) and output through serial, some information like the inference time.

 

I hope it helps.

Julian

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Screenshot 2024-10-03 at 15.23.21.pngScreenshot 2024-10-03 at 15.23.03.pngScreenshot 2024-10-03 at 12.17.47.png

 

 

 

 

 

 

Thanks a lot Julian, I followed the steps and generated the C++ code from the developer cloud. But I am not able to integrate (#include ) it. I have attached the photos for reference. Could you please help me fix this?

Screenshot 2024-10-03 at 15.24.02.png



Consider this  photo too

Julian E.
ST Employee

Hello @slodh ,

As you think, it seems to be an error in the paths.

You other paths start with "../..", maybe try to put something like "../../sensor_model/"

 

Have a good day,

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
slodh
Associate II

Hey Julian, 

Thank you for your support. I am having a lot of issues. Could you please get on a zoom call to resolve it ?

I am situated in Brisbane, Australia (AEST). Please let me know a suitable time according to your convenience at the earliest. Anytime tomorrow on Monday 7th October would do. 

Cheers

Hello,

It would be easier for me to do it through ST Community to keep a trace for other that may have the same issues that you have. Also, I am based in Europe, so finding a time slot is not easy and I will probably need to contact experts depending on your questions to have the answers.

If you could describe where you are at, it would be great.

 

In the meantime, you can check this resource. The use case is different, but the CubeAI integration part may help you:

AI:How to perform motion sensing on STM32L4 IoTnode - stm32mcu

 

Julian.


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
slodh
Associate II

I tried integrating it with my the current code that I have. I am getting this errorerror.jpg

Hello @slodh ,

 

These kinds of errors are outside of my knowledge and scope of the EdgeAI threads. Please open a new thread in the ST Community in the right section like here for example: STM32CubeIDE (MCUs) - STMicroelectronics Community

 

Have a good day.

Julian

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
nehakakar
Associate

I appreciate the resources you've shared. I'll check the paths again and see if that resolves the integration issues. If I still have problems, I might start a new thread as you suggested.