One shot learning

What Is One-Shot Learning?

One shot learning, usually written as one-shot learning, is a machine learning setting in which a model must recognize a new category after seeing a single labeled example of it. It is the limiting case of few-shot learning, where the number of examples per new class is small but greater than one, and of zero-shot learning, where no example is given and the class must be inferred from a description or attribute vector. The setting is motivated by the gap between statistical learners, which typically need thousands of labeled images per class, and human learners, who can generalize a new visual concept from one presentation.

The problem cannot be solved by training a conventional classifier on a single sample, because a network with millions of parameters will simply memorize it. One-shot methods instead move the learning burden off the new class and onto a large set of related classes seen in advance. A model is trained on that background data to acquire a representation, a similarity function, or a prior that transfers, and the single new example is then used only to place the class within that already-learned structure. Early formulations from the mid-2000s framed this transfer in Bayesian terms, treating knowledge from previously learned object categories as a prior over the parameters of a new one.

Metric Learning and Similarity Networks

The most direct approach learns an embedding in which distance corresponds to semantic similarity, so classification of a new class reduces to a nearest-neighbor comparison against its single example. Siamese networks implement this with two weight-sharing branches that map a pair of inputs into the embedding and produce a similarity score, and the Siamese neural network formulation for one-shot image recognition trained on verification tasks showed that features learned this way generalize to classes absent from training. Triplet losses extend the idea to anchor, positive, and negative triples, pulling matched pairs together while pushing mismatched pairs apart by a margin. Prototypical networks simplify further by representing each class as the mean of its support embeddings and assigning a query to the nearest prototype.

Meta-Learning and Episodic Training

A second family treats one-shot recognition as a problem of learning to learn. Training is organized into episodes that mimic the test condition: a small support set of new classes with one example each, plus query items to classify. Matching networks for one shot learning formalized this by combining an attention mechanism over the support set with the principle that training conditions should match test conditions, yielding a classifier that requires no fine-tuning on the new classes. Optimization-based meta-learning takes a different route, learning an initialization from which a few gradient steps on the support set produce a good classifier. Memory-augmented architectures store support examples in an external memory and read from it at inference. Related work on one-shot learning in discriminative neural networks uses a Bayesian treatment of the final classification layer to add a class from one observation without retraining the feature extractor.

Benchmarks and Evaluation

Progress in the area is measured on a small set of standard benchmarks. Omniglot, a collection of 1,623 handwritten characters drawn from 50 alphabets with 20 examples each, was designed as a deliberate inverse of large image datasets: many classes with few instances. MiniImageNet and tieredImageNet provide harder natural-image versions. Results are reported as N-way one-shot accuracy, most often five-way, and comparisons are sensitive to backbone capacity and to whether classes in the test split share visual structure with training classes, which has prompted cross-domain evaluation protocols.

Applications

One-shot learning has applications in a range of fields, including:

  • Face verification and biometric identification from a single enrollment image
  • Signature and handwriting verification in document processing
  • Drug discovery, predicting activity for compounds with few assay results
  • Industrial defect inspection, where examples of each fault type are scarce
  • Robotic manipulation learned from a single human demonstration
  • Rare disease diagnosis from limited annotated medical imaging
Loading…