forked from SongBaiHust/Adversarial_Metric_Attack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadv.sh
50 lines (44 loc) · 1.17 KB
/
adv.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
#!/bin/sh
loss_type=soft
name=resnet_50
attack=I-FGSM
epsilon=5
echo ${loss_type}_${name}
# generate adversarial images and save at pytorch/gallery_adv. Directly test the performance using features "pytorch_fea_adv.mat" (both original and adv image features)
if [ 1 -eq 1 ]; then
python Gan_Adv.py \
--loss_type=$loss_type \
--name=$name \
--attack=$attack \
--epsilon=$epsilon \
--save_img \
--save_fea
python evaluate_adv.py \
--loss_type=$loss_type \
--name=$name \
--attack=$attack \
--epsilon=$epsilon
fi
# test adv images in pytorch/gallery_adv. It generates "pytorch_fea_from_image.mat"
if [ 1 -eq 1 ]; then
python test.py \
--loss_type=$loss_type \
--name=$name \
--attack=$attack \
--epsilon=$epsilon \
--adv
fi
# test clean images pytorch/gallery. It generates "pytorch_fea_from_image.mat"
if [ 1 -eq 1 ]; then
python test.py \
--loss_type=$loss_type \
--name=$name
fi
# concat clean and image for visualization
if [ 1 -eq 1 ]; then
python concatImage.py \
--loss_type=$loss_type \
--name=$name \
--attack=$attack \
--epsilon=$epsilon
fi