Improved Deep Metric Learning with Multi-class N-pair Loss Objective — Sohn

The triplet loss model can be extended to multiple negative samples with N-pair loss.

Given a set of (N+1) traomomg samples, let one be the anchor, one positive, and N-1 negative data points. The N-pair loss is defined as:

Instead of just comparing anchor with one positive and one negative, the loss uses one positive pair and many negative pairs. This should help the model learn more robust representations for the data. This looks similar to multi-class logistic loss, like softmax. For N=2, the corresponding loss will look similar to triplet loss, as there is only one negative example.

References