Skip to content

Commit 18dc124

Browse files
authored
Merge pull request #906 from Trusted-AI/dev_1.5.2
Update to ART 1.5.2
2 parents ad42a79 + ed65718 commit 18dc124

35 files changed

+558
-192
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,45 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
include:
28-
- name: TensorFlow 1.15.4 (Keras 2.2.5 Python 3.7)
28+
- name: TensorFlow 1.15.5 (Keras 2.2.5 Python 3.7)
2929
framework: tensorflow
3030
python: 3.7
31-
tensorflow: 1.15.4
31+
tensorflow: 1.15.5
3232
tf_version: v1
3333
keras: 2.2.5
34-
- name: TensorFlow 2.2.0 (Keras 2.3.1 Python 3.7)
34+
- name: TensorFlow 2.2.2 (Keras 2.3.1 Python 3.7)
3535
framework: tensorflow
3636
python: 3.7
37-
tensorflow: 2.2.0
37+
tensorflow: 2.2.2
3838
tf_version: v2
3939
keras: 2.3.1
40-
- name: TensorFlow 2.2.0v1 (Keras 2.3.1 Python 3.7)
40+
- name: TensorFlow 2.2.2v1 (Keras 2.3.1 Python 3.7)
4141
framework: tensorflow2v1
4242
python: 3.7
43-
tensorflow: 2.2.0
43+
tensorflow: 2.2.2
4444
tf_version: v2
4545
keras: 2.3.1
46-
- name: TensorFlow 2.3.1 (Keras 2.4.3 Python 3.7)
46+
- name: TensorFlow 2.3.2 (Keras 2.4.3 Python 3.7)
4747
framework: tensorflow
4848
python: 3.7
49-
tensorflow: 2.3.1
49+
tensorflow: 2.3.2
5050
tf_version: v2
5151
keras: 2.4.3
52-
- name: TensorFlow 2.4.0rc3 (Keras 2.4.3 Python 3.8)
52+
- name: TensorFlow 2.4.1 (Keras 2.4.3 Python 3.8)
5353
framework: tensorflow
5454
python: 3.8
55-
tensorflow: 2.4.0rc3
55+
tensorflow: 2.4.1
5656
tf_version: v2
5757
keras: 2.4.3
5858
- name: Keras 2.3.1 (TensorFlow 2.2.1 Python 3.7)
5959
framework: keras
6060
python: 3.7
6161
tensorflow: 2.2.1
6262
keras: 2.3.1
63-
- name: TensorFlow-Keras 2.3.1 (Keras 2.4.3 Python 3.7)
63+
- name: TensorFlow-Keras 2.3.2 (Keras 2.4.3 Python 3.7)
6464
framework: kerastf
6565
python: 3.7
66-
tensorflow: 2.3.1
66+
tensorflow: 2.3.2
6767
keras: 2.4.3
6868
- name: PyTorch (Python 3.7)
6969
framework: pytorch
@@ -85,10 +85,10 @@ jobs:
8585
tensorflow: 2.2.1
8686
keras: 2.3.1
8787
scikit-learn: 0.22.2
88-
- name: legacy (TensorFlow 2.3.1 Keras 2.4.3 scikit-learn 0.23.2 Python 3.8)
88+
- name: legacy (TensorFlow 2.3.2 Keras 2.4.3 scikit-learn 0.23.2 Python 3.8)
8989
framework: legacy
9090
python: 3.8
91-
tensorflow: 2.3.1
91+
tensorflow: 2.3.2
9292
keras: 2.4.3
9393
scikit-learn: 0.23.2
9494

@@ -143,7 +143,7 @@ jobs:
143143
run: |
144144
sudo apt-get update
145145
sudo apt-get -y -q install ffmpeg libavcodec-extra
146-
pip install tensorflow==2.2.0
146+
pip install tensorflow==2.2.2
147147
pip install keras==2.3.1
148148
- name: Install Dependencies
149149
run: |

art/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from art import wrappers
1212

1313
# Semantic Version
14-
__version__ = "1.5.1"
14+
__version__ = "1.5.2-dev"
1515

1616
# pylint: disable=C0103
1717

art/attacks/evasion/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from art.attacks.evasion.adversarial_patch.adversarial_patch import AdversarialPatch
55
from art.attacks.evasion.adversarial_patch.adversarial_patch_numpy import AdversarialPatchNumpy
66
from art.attacks.evasion.adversarial_patch.adversarial_patch_tensorflow import AdversarialPatchTensorFlowV2
7+
from art.attacks.evasion.adversarial_asr import CarliniWagnerASR
78
from art.attacks.evasion.auto_attack import AutoAttack
89
from art.attacks.evasion.auto_projected_gradient_descent import AutoProjectedGradientDescent
910
from art.attacks.evasion.brendel_bethge import BrendelBethgeAttack

art/attacks/evasion/adversarial_patch/adversarial_patch.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,14 @@ def generate(self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> T
127127
128128
:param x: An array with the original input images of shape NHWC or NCHW or input videos of shape NFHWC or NFCHW.
129129
:param y: An array with the original true labels.
130-
:param mask: An boolean array of shape equal to the shape of a single samples (1, H, W) or the shape of `x`
130+
:param mask: A boolean array of shape equal to the shape of a single samples (1, H, W) or the shape of `x`
131131
(N, H, W) without their channel dimensions. Any features for which the mask is True can be the
132132
center location of the patch during sampling.
133133
:type mask: `np.ndarray`
134+
:param reset_patch: If `True` reset patch to initial values of mean of minimal and maximal clip value, else if
135+
`False` (default) restart from previous patch values created by previous call to `generate`
136+
or mean of minimal and maximal clip value if first call to `generate`.
137+
:type reset_patch: bool
134138
:return: An array with adversarial patch and an array of the patch mask.
135139
"""
136140
logger.info("Creating adversarial patch.")
@@ -157,6 +161,14 @@ def apply_patch(self, x: np.ndarray, scale: float, patch_external: Optional[np.n
157161
"""
158162
return self._attack.apply_patch(x, scale, patch_external=patch_external)
159163

164+
def reset_patch(self, initial_patch_value: Optional[Union[float, np.ndarray]]) -> None:
165+
"""
166+
Reset the adversarial patch.
167+
168+
:param initial_patch_value: Patch value to use for resetting the patch.
169+
"""
170+
self._attack.reset_patch(initial_patch_value=initial_patch_value)
171+
160172
def set_params(self, **kwargs) -> None:
161173
super().set_params(**kwargs)
162174
self._attack.set_params(**kwargs)

0 commit comments

Comments
 (0)