Failed to allocate tensor arena on Nano.ble33_sense

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


Hi @mpustie,

“Failed to allocate tensor arena” means you ran out of RAM on your device. The Nano 33 BLE Sense only has 256 kB of RAM. If you look on the “Transfer Learning” page of your project, you can see that the model is estimated to take up 346.9 kB of RAM, which won’t fit on the Nano 33 BLE. You will need to use a different model. In my experience the “Transfer Learning” models on Edge Impulse are too big for most Arm Cortex M4 systems.

Thanks for the response. I am thinking of trying an Arduino Portenta H7 or a Raspberry Pi 4. I am thinking that the setup for a high school audience might be easier with the Arduino.

Hi, @shawn_edgeimpulse

I am running a keyword spotting project.
My project ID is 246032
The expected RAM usage is 215.3K which is smaller than 256 kB of RAM.

But I still get following error when running edge-impulse-run-impulse

edge-impulse-run-impulse
Edge Impulse impulse runner v1.19.3
[SER] Connecting to COM4
[SER] Serial is connected, trying to read config...
Failed to parse snapshot line [  ]
[SER] Retrieved configuration
[SER] Device is running AT command version 1.8.0
[SER] Started inferencing, press CTRL+C to stop...
LSE
Inferencing settings:
        Interval: 0.06 ms.
        Frame size: 16000
        Sample length: 1000 ms.
        No. of classes: 3
Starting inferencing, press 'b' to break
Starting inferencing in 2 seconds...
Recording...
Recording done
ERR: failed to allocate tensor arena
Failed to allocate TFLite arena (error code 1)
ERR: Failed to run classifier (-6)

Is there anyway to improve this?

Hi @Yang1991,

It looks like you are using MobileNetV2 0.35 in your transfer learning block, which requires a relatively large amount of RAM (200+ kB). I recommend switching to a different model for transfer learning (e.g. MobileNetV1 0.1) or switching to a basic classifier for a 2 or 3-layer CNN, which requires much less RAM than MobileNet, instead of the transfer learning block.

1 Like

Thanks. I have changed it to MobileNetV1, it is running now.

2 Likes