-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.py
executable file
·278 lines (262 loc) · 9.74 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
'''
本文件是配置文件
'''
# 一些公共配置
class BaseConfig:
#
# batch_size = 8
# shuffle = True
# num_workers = 4
# rnn_hidden = 256
# embedding_dim = 256
# num_layers = 2
# share_embedding_weights = False
# debug_file = '/tmp/debugc'
pass
###################################################################################
# 本次配置是 for mnist_testing
class Config_mnist_testing(BaseConfig):
#
plot_every = 10
# set_1
# model_ckpt = 'checkpoints/' # 每次从某个断点加载模型
# output_file = 'ucsd_ped1.txt'
# set_2
model_ckpt = 'checkpoints/mnist_0606_1305.pkl'
output_file = 'mnist_0606_1305.txt'
#
video_folder = 'data/MNIST'
shuffle = False
epoch = 1 #
batch_size = 1 #
num_workers = 1
device_idx = "0" # GPU:1
cpd_channels = 100
LAM = 0.1
###################################################################################
# 本次配置是 for cifar10_testing
class Config_cifar10_testing(BaseConfig):
#
plot_every = 10
# set_1
# model_ckpt = 'checkpoints/' # 每次从某个断点加载模型
# output_file = 'ucsd_ped1.txt'
# set_2
model_ckpt = 'checkpoints/ucsd_ped1_0527_0721.pkl'
output_file = 'ucsd_ped1_0527_0721.txt'
#
video_folder = 'data/CIFAR10'
shuffle = False
epoch = 1 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 1 #
num_workers = 1
device_idx = "0" # GPU:1
cpd_channels = 100
LAM = 0.1
###################################################################################
# 本次配置是 for ped1_testing
class Config_ped1_testing(BaseConfig):
#
plot_every = 10
save_ckpt_every = 2000
prefix = "checkpoints/"
dataset_name = "ucsd_ped1"
# set_1
# model_ckpt = 'checkpoints/' # 每次从某个断点加载模型
# output_file = 'ucsd_ped1.txt'
# set_2
model_ckpt = 'checkpoints/ucsd_ped1_0527_0721.pkl'
output_file = 'ucsd_ped1_0527_0721.txt'
#
video_folder = 'data/UCSD_Anomaly_Dataset.v1p2'
shuffle = False
epoch = 1 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 1 #
num_workers = 1
device_idx = "3" # GPU:1
LR = 0.001
cpd_channels = 100
LAM = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
####################################################################################
# 本次配置是 for ped2_testing
class Config_ped2_testing(BaseConfig):
#
plot_every = 10
save_ckpt_every = 1000
prefix = "checkpoints/"
dataset_name = "ucsd_ped2"
# set_1
model_ckpt = 'checkpoints/ucsd_ped2_0626_2251.pkl' # 每次从某个断点加载模型
output_file = 'ucsd_ped2_0626_2251.txt'
# set_2
# model_ckpt = 'checkpoints/ucsd_ped2.pkl'
# output_file = 'ucsd_ped2.txt'
#
video_folder = 'data/UCSD_Anomaly_Dataset.v1p2'
shuffle = False
epoch = 1 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 1 #
num_workers = 1
device_idx = "1" # GPU:1
#
# lam_rec, lam_svdd = 1, 0 # for rec loss
lam_rec, lam_svdd = 0, 1 # for deepSVDD loss
objective = "one-class"
nu = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
####################################################################################
class Config_ShanghaiTech_testing(BaseConfig):
#
plot_every = 10
save_ckpt_every = 2000
prefix = "checkpoints/"
dataset_name = "ucsd_ped2"
# model_ckpt = 'checkpoints/ucsd_ped2_0523_1531.pkl' # 每次从某个断点加载模型
# output_file = 'ucsd_ped2_0523_1531.txt'
model_ckpt = 'checkpoints/shanghaitech_0525_1012.pkl'
output_file = 'shanghaitech_0525_1012.txt'
#
video_folder = 'data/shanghaitech'
shuffle = False
epoch = 1 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 1 #
num_workers = 1
device_idx = "3" # GPU:1
LR = 0.001
cpd_channels = 100
LAM = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
####################################################################################
# 本次配置是 for mnist_training
class Config_mnist_training(BaseConfig):
#
plot_every = 10
save_ckpt_every = 1000
prefix = "checkpoints/"
dataset_name = "mnist"
model_ckpt = 'checkpoints/xxx' # 每次从某个断点加载模型
output_file = 'xxx.txt'
#
video_folder = 'data/MNIST'
shuffle = True
epoch = 100 #
batch_size = 256 #
num_workers = 4
device_idx = "0" # GPU:1
normal_or_dist = "normal"
LR = 0.0001
cpd_channels = 100
LAM = 1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
#################################################################################
# 本次配置是 for cifar10_training
class Config_cifar10_training(BaseConfig):
#
plot_every = 10
save_ckpt_every = 1000
prefix = "checkpoints/"
dataset_name = "cifar10"
model_ckpt = 'checkpoints/xxx' # 每次从某个断点加载模型
output_file = 'xxx.txt'
#
video_folder = 'data/CIFAR10'
shuffle = True
epoch = 100 #
batch_size = 256 #
num_workers = 4
device_idx = "1" # GPU:1
normal_or_dist = "normal"
LR = 0.001
cpd_channels = 100
LAM = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
####################################################################################
# 本次配置是 for ped1_training
class Config_ped1_training(BaseConfig):
#
plot_every = 10
save_ckpt_every = 2000
prefix = "checkpoints/"
dataset_name = "ucsd_ped1"
model_ckpt = 'checkpoints/xxx' # 每次从某个断点加载模型
output_file = 'ucsd_ped1.txt'
#
video_folder = 'data/UCSD_Anomaly_Dataset.v1p2'
shuffle = True
epoch = 10 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 2 #
num_workers = 4
device_idx = "0" # GPU:1
normal_or_dist = "normal"
LR = 0.001
cpd_channels = 100
LAM = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
#################################################################################
# 本次配置是 for ped2_training
class Config_ped2_training(BaseConfig):
#
plot_every = 10
save_ckpt_every = 1000
prefix = "checkpoints/"
dataset_name = "ucsd_ped2"
model_ckpt = 'checkpoints/ucsd_ped2_0626_0851.pkl' # 每次从某个断点加载模型
# model_ckpt = 'checkpoints/xxx' # 每次从某个断点加载模型
output_file = 'xxx.txt'
#
video_folder = 'data/UCSD_Anomaly_Dataset.v1p2'
shuffle = True
epoch = 10 # 经过验证 1200 it(即batch) / epoch, 16.52s/it,所以~ 5 h/epoch
batch_size = 2 #
num_workers = 4
device_idx = "0" # GPU:1
normal_or_dist = "normal"
LR = 0.001
# lam_rec, lam_svdd = 1, 0 # for rec loss
lam_rec, lam_svdd = 0, 1 # for deepSVDD loss
# lam_rec, lam_svdd = 0.8, 0.2 # joint learn
warm_up_n_steps = 300
objective = "one-class"
nu = 0.1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
####################################################################################
# 本次配置是 for shanghaitech_training
class Config_shanghaitech_training(BaseConfig):
#
plot_every = 10
save_ckpt_every = 2000 # 这个是我自己观察tensorboard发现2000 step就有不错的结果
prefix = "checkpoints/"
dataset_name = "shanghaitech"
model_ckpt = 'checkpoints/shanghaitech.pkl' # 每次从某个断点加载模型
output_file = 'shanghaitech.txt'
#
device_ids = [0,1]
device_idx = "0" # GPU:1
video_folder = 'data/shanghaitech'
shuffle = True
num_workers = 4
epoch = 1 # 经过验证 ? batch / epoch
batch_size = 4 # 3是 gpu_num
# LR = 0.0005
LR = 0.001
cpd_channels = 100
LAM = 1
# TIME_STEPS = 16 # 这个论文代码在代码中写死了,TODO
# new_weight, new_height = 225, 225 # 这个作者代码也写死了
# channel = 1 # avenue是RGB image,但是论文转化为Gray,这个作者也写死了
#############################################################################################