STMicroelectronics/stm32ai-modelzoo

error: invalid initializer ai_sine_model_inputs_get(network, NULL);

tempdeltavalue opened this issue · 5 comments

Hi, I'm a beginner in STM32 programming, and I've tried running a few examples of CUBE AI inference in versions 8.0.1 and 7.3.0. However, in both cases, I encountered an error. Can somebody advise me on what I should do?

code which I tried:
from here
https://github.com/STMicroelectronics/stm32ai-modelzoo/blob/main/hand_posture/getting_started/Application/NUCLEO-F401RE/Src/app_network.c#L183
and here
https://www.digikey.com/en/maker/projects/tinyml-getting-started-with-stm32-x-cube-ai/f94e1c8bfc1e4b6291d0f672d780d2c0

error: invalid initializer ai_sine_model_inputs_get(network, NULL);
(this function generated in code)
Screenshot 2023-06-18 184200

Also the same issue but in Polish, but it seems they haven't figured out how to fix it.
https://forbot.pl/forum/topic/21297-blad-kompilacji-invalid-initializer/

Thank you in advance

Hi @tempdeltavalue,

The projects in the links you posted target different MCUs. What is the MCU you want to flash? What is the use case you are interested in?
Did you follow the README instructions?
Did you tried the provided Python scripts in the use case you are interested in? (folder /scripts)

Guillaume

Hi @GRATTINSTM

I'm using STM32F7508-DK. My use case at this stage just to run any simple NN

Actually, no. I am using another model and converting it to an h5 format in Colab using TensorFlow version 2.12.0. Then, I put it into CubeIDE and click the 'Analyze' button. The process completes successfully, and I get model files which are generated by IDE.

here's the example of generated function
ai_buffer* ai_sine_model_inputs_get(ai_handle network, ai_u16 *n_buffer)
{
if (network == AI_HANDLE_NULL) {
network = (ai_handle)&AI_NET_OBJ_INSTANCE;
((ai_network *)network)->magic = AI_MAGIC_CONTEXT_TOKEN;
}
return ai_platform_inputs_get(network, n_buffer);
}

and call looks like this
ai_sine_model_inputs_get(network, NULL);

for training I'm using this code
https://gist.github.com/ShawnHymel/79237fe6aee5a3653c497d879f746c0c

@GRATTINSTM I changed tf version and tried tflite but still same error .. any ideas ?

https://colab.research.google.com/drive/1whQcSLityD_Kygbe6KZbAiJ6freb5Xn6?usp=sharing

LFOSTM commented

Hello,
Following readme instructions should solve your issue actually.
Regards