mocleiri / tensorflow-micropython-examples

A custom micropython firmware integrating tensorflow lite for microcontrollers and ulab to implement the tensorflow micro examples.
MIT License
183 stars 87 forks source link

tensor object has no attribute getInputTensor #112

Open lcarnevale opened 1 year ago

lcarnevale commented 1 year ago

Hey there,

I am running the hello_world project on the latest firmware available for the ESP32. I use ampy to run the main and the application fails with this issue:

ampy.pyboard.PyboardError: ('exception', b'interpreter_make_new: model size = 2488, tensor area = 2064\r\ntime step,y\r\n', b'Traceback (most recent call last):\r\n File "<stdin>", line 1, in <module>\r\n File "hello.py", line 60, in <module>\r\n File "hello.py", line 17, in input_callback\r\nAttributeError: \'tensor\' object has no attribute \'getInputTensor\'\r\n')

horvathgergo commented 1 year ago

Same issue here. I'm using Thonny IDE and ESP32 (doit ESP32 devkit v1) trying to run micro_speech:

interpreter_make_new: model size = 18712, tensor area = 8208 Starting caught exception AttributeError 'tensor' object has no attribute 'getInputTensor' Done Traceback (most recent call last): File "", line 344, in File "", line 317, in runModel File "", line 45, in input_callback AttributeError: 'tensor' object has no attribute 'getInputTensor'

Also uploaded the firmware with spiram but it reboots every second:

ELF file SHA256: dc87bbbec229fb29

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0030,len:4604 ho 0 tail 12 room 4 load:0x40078000,len:13872 load:0x40080400,len:3356 entry 0x4008061c E (880) psram: PSRAM ID read error: 0xffffffff E (880) spiram: SPI RAM enabled but initialization failed. Bailing out. E (10) spiram: SPI RAM not initialized

abort() was called at PC 0x4014bfb7 on core 1

Backtrace:0x40097e59:0x3ffced20 0x400987cd:0x3ffced40 0x4009e055:0x3ffced60 0x4014bfb7:0x3ffcedd0 0x40177c72:0x3ffcedf0

AbdouTobblaze commented 1 year ago

Hi, I got the same issue : AttributeError: 'interpreter' object has no attribute 'getInputTensor' when running the hello-world example on the ESP32S3.

interpreter_make_new: model size = 2488, tensor area = 2064 time step,y Traceback (most recent call last): File "", line 60, in File "", line 17, in input_callback AttributeError: 'tensor' object has no attribute 'getInputTensor'

Can you please fix it

mocleiri commented 1 year ago

I have an experimental branch where I reverted changes to go back to the openmv baseline for how inference works to remove a single dynamic memory allocation which has been causing issues with the stm32 port and I thought also the esp32c3 port but It didn't fix it.

It changes the lifetime of the interpreter from being heap based to being stack based so the Tensor object no longer exists outside of the callback functions.

The examples work with images from the main branch here: https://github.com/mocleiri/tensorflow-micropython-examples/actions/runs/4791546929 (esp32) https://github.com/mocleiri/tensorflow-micropython-examples/actions/runs/4791546936 (esp32s3)