ESP32-S3 Face Detection (Edge Impulse FOMO) - Memory Issue/Guru Meditation Error

Hi everyone,

I’m pretty new to edge ML and having trouble with a Face Detection project using Edge Impulse’s FOMO model. Getting consistent memory-related crashes that I can’t resolve.

Project: Face detection - FOMO - Dashboard - Edge Impulse

Board: ESP32-S3 WROOM N16R8 CAM

Problem: After compiling and uploading the example code, the board continuously reboots with a Guru Meditation Error (LoadProhibited exception).

Error Output:

ELF file SHA256: fe03a05a0a477bc6

Rebooting...

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
Saved PC:0x42037a3e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0

Edge Impulse Inferencing Demo

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x420208b5 PS : 0x00060630 A0 : 0x820197bc A1 : 0x3fcebd70
A2 : 0x3fc9b0f8 A3 : 0x3fc92e88 A4 : 0xffff8fff A5 : 0x3c04dda0
A6 : 0x00000060 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3fcebd90
A10 : 0x3fc9b0f8 A11 : 0x00000000 A12 : 0x00000060 A13 : 0x3fc9b158
A14 : 0x00000008 A15 : 0x00000006 SAR : 0x00000019 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000

Backtrace: 0x420208b2:0x3fcebd70 0x420197b9:0x3fcebdc0 0x4201930a:0x3fcebdf0 0x42002b0a:0x3fcebe40 0x42002baf:0x3fcebe60 0x4200dd0a:0x3fcebe90

What I’ve tried:

  • Modifying ARENA_SIZE in the Edge Impulse library

From what I’ve read online, this is likely a memory allocation issue with the ML model being too large for available RAM.

Questions:

  1. Has anyone successfully run FOMO face detection on ESP32-S3?
  2. Are there specific memory optimization techniques for Edge Impulse models on ESP32-S3?

Any advice would be greatly appreciated!

Hi, @ansioso !
No, it is not likely to be RAM issue.
Can you please fill the template? It is there for a reason. Mainly we need to know

  • Build Environment Details: [e.g., Arduino IDE 1.8.19 ESP32 Core for Arduino 2.0.4]
    because you didn’t specify how and what are you compiling.

Also, if you use Arduino IDE, there is esp exception decoder. Would be helpful to decode your backtrace.

yes sorry is my first time posting so i missed some steps :sweat_smile:
Arduino IDE → 2.3.4
ESP32 Core → 3.3.0

after decoding the exception i get this:

1 | LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads | 28

PC -> 0x42024b8d: ll_cam_set_pin () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/managed_components/espressif__esp32-camera/target/esp32s3/ll_cam.c:370

0x42024b8a: ll_cam_set_pin () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/managed_components/espressif__esp32-camera/target/esp32s3/ll_cam.c:370
0x4201cc67: cam_init () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/managed_components/espressif__esp32-camera/driver/cam_hal.c:402
0x4201c79d: esp_camera_init () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/managed_components/espressif__esp32-camera/driver/esp_camera.c:303
0x4200300d: ei_camera_init () at /tmp/.arduinoIDE-unsaved2025712-5008-u91tqa.lf0y8/esp32_camera/esp32_camera.ino:260
0x420030bb: setup () at /tmp/.arduinoIDE-unsaved2025712-5008-u91tqa.lf0y8/esp32_camera/esp32_camera.ino:138
0x4200e57e: loopTask (void*) at /home/fusillo/.arduino15/packages/esp32/hardware/esp32/3.3.0/cores/esp32/main.cpp:59
0x4037c195: vPortTaskWrapper () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

this decoder is really helpful, but with my little/no experience i still can’t find the issue
(at the end i used this decoder due to my Arduino IDE version)

Something is wrong with you camera init.
The Arduino sketch we ship is by default is for ESP-EYE, you’ll need to make some changes to the camera config to make it work with ESP32-S3 WROOM N16R8 CAM. Check the board documentation or examples for the correct pin config and then change them in our example sketch.

