Skip to content

Triplet Loss

A representation learning loss that pulls similar examples closer together and pushes dissimilar ones apart.

Triplet loss is a powerful loss function used especially in embedding and representation learning. It operates on an anchor example, a similar positive example, and a dissimilar negative example. The goal is to reduce the distance between the anchor and positive while increasing the distance to the negative. It is highly effective in face recognition, re-identification, similarity search, and metric learning. This loss does not merely teach the model class labels; it helps organize a semantically meaningful space.