arduino / ArduinoTensorFlowLiteTutorials

252 stars 117 forks source link

xx bytes lost due to alignment. To avoid this loss, please make sure the tensor_arena is 16 bytes aligned #21

Open gmram opened 3 years ago

gmram commented 3 years ago

I get this error message I get when I basically replicate the gesture recognition tutorial in Arduino ML guide.

More importantly, though the arduino sketch builds, the model doesn't appear to be working, since the serial output doesn't report any gestures.

The workaround that worked for me was to change the header in the model.h encoding in the Google Colab ML notebook:

Original: !echo "const unsigned char model[] = {"

What worked for me: !echo "alignas(8)const unsigned char model[] = {"

The addition of alignas(8) fixed the issue in that the arduino sketch build is now working, and I am able to classify gestures.

manchoz commented 3 years ago

Hi @gmram, would you mind to submit a PR with your fix?

Could you, please, try with the __attribute__((aligned(8))) syntax and base your PR on this (take a look at #24)?

Many thanks!