STMicroelectronics / stm32ai-modelzoo

AI Model Zoo for STM32 devices
Other
236 stars 64 forks source link

error: invalid initializer ai_sine_model_inputs_get(network, NULL); #9

Closed tempdeltavalue closed 11 months ago

tempdeltavalue commented 1 year ago

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

GRATTINSTM commented 1 year ago

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

tempdeltavalue commented 1 year ago

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

tempdeltavalue commented 1 year ago

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

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

tempdeltavalue commented 1 year ago

and here's the project

https://github.com/tempdeltavalue/temp_STM32

LFOSTM commented 11 months ago

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