Posted by Zu Kim and Louis Romero, Software Engineers, Google Research
with the classification-by-retrieval technology.There are many use-cases for classification-by-retrieval, including:
- Machine learning education (e.g., an educational hackathon event).
- Easily prototyping, or demonstrating image classification.
- Custom product recognition (e.g., developing a product recognition app for a small/medium business without the need to gather extensive training data or write lots of code).
Technical background
Classification and retrieval are two distinct methods of image recognition. A typical object recognition approach is to build a neural network classifier and train it with a large amount of training data (often thousands of images, or more). On the contrary, the retrieval approach uses a pre-trained feature extractor (e.g., an image embedding model) with feature matching based on a nearest neighbor search algorithm. The retrieval approach is scalable and flexible. For example, it can handle a large number of classes (say, > 1 million), and adding or removing classes does not require extra training. One would need as little as a single training data per class, which makes it effectively few-shot learning. A downside of the retrieval approach is that it requires extra infrastructure, and is less intuitive to use than a classification model. You can learn about modern retrieval systems in this article on . The provided , which is a generic and efficient on-device model.
Model accuracy: Comparison with typical few-shot learning approaches
In some sense, CbR (indexing) can be considered as a few-shot learning approach without training. Although it is not apples to apples to compare CbR with an arbitrary pre-trained base embedding model with a typical few-shot learning approach where the whole model trained with given training data, there is a .
iOS mobile app
To demo the ease of use of the Classification-by-Retrieval library, we built a mobile app that lets users select albums in their photo library as input data to create a new, tailor-made, image classification TFLite model. No coding required.
| The iOS lets users create a new model by selecting albums in their library. Then the app lets them try the classification model on the live camera feed. |
We encourage you to use these tools to build a model that is fair and responsible. To learn more about building a responsible model:
- https://www.tensorflow.org/responsible_ai
Future Work
We will explore possible ways to extend TensorFlow Lite Model Maker for on-device training capability based on this work.
Acknowledgments
Many people contributed to this work. We would like to thank Maxime Brénon, Cédric Deltheil, Denis Brulé, Chenyang Zhang, Christine Kaeser-Chen, Jack Sim, Tian Lin, Lu Wang, Shuangfeng Li, and everyone else involved in the project.
SOCIAL SHARE CARD GENERATOR