Notes on Few-Shot Learning

  • What Few-Shot Learning is — definition, purpose, and FSL problem example
  • Few-Shot Learning variations — N-Shot Learning, Few-Shot Learning, One-Shot Learning, Zero-Shot Learning
  • Few-Shot Learning approaches Meta-Learning, Data-level, Parameter-level
  • Meta-Learning algorithm — definition, Metric-Learning, Gradient-Based Meta-Learning
  • Algorithms for Few-Shot image classification — Model-Agnostic Meta-Learning, Matching, Prototypical and Relation Networks
  • Few-Shot Object Detection YOLOMAML

What is Few-Shot learning?

Few-Shot variations

  1. N-Shot Learning (NSL)
  2. Few-Shot Learning
  3. One-Shot Learning (OSL)
  4. Less than one or Zero-Shot Learning (ZSL)


One-Shot and Few-Shot

Few-Shot learning approaches

  1. A training (support) set that consists of:
  2. N class labels
  3. K labeled images for each class (a small amount, less than ten samples per class)
  4. Q query images
  • Data-level approach (DLA)
  • Parameter-level approach (PLA)

Data-level approach

Parameter-level approach

Meta-Learning algorithm


Gradient-Based Meta-Learning

  1. We choose a meta-learner model,
  2. Episode is started,
  3. We initialize the base-learner (typically a CNN classifier),
  4. We train it on the support-set (the exact algorithm used to train the base-learner is defined by the meta-learner),
  5. Base-learner predicts the classes on the query set,
  6. Meta-learner parameters are trained on the loss resulting from the classification error,
  7. From this point, the pipeline may differ based on your choice of meta-learner. [1]

Algorithms for Few-Shot image classification

  1. Model-Agnostic Meta-Learning (MAML)
  2. Matching Networks
  3. Prototypical Networks
  4. Relation Network

Model-Agnostic Meta-Learning

  1. The meta-learner creates a copy of itself © at the beginning of each episode,
  2. C is trained on the episode (just as we have previously discussed, with the help of base-model),
  3. C makes predictions on the query set,
  4. The loss computed from these predictions is used to update C,
  5. This continues until you’ve trained on all episodes.

Matching Networks

  1. Each image from the support and the query set is fed to a CNN that outputs embeddings for them,
  2. Each query image is classified using the softmax of the cosine distance from its embeddings to the support-set embeddings,
  3. The Cross-Entropy Loss on the resulting classification is backpropagated through the CNN.

Prototypical Networks

Relation Network

Few-Shot Object Detection

  1. we localized it by drawing the smallest bounding box possible that contains it,
  2. we classified the object.
  1. A support set composed of:
  2. N class labels,
  3. For each class, K labeled images containing at least one object belonging to this class,
  4. Q query images.


Final thoughts

Additional resources

  1. “Few-Shot Image Classification with Meta-Learning” by Etienne Bennequin
  2. “Meta-learning algorithms for Few-Shot Computer Vision” by Etienne Bennequin




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Machine Learning In IOS With Core ML

Neural Networks — Analysis, Advantages, & Applications

Optimization in Neural Networks

Humans are metal robots in a valid sense.

A Quick Guide to Activation Functions In Deep Learning

Image Processing with Python: Image Segmentation using Thresholding Methods

How to finetune BERT to classify your Slack chats without coding

Batch sampler for sequential data using PyTorch deep learning framework — Part 3

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adarsh Gouda

Adarsh Gouda

More from Medium

Python3: Mutable, Immutable… everything is object!

Artificial Neural Networks for dynamical systems. The case of the double pendulum

Dog breed Identification with CNN Transfer Learning.

Divide & Conquer