1. contrastive loss
2. triplet loss
In triplet loss training, a triplet contains two images belonging to the same class, referred to as the anchor and positive samples, and a third image, from a different class, which is referred to as the negative sample. The triplet loss function is given as, , where , and are anchor, positive, and negative samples, respectively. is the learned metric function and is a margin term which encourages the negative sample to be further from the anchor than the positive sample.