The multi-similarity (MS) loss [1]} considers self-similarity and relative similarities between positive as well as negative pairs to learn the embedding space. It involves mining for hard negative and positive pairs, where a pair of negatives \((\mathbf {X}[i],\mathbf {X}[j])\)  (for \(\mathbf {c}[i]\ne \mathbf {c}[j]\) ) is selected when:
\(s^-_{i,j}>\min _{\mathbf {c}[i]= \mathbf {c}[k]}s_{i,k}-\epsilon .\) 
