-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_ae.bat
149 lines (122 loc) · 6.04 KB
/
generate_ae.bat
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
@echo OFF
@REM How to run a Python script in a given conda environment from a batch file.
@REM It doesn't require:
@REM - conda to be in the PATH
@REM - cmd.exe to be initialized with conda init
@REM Define here the path to your conda installation
set CONDAPATH=C:\Users\Miniconda3
@REM Define here the name of the environment
set ENVNAME=xai
@REM The following command activates the base environment.
if %ENVNAME%==base (set ENVPATH=%CONDAPATH%) else (set ENVPATH=%CONDAPATH%\envs\%ENVNAME%)
@REM Activate the conda environment
@REM Using call is required here, see: https://stackoverflow.com/questions/24678144/conda-environments-and-bat-files
call %CONDAPATH%\Scripts\activate.bat %ENVPATH%
@REM Run a python script in that environment
@REM RUN DeepFool Attack for 10 times
@REM python 2_generate_ae.py --deepfool True --times 0
@REM python 2_generate_ae.py --deepfool True --times 1
@REM python 2_generate_ae.py --deepfool True --times 2
@REM python 2_generate_ae.py --deepfool True --times 3
@REM python 2_generate_ae.py --deepfool True --times 4
@REM python 2_generate_ae.py --deepfool True --times 5
@REM python 2_generate_ae.py --deepfool True --times 6
@REM python 2_generate_ae.py --deepfool True --times 7
@REM python 2_generate_ae.py --deepfool True --times 8
@REM python 2_generate_ae.py --deepfool True --times 9
@REM RUN Carlini Attack for 10 times
@REM python 2_generate_ae.py --carlini True --times 0
@REM python 2_generate_ae.py --carlini True --times 1
@REM python 2_generate_ae.py --carlini True --times 2
@REM python 2_generate_ae.py --carlini True --times 3
@REM python 2_generate_ae.py --carlini True --times 4
@REM python 2_generate_ae.py --carlini True --times 5
@REM python 2_generate_ae.py --carlini True --times 6
@REM python 2_generate_ae.py --carlini True --times 7
@REM python 2_generate_ae.py --carlini True --times 8
@REM python 2_generate_ae.py --carlini True --times 9
@REM RUN LowProFool Attack for 10 times
@REM python 2_generate_ae.py --lowprofool True --times 0
@REM python 2_generate_ae.py --lowprofool True --times 1
@REM python 2_generate_ae.py --lowprofool True --times 2
@REM python 2_generate_ae.py --lowprofool True --times 3
@REM python 2_generate_ae.py --lowprofool True --times 4
@REM python 2_generate_ae.py --lowprofool True --times 5
@REM python 2_generate_ae.py --lowprofool True --times 6
@REM python 2_generate_ae.py --lowprofool True --times 7
@REM python 2_generate_ae.py --lowprofool True --times 8
@REM python 2_generate_ae.py --lowprofool True --times 9
@REM RUN FGSM Attack for 10 times
@REM python 2_generate_ae.py --fgsm True --times 0
@REM python 2_generate_ae.py --fgsm True --times 1
@REM python 2_generate_ae.py --fgsm True --times 2
@REM python 2_generate_ae.py --fgsm True --times 3
@REM python 2_generate_ae.py --fgsm True --times 4
@REM python 2_generate_ae.py --fgsm True --times 5
@REM python 2_generate_ae.py --fgsm True --times 6
@REM python 2_generate_ae.py --fgsm True --times 7
@REM python 2_generate_ae.py --fgsm True --times 8
@REM python 2_generate_ae.py --fgsm True --times 9
@REM RUN BIM Attack for 10 times
@REM python 2_generate_ae.py --bim True --times 0
@REM python 2_generate_ae.py --bim True --times 1
@REM python 2_generate_ae.py --bim True --times 2
@REM python 2_generate_ae.py --bim True --times 3
@REM python 2_generate_ae.py --bim True --times 4
@REM python 2_generate_ae.py --bim True --times 5
@REM python 2_generate_ae.py --bim True --times 6
@REM python 2_generate_ae.py --bim True --times 7
@REM python 2_generate_ae.py --bim True --times 8
@REM python 2_generate_ae.py --bim True --times 9
@REM RUN MIM Attack for 10 times
@REM python 2_generate_ae.py --mim True --times 0
@REM python 2_generate_ae.py --mim True --times 1
@REM python 2_generate_ae.py --mim True --times 2
@REM python 2_generate_ae.py --mim True --times 3
@REM python 2_generate_ae.py --mim True --times 4
@REM python 2_generate_ae.py --mim True --times 5
@REM python 2_generate_ae.py --mim True --times 6
@REM python 2_generate_ae.py --mim True --times 7
@REM python 2_generate_ae.py --mim True --times 8
@REM python 2_generate_ae.py --mim True --times 9
@REM RUN PGD Attack for 10 times
@REM python 2_generate_ae.py --pgd True --times 0
@REM python 2_generate_ae.py --pgd True --times 1
@REM python 2_generate_ae.py --pgd True --times 2
@REM python 2_generate_ae.py --pgd True --times 3
@REM python 2_generate_ae.py --pgd True --times 4
@REM python 2_generate_ae.py --pgd True --times 5
@REM python 2_generate_ae.py --pgd True --times 6
@REM python 2_generate_ae.py --pgd True --times 7
@REM python 2_generate_ae.py --pgd True --times 8
@REM python 2_generate_ae.py --pgd True --times 9
@REM RUN Boundary Attack for 10 times
@REM python 2_generate_ae.py --boundary True --times 0
@REM python 2_generate_ae.py --boundary True --times 1
@REM python 2_generate_ae.py --boundary True --times 2
@REM python 2_generate_ae.py --boundary True --times 3
@REM python 2_generate_ae.py --boundary True --times 4
@REM python 2_generate_ae.py --boundary True --times 5
@REM python 2_generate_ae.py --boundary True --times 6
@REM python 2_generate_ae.py --boundary True --times 7
@REM python 2_generate_ae.py --boundary True --times 8
@REM python 2_generate_ae.py --boundary True --times 9
@REM RUN Boundary Attack for 10 times
@REM python 2_generate_ae.py --hopskipjump True --times 0
@REM python 2_generate_ae.py --hopskipjump True --times 1
@REM python 2_generate_ae.py --hopskipjump True --times 2
@REM python 2_generate_ae.py --hopskipjump True --times 3
@REM python 2_generate_ae.py --hopskipjump True --times 4
@REM python 2_generate_ae.py --hopskipjump True --times 5
@REM python 2_generate_ae.py --hopskipjump True --times 6
@REM python 2_generate_ae.py --hopskipjump True --times 7
@REM python 2_generate_ae.py --hopskipjump True --times 8
@REM python 2_generate_ae.py --hopskipjump True --times 9
@REM Deactivate the environment
call conda deactivate
@REM If conda is directly available from the command line then the following code works.
@REM call activate xai
@REM python script.py
@REM conda deactivate
@REM One could also use the conda run command
@REM conda run -n someenv python script.py