-
Notifications
You must be signed in to change notification settings - Fork 0
/
5.run_eval_adv_bb.sh
executable file
·180 lines (144 loc) · 11.7 KB
/
5.run_eval_adv_bb.sh
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
# Description: run eval_adv_bb.py with different models and adv samples
# EXPERIMENT 1: attack SENet using adversarial samples generated by LCNN
# MODELS
# NEW DISTILLED model, trained with clipped frequencies /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221129_153659
# NON DISTILLED model, trained with clipped frequencies /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221130_130922_nondistilled_clipped
# SENet34: /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221110_120043_BS512_LR0.00001/model_best.pth
# SENet12: /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221116_175342_NODISTILLED/model_best.pth
# ADVERSARIAL DATA
# old lcnn half non-clipped /data/longnv/_saved/models/LA_lcnnHalf_LPSseg_uf_seg600/20221115_112707/fgsm_adv_egs_None_5.0
# old lcnn non-clipped /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/fgsm_adv_egs_None_5.0
# new lcnn full clipped /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221128_173044/fgsm_adv_egs_None_5.0
# new lcnn half clipped /data/longnv/_saved/models/LA_lcnnHalf_LPSseg_uf_seg600/20221129_184127/fgsm_adv_egs_None_5.0
# EXPERIMENT 2: attack LCNN using adversarial samples generated by SENet
# MODELS
# GPU=3
# echo "attack new non-distilled (clipped) model using new adv samples"
# for i in `seq 13 19`; do echo $i;
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221130_130922_nondistilled_clipped/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221130_SENet12_NOdistilled_clipped.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221130_130922_nondistilled_clipped/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221128_173044/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221130_SENet12_NOdistilled_clipped.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221130_130922_nondistilled_clipped/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnnHalf_LPSseg_uf_seg600/20221129_184127/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221130_SENet12_NOdistilled_clipped.text
# done
# echo done
# exit
# exit()
GPU=3
echo "attack non-distilled LCNN model, trained with original data"
# for i in 4 6 10 14 18 33 38 41 42 49 57 62 86; do echo $i;
for i in `seq 1 8`; do echo $i;
python eval_adv.py --resume /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/checkpoint-epoch${i}.pth \
--adv_data /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221116_193008_NODISTILLED/fgsm_adv_egs_None_5.0 \
--protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
--asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
--device ${GPU} | tee -a LCNN_original.text
python eval_adv.py --resume /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/checkpoint-epoch${i}.pth \
--adv_data /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221130_130922_nondistilled_clipped/fgsm_adv_egs_None_5.0 \
--protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
--asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
--device ${GPU} | tee -a LCNN_original.text
python eval_adv.py --resume /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/checkpoint-epoch${i}.pth \
--adv_data /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221110_120043_BS512_LR0.00001/fgsm_adv_egs_None_5.0 \
--protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
--asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
--device ${GPU} | tee -a LCNN_original.text
python eval_adv.py --resume /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/checkpoint-epoch${i}.pth \
--adv_data /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221129_134503_e4/fgsm_adv_egs_None_5.0 \
--protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
--asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
--device ${GPU} | tee -a LCNN_original.text
done
echo done
exit
exit()
# GPU=2
# echo "attack non-distilled SENet12 model using new adv samples"
# for i in `seq 1 13`; do echo $i;
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221116_175342_NODISTILLED/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet12_NOdistilled.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221116_175342_NODISTILLED/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221128_173044/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet12_NOdistilled.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet12_LPSseg_uf_seg600/20221116_175342_NODISTILLED/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnnHalf_LPSseg_uf_seg600/20221129_184127/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet12_NOdistilled.text
# done
# echo done
# exit
# exit()
# GPU=1
# echo "attack big model using new adv samples"
# for i in 4 6 10 14 18 33 38 41 42 49 57 62 86; do echo $i;
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221110_120043_BS512_LR0.00001/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221114_211710/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet34.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221110_120043_BS512_LR0.00001/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnn_LPSseg_uf_seg600/20221128_173044/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet34.text
# python eval_adv.py --resume /data/longnv/_saved/models/LA_SENet34_LPSseg_uf_seg600/20221110_120043_BS512_LR0.00001/checkpoint-epoch${i}.pth \
# --adv_data /data/longnv/_saved/models/LA_lcnnHalf_LPSseg_uf_seg600/20221129_184127/fgsm_adv_egs_None_5.0 \
# --protocol_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file /data/Dataset/ASVspoof/LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU} | tee -a 20221129_SENet34.text
# done
# echo done
# exit
# exit()
# sysid=A11
# epsilon=100.0
# LCNN model
# python eval3_adv.py --resume _saved/models/LA_lcnn_LPSseg_uf_seg600/20190620_121836/checkpoint-epoch3.pth \
# --adv_data _saved/models/LA_lcnn_LPSseg_uf_seg600/20190620_121836/fgsm_adv_egs_${sysid}_${epsilon} \
# --protocol_file data_LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl_${sysid}.txt \
# --asv_score_file data_LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores_${sysid}.txt \
# --device ${GPU}
# origin performance of adv. attack
# python eval3_adv.py --resume _saved/models/LA_SENet12_LPSseg_uf_seg600/20190623_182148/model_best.pth \
# --adv_data _saved/models/LA_SENet34_LPSseg_uf_seg600/20190623_093457/fgsm_adv_egs_${sysid}_${epsilon} \
# --protocol_file data_LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl_${sysid}.txt \
# --asv_score_file data_LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores_${sysid}.txt \
# --device ${GPU}
# Conduct black-box attack
# python eval3_adv.py --resume _saved/models/LA_lcnn_LPSseg_uf_seg600/20190620_121836/checkpoint-epoch3.pth \
# --adv_data _saved/models/LA_SENet12_LPSseg_uf_seg600/20190623_182148/fgsm_adv_egs_${sysid}_${epsilon} \
# --protocol_file data_LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl_${sysid}.txt \
# --asv_score_file data_LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores_${sysid}.txt \
# --device ${GPU}
# Conduct black-box attack
# python eval3_adv.py --resume _saved/models/LA_SENet12_LPSseg_uf_seg600/20190623_182148/checkpoint-epoch8.pth \
# --adv_data _saved/models/LA_lcnn_LPSseg_uf_seg600/20190620_121836/fgsm_adv_egs_${sysid}_${epsilon} \
# --protocol_file data_LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl_${sysid}.txt \
# --asv_score_file data_LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores_${sysid}.txt \
# --device ${GPU}
# for epsilon in 0.1 1.0 5.0 10.0 25.0 50.0 100.0 # LA_lcnn_LPSseg_uf_seg600/20190620_121836/checkpoint-epoch3.pth
# do
# # Conduct black-box attack
# python eval3_adv.py --resume _saved/models/LA_lcnn_LPSseg_uf_seg600/20190620_121836/checkpoint-epoch3.pth \
# --adv_data _saved/models/LA_SENet12_LPSseg_uf_seg600/20190623_182148/fgsm_adv_egs_None_${epsilon} \
# --protocol_file data_LA/ASVspoof2019_LA_cm_protocols/ASVspoof2019.LA.cm.eval.trl.txt \
# --asv_score_file data_LA/ASVspoof2019_LA_asv_scores/ASVspoof2019.LA.asv.eval.gi.trl.scores.txt \
# --device ${GPU}
# done
# test