-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
53 lines (51 loc) · 1.8 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
class hyperparameters():
def __init__(self, dataName, modelName):
if dataName == "mnist":
self.class_num = 10
self.batch_size = 100
self.epochs = 10
self.epsilon = 0.3
self.alpha = 0.01
self.attack_iters = 40
self.num_initial = 200
self.num_label = 200
self.budget = 5000
elif dataName == "svhn":
self.class_num = 10
self.batch_size = 100
self.epochs = 20
self.epsilon = 8 / 255
self.alpha = 2 / 255
self.attack_iters = 7
self.num_initial = 1000
self.num_label = 500
self.budget = 10000
elif dataName == "cifar10":
self.class_num = 10
self.batch_size = 100
self.epochs = 10
self.epochs_retrain = 40
self.epsilon = 8 / 255
self.alpha = 2 / 255
self.attack_iters = 7
self.num_initial = 1000
self.num_label = 500
self.budget = 25000
elif dataName == "fashion":
self.class_num = 10
self.batch_size = 100
self.epochs = 10
self.epsilon = 0.3
self.alpha = 0.01
self.attack_iters = 40
self.num_initial = 200
self.num_label = 200
self.budget = 6000
self.data_dir = "data".format(dataName)
self.save_model_root = "{0}/{1}/savedM/".format(dataName, modelName)
self.save_log_root_test = "{0}/{1}/savedLT/".format(dataName, modelName)
if not os.path.isdir(self.save_model_root):
os.makedirs(self.save_model_root)
if not os.path.isdir(self.save_log_root_test):
os.makedirs(self.save_log_root_test)