FOMO on ESP32-S3 (XIAO ESP32S3 Sense): Arduino export under-sizes tensor arena

The Arduino library export for a FOMO object-detection model writes a tensor arena size that is too small for the ESP32-S3. The result is a hard failure on a stock export, on every Arduino core version. Doubling one constant in the exported library fixes it completely. Details and full repro below.

Environment

  • Board: Seeed Studio XIAO ESP32S3 Sense (PSRAM working: psramFound() = 1, 8,386,076 bytes free)
  • Arduino IDE 2.3.7, Windows
  • ESP32 cores tested: latest 3.x, 2.0.17, and 2.0.7 — identical behavior on all three
  • Board settings: PSRAM “OPI PSRAM”, defaults otherwise
  • Model: FOMO, 96x96, 2 classes, quantized (int8)
  • Library exported 2026-08-26 from project ID 1097002 (University Program)

Symptom 1 — TensorFlow Lite inference engine (stock export)

Camera and PSRAM initialize normally, then every inference fails:

ERROR: run_classifier returned -3
AllocateTensors() failed

This repeats forever. Same output on core 3.x, 2.0.17, and 2.0.7.

Symptom 2 — EON Compiler inference engine (stock export, same project)

The same model exported with EON crashes at the first inference and boot-loops:

CORRUPT HEAP: Bad head at 0x3c110d20. Expected 0xabba1234 got 0x00220022
assert failed: multi_heap_free multi_heap_poisoning.c:279 (head != NULL)

The corrupted address is in the PSRAM heap region, consistent with a write past the end of an under-sized allocation. TFLite refuses to start; EON runs anyway and scribbles.

Fix

In the exported library, src/tflite-model/tflite_learn_1097002_3.h contains:

const size_t tflite_learn_1097002_3_arena_size = 185036;

Doubling this to 370072 and recompiling makes the model run correctly — detections are accurate and stable, tested on core 2.0.17. No other change of any kind.

Hello @micromet first of all welcome to the Edge Impulse community!

Thanks for sharing all the details on this! And also sharing the fix.

One quick question, when you deployed the model as an Arduino library did you use as a Model Optimization Tensor Flow Lite?

image

Thanks