Closed PCPJ closed 2 years ago
Hi, PCPJ: Thanks for taking himax board as a platform to experiment your model, please let me classify the situation first: There will be 2 kinds of size for the model
As described in your post, "model data ended up with 368 Kbytes", so i think that is the first one, which is the model data size and as log shows "Arena size is too small for all buffers", which is second one, tensor arena size.
Usually, tensor arena size related to the tensor shape in the model, kernel weight/bias parameter and data type(floating/int8...) used in the model.
Thanks.
Hello @bigcat-himax. Thank you so much for the quick response. This is my model data size:
const unsigned int classification_model_data_size = 60424;
Do you have any idea where this number came from?
Arena size is too small for all buffers. Needed 14961408 but only 842320 was available.
Where does this number, 14961408
, came from?
Hi, @PCPJ :
Arena size is too small for all buffers. Needed 14961408 but only 842320 was available.
This number 14961408
is the memory bytes size needed by TFLM and calculated while invoke.
Could you help to provide the tensor arena size information in your case?
ex. in person_detection/main_functions.cc
kTensorArenaSize = 136 * 1024;
and perhaps your model tflite
file or .cc
files also will help to analyze.
Thanks.
Sorry for not replaying earlier, @bigcat-himax.
Today, a few hours after my last comment I found the problem.
The tensor arena is the memory needed for the model parameters, and also the input tensors.
The model data file has all the model parameters, but of course it don't have the input data.
In my case the input was set to be a tensor of size 1,3,480,640
, way bigger than the board can handle.
That's why my model data file is smaller than the person detection example, and the memory needed was bigger.
Now I re-created the model file, using a smaller input size, and the tensors was allocated successfully.
Thank you so much for your attention.
Now I have to retrain my model with this smaller input size. Wish me luck.
Hi, @PCPJ Thanks for the information, all the best.
Hello everyone. I have a himax board and I am trying to deploy my own classification model. I am having some problems, hope someone can help me. My model is a simpler version of a mobilenet_v2 for classification. I removed he final layers of the network to make it smaller. I used this colab notebook as a guide line to convert my model to tensorflow lite for micro controllers. The final
.cc
file with the model data ended up with368 Kbytes
, way less than1.5 Mega bytes
which is the size of the peron detection model in the examples of this repository. I used the person detection example as a guide to deploy my model. I made the following modification:model_data.cc
andmodel_data.h
files with my model files.kTensorArenaSize
to the maximum size possible, without the makefile pointing out that the img file become too big.When I flash this image, using my model, I got the following error message:
Why tensorflow is telling me that I need all this memory? My model is smaller than the person detection one in the examples. Does someone understand what is happening? I can provide my source files if needed, including the model data file. Any help is welcome, thank you so much.