Triplet Loss

Triplet Loss is a loss function typically used in contrastive/metric learning. Given an anchor point A, a semantically similar (to A) point S, a semantically different (from A) point D, a margin m (> 0), and a distance d, it is defined as L(A, S, D) = max(d(A,S)-d(A,D)+m, 0). This forces d(A,S)+m < d(A,D), i.e. the distance between A and D to be greater than the distance between A and S by a margin m. Therefore at test time the value m can be used as a threshold to decide if two objects are from the same semantic class.
Related concepts:
Metric Learning