If I have 3 embeddings Anchor, Positive, Negative
from a Siamese model trained with Euclidean distance as distance metric for triplet loss.
During inference can cosine similarity similarity be used?
I have noticed if I calculate Euclidean distance with model from A, P, N results seem somewhat consistent with matching images getting smaller distance and non-matching images getting bigger distance in most cases.
In case I use cosine similarity on above embeddings I am unable to differentiate as similarity values between (A, P)
and (A, N)
seem almost equal or for different images one value seem higher vice versa.
Triplets were selected at random with no online hard, semi hard mining.
Wondering if I made mistake somewhere in implementation or the distance function in inference time should be same.
1 /(1 + euclidean_dist(embedding1, embedding2) )
the positive images get expected higher values and negatives lower in most cases. $\endgroup$