Flatbuffer error while using tflite converted to .h while running on STMicroController

77 views
Skip to first unread message

Srisuhasini Gottumukkala

unread,
May 6, 2022, 6:55:32 AM5/6/22
to TensorFlow Lite
Hello,
    I am converting the tflite model to .h file. The model works fine with 2 layers and it fails when there are more than two layers.
!apt-get update && apt-get -qq install xxd
# Convert to a C source file, i.e, a TensorFlow Lite for Microcontrollers model
!xxd -i {MODEL_TFLITE} > {MODEL_TFLITE_MICRO}
# Update variable names
REPLACE_TEXT = MODEL_TFLITE.replace('/', '_').replace('.', '_')
!sed -i 's/'{REPLACE_TEXT}'/model300_2/g' {MODEL_TFLITE_MICRO}

error i am getting:
Breakpoint 4, setup () at ..\src\main_functions.cc:84
84          model, resolver, tensor_arena, kTensorArenaSize, error_reporter);

Breakpoint 1, setup () at ..\src\main_functions.cc:85
85      interpreter = &static_interpreter;

Breakpoint 3, setup () at ..\src\main_functions.cc:88
88      TfLiteStatus allocate_status = interpreter->AllocateTensors();

Program received signal SIGSEGV, Segmentation fault.
0x000000000048b8bc in tflite::BuiltinDataAllocator::AllocatePOD<TfLiteFullyConnectedParams> (this=0x4e47b8 <(anonymous namespace)::tensor_arena+1752>) at D:/Projects/TinyML_Simulator/TF_Simulator/tensorflowLite/tensorflow/lite/core/api/flatbuffer_conversions.h:48
48        return new (allocated_memory) T();

Please help me in resolving the issue

Rocky Rhodes

unread,
May 16, 2022, 5:17:58 PM5/16/22
to Srisuhasini Gottumukkala, TensorFlow Lite
Sorry you're having trouble. I'm not able to tell exactly what is going on from your description, but it sounds like you may be copying/changing code from one of the TFLM examples. In the examples, the constant kTensorArenaSize is set to an appropriate size for the particular model used. For a larger model (you mention this is a problem when you increase your model size by adding layers) this constant will need to be increased.  I would try a bigger arena and see if that works.


--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/9f58e348-6562-4213-9459-f288fa3e4fd5n%40tensorflow.org.
Reply all
Reply to author
Forward
0 new messages