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

Improvements to the Repo #122

Closed MATTYGILO closed 1 year ago

MATTYGILO commented 1 year ago

More than happy to help with these, but I think it is important we focus on these improvements

  1. Update to the repo to the newest micropython
  2. Update to tflite-micro
  3. Include ESP_NN
MATTYGILO commented 1 year ago

I have begun to update the code to the newest micropython version and updating tflite-micro but I am currently getting these errors:

microlite/openmv-libtf.cpp:6:10: fatal error: tensorflow/lite/micro/all_ops_resolver.h: No such file or directory
 #include "tensorflow/lite/micro/all_ops_resolver.h"
MATTYGILO commented 1 year ago

So the reason behind this issue is since I now implement tflite micro, it no longer has all_ops_resolver.h in "tensorflow/lite/micro/all_ops_resolver.h"

Screenshot 2023-06-23 at 10 13 46
MATTYGILO commented 1 year ago

So I fixed this error by converting it to #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" and removing #include "tensorflow/lite/micro/all_ops_resolver.h"

MATTYGILO commented 1 year ago

Question: Why do we convert .cc files to .cpp

mocleiri commented 1 year ago

120 is going to address items 2 and 3 from your list.

Question: Why do we convert .cc files to .cpp

Micropython assumed .cpp files for C++ modules. Originally when the build was based on Gnu Make the QSTR generation was collecting all of the .cpp files. So the renaming was done to get the QSTR generation to work properly.

TFLM uses .cc for all of the source files.

I think for the esp32/rp build the use of CMake changes how the sources are collected to not care about the extension.

The preparation script micropython-modules/microlite/prepare-tflm-esp.sh generates the tflm base files and uses the --rename_cc_to_cpp option so that the generated files have .cpp extensions.