Skip to content

Commit 835879e

Browse files
author
Pengqian Lu
committed
update cifar100
1 parent 4e2913e commit 835879e

File tree

3 files changed

+202
-9
lines changed

3 files changed

+202
-9
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# don't upload cache file
22
__pycache__/
33
.vscode/
4+
/log/
5+
/database/
6+
generate_bash.ipynb
7+
.ipynb
8+
*.sh
9+
/results/

config/cifar100.json

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[
2+
{
3+
"dataset": "cifar100",
4+
"noise_type": "ILN",
5+
"noise_rate": 30,
6+
"loss": "rtcatoni",
7+
"settings": {
8+
"pretrain": 30,
9+
"relax": 2
10+
}
11+
},
12+
{
13+
"dataset": "cifar100",
14+
"noise_type": "ILN",
15+
"noise_rate": 30,
16+
"loss": "rtlogsum",
17+
"settings": {
18+
"pretrain": 20,
19+
"relax": 3
20+
}
21+
},
22+
{
23+
"dataset": "cifar100",
24+
"noise_type": "ILN",
25+
"noise_rate": 30,
26+
"loss": "rtwelschp",
27+
"settings": {
28+
"pretrain": 40,
29+
"relax": 3
30+
}
31+
},
32+
{
33+
"dataset": "cifar100",
34+
"noise_type": "ILN",
35+
"noise_rate": 50,
36+
"loss": "rtcatoni",
37+
"settings": {
38+
"pretrain": 40,
39+
"relax": 2
40+
}
41+
},
42+
{
43+
"dataset": "cifar100",
44+
"noise_type": "ILN",
45+
"noise_rate": 50,
46+
"loss": "rtlogsum",
47+
"settings": {
48+
"pretrain": 20,
49+
"relax": 3
50+
}
51+
},
52+
{
53+
"dataset": "cifar100",
54+
"noise_type": "ILN",
55+
"noise_rate": 50,
56+
"loss": "rtwelschp",
57+
"settings": {
58+
"pretrain": 20,
59+
"relax": 4
60+
}
61+
},
62+
{
63+
"dataset": "cifar100",
64+
"noise_type": "pairflip",
65+
"noise_rate": 30,
66+
"loss": "rtcatoni",
67+
"settings": {
68+
"pretrain": 30,
69+
"relax": 2
70+
}
71+
},
72+
{
73+
"dataset": "cifar100",
74+
"noise_type": "pairflip",
75+
"noise_rate": 30,
76+
"loss": "rtlogsum",
77+
"settings": {
78+
"pretrain": 40,
79+
"relax": 3
80+
}
81+
},
82+
{
83+
"dataset": "cifar100",
84+
"noise_type": "pairflip",
85+
"noise_rate": 30,
86+
"loss": "rtwelschp",
87+
"settings": {
88+
"pretrain": 40,
89+
"relax": 3
90+
}
91+
},
92+
{
93+
"dataset": "cifar100",
94+
"noise_type": "pairflip",
95+
"noise_rate": 45,
96+
"loss": "rtcatoni",
97+
"settings": {
98+
"pretrain": 20,
99+
"relax": 2
100+
}
101+
},
102+
{
103+
"dataset": "cifar100",
104+
"noise_type": "pairflip",
105+
"noise_rate": 45,
106+
"loss": "rtlogsum",
107+
"settings": {
108+
"pretrain": 20,
109+
"relax": 3
110+
}
111+
},
112+
{
113+
"dataset": "cifar100",
114+
"noise_type": "pairflip",
115+
"noise_rate": 45,
116+
"loss": "rtwelschp",
117+
"settings": {
118+
"pretrain": 40,
119+
"relax": 3
120+
}
121+
},
122+
{
123+
"dataset": "cifar100",
124+
"noise_type": "symmetric",
125+
"noise_rate": 30,
126+
"loss": "rtcatoni",
127+
"settings": {
128+
"pretrain": 10,
129+
"relax": 2
130+
}
131+
},
132+
{
133+
"dataset": "cifar100",
134+
"noise_type": "symmetric",
135+
"noise_rate": 30,
136+
"loss": "rtlogsum",
137+
"settings": {
138+
"pretrain": 10,
139+
"relax": 2
140+
}
141+
},
142+
{
143+
"dataset": "cifar100",
144+
"noise_type": "symmetric",
145+
"noise_rate": 30,
146+
"loss": "rtwelschp",
147+
"settings": {
148+
"pretrain": 50,
149+
"relax": 2
150+
}
151+
},
152+
{
153+
"dataset": "cifar100",
154+
"noise_type": "symmetric",
155+
"noise_rate": 50,
156+
"loss": "rtcatoni",
157+
"settings": {
158+
"pretrain": 10,
159+
"relax": 2
160+
}
161+
},
162+
{
163+
"dataset": "cifar100",
164+
"noise_type": "symmetric",
165+
"noise_rate": 50,
166+
"loss": "rtlogsum",
167+
"settings": {
168+
"pretrain": 15,
169+
"relax": 2
170+
}
171+
},
172+
{
173+
"dataset": "cifar100",
174+
"noise_type": "symmetric",
175+
"noise_rate": 50,
176+
"loss": "rtwelschp",
177+
"settings": {
178+
"pretrain": 50,
179+
"relax": 2
180+
}
181+
}
182+
]

option.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,23 @@
7474
elif args.dataset == 'news':
7575
args.model = 'newsnet'
7676
args.data_path = "./database/news/"
77+
elif args.dataset == 'cifar100':
78+
args.model = 'resnet50'
79+
args.data_path = "./database/cifar100"
7780

7881

7982
import json
8083

8184
file_path = f"./config/{args.dataset}.json"
8285

83-
with open(file_path, 'r') as f:
84-
config = json.load(f)
85-
for item in config['configurations']:
86-
if item['loss'] == args.loss and item['noise_rate'] == args.noise_rate and item['noise_type'] == args.noise_type:
87-
if 'pretrain' in item['settings']:
88-
args.pretrain = item['settings']['pretrain']
89-
if 'relax' in item['settings']:
90-
args.relax = item['settings']['relax']
91-
break
86+
import os
87+
if os.path.exists(file_path):
88+
with open(file_path, 'r') as f:
89+
config = json.load(f)
90+
for item in config['configurations']:
91+
if item['loss'] == args.loss and item['noise_rate'] == args.noise_rate and item['noise_type'] == args.noise_type:
92+
if 'pretrain' in item['settings']:
93+
args.pretrain = item['settings']['pretrain']
94+
if 'relax' in item['settings']:
95+
args.relax = item['settings']['relax']
96+
break

0 commit comments

Comments
 (0)