Learning the Metric Itself

What makes two pictures similar depends on the task. By training on examples of useful matches, we can learn a representation in which the differences we care about affect the distance.

16 sections · 14 questions · 4 coding challenges

1 / 16

Could Examples Teach Us What Similar Should Mean?

BOTIE

For some searches, similar means the same object under different lighting. For others, it means different objects in the same category. Raw pixel distance cannot decide which of those relationships matters, and a generic classifier may not have learned it either.

Hadsell, Chopra and LeCun's 2006 work learned a mapping from examples of relationships between inputs. Its contrastive objective encouraged related observations to be nearby while separating observations marked as dissimilar.

A shared encoder maps both members of a pair into the same space. Training pulls specified positive pairs together and penalises negative pairs that are too close under the chosen margin. This makes the desired relationship part of the learning task. The labels and sampling policy therefore define the notion of similarity, and the resulting distances still need evaluation on pairs the model did not see.

Sources for this history