cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any example of a CNN used in CubeIDE?

SSeas
Associate II

Is there any example of a CNN used in CubeIDE? Let me explain better, among the various video tutorials on the ST website and on youtube the demonstrations end with the loading of the neural network and their validation through the functions made available by the IDE.

I need to understand how to manage the network call then inside main.c. On the web I found only one example of how a mono-input and mono-output neural network can be applied, but everything becomes more complicated now that I have to implement a CNN that has a two-dimensional array (spectrogram) at the input.

Can anyone point me to an example or tutorial to follow?

3 REPLIES 3
fauvarque.daniel
ST Employee

To help you develop your own AI solution we provide a set of function packs that are full example applications with source code.

You can look in the Embedded Software list of this page https://www.st.com/content/st_com/en/stm32-ann.html for the function pack that best match your needs (FP-AI-VISION1 or FP-AI-SENSING1)

Regards

Daniel


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.
SSeas
Associate II

Thank you, I had already started to see FP-AI-SENSING1, in particular the Acoustic Scene Classification example being similar to my implementation.

I am quite inexperienced in this field (I get along much more with Python than with C), but there are some inconsistencies that I don't understand in this example.

the main.c file, in the part relating to the ASC, uses this function for classification:

/ * ASC_Run needs to be called 32 times before it can run the NN and return a classification * /

classification_result = ASC_Run (Proc_Buffer_f);

while in the asc.h file, as I already knew it happened in these cases, a different function is defined:

ai_i32 ai_asc_run (

ai_handle network, const ai_buffer * input, ai_buffer * output);

Can you kindly explain to me why this happens?

Gln
ST Employee

Hello @SSeas​ ,

I agree, the FP-AI-SENSING1 example is a bit confusing and not very clear, but here is how it works:

ASC_Run() is called each time a 32 ms audio buffer is received (64 ms buffer with 50% overlap). ASC_Run() performs two things:

  1. input feature creation (audio preprocessing) - 32 of the 64 ms buffers are required to create the Mel spectrogram.
  2. NN inferencee - when the Mel spectrogram is created, only then we can make a call to ai_asc_run() and actually run the neural network inference.

For a more basic example (based on CubeIDE), I wrote a tutorial on our wiki, hopefully this will help:

https://wiki.st.com/stm32mcu/index.php?title=Getting_started_with_STM32Cube.AI_and_motion_sensing_on_the_STM32L4_IoT_node

Regards,

Guillaume