Home

Awesome

TensorFlow Lite Examples - Android

This repository refactors and rewrites all the TensorFlow Lite examples for Android. They are officially illustrated on the TensorFlow official website. For more details, please refer to:

https://www.tensorflow.org/lite/examples

Most of these examples are maintained by Googlers. But of all the maintainers are experts in Android. The quality and readability are not good enough. This repository's target is to recreate these examples, with the same UI designs, with the same approaches to run inference, and provide you base facilities to do machine learning in a much simpler way on Android. It helps you quickly understand how a captured Bitmap, a small buffer of raw audio data, or a piece of text are converted to run in inferences and how to represent results on the user interface.

Examples

Currently, this repository has covered almost all the examples on the official website. The rest of them are still under development. All of these examples are synchronized periodically with the official repository.

Here is a list of the covered cases:

Vision

Natural Language

Others

TensorFlow Lite eXetremes

TensorFlow Lite eXetrems is an open-source library that is just extracted during the recreation of the examples in this repo. It helps you build machine learning tasks in Android apps with less work wasted on repetitive routines, like permission handling, Camera setup, acceleration selection, inference statistics and show up, etc.

For more detailed information, pelase refer to tensorflow-litex in this repo.

Templates

To make it easy to create your new example application, there are a few of boilerplate projects under the templates directory.

There is also a script that helps to create your project quickly from the boilerplate.

Performance

Here is the performance test results on two Android phones and with two different Android versions.

Compare to the official performance tool provided by TensorFlow Lite, the results are taken in a realistic running environment, which is also affected by other parts of the application and potential hardware resource occupation.

In this test, Oneplus 7 (Snapdragon 855) is a flagship device in 2019, whereas Oneplus 9 (Snapdragon 888) is a flagship device in 2021. Oneplus 7 is running with Android 11, while Oneplus 9 is running with Android 12. Both of them have 12 RAM on the device.

License

Copyright 2022 Daily Studio.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.