You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a library dedicated to **adversarial machine learning**. Its purpose is to allow rapid crafting and analysis of attacks and defense methods for machine learning models. Nemesis provides an implementation for many state-of-the-art methods for attacking and defending classifiers.
3
5
4
6
The library is still under development. Feedback, bug reports and extension requests are highly appreciated.
@@ -12,51 +14,47 @@ Nemesis contains implementations of the following attacks:
12
14
* Universal Perturbation ([Moosavi-Dezfooli et al., 2016](https://arxiv.org/abs/1610.08401))
13
15
* Virtual Adversarial Method ([Moosavi-Dezfooli et al., 2015](https://arxiv.org/abs/1507.00677))
14
16
* C&W Attack ([Carlini and Wagner, 2016](https://arxiv.org/abs/1608.04644))
17
+
* NewtonFool ([Jang et al., 2017](http://doi.acm.org/10.1145/3134600.3134635))
15
18
16
19
The following defense methods are also supported:
17
20
* Feature squeezing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
21
+
* Spatial smoothing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
18
22
* Label smoothing (Warde-Farley and Goodfellow, 2016)
19
23
* Adversarial training ([Szegedy et al., 2013](http://arxiv.org/abs/1312.6199))
20
24
* Virtual adversarial training ([Miyato et al., 2017](https://arxiv.org/abs/1704.03976))
21
25
22
26
## Setup
23
27
24
-
### Requirements
25
-
26
28
Nemesis is designed to run with Python 3 (and most likely Python 2 with small changes). You can either download the source code of Nemesis or clone the repository in your directory of choice:
To install the project dependencies, use the requirements file:
32
34
```bash
33
-
pip install -r requirements.txt
35
+
pip install .
34
36
```
35
37
36
-
You will additionally need to download [Cleverhans](https://github.com/tensorflow/cleverhans).
37
-
38
-
### Installation
38
+
The library comes with a basic set of unit tests. To check your install, you can run all the unit tests by calling in the Nemesis folder:
39
+
```bash
40
+
bash run_tests.sh
41
+
```
39
42
40
-
Nemesis is linked against Cleverhans through the configuration file `config/config.ini`. When installing Nemesis on your local machine, you need to set the appropriate paths and the `LOCAL` configuration profile as follows:
43
+
The configuration file `config/config.ini` allows to set custom paths for data. By default, data is downloaded in the `nemesis/data` folder as follows:
41
44
42
45
```text
43
46
[DEFAULT]
44
47
profile=LOCAL
45
48
46
49
[LOCAL]
47
-
data_path=/local/path/here
48
-
mnist_path=/local/path/here
49
-
cifar10_path=/local/path/here
50
-
stl10_path=/local/path/here
51
-
cleverhans_path=/local/path/here
50
+
data_path=./data
51
+
mnist_path=./data/mnist
52
+
cifar10_path=./data/cifar-10
53
+
stl10_path=./data/stl-10
52
54
```
53
55
54
56
If the datasets are not present at the indicated path, loading them will also download the data.
55
57
56
-
The library comes with a basic set of unit tests. To check that the installation has succeeded, you can run all the unit tests by calling in the Nemesis folder:
57
-
```bash
58
-
bash run_tests.sh
59
-
```
60
58
61
59
## Running Nemesis
62
60
@@ -66,11 +64,11 @@ The library contains three main scripts for:
66
64
* testing model accuracy on different test sets using (`test_accuracies.py`)
67
65
68
66
Detailed instructions for each script are available by typing
69
-
```python
67
+
```bash
70
68
python3 <script_name> -h
71
69
```
72
70
73
71
Some examples of how to use Nemesis when writing your own code can be found in the `examples` folder. See `examples/README.md` for more information about what each example does. To run an example, use the following command:
0 commit comments