One of the earliest metric learning losses, triplet loss [1]}, [2]} tries to pull a positive sample belonging to the same class as the anchor, close to the anchor, and push a negative sample belonging to a different class away from the anchor, by a margin \(m\) . It is formulated as follows:
