Skip to main content
Associate II
May 7, 2024
Solved

error while analyzing a neural network (Tflite model) in stm32 cube ai

  • May 7, 2024
  • 3 replies
  • 2362 views

good morning, I'm trying to import a neural network for NILM (non-intrusive load monitoring) in the stm32 environment, but I can't complete the analysis due to the presence of the error: 

INTERNAL ERROR: unpack_from requires a buffer of at least 122836864 bytes for unpacking 4 bytes at offset 122836860 (actual buffer size is 1654784)

 The network is CNN type and I'm working with xcube ai v. 9.0.0 and stm32cubeide 1.15.1

I'm asking anyone if they know how I can solve the problem of the buffer size, thanks in advance.

Best answer by fauvarque.daniel

Thanks for sharing this network, there seem to be something wrong with the generated tflite, I can't open it with Netron, nor with tflite micro and as you saw CubeAI is also reporting an error.

I tried also to dump it in json using flatc but this is producing an error too.

If you have your original model in Keras, we can support it directly in the tool, or I recommend to try to regenerate the tflite from your source.

Regards

3 replies

fauvarque.daniel
ST Employee
May 7, 2024

Can you share the model please (it can be with random weights)

Regards

Luca4Author
Associate II
May 9, 2024

Good morning, this is the neural network that I tried to import, thanks for your answer.

https://drive.google.com/file/d/1VTm0BNQ8uM_mkBeo8TVoX1i1VdZ-GbL2/view?usp=drive_link 

fauvarque.daniel
ST Employee
May 13, 2024

for this model I have a different error

 

stedgeai analyze --target stm32 -m STUDENT_converted_model.tflite
STEdgeAI Core v9.0.0-19802

NOT IMPLEMENTED: Unsupported layer types: FlexTensorListReserve, FlexTensorListS
tack, WHILE, stopping.

As  of today we support RNN only in float keras format.

The conversion in TFLite is introducing layers that we don't support for the moment (for example While)

Regards

Daniel

Luca4Author
Associate II
May 14, 2024

Sorry, my mistake, the network I shared before was an old version of the one I need (that was with a CRNN approach), below I'll send you the one that gives me the type of error I was talking about in the first post

https://drive.google.com/file/d/1FhDdYCNd0y86SptZ5FHCSjpUQdkdxXZ9/view?usp=drive_link

fauvarque.daniel
fauvarque.danielBest answer
ST Employee
May 24, 2024

Thanks for sharing this network, there seem to be something wrong with the generated tflite, I can't open it with Netron, nor with tflite micro and as you saw CubeAI is also reporting an error.

I tried also to dump it in json using flatc but this is producing an error too.

If you have your original model in Keras, we can support it directly in the tool, or I recommend to try to regenerate the tflite from your source.

Regards