-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3-run_art.py
180 lines (136 loc) · 7.39 KB
/
3-run_art.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
import os
from art_utils import med_vs_lowres, high_vs_lowres, per_vs_cnn
file_dir = os.path.abspath(os.path.dirname(__file__))
if __name__ == "__main__":
# number of data shuffles for approximate randomization testing
N = 100000
log_dir = os.path.join(file_dir, 'results', 'art')
if not os.path.exists(log_dir):
os.makedirs(log_dir)
data_dir = os.path.join(file_dir, 'Featurize', 'featurized')
models_dir = os.path.join(file_dir, 'results', 'models')
highres_words = os.path.join(data_dir, 'words', 'hires_test')
medres_words = os.path.join(data_dir, 'words', 'medres_test')
lowres_words = os.path.join(data_dir, 'words', 'lores_test')
highres_gender = os.path.join(data_dir, 'gender', 'hires_test')
medres_gender = os.path.join(data_dir, 'gender', 'medres_test')
lowres_gender = os.path.join(data_dir, 'gender', 'lores_test')
params = dict()
params['highres_id'] = 0
params['medres_id'] = 1
params['lowres_id'] = 2
params['bonferroni'] = 18
# run ART comparisons for word recognition
###########################################################################
params['lowres_path'] = lowres_words
params['medres_path'] = medres_words
params['highres_path'] = highres_words
params['logpath'] = os.path.join(log_dir, 'words_cd_cnn.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_cnn')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_cd_per.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_per')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_cd_cnn_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_cnn_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_cd_cnn_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_cnn_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_cd_per_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_per_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_cd_per_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_cd_per_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_cnn.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_cnn')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_per.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_per')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_cnn_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_cnn_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_cnn_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_cnn_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_per_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_per_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'words_pd_per_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'words_pd_per_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'high_vs_lowres_words_per.csv')
params['highres_model_dir'] = os.path.join(models_dir, 'words_pd_per')
params['lowres_model_dir'] = os.path.join(models_dir, 'words_cd_per')
high_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'high_vs_lowres_words_cnn.csv')
params['highres_model_dir'] = os.path.join(models_dir, 'words_pd_cnn')
params['lowres_model_dir'] = os.path.join(models_dir, 'words_cd_cnn')
high_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'per_vs_cnn_words_pd.csv')
params['per_dir'] = os.path.join(models_dir, 'words_pd_per')
params['cnn_dir'] = os.path.join(models_dir, 'words_pd_cnn')
per_vs_cnn(params, N)
params['logpath'] = os.path.join(log_dir, 'per_vs_cnn_words_cd.csv')
params['per_dir'] = os.path.join(models_dir, 'words_cd_per')
params['cnn_dir'] = os.path.join(models_dir, 'words_cd_cnn')
per_vs_cnn(params, N)
# run ART comparisons for gender recognition
###########################################################################
params['lowres_path'] = lowres_gender
params['medres_path'] = medres_gender
params['highres_path'] = highres_gender
params['logpath'] = os.path.join(log_dir, 'gender_cd_cnn.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_cnn')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_cd_per.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_per')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_cd_cnn_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_cnn_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_cd_cnn_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_cnn_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_cd_per_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_per_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_cd_per_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_cd_per_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_cnn.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_cnn')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_per.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_per')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_cnn_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_cnn_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_cnn_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_cnn_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_per_0ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_per_0ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'gender_pd_per_1ep.csv')
params['model_dir'] = os.path.join(models_dir, 'gender_pd_per_1ep')
med_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'high_vs_lowres_gender_per.csv')
params['highres_model_dir'] = os.path.join(models_dir, 'gender_pd_per')
params['lowres_model_dir'] = os.path.join(models_dir, 'gender_cd_per')
high_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'high_vs_lowres_gender_cnn.csv')
params['highres_model_dir'] = os.path.join(models_dir, 'gender_pd_cnn')
params['lowres_model_dir'] = os.path.join(models_dir, 'gender_cd_cnn')
high_vs_lowres(params, N)
params['logpath'] = os.path.join(log_dir, 'per_vs_cnn_gender_pd.csv')
params['per_dir'] = os.path.join(models_dir, 'gender_pd_per')
params['cnn_dir'] = os.path.join(models_dir, 'gender_pd_cnn')
per_vs_cnn(params, N)
params['logpath'] = os.path.join(log_dir, 'per_vs_cnn_gender_cd.csv')
params['per_dir'] = os.path.join(models_dir, 'gender_cd_per')
params['cnn_dir'] = os.path.join(models_dir, 'gender_cd_cnn')
per_vs_cnn(params, N)