Ranking losses, as described by Raúl Gómez in his blog, “Understanding Categorical Cross-Entropy Loss, Binary Cross-Entropy Loss, Softmax Loss, Logistic Loss, Focal Loss and all those confusing names” are used to predict the ‘relative distances between inputs’. The ranking problems are separated into two different types of inputs: Pairs and Triplets of inputs.
Pairs of Inputs
Pairs of inputs consist of two inputs paired together that are either in the same matching class (positive), or int separate classes (negative). A common model that uses pairs of inputs is the Siamese Net which learns to increase the distance between non-matching pairs (negative) and decrease the distance between matching (positive) pairs.
MyCaffe layer: ContrastiveLossLayer
Triplets of Inputs
Triplets of inputs consists of three inputs where the first is the anchor input, the next is a positive input matching the anchor class and the last is a negative input that does not match the anchor class. A common model using triplets of inputs is the Triplet Net which learns to increase the distance between the non-matching (anchor-negative inputs) and decrease the distance between the matching (anchor-positive inputs).
MyCaffe layer: TripletLossLayer