-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Description
Hi, Thanks a lot for sharing this great code.
In NCEAverage.py, the code is shown as the following:
if idx is None:
idx = self.multinomial.draw(batchSize * (self.K + 1)).view(batchSize, -1)
idx.select(1, 0).copy_(y.data)
# sample
weight_l = torch.index_select(self.memory_l, 0, idx.view(-1)).detach()
weight_l = weight_l.view(batchSize, K + 1, inputSize)
out_ab = torch.bmm(weight_l, ab.view(batchSize, inputSize, 1))
Select batchsize * (K + 1) features from memory bank and then calculate the similarity matrix. How to determine a positive pair and K negative pairs for each sample?
In MoCo, the aug views of the same image, v1 and v2, are a positive pairs, besides,v1 and other k views from the memory bank of the encoder_k are the k negative pairs. In CMC, this seems to be K + 1 negative pairs, because the memory bank is updated late and it seems that it is not guaranteed to obtain the positive pair view of each sample in the same batch.
Metadata
Metadata
Assignees
Labels
No labels