Oh, and we don’t test with 3.3.0 core - it may be possible this is an issue as well. As it says in the sketch
// These sketches are tested with 2.0.4 ESP32 Arduino Core

1 Like

the same issue with me
did you findout what is the main problem here because im also new in ai ml do need help with this problem im using same board but my ml model is image classification for electronics components

Hi, unfortunately I still haven’t figured out how to fix the issue… I have tried to:

  • modify the camera configuration with one that I’m using to take single camera shot (and that is working for that purpose)
  • go back to the 2.0.4 ESP32 Arduino Core

But out of all this I have only changed the error that is showing on reboot… for now I’m using another approach:

  1. use Http post to send single frames to a flask server on my pc
  2. process the images with yolo v11
  3. send back with the response found object as string
  4. process them with ArduinoJson

I would prefer to process all on the board, but for now I will stick to this flow and try to find a solution…

these are the config that works for the picture taking script:

// ESP32-S3 Camera pins
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM     15
#define SIOD_GPIO_NUM     4
#define SIOC_GPIO_NUM     5
#define Y9_GPIO_NUM       16
#define Y8_GPIO_NUM       17
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       12
#define Y5_GPIO_NUM       10
#define Y4_GPIO_NUM       8
#define Y3_GPIO_NUM       9
#define Y2_GPIO_NUM       11
#define VSYNC_GPIO_NUM    6
#define HREF_GPIO_NUM     7
#define PCLK_GPIO_NUM     13

camera_config_t createCameraConf(){
    // definizione parametri configurazione camera  
    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer = LEDC_TIMER_0;
    config.pin_d0 = Y2_GPIO_NUM;
    config.pin_d1 = Y3_GPIO_NUM;
    config.pin_d2 = Y4_GPIO_NUM;
    config.pin_d3 = Y5_GPIO_NUM;
    config.pin_d4 = Y6_GPIO_NUM;
    config.pin_d5 = Y7_GPIO_NUM;
    config.pin_d6 = Y8_GPIO_NUM;
    config.pin_d7 = Y9_GPIO_NUM;
    config.pin_xclk = XCLK_GPIO_NUM;
    config.pin_pclk = PCLK_GPIO_NUM;
    config.pin_vsync = VSYNC_GPIO_NUM;
    config.pin_href = HREF_GPIO_NUM;
    config.pin_sscb_sda = SIOD_GPIO_NUM;
    config.pin_sscb_scl = SIOC_GPIO_NUM;
    config.pin_pwdn = PWDN_GPIO_NUM;
    config.pin_reset = RESET_GPIO_NUM;
    config.xclk_freq_hz = 20000000;
    config.pixel_format = PIXFORMAT_JPEG;
    config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
    config.fb_location = CAMERA_FB_IN_PSRAM;
    config.jpeg_quality = 12;
    config.fb_count = 1;
    
    if(psramFound()){
        config.frame_size = FRAMESIZE_UXGA;
        config.jpeg_quality = 10;
        config.fb_count = 2;
    } else {
        config.frame_size = FRAMESIZE_SVGA;
        config.fb_location = CAMERA_FB_IN_DRAM;
    }

    return config;
}

currerntly facing the same issue with image detection model luckily found a youtube channel he succesfully deploy the model on esp32s3 i will attach the video he change the partion scheme for his project i also tried that but no any progress same error maybe im not doing it ok let me send you his video but its in chinese so you have to figure it out whats happening in the video if you could get some progress do share with me im also attaching my mail

ytlink : https://youtu.be/gLA64_JDgv8?feature=shared
it has three parts so you can find all parts on his channel
mymail: hanan03149681524@gmail.com

@ansioso , @leo_16572
Writing things like “But out of all this I have only changed the error that is showing on reboot” does not help debugging at all. We’re not mind-readers, nor we can just peek at your screen and see the exact error message, can we?

