Wouldn’t it be frustrating if your smartphone needed to have thousands of pictures of you to recognize you and get unlocked? Few-shot learning, or one-shot learning in this case, is a hot topic for machine learning applications where the model is supposed to predict something based on a few training examples:
What is Few-Shot Learning?
Few-shot learning (FSL), also referred to as low-shot learning (LSL) in few sources, is a type of machine learning problems where the training dataset contains limited information.
Common practice for machine learning applications is to feed as much data as the model can take. This is because in most machine learning applications feeding more data enables the model to predict better. However, few-shot learning aims to build accurate machine learning models with less training data. As the dimension of input data is a factor that determines resource costs (e.g. time costs, computational costs etc.), companies can reduce data analysis/machine learning (ML) costs by using few-shot learning.
Why is it important?
- Test base for learning like human: Humans can spot the difference between handwritten characters after seeing a few examples. However, computers need large amounts of data to classify what they “see” and spot the difference between handwritten characters. Few-shot learning is a test base where computers are expected to learn from few examples like humans.
- Learning for rare cases: By using few-shot learning, machines can learn rare cases. For example, when classifying images of animals, a machine learning model trained with few-shot learning techniques can classify an image of a rare species correctly after being exposed to small amount of prior information.
- Reducing data collection effort and computational costs: As few-shot learning requires less data to train a model, high costs related to data collection and labeling are eliminated. Low amount of training data means low dimensionality in the training dataset, which can significantly reduce the computational costs.
Differences between Few-shot Learning and Zero-shot Learning
Few-shot learning aims for ML models to predict the correct class of instances when a small amount of examples are available in the training dataset. Zero-shot learning aims to predict the correct class without being exposed to any instances belonging to that class in the training dataset. Zero-shot learning and few-shot learning have mutual applications such as:
- image classification
- semantic segmentation
- image generation
- object detection
- natural language processing
Finally, there is one-shot learning, which is often mixed with zero-shot learning. One-shot learning is a special type of few-shot learning problem, where the aim is to learn information about object categories from one training sample/image. Face-recognition technologies used by smartphones is an example for a one-shot learning problem.
Approaches of Few-shot Learning
- Prior knowledge about similarity: ML models learn patterns in training data that tend to separate different classes even when they are unseen. Traditional ML models can not discriminate classes that are not present in training datasets, whereas few shot learning techniques enable ML models to separate two classes that are not present in the training data and in some applications they can even separate more than two unseen classes:
- Discriminating two unseen classes:
- Discriminating multiple unseen classes:
- Prior knowledge about learning: ML models use prior knowledge to constrain the learning algorithm to choose parameters that generalize well from few examples.
- Techniques used for hyperparameter tuning in few-shot learning are:
- Learning update rules can also encourage good performance with small datasets:
- Sequence methods take entire dataset and test example and predict the value of the test label:
- Prior knowledge of data: ML models exploit prior knowledge about the structure and variability of the data, which enables construction of viable models from few examples.
- Generative models can be constructed for families of data classes:
- New examples for the training set can be synthesized:
Applications of Few-shot Learning
- Computer Vision: Computer vision explores how computers can gain high-level understanding from digital images or videos. Few-shot learning is used mainly in computer vision to deal with problems such as:
- Character recognition (NIPS)
- Image classification (ICML)
- Object recognition (NIPS*)
- Other image applications:
- image retrieval (NIPS**)
- object tracking (NIPS***)
- specific object counting in images (ECCV)
- scene location recognition (IEEE)
- gesture recognition (Oxford)
- part labeling (IEEE*)
- image generation (NIPS****)
- shape view reconstruction for 3D objects (ICLR)
- image captioning (Association for Computing Machinery)
- Video applications
- video classification (ECCV*)
- motion prediction (ECCV**)
- action localization (IEEE**)
- person re-identification (IEEE***)
- event detection (British Machine Vision Conference)
- Natural Language Processing: Few-shot learning enables natural language processing applications to complete tasks with few examples of text data. These tasks can be listed as:
- parsing (Association for Computational Linguistics)
- translation (ICLR*)
- sentence completion (Google)
- sentiment classification from short reviews (NAACL)
- user intent classification for dialog systems (IBM Research)
- criminal charge prediction, the code used in the study was shared on Github. (Association for Computer Linguistics)
- word similarity tasks (e.g. nonce definition) (Association for Computer Linguistics*)
- multi-label text classification (Association for Computer Linguistics**)
- Robotics: For robots to behave more like human, they should be able to generalize information from a few demonstrations. Therefore, few-shot learning plays a critical role in training robots to complete certain tasks such as:
- learning a movement by imitating a single demonstration (IEEE****)
- learning manipulation actions from a few demonstrations (IEEE*****)
- visual navigation (PMLR)
- continuous control (NIPS*****)
- Acoustic Signal Processing: Data that contains information regarding voices/sounds can be analyzed by acoustic signal processing and few-shot learning can enable deployment of tasks such as:
- Other Applications:
- medical applications (e.g. few-shot drug discovery)
- one-shot architecture search: Finding architectures by training the supernet (supernets are combinations of several Internet Protocol (IP) networks or subnets into one network with a single classless interdomain routing (CIDR) prefix) once
- IoT Analytics (RecordEvolution)
- mathematical applications:
Implementation in Python
There are several open-source few-shot learning projects available. To implement few-shot learning projects, users can refer to the following libraries/repositories in Python:
- Pytorch – Torchmeta: A library for both few-shot classification and regression problems, which enables easy benchmarking on multiple problems and reproducibility.
- FewRel: A large-scale few-shot relation extraction dataset, which contains more than one hundred relations and lots of annotated instances cross different domains.
- Meta Transfer Learning: This repository contains the TensorFlow and PyTorch implementations for Meta-Transfer Learning for Few-Shot Learning.
- Few Shot: Repository that contains clean, readable and tested code to reproduce few-shot learning research.
- Few-Shot Object Detection (FsDet): Contains the official few-shot object detection implementation of Simple Few-Shot Object Detection.
- Prototypical Networks on the Omniglot Dataset: An implementation of “Prototypical Networks for Few-shot Learning” on a notebook in Pytorch.
Future of ML
IBM research suggests ML to evolve around following segments in the future:
- Classic ML: Deals with problems with one dataset at a time, one task and one heavy training
- Few-shot ML: Deals with heavy offline training, then easy learning on similar tasks
- Developing ML: Continuous life-long learning on various tasks
For more detailed information about few-shot learning, please check our Custom AI whitepaper or contact us:
NIPS, ICML, NIPS*, NIPS**, NIPS***, ECCV, IEEE, Oxford, IEEE*, NIPS****, ICLR, Association for Computing Machinery, ECCV*, ECCV**, IEEE**, IEEE***, British Machine Vision Conference, Association for Computational Linguistics, ICLR, Google, NAACL, IBM Research, Association for Computer Linguistics, Association for Computer Linguistics*, Association for Computer Linguistics**, IEEE****, IEEE*****, PMLR, NIPS*****, RecordEvolution, Facebook AI Research
How can we do better?
Your feedback is valuable. We will do our best to improve our work based on it.