cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to start the generated application.

VDyac.1014
Associate

Hello,

I have some questions about using the code generator

I am currently using an NUCLEO-L476RG with X-NUCLEO-CCA02M1 and I want to use a tflite model for speech commands recognition.

I use X-CUBE-AI version 4.1.0 with ApplicationTemplate.

My AI initialization function generated by CubeMX:

void MX_X_CUBE_AI_Init(void)
{
    /* USER CODE BEGIN 0 */
    /* Activation/working buffer is allocated as a static memory chunk
     * (bss section) */
    AI_ALIGNED(4)
    static ai_u8 activations[AI_SPEECH_CMD_DATA_ACTIVATIONS_SIZE];
 
    aiInit(activations);
    /* USER CODE END 0 */
}

My function to retrieve the result of my prediction:

int aiRun(const void *in_data, void *out_data)
{
    ai_i32 nbatch;
    ai_error err;
 
    /* Parameters checking */
    if (!in_data || !out_data || !speech_cmd)
        return -1;
 
    /* Initialize input/output buffer handlers */
    ai_input[0].n_batches = 1;
    ai_input[0].data = AI_HANDLE_PTR(in_data);
    ai_output[0].n_batches = 1;
    ai_output[0].data = AI_HANDLE_PTR(out_data);
 
    /* 2 - Perform the inference */
    nbatch = ai_speech_cmd_run(speech_cmd, &ai_input[0], &ai_output[0]);
    nbatch = ai_speech_cmd_run(speech_cmd, &ai_input[1], &ai_output[1]);
    nbatch = ai_speech_cmd_run(speech_cmd, &ai_input[2], &ai_output[2]);
    if (nbatch != 1) {
        err = ai_speech_cmd_get_error(speech_cmd);
        // ...
        return err.code;
    }
 
    return 0;
}

As <in_data> I feed the microphone data that contains the speech command. After executing the function, <out_data> contains incomprehensible information.

What format should the results be in?

Who knows what I'm doing wrong please show me the right way.

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

thanks

1 REPLY 1
Romain LE DONGE
Associate III

Hello,

You can check the FunctionPack FP-AI-SENSING-1 : https://www.st.com/en/embedded-software/fp-ai-sensing1.html

There is examples with Audio Scene Classification, that you can use to get inspired

Romain