espressif / esp-who

Face detection and recognition framework
Other
1.65k stars 459 forks source link

matrix3du item alloc failed when working with AmazonFreeRTOS #97

Open Ascarron opened 4 years ago

Ascarron commented 4 years ago

I am trying to run the esp-who face detectionon the ESP-EYE using the AmazonFreeRTOS built upon the custom idf. When running the project I get the following error during image capture:

matrix3du item alloc failed.
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

I have enabled the SPI RAM (Component Config > ESP32 Specific > Support for External SPI RAM). What changes are necessary for the correct heap allocation? I tested it by lowering the resolution to QQVGA but it still crashes when doing the face detection. Even though for heap initialization in FreeRTOSConfig.h is set to: #define configTOTAL_HEAP_SIZE ( ( size_t ) (256 * 1024) ) when I call xPortGetFreeHeapSize() the output is only 65536

XiaochaoGONG commented 4 years ago

Not sure if the os support mapping external memory to heap. You can try to allocate about 300KB space to see if SPI RAM works.

Ascarron commented 4 years ago

Yes the mapping to the external memory works. To test this I did image_matrix = dl_matrix3du_alloc(1, 160, 120, 3); and the memory is allocated with a decrease in free heap size. If I try to increase the dimensions any more than this the allocation fails.

XiaochaoGONG commented 4 years ago

160x120x3 = about 57KB, which is still allocated in the internal memory. It seems you didn't successfully enable the SPI RAM. You may transfer this issue to esp-idf.

farshad-a commented 2 years ago

Has there been any updates on this issue and how to solve it? I am having the same problem when allocating 57KB of memory. The PSRAM is enabled using build flags in platformio.ini file:

    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue