Contrastive Loss

Contrastive Loss Formula

Loss=(1−Y)∗|xi−xj|2+Y∗max(0,m−|xi−xj|2)

Here,

  • Y = 0 if sample is similar
  • Y = 1 if sample is different
  • m is a hyper-parameter

This loss mainly minimized the Euclidian Distance between similar points and increases the Euclidian Distance between different points till some limit m.


Related Notes