Skip to main content
CSerg
Associate
March 18, 2019
Question

How to use the generate code with the IA resources ApplicationTemplate

  • March 18, 2019
  • 5 replies
  • 2321 views

Hello,

I have some questions about using the code generator

I am currently using an STM32F446 and I want to use a Keras model driven by python to make a prediction on the data retrieved by the micro-controller in order to get better results.

  • I found on internet that I should use X-CUBE-AI version 3.4 with ApplicationTemplate as a resource. Is it really the right resource, if I want to do only the prediction on the micro-controller ?
  • If yes, I have, once the code is generated, an MX_X_X_CUBE_AI_Process function that seems empty, do I have to complete it or does it work as it ? If I have to complete it, is it possible to indicate me how to complete it and especially with what.
void MX_X_CUBE_AI_Init(void)
{
 MX_UARTx_Init();
 /* USER CODE BEGIN 0 */
 /* USER CODE END 0 */
}
 
void MX_X_CUBE_AI_Process(void)
{
 /* USER CODE BEGIN 1 */
 /* USER CODE END 1 */
}
  • Where is called the function to retrieve the data from the micro-controller and transform it ? With this, the data can be used by the program to make the prediction from the Keras model?
  • Last question, Where is the function to retrieve the result of my prediction. In which form is the results ?

If someone have more information about how to use the generator code it could be really helpful for me.

thanks

This topic has been closed for replies.

5 replies

ST Employee
March 18, 2019
Error while parsing Rich Text Content
ST Employee
March 18, 2019
Error while parsing Rich Text Content
ST Employee
March 18, 2019

Hello,

The current version of the AI application template which is provided in the pack 3.4.0 should be improved to export a real complete AI application template. Now to understand how to use the generated NN API, you can look the section 7 and 8 of the UM2526 (https://www.st.com/en/embedded-software/x-cube-ai.html) or/and the provided C-code for the generated AI system performance or AI validation projects.

In Middlewares\ST\Application\SystemPerformance\aiSystemPerformance.c, the functions aiInit() and aiTestPerformance() can be a good starting point. 

In the attached file, a code snippet to use the generated API.

Best Regards,

Jean-Michel

CSerg
CSergAuthor
Associate
March 19, 2019

thanks for your answer,

So if I understand perfectly, I need to use the file aiTemplate_340.c as the file aiSystemPerformance.c

thanks for your quick answer

Clara

OGaie
Associate II
July 22, 2019

how can you use the aiTemplate_340 and include it in main if you dont have a header to the "aiTemplate_340.c" file ?