cancel
Showing results for 
Search instead for 
Did you mean: 

how to use public API of cubeMX AI API

Sbv
Associate II

We have a trained keras model, and we we are trying to deploy it on the stm32. We successfully loaded the model on cubeMX and can see the generated code in Keil.(attached .h and .c files).

WE are having difficulty understanding what to pass as arguments to the create function below - Any suggestions would be of great help.

ai_error ai_rnn2_create(

 ai_handle* network, const ai_buffer* network_config);

thank you

siva

3 REPLIES 3
Romain LE DONGE
Associate III

Hello,

If you looking for an example of code you can:

  • Generate a validation application by selecting Validation in the additional software window of CubeMX, you will then have the code used to for validation (which includes all the pipeline to initialize,set inputs, run, get outputs of the NN)
  • You can check this application: https://github.com/ROC5COR/HousePricePredictionOnSTM32 which is just a very simple project that uses STM32 AI API to predict prices of houses. You can then see how data are loaded, how NN is initialized, how the prediction is done and how output is fetched :smiling_face_with_smiling_eyes: (the project uses an old version of X-Cube-AI v3.3.0 but you can always use the sources to get inspired and see how the functions are called)

Hope this can help you!

Romain

Hi,

Thank you for the reply.

For learning purpose I tried to work on your model(keras house prediction), and converted the same with "cube-ai", when tried to build the project I am getting this error, error: #3626: a designator cannot be used with a non-aggregate type "ai_buffer_format"

Attached an image of the same, please have a look.I couldn't clearly understand the problem, can you let me know what is the problem?

Romain LE DONGE
Associate III

Hello,

I tried with the new version X-Cube-AI 4.0.0

The problem is caused by the '{...}' around AI_NETWORK_IN

You have to remove the '{}' around AI_NETWORK_IN => ai_buffer input_data[AI_NETWORK_IN_NUM] = AI_NETWORK_IN;

Romain