You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your open-source code.
Here I have a question about the code of rank-aware contrastive loss metioned in the Section3.4 of the paper:
This is the rank-aware contrastive loss formula listed in the paper,
This is the code of rank-aware contrastive loss computation in the qd_detr/model.py:
# softmax
exp_logits = torch.exp(logits) log_prob = logits - torch.log(exp_logits.sum(1, keepdim=True) + 1e-6)
mean_log_prob_pos = (pos_mask * log_prob * vid_token_mask).sum(1) / (pos_mask.sum(1) + 1e-6)
loss = - mean_log_prob_pos * batch_drop_mask
loss_rank_contrastive = loss_rank_contrastive + loss.mean()
I don't think the code implement matched the formula? Especially the bolded code makes me confused.
If I get it wrong, please inform me. Thank you for your time.
The text was updated successfully, but these errors were encountered:
For the contrastive equation and the implementation, you can find descriptions in supervised contrastive Learning paper and repository.
For the rank, there is a for loop to implement it.
Thank you for your open-source code.
Here I have a question about the code of rank-aware contrastive loss metioned in the Section3.4 of the paper:
This is the rank-aware contrastive loss formula listed in the paper,
This is the code of rank-aware contrastive loss computation in the qd_detr/model.py:
# softmax
exp_logits = torch.exp(logits)
log_prob = logits - torch.log(exp_logits.sum(1, keepdim=True) + 1e-6)
mean_log_prob_pos = (pos_mask * log_prob * vid_token_mask).sum(1) / (pos_mask.sum(1) + 1e-6)
loss = - mean_log_prob_pos * batch_drop_mask
loss_rank_contrastive = loss_rank_contrastive + loss.mean()
I don't think the code implement matched the formula? Especially the bolded code makes me confused.
If I get it wrong, please inform me. Thank you for your time.
The text was updated successfully, but these errors were encountered: