Prototypical Networks for few-shot classification
metric-based few-shot learning.
an encoder embeds support examples, each class prototype is the mean embedding of its support examples, and a query is classified by nearest prototype using a distance like Euclidean via softmax.
WHAT THIS TESTS: Whether you understand metric-based few-shot learning and the simple prototype-and-distance rule at its core.
A GOOD ANSWER COVERS: Prototypical Networks tackle few-shot classification, where each task or episode provides only a handful of labeled examples per class, called the support set, plus query images to classify. A single embedding network, shared across all classes, maps each image into a feature space. For each class the prototype is computed as the mean vector of the embeddings of that class's support examples, so with five examples per class you average five embeddings into one prototype. A query image is then embedded with the same network and classified by finding the nearest prototype, using a distance metric, with squared Euclidean distance working well; the negative distances are passed through a softmax to give class probabilities. Training is episodic: each training iteration samples a small support and query set mimicking the few-shot test setting, and the encoder is optimized so that queries land close to their correct class prototype. The key idea is that classification reduces to nearest-prototype matching in a learned space, requiring no per-episode parameter updates.
COMMON WRONG ANSWERS: Claiming it trains or fine-tunes a new classifier head for each episode rather than comparing embeddings; using a learned parametric classifier instead of distance to class means; saying prototypes are single examples rather than means; forgetting episodic training; assuming cosine similarity is required when the original work used squared Euclidean.
LIKELY FOLLOW-UPS: Why squared Euclidean rather than cosine, and how does it relate to a linear classifier? How does this compare with Matching Networks or MAML? What happens with one-shot, where the prototype is a single embedding? How does episodic training improve generalization to new classes?
ONE CONCRETE EXAMPLE: In a five-way five-shot episode you get five new classes with five labeled images each. The encoder embeds all twenty-five support images and averages the five per class into five prototypes. A query image of an unseen bird is embedded, and its squared Euclidean distance to each prototype is computed; the softmax over negative distances assigns it to the nearest prototype's class, all without updating any weights at test time.
Read the original → arxiv.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.