-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/tflite-micro: add support and deprecate tensorflow-lite #17908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good and tests output has been provided.
Thank you for packaging all of this!
USEPKG += tflite-micro | ||
|
||
# TensorFlow-Lite crashes on M4/M7 CPUs when FPU is enabled, so disable it by | ||
# default for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open an issue for that?
Smells fishy.
Does this package make use of the DSP instructions found in those cores? Might be that we are not handling those registers properly yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open an issue for that?
Sure. I tested without just to be sure and on cortexm it ends up with a hardfault. Maybe that's the same issue on riscv ?
Does this package make use of the DSP instructions found in those cores? Might be that we are not handling those registers properly yet.
There's room for improvements. On cortex m4/7, we could enable CMSIS-NN primitives to speed up the inference (40% gain).
More generally, we could package kissfft and see how to support more complex scenario for keyword spotting. I was not able to make the whole stuff to work when I ported tensorflow-lite (back in 2019/2020) but maybe things have evolved positively since then.
I'm also looking into the edge-impulse SDK (I have a branch) which also relies on tensorflow and is easier to package, all third-party libraries are present in the repo, so can adapted with only one package.
Since this has a component of |
Looks like |
I'm running locally the |
3d913bd
to
c06b576
Compare
c06b576
to
454378a
Compare
50ca2a7
to
ab0ace4
Compare
ab0ace4
to
9b826b6
Compare
Contribution description
This PR introduces the tflite-micro framework as a package to replace the actual tensorflow-lite package.
The main advantage of tflite-micro is that it's a subset of tensorflow, that only targets microcontrollers. tflite-micro is automatically synchronized with the upstream tensorflow lite repo.
As a result, it takes less time to fetch with git and also less space on disk.
The actual tensorflow-lite package is updated to 2.2.2 and deprecated by this PR but the test application, renamed
tests/pkg_tflite-micro
and slightly adapted, is still compatible with it (that's also why 2.2.2 is required).To add support for tflite-micro, several things were needed:
Even if not strictly required, gemmlowp version was also updated.
Testing procedure
The tflite-micro port was tested on native, cortexm4 (nucleo-l4) and esp32. It doesn't work on riscv even if it builds fine.
native
nucleo-l476rg
esp32-wroom-32
Murdock should catch other issues.
Issues/PRs references
closes #16416