tensorflow-micropython-examples icon indicating copy to clipboard operation
tensorflow-micropython-examples copied to clipboard

MemoryError: memory allocation failed, allocating 300568 bytes

Open abhinavrawat27 opened this issue 1 year ago • 1 comments

Hi I have ESP-Eye board. I have downloaded the firmware.bin file from https://github.com/mocleiri/tensorflow-micropython-examples/actions/runs/4399527522

I have connected ESP Eye board to my system. Using Thonny IDE I have uploaded the firmware.bin file on the board. I have also uploaded the no_person_image_data.dat person_detect_model.tflite person_detection.py person_image_data.dat . When running person detection, I am getting below error:

Traceback (most recent call last):
  File "<stdin>", line 30, in <module>
MemoryError: memory allocation failed, allocating 300568 bytes

I am new to this board and unable to find a proper documentation of running the person detection on ESP32. Can anyone please help me here. Thanks

abhinavrawat27 avatar Apr 03 '23 16:04 abhinavrawat27

@abhinavrawat27 did you flash the spiram version? the person detection model is ~300KB which doesn't fit in the normal esp32 which has 100k effective ram. But does fit fine in the 4MB SPI ram versions of the board.

I think the latest micropython is actually splitting the spi ram into two chunks (one for the Micropython Heap and the other for C memory allocation) but still 300 KB will fit fine into 2MB.

Also the build you flashed was from an experimental branch. Try the firmware from here is which is the latest build of the main branch: https://github.com/mocleiri/tensorflow-micropython-examples/actions/runs/4791546929

mocleiri avatar May 05 '23 02:05 mocleiri