Please star the repo if you find it useful…
TensorFlow Lite (TFLite) is a set of tools that help convert and optimize TensorFlow models to run on mobile and edge devices - currently running on more than 4 billion devices! With TensorFlow 2.x, you can train a model with tf.Keras, easily convert model to .tflite and deploy it; or you can download a pretrained TFLite model from the model zoo.
This is a curated list of TFLite models with sample apps, model zoo, helpful tools and learning resources. The purpose of this repo is to -
- showcase what the community has built with TFLite
- put all the samples side-by-side for easy references
- knowledge sharing and learning for everyone
Please submit a PR if you would like to contribute and follow the guidelines here.
Here are some new features recently announced at TensorFlow World:
- New MLIR-based TFLite converter - enables conversion of new classes of models such as Mask R-CNN and Mobile BERT etc, supports functional control flow and better error handling during conversion. It is now enabled by default in the nightly builds - see details in the updated & initial announcements.
- TFLite Android Support Library - documentation | Sample code (Android)
- Create your custom classification models easily with the TFLite Model Maker (
model customization API) - Colab tutorials for Image & Text - On-device training is finally here! Currently limited to transfer learning for image classification only but it's a great start - Blog | Sample code (Android). Here is an example from the community - on-device activity recognition for next-generation privacy-preserving personal informatics apps - Blog | Android. Leverage transfer learning for efficiently training context sensing models directly on the Android device without the need for sending data to the server.
- Accelerating TensorFlow Lite on Qualcomm Hexagon DSPs - Blog | Documentation
Here are the TFLite models with app / device implementations, and references.
Note: pretrained TFLite models from MediaPipe are included, which you can implement with or without MediaPipe.
Task | Model | App | Reference | Source |
---|---|---|---|
Classification | MobileNetV1 (download) | Android | iOS | Raspberry Pi | Overview | tensorflow.org |
Classification | MobileNetV2 | Recognize Flowers with TFLite on Android Codelab | Android | TensorFlow team |
Classification | MobileNetV2 | Skin Lesion Detection Android | Community |
Classification | EfficientNet-Lite0 (download) | Icon classifier Colab & Android | tutorial 1 | tutorial 2 | Community |
Object detection | Quantized COCO SSD MobileNet v1 (download) | Android | iOS | Overview | tensorflow.org |
Object detection | YOLO | Flutter | Paper | Community |
Object detection | MobileNetV2 SSD (download) | Reference | MediaPipe |
License Plate detection | SSD MobileNet (download) | Flutter | Community |
Face detection | BlazeFace (download) | Paper | Model card | MediaPipe |
Hand detection & tracking | Download: Palm detection, 2D hand landmark, 3D hand landmark |
Blog post | Model card | MediaPipe |
Pose estimation | Posenet (download) | Android | iOS | Overview | tensorflow.org |
Segmentation | DeepLab V3 (download) | Flutter | Paper | Community |
Segmentation (Flutter Realtime) | DeepLab V3 (download) | Flutter | Paper | Community |
Segmentation | DeepLab V3 (download) | Android | iOS | Overview | tensorflow.org |
Segmentation | Different variants of DeepLab V3 models in TFLite | Find the models on TF Hub with Colab Notebooks | Community |
Hair Segmentation | Download | Paper | Model card | MediaPipe |
Style transfer | Download: Style prediction, Style transform |
Overview | Android | tensorflow.org |
Style transfer | Better-quality style transfer models in TFLite | Models on TF Hub with Colab Notebooks | Community |
GANs | U-GAT-IT | Project repo | Android | Tutorial | Community |
Task | Model | App | Reference | Source |
---|---|---|---|
Question & Answer | DistilBERT | Android | Hugging Face |
Text Generation | GPT-2 / DistilGPT2 | Android | Hugging Face |
Text Classification | Download | Android | tensorflow.org |
Text Classification | Download | iOS | Community |
Text Classification | Download | Flutter | Community |
Task | Model | App | Reference | Source |
---|---|---|---|
Speech Recognition | DeepSpeech | Reference | Mozilla |
Speech Synthesis | Tacotron-2 | Android | TensorSpeech |
Speech Synthesis | FastSpeech2 | Android | TensorSpeech |
Speech Synthesis | MB-Melgan | Android | TensorSpeech |
These are TFLite models that could be implemented in apps and things:
- MobileNet- pretrained MobileNet v2 and v3 models.
- TFLite models
- TensorFlow Lite models with Android and iOS examples
- TensorFlow Lite hosted models with quantized and floating point variants
- TFLite models from TensorFlow Hub
These are TensorFlow models that could be converted to TFLite and then implemented in apps and things:
- Official TensorFlow models
- Tensorflow detection model zoo - pre-trained on COCO, KITTI, AVA v2.1, iNaturalist Species datasets
Checkout the E2E TFLite Tutorials repo for sample app ideas and in-progress end-to-end tutorials. You can also ask for help there, to get people to join your tutorial projects. Once a project gets completed, the links of the tflite model, sample code and tutorials will be added to the awesome-tflite list here.
ML Kit is a mobile SDK that brings Google's ML expertise to mobile devs.
- 10/1/2019 ML Kit Translate demo with material design - recognize, identify Language and translate text from live camera with ML Kit for Firebase - Codelab | Android (Kotlin).
- 3/13/2019 Computer Vision with ML Kit - Flutter In Focus - tutorial.
- 2/9/219 Flutter + MLKit: Business Card Mail Extractor - tutorial | Flutter.
- 2/8/2019 From TensorFlow to ML Kit: Power your Android application with machine learning - slides | Android (Kotlin).
- 8/7/2018 Building a Custom Machine Learning Model on Android with TensorFlow Lite - tutorial.
- 7/20/2018 - ML Kit and Face Detection in Flutter - tutorial.
- 7/27/2018 ML Kit on Android 4: Landmark Detection - tutorial.
- 7/28/2018 ML Kit on Android 3: Barcode Scanning - tutorial.
- 5/31/2018 ML Kit on Android 2: Face Detection - tutorial.
- 5/22/2018 ML Kit on Android 1: Intro - tutorial.
- Edge Impulse - helps you to train TFLite models for embedded devices in the cloud. (@EdgeImpulse)
- Fritz.ai - an ML platform that makes iOS and Android developers’ life easier: with pre-trained ML models and end-to-end platform for building and deploying custom trained models. (@fritzlabs)
- MediaPipe - a cross platform (mobile, desktop and Edge TPUs) AI pipeline by Google AI. (PM Ming Yong) | MediaPipe examples
- Coral Edge TPU - Google’s edge hardware. Coral Edge TPU examples
- TFLite Flutter Plugin - provides a dart API similar to the TFLite Java API for accessing TensorFlow Lite interpreter and performing inference in flutter apps. tflite_flutter on pub.dev
- Netron - for visualizing models
- AI benchmark - for benchmarking computer vision models on smartphones
- Performance benchmarks for Android and iOS
- How to design machine learning powered features - material design guidelines for ML | ML Kit Showcase App
- The People + AI Guide book - learn how to design human-centered AI products
- Adventures in TFLite - A repository showing non-trivial conversion processes and general explorations in TFLite by Sayak Paul.
- Propane Scanner - Propane Refill Finder Near Me - uses a custom TFLite model to detect propane tanks around gas stations via Google street view images.
Interested but not sure how to get started? Here are some learning resources that will help you whether you are a beginner or a practitioner in the field for a while.
- 4/20/2020 - What’s new in TensorFlow Lite from DevSummit 2020, Khanh LeViet. (link)
- 4/17/2020 - Optimizing style transfer to run on mobile with TFLite, Khanh LeViet and Luiz Gustavo Martins. (link)
- 4/14/2020 - How TensorFlow Lite helps you from prototype to product, Khanh LeViet. (link)
- 11/8/2019 - Getting Started with ML on MCUs with TensorFlow, BRANDON SATROM. (link)
- 8/5/2019 - TensorFlow Model Optimization Toolkit — float16 quantization halves model size, the TensorFlow team. (link)
- 7/13/2018 - Training and serving a realtime mobile object detector in 30 minutes with Cloud TPUs, Sara Robinson, Aakanksha Chowdhery, and Jonathan Huang. (link)
- 6/11/2018 - Why the Future of Machine Learning is Tiny, Pete Warden. (link)
- 3/30/2018 - Using TensorFlow Lite on Android, Laurence Moroney. (link)
- 03/2020 - Raspberry Pi for Computer Vision (Complete Bundle | TOC) by the PyImageSearch Team: Adrian Rosebrock (@PyImageSearch), David Hoffman, Asbhishek Thanki, Sayak Paul (@RisingSayak), and David Mcduffee.
- 12/2019 - TinyML by Pete Warden (@petewarden) and Daniel Situnayake (@dansitu).
- 10/2019 - Practical Deep Learning for Cloud, Mobile, and Edge by Anirudh Koul (@AnirudhKoul), Siddha Ganju (@SiddhaGanju), and Meher Kasam (@MeherKasam).
- 4/1/2020 - Easy on-device ML from prototype to production (TF Dev Summit '20)
- 3/11/2020 - TensorFlow Lite: ML for mobile and IoT devices (TF Dev Summit '20)
- 10/31/2019 - Keynote - TensorFlow Lite: ML for mobile and IoT devices
- 10/31/2019 - TensorFlow Lite: Solution for running ML on-device
- 10/31/2019 - TensorFlow model optimization: Quantization and pruning
- 10/29/2019 - Inside TensorFlow: TensorFlow Lite
- 4/18/2018 - TensorFlow Lite for Android (Coding TensorFlow)
- Udacity Introduction to TensorFlow Lite - by Daniel Situnayake (@dansitu), Paige Bailey (@DynamicWebPaige), and Juan Delgado
- Coursera Device-based Models with TensorFlow Lite - by Laurence Moroney (@lmoroney)