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

Generation of asymmetric noise for cifar10 might have problems? #16

Closed
he-zh opened this issue Nov 16, 2021 · 1 comment
Closed

Generation of asymmetric noise for cifar10 might have problems? #16

he-zh opened this issue Nov 16, 2021 · 1 comment

Comments

@he-zh
Copy link

he-zh commented Nov 16, 2021

Hi, thanks for your inspiring work.

In ELR/data_loader/cifar10.py, line 17 in this page, after self.train_labels[idx]=5, the indices of class '5' is enlarged because some labels in class '3' are switched to class '5'. While in the following iterations where i=5, line 4 will select the changed train_labels which equal '5'.
Then a larger set of examples with label '5' will be selected than expected, which results in that more examples being assigned with label '3' after executing the command in line 20.

I assume that if we set the percent = 0.5, after the label flipping step, we will get 12.5% examples with label '3' and 7.5% examples with label '5'. I am wondering if my understanding is right? Or maybe I just misunderstand your code. I would appreciate it very much if you could spare time to respond to my concerns.

1.     def asymmetric_noise(self):
2.         self.train_labels_gt = self.train_labels.copy()
3.         for i in range(self.num_classes):
4.             indices = np.where(self.train_labels == i)[0]
5.             np.random.shuffle(indices)
6.             for j, idx in enumerate(indices):
7.                 if j < self.cfg_trainer['percent'] * len(indices):
8.                     self.noise_indx.append(idx)
9.                     # truck -> automobile
10.                     if i == 9:
11.                         self.train_labels[idx] = 1
12.                     # bird -> airplane
13.                     elif i == 2:
14.                         self.train_labels[idx] = 0
15.                     # cat -> dog
16.                     elif i == 3:
17.                         self.train_labels[idx] = 5
18.                     # dog -> cat
19.                     elif i == 5:
20.                         self.train_labels[idx] = 3
21.                     # deer -> horse
22.                     elif i == 4:
23.                         self.train_labels[idx] = 7

@shengliu66
Copy link
Owner

Yeah, the definition is following previous work such as https://arxiv.org/abs/1803.11364.

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