-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript_test.py
79 lines (70 loc) · 2.31 KB
/
script_test.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
from subprocess import call
import sys
level = int(sys.argv[1])
shared = sys.argv[2]
setting = sys.argv[3]
name = sys.argv[4]
common_corruptions = ['gaussian_noise', 'shot_noise', 'impulse_noise', 'defocus_blur', 'glass_blur',
'motion_blur', 'zoom_blur', 'snow', 'frost', 'fog',
'brightness', 'contrast', 'elastic_transform', 'pixelate', 'jpeg_compression']
if level == 5:
common_corruptions.append('original')
none_tag = '--none' if shared == 'none' else ''
if setting == 'slow':
lr = 0.001
niter = 10
online_tag = ''
shuffle_tag = ''
elif setting == 'online':
lr = 0.001
niter = 1
online_tag = '--online'
shuffle_tag = ''
elif setting == 'online_shuffle':
lr = 0.001
niter = 1
online_tag = '--online'
shuffle_tag = '--shuffle'
batch_size_main = 256
batch_size_test = 64
for corruption in common_corruptions:
print(corruption, 'level', level)
# call(' '.join(['python', 'test_calls/test_initial.py',
# none_tag,
# '--group_norm 32',
# '--worker 16',
# '--level %d' %(level),
# '--corruption %s' %(corruption),
# '--shared %s' %(shared),
# '--batch_size %d' %(batch_size_main),
# '--resume results/resnet18_%s_%s/' %(shared, name),
# '--outf results/test_%s_%s_%s/' %(shared, setting, name)]),
# shell=True)
# if shared == 'none':
# continue
# call(' '.join(['python', 'test_calls/show_decomp.py',
# '--level %d' %(level),
# '--corruption %s' %(corruption),
# '--outf results/test_%s_%s_%s/' %(shared, setting, name)]),
# shell=True)
# call(' '.join(['python', 'test_calls/test_adapt.py',
# online_tag,
# shuffle_tag,
# '--group_norm 32',
# '--level %d' %(level),
# '--corruption %s' %(corruption),
# '--shared %s' %(shared),
# '--lr %f' %(lr),
# '--niter %d' %(niter),
# '--batch_size %d' %(batch_size_test),
# '--resume results/resnet18_%s_%s/' %(shared, name),
# '--outf results/test_%s_%s_%s/' %(shared, setting, name)]),
# shell=True)
call(' '.join(['python', 'test_calls/show_result.py',
'--analyze_avg',
'--analyze_bin',
'--analyze_ssh',
'--level %d' %(level),
'--corruption %s' %(corruption),
'--outf results/test_%s_%s_%s/' %(shared, setting, name)]),
shell=True)