msight-tech / research-ms-loss

MS-Loss: Multi-Similarity Loss for Deep Metric Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pos_pair_ = pos_pair_[pos_pair_ < 1 - epsilon] ?

rayLemond opened this issue · comments

Hi there, thanks for sharing the code and beautifule work!
In multi_similarity_loss.py line 35 :
pos_pair_ = pos_pair_[pos_pair_ < 1 - epsilon]
why do we need this code ?
And what's the logic of using the output of avgpooling as the embeddings of network?

A trick to exclude the similarity with itself, because the cosine similarity between one feature and itself is 1.

Umm, but in line multi_similarity_loss.py line 28:
sim_mat = torch.matmul(feats, torch.t(feats))
you are using the dot product similarity?

so the feature must be normalized, right?

but I wonder that the input of loss should be logits, to compare with labels. so do I need to do a softmax first to make it between 0~1?