zhirongw / lemniscate.pytorch

Unsupervised Feature Learning via Non-parametric Instance Discrimination

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure positive index is not chosen in negatives

senthilps8 opened this issue · comments

Shouldn't you ensure idx != y here?
This probably is not a big deal for ImageNet-scale datasets, but might cause issues in smaller datasets.

idx = self.multinomial.draw(batchSize * (self.K+1)).view(batchSize, -1)

@senthilps8 , I guess you are absolutely correct. The code here is not exactly right.
In smaller dataset, sampling is actually not needed. You can switch to the full softmax loss as in Cifar10.

@senthilps8 , according to my observation, this does not affect the final performance.

@HobbitLong Thanks for confirming.