tensorflow/lite/examples/minimal/README.md
This example shows how you can build a simple TensorFlow Lite application.
It requires CMake 3.16 or higher. On Ubuntu, you can simply run the following command.
sudo apt-get install cmake
Or you can follow the official cmake installation guide
It requires libffi7. On Ubuntu 20.10 or later, you can simply run the following command.
wget http://es.archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi7_3.3-4_amd64.deb
sudo dpkg -i libffi7_3.3-4_amd64.deb
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
mkdir minimal_build
cd minimal_build
cmake ../tensorflow_src/tensorflow/lite/examples/minimal
In the minimal_build directory,
cmake --build . -j
In the minimal_build directory,
./minimal <path/to/tflite/model>
You may want to link with tensorflowlite_flex library to use TF select Ops in your model.
First tensorflowlite_flex needs to be compiled using bazel in tensorflow_src
directory: sh bazel build -c opt --cxxopt='--std=c++17' --config=monolithic tensorflow/lite/delegates/flex:tensorflowlite_flex
Then when configuring cmake build (Step 4), add the following option:
cmake ../tensorflow_src/tensorflow/lite/examples/minimal -DLINK_TFLITE_FLEX="ON"
And build: sh cmake --build . -j