New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What loss is suitable for one anchor, multiple positive and multiple negative? #693
Comments
Apologies for the late reply. You can use the concept of For example, using ContrastiveLoss: from pytorch_metric_learning.losses import ContrastiveLoss
loss_fn = ContrastiveLoss()
# anchors has shape NxD
# anchor_labels has shape N
# ref_emb has shape MxD
# ref_labels has shape M
loss = loss_fn(anchors, anchor_labels, ref_emb=ref_emb, ref_labels=ref_labels) Positive pairs will be formed by embeddings in You can have multiple positive pairs and negative pairs for any of the embeddings in |
No description provided.
The text was updated successfully, but these errors were encountered: