0

I am trying to figure out how should look input buffer for tensorflow lite model.

My input should be (1, 224, 224, 3) image buffer.

When I put to input buffer with 0 or 255 (black or white) images on the answer I am getting same answer.

uchar* in_data = new uchar[224*224*3];
for(int i=0; i<224*224*3;i++){
   // in_data[i] = 0;
   in_data[i] = 255;
}

uchar* input_1 = interpreter_stage1->typed_input_tensor<uchar>(0);

input_1 = in_data;


This code is giving me the same answer for all data which I am putting as input. How should be constructed, proper input for the case when model dimensions are (1, 224, 224, 3)?

For the easy case when I have only (1, 128) single dimension vector everything is working good. But with this multidimensional case I don't know how to proceed.

LongerAiR
  • 71
  • 1
  • 6
  • Have a look at the [anwer i gave to your related question](https://stackoverflow.com/questions/56222822/how-to-set-input-with-image-for-tensorflow-lite-in-c/56251738#56251738) - it might also answer this one. – nada May 22 '19 at 07:50
  • One point: In the above snippet, you don't actually copy data from in_data to input_1, you just point the variable pointer input_1 to the same location as in_data. You should do the data assignment to input_1 directly, like "input_1[i] = ..." – Sachin Joglekar May 22 '19 at 18:35
  • I cannot assign nothing to input_1[i]. Every try of assigment is giving me seg fault – LongerAiR May 24 '19 at 08:35

0 Answers0