cancel
Showing results for 
Search instead for 
Did you mean: 

x-cube-ai : error while validating on desktop

minyar
Associate

Bonjour,

Je rencontre une erreur lors de la génération de la bibliothèque pour mon modèle de réseau de neurones dans X-CUBE-AI. L'erreur est la suivante :

E103(CliRuntimeError): Unable to generate the "libai_network_1" library

J'ai suivi les étapes suivantes :
1. Importé le modèle TFLite et puis l'analyse du modele est validé
le fichier network_data.c ne contient pas le reseau de neurone , voici son contenu : 

/**

******************************************************************************

* @file network_data.c

* @author AST Embedded Analytics Research Platform

* @date Mon Jun 24 23:40:55 2024

* @brief AI Tool Automatic Code Generator for Embedded NN computing

******************************************************************************

* @attention

*

* Copyright (c) 2024 STMicroelectronics.

* All rights reserved.

*

* This software is licensed under terms that can be found in the LICENSE file

* in the root directory of this software component.

* If no LICENSE file comes with this software, it is provided AS-IS.

******************************************************************************

*/

#include "network_data.h"

#include "ai_platform_interface.h"

 

AI_API_DECLARE_BEGIN

ai_buffer g_network_data_map_activations[AI_NETWORK_DATA_ACTIVATIONS_COUNT] = {

AI_BUFFER_INIT(AI_FLAG_NONE, AI_BUFFER_FORMAT_U8,

AI_BUFFER_SHAPE_INIT(AI_SHAPE_BCWH, 4, 1, 6144, 1, 1),

6144, NULL, NULL), /* heap_overlay_pool */

};

ai_buffer g_network_data_map_weights[AI_NETWORK_DATA_WEIGHTS_COUNT] = {

AI_BUFFER_INIT(AI_FLAG_NONE, AI_BUFFER_FORMAT_U8,

AI_BUFFER_SHAPE_INIT(AI_SHAPE_BCWH, 4, 1, 1207052, 1, 1),

1207052, NULL, s_network_weights_array_u64), /* weights_array */

};

 

 

/*!

* @brief Get network activations buffer initialized struct.

* @ingroup network_data

* @param[in] ptr a pointer to the activations array storage area

* @return an ai_buffer initialized struct

*/

AI_DEPRECATED

AI_API_ENTRY

ai_buffer ai_network_data_activations_buffer_get(const ai_handle ptr)

{

ai_buffer buf = AI_BUFFER_INIT(

AI_FLAG_NONE, AI_BUFFER_FORMAT_U8,

AI_BUFFER_SHAPE_INIT(AI_SHAPE_BCWH, 4, 1, AI_NETWORK_DATA_ACTIVATIONS_SIZE, 1, AI_NETWORK_DATA_ACTIVATIONS_COUNT),

AI_NETWORK_DATA_ACTIVATIONS_SIZE,

NULL, ptr);

return buf;

}

 

/*!

* @brief Get network weights buffer initialized struct.

* @ingroup network_data

* @param[in] ptr a pointer to the weights array storage area

* @return an ai_buffer initialized struct

*/

AI_DEPRECATED

AI_API_ENTRY

ai_buffer ai_network_data_weights_buffer_get(const ai_handle ptr)

{

ai_buffer buf = AI_BUFFER_INIT(

AI_FLAG_NONE, AI_BUFFER_FORMAT_U8|AI_BUFFER_FMT_FLAG_CONST,

AI_BUFFER_SHAPE_INIT(AI_SHAPE_BCWH, 4, 1, AI_NETWORK_DATA_WEIGHTS_SIZE, 1, AI_NETWORK_DATA_WEIGHTS_COUNT),

AI_NETWORK_DATA_WEIGHTS_SIZE,

NULL, ptr);

return buf;

}

 

 

/*!

* @brief Get network weights array pointer as a handle ptr.

* @ingroup network_data

* @return a ai_handle pointer to the weights array

*/

AI_DEPRECATED

AI_API_ENTRY

ai_handle ai_network_data_weights_get(void)

{

return AI_HANDLE_PTR(g_network_weights_table);

 

}

 

 

/*!

* @brief Get network params configuration data structure.

* @ingroup network_data

* @return true if a valid configuration is present, false otherwise

*/

AI_API_ENTRY

ai_bool ai_network_data_params_get(ai_network_params* params)

{

if (!params) return false;

 

const ai_buffer_array map_activations =

AI_BUFFER_ARRAY_OBJ_INIT(AI_FLAG_NONE, AI_NETWORK_DATA_ACTIVATIONS_COUNT, g_network_data_map_activations);

 

const ai_buffer_array map_weights =

AI_BUFFER_ARRAY_OBJ_INIT(AI_FLAG_NONE, AI_NETWORK_DATA_WEIGHTS_COUNT, g_network_data_map_weights);

 

return ai_platform_bind_network_params(params, &map_weights, &map_activations);

}

 

 

AI_API_DECLARE_END

 

Pourriez-vous m'aider à diagnostiquer et résoudre ce problème ?

Merci d'avance,
minyar boukhatem

4 REPLIES 4
Jinchen
Associate II

I also encountered this problem, E103(CliRuntimeError): Unable to generate the "libai_network" library.

The model is able to running on the STM32, but the results are bad and could not be validated on desktop.

fauvarque.daniel
ST Employee

What platform are you running validation on ? is it a Windows machine or another OS ? 

On Linux and MacOS you need to have the compiler installed (gcc or clang for MacOS)

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.

I am using Windows11, and the CubeAI 9.0.0.

Please find my model in the attachment.

fauvarque.daniel
ST Employee

ok same model as in the other thread (https://community.st.com/t5/edge-ai/validation-error-unable-to-generate-the-quot-libai-network-quot/td-p/726346)

The main issue with this model is the mixed mode of quantized and float layers.

In our current product we support Float models or fully quantized Int8 models SSSA (Signed Symmetric weights and Signed Asymmetric activations)

You can refer to the quantization part of the documentation part of the installation to see examples of the recommended quantization parameters.

Regards


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.