bjk021
June 15, 2023, 6:57pm
#1
I keep getting this error message when I try to compile my deployed Edge Impulse Model on Arduino IDE using the TinyML camera. There aren’t too many resources as to how to fix this problem, so I am not sure how to proceed. Let me know if you need more information.
This is the error message:
Starting inferencing in 2 seconds…
Taking photo…
ERR: failed to allocate tensor arena
Failed to allocate TFLite arena (error code 1)
Failed to run impulse (-6)
Camera Module Running…
Reduce Image:
It means that the TFLite interpreter was not able to allocate memory for its arena , which is where it runs in circles performing its computations. Try reducing your Impulse input image size down to 64x64 in the Create Impulse page and select grayscale on the Create Impulse - Image page.
What is your Input Image Block set to?
You’ll probably need to goto an Impulse design that has an Input Image Block set to 96x96 that in turn will reduce the RAM usage you see on the Deployment tab in the EI Studio.
The estimates you see in the EI Studio are estimates for your Model’s usage and performance. Your INO file will use RAM and Flash as well.
@Tarun.ece ,
BLE Sense is very limited in RAM. Shrinking input images to 64x64 and using grayscale should work though. Also make sure to select a small FOMO model.
Aurelien
Try a Different Model:
Trying to run a vision model on Arduino Nano ble33 sense.Obtain “Failed to allocate tensor arena”.
Using Arduino IDE 1.8.19. Please see uploads below. I tried 48 x 48 images, still same issue.
Any suggestions much appreciated!
**Project ID: 126581
[CaptureCompile]
[CaptureRunError]
Hello @JamesC1a ,
The Arduino Nano 33 BLE Sense has 256KB RAM and your model has a Peak RAM usage of 240.2KB.
Keep in mind that the peak RAM for your model is only to run the inference, your board might use some ram elsewhere (such as the Serial interface for example to print the results). You might want to have a deeper look at the memory management using MbedOS. Our CTO @janjongboom actually wrote something about it while he was still working at ARM. If you want to get a better understanding,…
Hi @gransasso This is a memory allocation issue, we cannot allocate enough memory to run the neural network. Using a smaller transfer learning model / smaller neural network will resolve this.
@louis Can you not show any conclusions if run_classifier returns an error? That would help with perception.
Hello @himani.upadhyay ,
This is because you model is too big, can you make sure you used a MobileNet V1 for the transfer learning base model?
Regards,
Louis
Adjust Library:
Can you set the last argument to true and retry?
EI_IMPULSE_ERROR res = run_classifier(&signal, &result, true /* debug */);
Search for EI_IMPULSE_ERROR in the deployed Arduino library to lookup your error code: Sound Classifier ERROR (-8) - #2 by louis
Optimize Impulse:
Thank @MMarcial I deleted all the data in the compressed file and then decompressed it, and then rebuilt it successfully.
General Help:
This post is old but may be helpful for you: Person detection model
1 Like