DiegoOrtego / LabelNoiseMOIT

Official implementation for: "Multi-Objective Interpolation Training for Robustness to Label Noise"
38 stars 4 forks source link

Self-contrast set to -1 #5

Closed Hzzone closed 2 years ago

Hzzone commented 2 years ago

We need to remove the cosine between themselves, so the authors used the code https://github.com/DiegoOrtego/LabelNoiseMOIT/blob/0f8b424bb4aa08bf56cf1951b9adf3c95d7cdc2f/utils_labelNoise/utils_noise.py#L591. There may be a mistake that the elements of first dist.size()[0] at dim 1 are always set to -1, since the features are from a minibatch. The right way is:

dist = torch.mm(features, trainFeatures) # instead of features here
dist[torch.arange(dist.size()[0]), index] = -1  ##Self-contrast set to -1
Hzzone commented 2 years ago

I believe that this may be not so important for the case of topk is large enough.

DiegoOrtego commented 2 years ago

Hi @Hzzone,

You are totally rigth, that's a bug and we will correct it. As you comment, I doubt that it has a negative impact on performance, as the bug implies: 1) discarding the first batch as possible similar samples (we are not considering 100 samples out of the train set size) 2) We are using the self-contrast similarity, i.e. considering the current samples among the 250 samples that impact the k-nn. Obviously this is a mistake, but given that we use k=250, considering the current sample label in the k-nn is not really important (but, definitely not what we wanted to do).

In summary, many thanks for reporting the bug. Much appreciated! We will correct it. But, just to be clear to any reader, this bug doesn't have a negative impact on performance.

Hzzone commented 2 years ago

The second point is what I have mentioned.