Skip to content
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

How to prevent an element in the enqueue come from the same sample as the query? #27

Closed
ZYX-MLer opened this issue Dec 29, 2019 · 1 comment

Comments

@ZYX-MLer
Copy link

How to prevent an element in the enqueue come from the same sample as the query, especially when the dataloader‘s param "shuffle" is True?

Thank you

l_neg = torch.mm(queue.detach(), q.transpose(1, 0))

@HobbitLong
Copy link
Owner

HobbitLong commented Dec 31, 2019

Hi, @HebutAIer ,

That case can only happen at the beginning of each epoch. It's pretty sparse in general.

It should not affect the performance much if your dataset is big enough, e.g., ImageNet. Even on ImageNet100, I did not see a big difference in the final accuracy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants