-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.py
204 lines (175 loc) · 5.66 KB
/
template.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
machine = {"A3":"/data/shizun/dataset/",
"B3":"/data/shizun/"}
import datetime
import socket
hostname = socket.gethostname() # 获取当前主机名
dir_data = machine[hostname]
today = datetime.datetime.now().strftime('%Y%m%d')
def set_template(args):
if args.template == 'EDSR':
# model
args.model = 'EDSR'
args.n_resblocks = 32
args.n_feats = 256
args.res_scale = 0.1
# data
args.scale = "4"
args.dir_data = dir_data
args.ext = "sep"
args.data_train = 'DIV2K'
args.data_test = 'DIV2K'
args.data_range = '1-800/801-810'
args.patch_size = 192
# device
args.device = "0" #############
args.n_GPUs = 1
# pipeline
args.epochs = 300
args.lr = 1e-4
args.batch_size = 16
args.print_every = 10
# experiemnt
args.reset = True
args.save = "{}_{}_x{}_e{}_ps{}_lr{}_n{}".format(today, args.model, args.scale, args.epochs, args.patch_size, args.lr, args.n_resblocks)
# resume
# args.reset = False
# args.load = "xxx"
# args.resume = -1
# test
# args.data_test = 'TEST8K'
# args.data_test = 'DIV2K'
# if args.data_test == 'DIV2K':
# args.data_range = '801-810'
# elif args.data_test == 'TEST8K':
# args.data_range = '1-100'
# args.test_only = True
# args.ssim = True
# args.save_gt = True
# args.save_results = True
# args.pre_train = "xxx/model/model_best.pt"
# args.save = "{}_{}_x{}_{}".format(today, args.model, args.scale, args.data_test)
elif args.template == 'EDSR_APE':
# model
args.model = 'EDSR_APE'
args.n_resblocks = 32
args.n_feats = 256
args.res_scale = 0.1
# data
args.scale = "4"
args.dir_data = dir_data
args.ext = "sep"
args.data_train = 'DIV2K'
args.data_test = 'DIV2K'
args.data_range = '1-800/801-810'
args.patch_size = 192
# device
args.device = "0"
args.n_GPUs = 1
# pipeline
args.epochs = 300
args.lr = 1e-4
args.batch_size = 16
args.print_every = 10
args.APE = True
args.exit_interval = 4
# experiemnt
args.reset = True
args.pre_train = "xxx/model/model_best.pt"
args.save = "{}_{}_x{}_e{}_ps{}_lr{}_n{}_i{}".format(today, args.model, args.scale, args.epochs, args.patch_size, args.lr, args.n_resblocks, args.exit_interval)
# resume
# args.reset = False
# args.load = "xxx"
# args.resume = -1
elif args.template == 'EDSR_test':
# model
args.model = 'EDSR'
args.n_resblocks = 32
args.n_feats = 256
args.res_scale = 0.1
# data
args.scale = "4" #############
args.dir_data = dir_data
# args.data_test = 'TEST8K'
args.data_test = 'DIV2K'
if args.data_test == 'DIV2K':
args.data_range = '801-810'
elif args.data_test == 'TEST8K':
args.data_range = '1-100'
args.ext = "sep"
args.patch_size = 48*int(args.scale)
args.step = 46*int(args.scale)
# device
args.device = "0"
args.n_GPUs = 1
# pipeline
args.APE = True
args.test_only = True
args.n_parallel = 500
args.save_results = True
args.save_gt = True
args.ssim = True
# experiment
args.reset = True
args.pre_train = "xxx/model/model_best.pt"
args.save = "{}_{}_x{}_{}_ps{}_st{}_n{}".format(today, args.model, args.scale, args.data_test, args.patch_size, args.step, args.n_resgroups)
elif args.template == 'EDSR_APE_test':
# model
args.model = 'EDSR_APE'
args.n_resblocks = 32
args.n_feats = 256
args.res_scale = 0.1
# data
args.scale = "4"
args.dir_data = dir_data
args.data_test = 'DIV2K'
# args.data_test = 'TEST8K'
if args.data_test == 'DIV2K':
args.data_range = '801-900'
elif args.data_test == 'TEST8K':
args.data_range = '1-100'
args.ext = "sep"
args.patch_size = 48*int(args.scale)
args.step = 46*int(args.scale)
# device
args.device = "0"
args.n_GPUs = 1
# pipeline
args.APE = True
args.test_only = True
args.exit_interval = 4
args.exit_threshold = 1
args.n_parallel = 500
args.save_results = True
args.save_gt = True
args.ssim = True
# args.add_mask = True
# experiment
args.reset = True
args.pre_train = "xxx_APE/model/model_best.pt"
args.save = "{}_{}_x{}_{}_ps{}_st{}_n{}_i{}_th{}".format(today, args.model, args.scale, args.data_test, args.patch_size, args.step, args.n_resgroups, args.exit_interval, args.exit_threshold)
elif args.template == 'RCAN':
# model
args.model = 'RCAN'
args.n_resgroups = 10
args.n_resblocks = 20
args.n_feats = 64
elif args.template == 'VDSR':
# model
args.model = 'VDSR'
args.n_resblocks = 20
args.n_feats = 64
elif args.template == 'ECBSR':
# model
args.model = 'ECBSR'
args.m_ecbsr = 16
args.c_ecbsr = 64
args.dm_ecbsr = 2
args.act = 'prelu'
elif args.template == 'RRDB':
# model
args.model = 'RRDB'
args.n_resblocks = 23
elif args.template == 'SWINIR':
# model
args.model = 'SWINIR'
args.n_resblocks = 6