ALWAYS give as much details as possible - and follow the template, it is there for a reason. Reason being, WE NEED THE INFO to triage and (possibly) debug your issues.

Now, for the issue at hand
@ansioso ,
you have a working camera config. What happens when you use it with 2.0.4 in Edge Impulse sketch?

@AIWintermuteAI sorry for not including more details in the response. I didn’t wanted to bother you again with the problem and was just sharing the workaround that I’m currently using with @leo_16572

That said, I’m still trying to fix the issue, and I really appreciate that you want still help. This is the error that I’m facing right now:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0x29 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:QIO, clock div:2
load:0x3fce3808,len:0x43c
ets_loader.c 78 

and this is how I edited the script, maybe I have missed something

// ESP32-S3 Camera pins
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM     15
#define SIOD_GPIO_NUM     4
#define SIOC_GPIO_NUM     5
#define Y9_GPIO_NUM       16
#define Y8_GPIO_NUM       17
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       12
#define Y5_GPIO_NUM       10
#define Y4_GPIO_NUM       8
#define Y3_GPIO_NUM       9
#define Y2_GPIO_NUM       11
#define VSYNC_GPIO_NUM    6
#define HREF_GPIO_NUM     7
#define PCLK_GPIO_NUM     13
camera_config_t createCameraConf(){
    // definizione parametri configurazione camera  
    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer = LEDC_TIMER_0;
    config.pin_d0 = Y2_GPIO_NUM;
    config.pin_d1 = Y3_GPIO_NUM;
    config.pin_d2 = Y4_GPIO_NUM;
    config.pin_d3 = Y5_GPIO_NUM;
    config.pin_d4 = Y6_GPIO_NUM;
    config.pin_d5 = Y7_GPIO_NUM;
    config.pin_d6 = Y8_GPIO_NUM;
    config.pin_d7 = Y9_GPIO_NUM;
    config.pin_xclk = XCLK_GPIO_NUM;
    config.pin_pclk = PCLK_GPIO_NUM;
    config.pin_vsync = VSYNC_GPIO_NUM;
    config.pin_href = HREF_GPIO_NUM;
    config.pin_sscb_sda = SIOD_GPIO_NUM;
    config.pin_sscb_scl = SIOC_GPIO_NUM;
    config.pin_pwdn = PWDN_GPIO_NUM;
    config.pin_reset = RESET_GPIO_NUM;
    config.xclk_freq_hz = 20000000;
    config.pixel_format = PIXFORMAT_JPEG;
    config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
    
    // settaggi qualità/velicità
    config.fb_count = 1;

    if(psramFound()){
      config.frame_size = FRAMESIZE_VGA;
      config.jpeg_quality = 15;
      config.fb_location = CAMERA_FB_IN_PSRAM;
    }else{
      config.frame_size = FRAMESIZE_QVGA;
      config.jpeg_quality = 25;
      config.fb_location = CAMERA_FB_IN_DRAM;
    }
    return config;
}

...

bool ei_camera_init(void) {

    if (is_initialised) return true;

    camera_config_t config = createCameraConf();

    //initialize the camera
    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK) {
      Serial.printf("Camera init failed with error 0x%x\n", err);
      return false;
    }

...

Hello friend, I was having the same problem and couln’t find a solution, what I did was follow this tutorial that is in chinese but you can translate through subtitles, what he does is integrate the edge impulse inferencing part into the camerawebserver example and it worked for me on ESP32-S3 with very good results, using PSRAM. Please check the configurations in Arduino IDE to make sure you are using PSRAM. Hope it helps!

Youtube tutorial: https://www.youtube.com/watch?v=UBWKahjcilk

Github: https://github.com/yijenlu1971/ESP32C3/tree/main/CameraWebServer

Just replace in edge_impulse.cpp with you inferencing library. I had to use arduino core 3.0.7 because the future versions don’t have some needed files.