cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass data to my model?

YahiaHedna
Associate

HI! 

I am newbie to CUBE AI. 

I m working on implementing my CNN network that takes input image of 128,128,1 (greyscale) and give an output of 3 classes {class1,class2,class3}.

i did convert and try my model to TFLITE successfully on python.

 then i went to stmcube and did put the model using X-CUBE-AI application template .

my problem is with 

 

 

 

int acquire_and_process_data(ai_i8* data[])
{
  /* fill the inputs of the c-model
  for (int idx=0; idx < AI_NETWORK_IN_NUM; idx++ )
  {
      data[idx] = ....
  }

  */
  return 0;
}

 

 

my input buffer is like this

 

 

#define AI_NETWORK_IN_1_FORMAT      (AI_BUFFER_FORMAT_FLOAT)
#define AI_NETWORK_IN_1_HEIGHT      (128)
#define AI_NETWORK_IN_1_WIDTH       (128)
#define AI_NETWORK_IN_1_CHANNEL     (1)
#define AI_NETWORK_IN_1_SIZE        (16384)
#define AI_NETWORK_IN_1_SIZE_BYTES  (65536)

 

 

i tried putting image as image [128*128] and image[128][128]

1 ACCEPTED SOLUTION

Accepted Solutions
Julian E.
ST Employee

Hello @YahiaHedna ,

 

you are using float input, please try to change the 

int acquire_and_process_data(ai_i8* data[])

to 

int acquire_and_process_data(ai_float* data[])

then pass a float array of size 128x128=16384 to data[idx] 

 

Have a good day,

Julian


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.

View solution in original post

2 REPLIES 2
Julian E.
ST Employee

Hello @YahiaHedna ,

 

you are using float input, please try to change the 

int acquire_and_process_data(ai_i8* data[])

to 

int acquire_and_process_data(ai_float* data[])

then pass a float array of size 128x128=16384 to data[idx] 

 

Have a good day,

Julian


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.
YahiaHedna
Associate

Thank you Julian!  

I figured out the problem and I was getting that error because of the improper data passing to the input layer.

Thanks again for your time!