Build sample on Raspberry Pi 4 AArch64 (core-image-weston).
git clone git://git.yoctoproject.org/poky.git
git clone git://git.yoctoproject.org/meta-raspberrypi
git clone git://git.openembedded.org/meta-openembedded
git clone https://github.com/NobuoTsukamoto/meta-tensorflow-lite.git
source poky/oe-init-build-env build
bitbake-layers add-layer ../meta-openembedded/meta-oe/
bitbake-layers add-layer ../meta-openembedded/meta-python/
bitbake-layers add-layer ../meta-openembedded/meta-networking/
bitbake-layers add-layer ../meta-openembedded/meta-multimedia/
bitbake-layers add-layer ../meta-raspberrypi/
bitbake-layers add-layer ../meta-tensorflow-lite/
Add tensorflow-lite-minimal
recipes to conf/auto.conf
file.
IMAGE_INSTALL:append = " tensorflow-lite-minimal"
MACHINE=raspberrypi4-64 bitbake core-image-weston
Write image to micro-SD card.
Power on your Raspberry Pi.
Launch a terminal and run the example.
cd /usr/share/tensorflow/lite/examples/minimal/
./minimal ./mobilenet_v1_1.0_224.tflite
The following results can be obtained.
=== Pre-invoke Interpreter State ===
Interpreter has 1 subgraphs.
...
Execution plan as the list of 3 nodes invoked in-order: [31,29,32]
Among these nodes in the execution plan:
Node 31 is a TfLiteXNNPackDelegate node (0x556d72abb0), which has delegated 29 nodes: [0-28]
Node 32 is a TfLiteXNNPackDelegate node (0x556d72abb0), which has delegated 1 nodes: [30]
--------------Subgraph-0 dump has completed--------------
The original sample CMake statically links tensorflow-lite. In this recipe, we will modify CMake to link the shared library (libtensorflow-lite.so) so that it can be built independently.
For more information about the changes in CMake, please refer to the following patch.
See libtensorflow-lite for a recipe to build a shared library for libtensorflow-lite.so.