Tensorflow Lite MicroPython support?
I am just wondering is there any possibility to upload esp32 firmware, which enables TensorFlow Lite features, on the FiPy board? I was following the instruction found in this repo https://github.com/mocleiri/tensorflow-micropython-examples, but it's not possible to connect with my FiPy and upload this firmware on it. I am constantly getting this error:
esptool.FatalError: Failed to connect to ESP32 : Invalid head on packet 0x08.
Does anyone know how to fix this issue, or the solution is to buy esp32 for this purpose?
Thanks and cheers!
@robert-hh Yes, indeed! I uploaded the new firmware and now everything works as expected. Thanks a lot for help and advices that you gave me!
@Adnan-Sabovic-0 You have to upload the new firmware. But now, that you know how it is not a big thing.
@robert-hh Do I need to upload a new firmware then and remove the existing one, or there is another way of using a firmware image with SPIRAM support?
@Adnan-Sabovic-0 Sometimes its /pyboard, sometimes /esp32. In case of a RAM shortage, use a firmware image with SPIRAM support, if available.
@robert-hh I have a small update, I am able to upload all the necessary files to my board. In my case it was ls /pyboard instead of ls /esp32. The new problem that occurred is related to memory allocation. Based on the code, it allocates 300568 bytes. Do you maybe know where can be a possible issue with memory part?
@Adnan-Sabovic-0 The files on the board should be available under the path /esp32. In rshell, try:
To put files there, just copy the to /esp32 with
cp source_file target_file
Target file names must start with /esp32/
@robert-hh I installed rshell and ran in my Ubuntu terminal. I am still confused how to upload here all files from the example folder. I can list them all:
on-examples/examples/person_test> ls -lthon-examples/tensorflow-micropytho 1316 Apr 15 12:15 main.py 9216 Apr 11 14:52 no_person_image_data.dat 300568 Apr 11 14:52 person_detect_model.tflite 9216 Apr 11 14:52 person_image_data.dat
And then I tried to run REPL and import main, but again same error as before. Then I imported microlite from main file but after I imported main again, still no any message. Where did I make mistakes?
@Adnan-Sabovic-0 Since you are not using the Pycom firmware, pymakr may not work. Try other tools for uploading like rshell https://pypi.org/project/rshell/ or mpremote https://pypi.org/project/mpremote/ . Both offer a REPL console as well. These are command line based tools, so they may look a little uncomfortable at the first moment. But once you get used to it, you'll see that it is way more robust than using an API like pymakr of Thonny.
@robert-hh I already have it. It is not possible to upload it via Pymark terminal in VS Code?
@robert-hh you script tries to open the file person_detect_model.tflite at the local file system, but it does not exist. You have to create or upload it to the board.
@robert-hh This is the output when I typed your commands in Pymakr terminal:
>>> import os >>> print(os.listdir("")) ['boot.py', 'esp32-cam', 'images', 'main.py', 'project.pymakr', 'show-test-images.py']
I completely followed these instructions: https://github.com/mocleiri/tensorflow-micropython-examples/runs/5553454051?check_suite_focus=true
After I set up everything and built tensorflow, all I needed to do is to choose the right firmware for my board. Once this job is finished, I supposed to be able to run the example (person detection), but then this problem occurs. The problem is detected after this line is called:
person_detection_model_file = open ('person_detect_model.tflite', 'rb')
which means that maybe the problem is related to model that is uploaded with tensorflow?
What do the instructions tell about using tensorflow?
Hi, it worked when I connected P2 and GND. I was able to upload the firmware successfully. But now I am facing another issue: OSError: [Errno 2] ENOENT. Is it possible that I uploaded the wrong firmware version? I built standard non-psram 4MB Flash firmware. Is it okay, or I should consider another version?
The possible versions can be found on this link:
@Adnan-Sabovic-0 you have to connect P2 to Gnd and push reset, to set the ESP32 into bootloader mode. The mechanisms required by esptool and implement by Pycom are incompatible.