Year: 2019

Abstract:
While deep neural networks have proven to be a powerful tool for many recognition and classification tasks, their stability properties are still not well understood. In the past, image classifiers have been shown to be vulnerable to so-called adversarial attacks, which are created by additively perturbing the correctly classified image. In this paper, we propose the ADef algorithm to construct a different kind of adversarial attack created by iteratively applying small deformations to the image, found through a gradient descent step. We demonstrate our results on MNIST with convolutional neural networks and on ImageNet with Inception-v3 and ResNet-101.

heading: 1 INTRODUCTION
text: In a first observation in Szegedy et al. (2013) it was found that deep neural networks exhibit unstable behavior to small perturbations in the input. For the task of image classification this means that two visually indistinguishable images may have very different outputs, resulting in one of them being misclassified even if the other one is correctly classified with high confidence. Since then, a lot of research has been done to investigate this issue through the construction of adversarial examples: given a correctly classified image x, we look for an image y which is visually indistinguishable from x but is misclassified by the network. Typically, the image y is constructed as y = x+ r, where r is an adversarial perturbation that is supposed to be small in a suitable sense (normally, with respect to an `p norm). Several algorithms have been developed to construct adversarial perturbations, see Goodfellow et al. (2014); Moosavi Dezfooli et al. (2016); Kurakin et al. (2017b); Madry et al. (2018); Carlini & Wagner (2017b) and the review paper Akhtar & Mian (2018).
Even though such pathological cases are very unlikely to occur in practice, their existence is relevant since malicious attackers may exploit this drawback to fool classifiers or other automatic systems. Further, adversarial perturbations may be constructed in a black-box setting (i.e., without knowing the architecture of the DNN but only its outputs) (Papernot et al., 2017; Moosavi-Dezfooli et al., 2017) and also in the physical world (Kurakin et al., 2017b; Athalye & Sutskever, 2017; Brown et al., 2017; Sharif et al., 2016). This has motivated the investigation of defenses, i.e., how to make the network invulnerable to such attacks, see Kurakin et al. (2017a); Carlini & Wagner (2017a); Madry et al. (2018); Tramèr et al. (2018); Wong & Kolter (2018); Raghunathan et al. (2018); Athalye et al. (2018); Kannan et al. (2018). In most cases, adversarial examples are artificially created and then used to retrain the network, which becomes more stable under these types of perturbations.
Most of the work on the construction of adversarial examples and on the design of defense strategies has been conducted in the context of small perturbations r measured in the `∞ norm. However, this is not necessarily a good measure of image similarity: e.g., for two translated images x and y, the norm of x−y is not small in general, even though x and y will look indistinguishable if the translation is small. Several papers have investigated the construction of adversarial perturbations not designed
for norm proximity (Rozsa et al., 2016; Sharif et al., 2016; Brown et al., 2017; Engstrom et al., 2017; Xiao et al., 2018).
In this work, we build up on these ideas and investigate the construction of adversarial deformations. In other words, the misclassified image y is not constructed as an additive perturbation y = x + r, but as a deformation y = x ◦ (id + τ), where τ is a vector field defining the transformation. In this case, the similarity is not measured through a norm of y−x, but instead through a norm of τ , which quantifies the deformation between y and x.
We develop an efficient algorithm for the construction of adversarial deformations, which we call ADef. It is based on the main ideas of DeepFool (Moosavi Dezfooli et al., 2016), and iteratively constructs the smallest deformation to misclassify the image. We test the procedure on MNIST (LeCun) (with convolutional neural networks) and on ImageNet (Russakovsky et al., 2015) (with Inception-v3 (Szegedy et al., 2016) and ResNet-101 (He et al., 2016)). The results show that ADef can succesfully fool the classifiers in the vast majority of cases (around 99%) by using very small and imperceptible deformations. We also test our adversarial attacks on adversarially trained networks for MNIST. Our implementation of the algorithm can be found at https://gitlab.math. ethz.ch/tandrig/ADef.
The results of this work have initially appeared in the master’s thesis Gauksson (2017), to which we refer for additional details on the mathematical aspects of this construction. While writing this paper, we have come across Xiao et al. (2018), in which a similar problem is considered and solved with a different algorithm. Whereas in Xiao et al. (2018) the authors use a second order solver to find a deforming vector field, we show how a first order method can be formulated efficiently and justify a smoothing operation, independent of the optimization step. We report, for the first time, success rates for adversarial attacks with deformations on ImageNet. The topic of deformations has also come up in Jaderberg et al. (2015), in which the authors introduce a class of learnable modules that deform inputs in order to increase the performance of existing DNNs, and Fawzi & Frossard (2015), in which the authors introduce a method to measure the invariance of classifiers to geometric transformations.

heading: 2 ADVERSARIAL DEFORMATIONS

heading: 2.1 ADVERSARIAL PERTURBATIONS
text: Let K be a classifier of images consisting of P pixels into L ≥ 2 categories, i.e. a function from the space of images X = RcP , where c = 1 (for grayscale images) or c = 3 (for color images), and into the set of labels L = {1, . . . , L}. Suppose x ∈ X is an image that is correctly classified by K and suppose y ∈ X is another image that is imperceptible from x and such that K(y) 6= K(x), then y is said to be an adversarial example. The meaning of imperceptibility varies, but generally, proximity in `p-norm (with 1 ≤ p ≤ ∞) is considered to be a sufficient substitute. Thus, an adversarial perturbation for an image x ∈ X is a vector r ∈ X such that K(x+ r) 6= K(x) and ‖r‖p is small, where
‖r‖p =  cP∑ j=1 |rj |p 1/p if 1 ≤ p <∞, and ‖r‖∞ = maxj=1,...,cP |rj | . (1)
Given such a classifier K and an image x, an adversary may attempt to find an adversarial example y by minimizing ‖x− y‖p subject to K(y) 6= K(x), or even subject to K(y) = k for some target label k 6= K(x). Different methods for finding minimal adversarial perturbations have been proposed, most notably FGSM (Goodfellow et al., 2014) and PGD (Madry et al., 2018) for `∞, and the DeepFool algorithm (Moosavi Dezfooli et al., 2016) for general `p-norms.

heading: 2.2 DEFORMATIONS
text: Instead of constructing adversarial perturbations, we intend to fool the classifier by small deformations of correctly classified images. Our procedure is in the spirit of the DeepFool algorithm. Before we explain it, let us first clarify what we mean by a deformation of an image. The discussion is at first more intuitive if we model images as functions ξ : [0, 1]2 → Rc (with c = 1 or c = 3) instead
of discrete vectors x in RcP . In this setting, perturbing an image ξ : [0, 1]2 → Rc corresponds to adding to it another function ρ : [0, 1]2 → Rc with a small Lp-norm. While any transformation of an image ξ can be written as a perturbation ξ + ρ, we shall restrict ourselves to a particular class of transformations. A deformation with respect to a vector field τ : [0, 1]2 → R2 is a transformation of the form ξ 7→ ξτ , where for any image ξ : [0, 1]2 → Rc, the image ξτ : [0, 1]2 → Rc is defined by
ξτ (u) = ξ (u+ τ(u)) for all u ∈ [0, 1]2, extending ξ by zero outside of [0, 1]2. Deformations capture many natural image transformations. For example, a translation of the image ξ by a vector v ∈ R2 is a deformation with respect to the constant vector field τ = v. If v is small, the images ξ and ξv may look similar, but the corresponding perturbation ρ = ξv − ξ may be arbitrarily large in the aforementioned Lp-norms. Figure 1 shows three minor deformations, all of which yield large L∞-norms.
In the discrete setting, deformations are implemented as follows. We consider square images of W ×W pixels and define the space of images to be X = ( RW×W )c . A discrete vector field is a function τ : {1, . . . ,W}2 → R2. In what follows we will only consider the set T of vector fields that do not move points on the grid {1, . . . ,W}2 outside of [1,W ]2. More precisely,
T := { τ : {1, . . . ,W}2 → R2 | τ(s, t) + (s, t) ∈ [1,W ]2 for all s, t ∈ {1, . . . ,W} } .
An image x ∈ X can be viewed as the collection of values of a function ξ : [0, 1]2 → Rc on a regular grid {1/(W+1), . . . ,W/(W+1)}2 ⊆ [0, 1]2, i.e. xs,t = ξ(s/(W+1), t/(W+1)) for s, t = 1, . . . ,W . Such a function ξ can be computed by interpolating from x. Thus, the deformation of an image x with respect to the discrete vector field τ can be defined as the discrete deformed image xτ in X by
xτs,t = ξ
( (s, t) + τ(s, t)
W + 1
) , s, t ∈ {1, . . . ,W}. (2)
It is not straightforward to measure the size of a deformation such that it captures the visual difference between the original image x and its deformed counterpart xτ . We will use the size of the
corresponding vector field, τ , in the norm defined by
‖τ‖T = maxs,t=1,...,W ‖τ(s, t)‖2 (3)
as a proxy. The `p-norms defined in (1), adapted to vector fields, can be used as well. (We remark, however, that none of these norms define a distance between x and xτ , since two vector fields τ, σ ∈ T with ‖τ‖T 6= ‖σ‖T may produce the same deformed image xτ = xσ .)

heading: 2.3 THE ALGORITHM ADEF
text: We will now describe our procedure for finding deformations that will lead a classifier to yield an output different from the original label.
Let F = (F1, . . . , FL) : X → RL be the underlying model for the classifier K, such that K(x) = argmax
k=1,...,L Fk(x).
Let x ∈ X be the image of interest and fix ξ : [0, 1]2 → Rc obtained by interpolation from x. Let l = K(x) denote the true label of x, let k ∈ L be a target label and set f = Fk − Fl. We assume that x does not lie on a decision boundary, so that we have f(x) < 0.
We define the function g : T → R, τ 7→ f(xτ ) and note that g(0) = f(x0) = f(x) < 0. Our goal is to find a small vector field τ ∈ T such that g(τ) = f(xτ ) ≥ 0. We can use a linear approximation of g around the zero vector field as a guide:
g(τ) ≈ g(0) + (D0g) τ (4) for small enough τ ∈ T and D0g : T → R the derivative of g at τ = 0. Hence, if τ is a vector field such that (D0g) τ = −g(0) (5) and ‖τ‖T is small, then the classifier K has approximately equal confidence for the deformed image xτ to have either label l or k. This is a scalar equation with unknown in T , and so has infinitely many solutions. In order to select τ with small norm, we solve it in the least-squares sense.
In view of (2), we have ∂x τ ∂τ |τ=0(s, t) = 1W+1∇ξ ( (s,t) W+1 ) ∈ Rc×2. Thus, by applying the chain rule to g(τ) = f(xτ ), we obtain that its derivative at τ = 0 can, with a slight abuse of notation, be identified with the vector field
D0g(s, t) = 1
W + 1
( ∇f(x) ) s,t ∇ξ ( (s, t)
W + 1
) , (6)
where ( ∇f(x) ) s,t ∈ R1×c is the derivative of f in x calculated at (s, t). With this, (D0g) τ stands
for ∑W s,t=1 D0g(s, t) · τ(s, t), and the solution to (5) in the least-square sense is given by
τ = − f(x)∑W s,t=1 |D0g(s, t)|2 D0g. (7)
Finally, we define the deformed image xτ ∈ X according to (2). One might like to impose some degree of smoothness on the deforming vector field. In fact, it suffices to search in the range of a smoothing operator S : T → T . However, this essentially amounts to applying S to the solution from the larger search space T . Let α = S(D0g) = ϕ∗(D0g), where S denotes the componentwise application of a two-dimensional Gaussian filter ϕ (of any standard deviation). Then the vector field
τ̃ = − f(x)∑W s,t=1 |α(s, t)|2 Sα = − f(x)∑W s,t=1 |α(s, t)|2 S2(D0g)
also satisfies (5), since S is self-adjoint. We can hence replace τ by τ̃ to obtain a smooth deformation of the image x.
We iterate the deformation process until the deformed image is misclassified. More explicitly, let x(0) = x and for n ≥ 1 let τ (n) be given by (7) for x(n−1). Then we can define the iteration as
x(n) = x(n−1) ◦ (id+ τ (n)). The algorithm terminates and outputs an adversarial example y = x(n) if K(x(n)) 6= l. The iteration also terminates if x(n) lies on a decision boundary of K, in which case we propose to introduce an overshoot factor 1+η on the total deforming vector field. Provided that the number of iterations is moderate, the total vector field can be well approximated by τ∗ = τ (1)+· · ·+τ (n) and the process can be altered to output the deformed image y = x◦(id+(1+η)τ∗) instead.
The target label k may be chosen in each iteration to minimize the vector field to obtain a better approximation in the linearization (4). More precisely, for a candidate set of labels k1, . . . , km, we compute the corresponding vectors fields τ1, . . . , τm and select
k = argmin j=1,...,m
‖τj‖T .
The candidate set consists of the labels corresponding to the indices of the m smallest entries of F − Fl, in absolute value.
Algorithm ADef Input: Classification model F , image x, correct label l, candidate labels k1, . . . , km Output: Deformed image y
Initialize y ← x while K(y) = l do
for j = 1, . . . ,m do αj ← S (∑c i=1 ( (∇Fkj )i − (∇Fl)i ) · ∇yi ) τj ← − Fkj (y)−Fl(y) ‖αj‖2 `2 Sαj end for i← argminj=1,...,m ‖τj‖T y ← y ◦ (id + τi)
end while return y
By equation (6), provided that ∇f is moderate, the deforming vector field takes small values wherever ξ has a small derivative. This means that the vector field will be concentrated on the edges in the image x (see e.g. the first row of figure 2). Further, note that the result of a deformation is always a valid image in the sense that it does not violate the pixel value bounds. This is not guaranteed for the perturbations computed with DeepFool.

heading: 3 EXPERIMENTS

heading: 3.1 SETUP
text: We evaluate the performance of ADef by applying the algorithm to classifiers trained on the MNIST (LeCun) and ImageNet (Russakovsky et al., 2015) datasets. Below, we briefly describe the setup of the experiments and in tables 1 and 2 we summarize their results.
MNIST: We train two convolutional neural networks based on architectures that appear in Madry et al. (2018) and Tramèr et al. (2018) respectively. The network MNIST-A consists of two convolutional layers of sizes 32 × 5 × 5 and 64 × 5 × 5, each followed by 2 × 2 max-pooling and a rectifier activation function, a fully connected layer into dimension 1024 with a rectifier activation function, and a final linear layer with output dimension 10. The network MNIST-B consists of two convolutional layers of sizes 128× 3× 3 and 64× 3× 3 with a rectifier activation function, a fully connected layer into dimension 128 with a rectifier activation function, and a final linear layer with output dimension 10. During training, the latter convolutional layer and the former fully connected layer of MNIST-B are subject to dropout of drop probabilities 1/4 and 1/2. We use ADef to produce adversarial deformations of the images in the test set. The algorithm is configured to pursue any label different from the correct label (all incorrect labels are candidate labels). It performs smoothing by a Gaussian filter of standard deviation 1/2, uses bilinear interpolation to obtain intermediate pixel intensities, and it overshoots by η = 2/10 whenever it converges to a decision boundary.
Original: orangutan Deformed: chimpanzee
T : 0.395
Vector field
`∞: 0.121
Perturbation Close-up
Original: orangutan Deformed: chimpanzee
T : 1.273
Vector field
`∞: 0.276
Perturbation Close-up
Figure 2: Sample deformations for the Inception-v3 model. The vector fields and perturbations have been amplified for visualization. First row: An image from the ILSVRC2012 validation set, the output of ADef with a Gaussian filter of standard deviation 1, the corresponding vector field and perturbation. The rightmost image is a close-up of the vector field around the nose of the ape. Second row: A larger deformation of the same image, obtained by using a wider Gaussian filter (standard deviation 6) for smoothing.
ImageNet: We apply ADef to pretrained Inception-v3 (Szegedy et al., 2016) and ResNet-101 (He et al., 2016) models to generate adversarial deformations for the images in the ILSVRC2012 validation set. The images are preprocessed by first scaling so that the smaller axis has 299 pixels for the Inception model and 224 pixels for ResNet, and then they are center-cropped to a square image. The algorithm is set to focus only on the label of second highest probability. It employs a Gaussian filter of standard deviation 1, bilinear interpolation, and an overshoot factor η = 1/10.
We only consider inputs that are correctly classified by the model in question, and, since τ∗ = τ (1)+· · ·+τ (n) approximates the total deforming vector field, we declare ADef to be successful if its output is misclassified and ‖τ∗‖T ≤ ε, where we choose ε = 3. Observe that, by (3), a deformation with respect to a vector field τ does not displace any pixel further away from its original position than ‖τ‖T . Hence, for high resolution images, the choice ε = 3 indeed produces small deformations if the vector fields are smooth. In appendix A, we illustrate how the success rate of ADef depends on the choice of ε.
When searching for an adversarial example, one usually searches for a perturbation with `∞-norm smaller than some small number ε > 0. Common choices of ε range from 1/10 to 3/10 for MNIST
classifiers (Goodfellow et al., 2014; Madry et al., 2018; Wong & Kolter, 2018; Tramèr et al., 2018; Kannan et al., 2018) and 2/255 to 16/255 for ImageNet classifiers (Goodfellow et al., 2014; Kurakin et al., 2017a; Tramèr et al., 2018; Kannan et al., 2018). Table 1 shows that on average, the perturbations obtained by ADef are quite large compared to those constraints. However, as can be seen in figure 2, the relatively high resolution images of the ImageNet dataset can be deformed into adversarial examples that, while corresponding to large perturbations, are not visibly different from the original images. In appendices B and C, we give more examples of adversarially deformed images.

heading: 3.2 ADVERSARIAL TRAINING
text: In addition to training MNIST-A and MNIST-B on the original MNIST data, we train independent copies of the networks using the adversarial training procedure described by Madry et al. (2018). That is, before each step of the training process, the input images are adversarially perturbed using the PGD algorithm. This manner of training provides increased robustness against adversarial perturbations of low `∞-norm. Moreover, we train networks using ADef instead of PGD as an adversary. In table 2 we show the results of attacking these adversarially trained networks, using ADef on the one hand, and PGD on the other. We use the same configuration for ADef as above, and for PGD we use 40 iterations, step size 1/100 and 3/10 as the maximum `∞-norm of the perturbation. Interestingly, using these configurations, the networks trained against PGD attacks are more resistant to adversarial deformations than those trained against ADef.

heading: 3.3 TARGETED ATTACKS
text: ADef can also be used for targeted adversarial attacks, by restricting the deformed image to have a particular target label instead of any label which yields the optimal deformation. Figure 3 demonstrates the effect of choosing different target labels for a given MNIST image, and figure 4 shows the result of targeting the label of lowest probability for an image from the ImageNet dataset.

heading: 4 CONCLUSION
text: In this work, we proposed a new efficient algorithm, ADef, to construct a new type of adversarial attacks for DNN image classifiers. The procedure is iterative and in each iteration takes a gradient descent step to deform the previous iterate in order to push to a decision boundary.
We demonstrated that with almost imperceptible deformations, state-of-the art classifiers can be fooled to misclassify with a high success rate of ADef. This suggests that networks are vulnerable to different types of attacks and that simply training the network on a specific class of adversarial examples might not form a sufficient defense strategy. Given this vulnerability of neural networks to deformations, we wish to study in future work how ADef can help for designing possible defense strategies. Furthermore, we also showed initial results on fooling adversarially trained networks. Remarkably, PGD trained networks on MNIST are more resistant to adversarial deformations than ADef trained networks. However, for this result to be more conclusive, similar tests on ImageNet will have to be conducted. We wish to study this in future work.

heading: ACKNOWLEDGMENTS
text: The authors would like to thank Helmut Bölcskei and Thomas Wiatowski for fruitful discussions.

heading: A DISTRIBUTION OF VECTOR FIELD NORMS
text: Figures 5 and 6 show the distribution of the norms of the total deforming vector fields, τ∗, from the experiments in section 3. For networks that have not been adversarially trained, most deformations fall well below the threshold of = 3. Out of the adversarially trained networks, only MNIST-A trained against PGD is truly robust against ADef. Further, a comparison between the first column of figure 5 and figure 6 indicates that ImageNet is much more vulnerable to adversarial deformations than MNIST, also considering the much higher resolution of the images in ImageNet. Thus, it would be very interesting to study the performance of ADef with adversarially trained network for ImageNet, as mentioned in the Conclusion.

heading: B SMOOTH DEFORMATIONS
text: The standard deviation of the Gaussian filter used for smoothing in the update step of ADef has significant impact on the resulting vector field. To explore this aspect of the algorithm, we repeat the experiment from section 3 on the Inception-v3 model, using standard deviations σ = 0, 1, 2, 4, 8 (where σ = 0 stands for no smoothing). The results are shown in table 3, and the effect of varying σ is illustrated in figures 7 and 8. We observe that as σ increases, the adversarial distortion steadily increases both in terms of vector field norm and perturbation norm. Likewise, the success rate of ADef decreases with larger σ. However, from figure 8 we see that the constraint ‖τ∗‖T ≤ 3 on the total vector field may provide a rather conservative measure of the effectiveness of ADef in the case of smooth high dimensional vector fields.

heading: C ADDITIONAL DEFORMED IMAGES
text: C.1 MNIST
Figures 9 and 10 show adversarial deformations for the models MNIST-A and MNIST-B, respectively. The attacks are performed using the same configuration as in the experiments in section 3. Observe that in some cases, features resembling the target class have appeared in the deformed image. For example, the top part of the 4 in the fifth column of figure 10 has been curved slightly to more resemble a 9.
C.2 IMAGENET
Figures 11 – 15 show additional deformed images resulting from attacking the Inception-v3 model using the same configuration as in the experiments in section 3. Similarly, figures 16 – 20 show deformed images resulting from attacking the ResNet-10 model. However, in order to increase variability in the output labels, we perform a targeted attack, targeting the label of 50th highest probability.

Review summaries:
The paper introduces an iterative method to generate deformed images for adversarial attack. The core idea is to perturb the correctly classified image by iteratively applying small deformations, which are estimated based on a first-order approximation step, until the image is misclassified. Experimental results on several benchmark datasets (MNIST, ImageNet) and commonly used deep nets (CNN, ResNet, Inception) are reported to show the power of adversarial deformations.