Skip to content

Commit 070bf75

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Merge branch 'master' into release
Changes: - Add logging - Add PGD evasion attack - Add thermometer encoding in defences - Change adversarial trainer to match Madry setup - Update examples and notebooks - Add visualization module Conflicts: art/classifiers/utils.py art/poison_detection/clustering_handler.py examples/README.md
2 parents 84716ce + 5e6d3b6 commit 070bf75

File tree

71 files changed

+2391
-775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2391
-775
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,32 @@ The library is still under development. Feedback, bug reports and extensions are
77

88
## Supported attack and defense methods
99

10-
The library contains implementations of the following attacks:
10+
The library contains implementations of the following **evasion attacks**:
1111
* DeepFool ([Moosavi-Dezfooli et al., 2015](https://arxiv.org/abs/1511.04599))
1212
* Fast Gradient Method ([Goodfellow et al., 2014](https://arxiv.org/abs/1412.6572))
1313
* Basic Iterative Method ([Kurakin et al., 2016](https://arxiv.org/abs/1607.02533))
14+
* Projected Gradient Descent ([Madry et al., 2017](https://arxiv.org/abs/1706.06083))
1415
* Jacobian Saliency Map ([Papernot et al., 2016](https://arxiv.org/abs/1511.07528))
1516
* Universal Perturbation ([Moosavi-Dezfooli et al., 2016](https://arxiv.org/abs/1610.08401))
1617
* Virtual Adversarial Method ([Miyato et al., 2015](https://arxiv.org/abs/1507.00677))
1718
* C&W Attack ([Carlini and Wagner, 2016](https://arxiv.org/abs/1608.04644))
1819
* NewtonFool ([Jang et al., 2017](http://doi.acm.org/10.1145/3134600.3134635))
1920

20-
The following defense methods are also supported:
21+
The following **defence** methods are also supported:
2122
* Feature squeezing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
2223
* Spatial smoothing ([Xu et al., 2017](http://arxiv.org/abs/1704.01155))
2324
* Label smoothing ([Warde-Farley and Goodfellow, 2016](https://pdfs.semanticscholar.org/b5ec/486044c6218dd41b17d8bba502b32a12b91a.pdf))
2425
* Adversarial training ([Szegedy et al., 2013](http://arxiv.org/abs/1312.6199))
2526
* Virtual adversarial training ([Miyato et al., 2015](https://arxiv.org/abs/1507.00677))
2627
* Gaussian data augmentation ([Zantedeschi et al., 2017](https://arxiv.org/abs/1707.06728))
28+
* Thermometer encoding ([Buckman et al., 2018](https://openreview.net/forum?id=S18Su--CW))
29+
30+
ART also implements **detection** methods of adversarial samples:
31+
* Basic detector based on inputs
32+
* Detector trained on the activations of a specific layer
33+
34+
The following **detector of poisoning attacks** is also supported:
35+
* Detector based on activations analysis
2736

2837
## Setup
2938

art/__init__.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1+
import json
2+
import logging
3+
import logging.config
14
import os
25

3-
import json
6+
from numpy import float32
7+
8+
LOGGING = {
9+
'version': 1,
10+
'disable_existing_loggers': False,
11+
'formatters': {
12+
'std': {
13+
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s',
14+
'datefmt': '%Y-%m-%d %H:%M'
15+
}
16+
},
17+
'handlers': {
18+
'default': {
19+
'class': 'logging.NullHandler',
20+
},
21+
'test': {
22+
'class': 'logging.StreamHandler',
23+
'formatter': 'std',
24+
'level': logging.DEBUG
25+
}
26+
},
27+
'loggers': {
28+
'': {
29+
'handlers': ['default']
30+
},
31+
'testLogger': {
32+
'handlers': ['test'],
33+
'level': 'INFO',
34+
'propagate': True
35+
}
36+
}
37+
}
38+
logging.config.dictConfig(LOGGING)
39+
logger = logging.getLogger(__name__)
440

541
_folder = os.path.expanduser('~')
642
if not os.access(_folder, os.W_OK):
@@ -19,8 +55,7 @@
1955
try:
2056
os.makedirs(_folder)
2157
except OSError:
22-
# Log warning here
23-
pass
58+
logger.warning('Unable to create folder for configuration file.', exc_info=True)
2459

2560
if not os.path.exists(_config_path):
2661
# Generate default config
@@ -30,8 +65,9 @@
3065
with open(_config_path, 'w') as f:
3166
f.write(json.dumps(_config, indent=4))
3267
except IOError:
33-
# Log warning here
34-
pass
68+
logger.warning('Unable to create configuration file', exc_info=True)
3569

3670
if 'DATA_PATH' in _config:
3771
DATA_PATH = _config['DATA_PATH']
72+
73+
NUMPY_DTYPE = float32

art/attacks/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from art.attacks.fast_gradient import FastGradientMethod
88
from art.attacks.iterative_method import BasicIterativeMethod
99
from art.attacks.newtonfool import NewtonFool
10+
from art.attacks.projected_gradient_descent import ProjectedGradientDescent
1011
from art.attacks.saliency_map import SaliencyMapMethod
1112
from art.attacks.universal_perturbation import UniversalPerturbation
1213
from art.attacks.virtual_adversarial import VirtualAdversarialMethod

0 commit comments

Comments
 (0)