amazon-science / video-contrastive-learning

Video Contrastive Learning with Global Context, ICCVW 2021
Apache License 2.0
156 stars 16 forks source link

NCESoftmaxLoss bug #5

Closed icorley-bsky closed 3 years ago

icorley-bsky commented 3 years ago

The implementation of the InfoNCE loss NCESoftmaxLoss seems to have a bug in it. You seems to be setting the labels to all zeros where there is no indicator for positive pairs but instead everything is a negative pair. Is this a desired feature or a bug?

https://github.com/amazon-research/video-contrastive-learning/blob/9a8d0473fd938dd77dfa6db2762abbc567da040e/models/Contrast.py#L14-L23

bryanyzhu commented 3 years ago

I think the code is fine, it is a desired feature. You can refer to this issue to find out why this is set to zero. Simply speaking, positive sample is always on position 0 in the logits.

bryanyzhu commented 3 years ago

Close the issue for now, feel free to reopen it if you have further questions.