Using TensorFlow Lite Library For Object Detection
TensorFlow Lite is TensorFlow’s lightweight solution for mobile devices.
TensorFlow Lite is better as:
- TensorFlow Lite enables on-device machine learning inference with low latency. Hence, it is fast.
- TensorFlow Lite takes small binary size. Hence, good for mobile devices.
- TensorFlow Lite also supports hardware acceleration with the Android Neural Networks API.
TensorFlow Lite uses many techniques for achieving low latency such as:
- Optimizing the kernels for mobile apps.
- Pre-fused activations.
- Quantized kernels that allow smaller and faster (fixed-point math) models.
How to use TensorFlow Lite in an Android application?
The most important tricky part while using the TensorFlow Lite is to prepare the model(.tflite) which is different from the normal TensorFlow model.
In order to run the model with the TensorFlow Lite, you will have to convert the model into the model(.tflite) which is accepted by the TensorFlow Lite. Follow the steps from here.
Now, you will have the model(.tflite) and the label file. You can start using these model and label files in your Android application to load the model and to predict the output using the TensorFlow Lite library.
I have created a complete running sample application using the TensorFlow Lite for object detection. Check the project here.
Credit: The classifier example has been taken from Google TensorFlow example.
Originally published on LetsLearnAI.com
Check out my other articles on Machine Learning
- Simplest Introduction To Machine Learning.
- What Is Feature Engineering for Machine Learning?
- What Is Bias In Artificial Neural Network?
- What Is Regularization In Machine Learning?
- What Are L1 and L2 Loss Functions?
- How Does The Machine Learning Library TensorFlow Work?
Happy Learning AI 🙂
Clap, share if you like it and follow me for the updates.
Source: Deep Learning on Medium