1 of 50

Protecting JPEG images against

adversarial attacks

Data Compression Conference �2018

Aaditya Prakash, Nick Moran, Solomon Garber, Antonella DiLillo and James Storer�Brandeis University

2 of 50

Image consumption

3 of 50

Image consumption

4 of 50

Adversarial Attack

Predicted: Indian Elephant (99.7%)

Original Image

5 of 50

Adversarial Attack

Predicted: Guacamole (99.9%)

Predicted: Indian Elephant (99.7%)

Original Image

Adversarial Image

6 of 50

Adversarial Attack

- With cleverly designed additive noise the classification of the image can be changed�- It is easy to find noise which makes the classifier predict any given class - Targeted attack

Predicted: Indian Elephant (99.7%)

Predicted: Guacamole (99.9%)

Original Image

Perturbations

Adversarial Image

7 of 50

CNNs are used in critical applications

8 of 50

Standard Convolutional Neural Network

9 of 50

Backpropagation

- Find the gradient (∇) with respect to the loss function, which is a measure of true vs predicted values.

10 of 50

Gradient Descent

- Update the parameters with small value (η) in the direction which decreases the loss

11 of 50

Gradient ascent attack

- Update the image with small value (ϵ) but in the direction which increases the loss

12 of 50

Gradient ascent attack

- Update the image with small value (ϵ) but in the direction which increases the loss

13 of 50

Various attack models

- Gradient Attack

- Fast Gradient Sign Method

- Iterated Gradient Sign Method

- Deep Fool

- JSMA

- L-BFGS

(and many more since we wrote our paper)

14 of 50

Various types of adversarial perturbations

One of the most popular attack is - Fast Gradient Sign Method (FGSM)

It is very efficient and but requires higher ϵ value compared to other techniques.

Iterative version of this method is called Iterated Gradient Sign Method (IGSM)

For every iteration the image is clipped to be within ±ϵ, thus the process is slow but generates more robust adversarial images.

Details of other attacks like JSMA and DeepFool are included in our paper.

15 of 50

Defending against adversarial attacks

16 of 50

Defending against adversarial attacks

Make models harder to attack�(robust classifiers, detectors, adversarial-training)

Better Model

17 of 50

Defending against adversarial attacks

Make models harder to attack�(robust classifiers, detectors, adversarial-training)

Remove perturbations from adversarial images

Remove perturbation

18 of 50

Defending against adversarial attacks

Make models harder to attack�(robust classifiers, detectors, adversarial-training)

Remove perturbations from adversarial images

Image transformations�(crop,reconstruct, pixel-deflection)

Denoising�(quantization, smoothing, shrinkage)

Remove perturbation

19 of 50

Defending against adversarial attacks

Make models harder to attack�(robust classifiers, detectors, adversarial-training)

Remove perturbations from adversarial images

Denoising�(quantization, smoothing, shrinkage)

Image transformations�(crop,reconstruct, pixel-deflection)

Remove perturbation

20 of 50

JPEG as a possible defense

21 of 50

JPEG as a possible defense

22 of 50

JPEG as a possible defense

Predicted: Indian Elephant (99.7%)

Original Image

Adversarial Image

Adversarial Image after JPEG

Guacamole (99.9%)

Indian Elephant (21.1%)

23 of 50

But JPEG has its limitations

80%

20%

75

50

25

JPEG Quantization Level

Classification Accuracy

24 of 50

But JPEG has its limitations

  • Recovery of classification accuracy is limited.�
  • Negatively impacts clean images - images which have not been perturbed.�
  • Optimum quantization value is not universal across attacks.�
  • Recovery is worse on stronger attacks.�
  • Works well with small perturbations only.

80%

20%

75

50

25

JPEG Quantization Level

Classification Accuracy

25 of 50

JPEG is not the best defense

Better than JPEG

26 of 50

Why do we care about JPEG?

- Fast decoding available in virtually all devices

- Deep Learning datasets already store images as JPEG � �

- JPEG defenses provide adequate visual quality

27 of 50

Attacks are agnostic to object location

FGSM

IGSM

DeepFool

low

high

Average location of adversarial perturbations

28 of 50

Object localization

  • Class activation map is the obtained by taking the output of GAP and learning weights that maximize the discriminative activations for a given class.
  • Widely used to for discriminative localization
  • Is good only for one object - the class label of the image

GAP�Global Activation Pooling

29 of 50

Semantic contents are localized

low

high

30 of 50

Semantic contents are localized

low

high

31 of 50

Semantic contents are localized

low

high

32 of 50

Semantic contents are localized

low

high

33 of 50

Semantic contents are localized

low

high

34 of 50

Semantic contents are localized

low

high

35 of 50

Semantic contents are localized

low

high

36 of 50

Semantic contents are localized

low

high

37 of 50

Semantic contents are localized

low

high

38 of 50

Where are the attacks located?

FGSM

IGSM

DeepFool

Natural Images

low

high

39 of 50

Key to improving JPEG's ability to defend

JPEG helps

Attacks are content blind

Semantic JPEG

40 of 50

Key to improving JPEG's ability to defend

JPEG with semantic quantization - DCC 2017

Soon to be available in Firefox browser

41 of 50

MSROI - DCC 2017

MSROI Map

is learned for every class c and for layer ‘d’

where

CAM

Advantage

  • MSROI - extracts all salient objects in the given image
  • Thus, more useful for image compression

Disadvantage

  • Uses classes of the object to get the map
  • Thus susceptible to adversarial attack

Boy's face and hand (only captured by our method)

Boy's face and hand (only captured by our method)

42 of 50

Making MSROI secure against adversary

MSROI on �Clean Image

MSROI on �Adversarial Image

43 of 50

Making MSROI secure against adversary

MSROI on �Clean Image

MSROI on �Adversarial Image

Various perturbations with Augmented MSROI

44 of 50

Making MSROI secure against adversary

MSROI on �Clean Image

MSROI on �Adversarial Image

Aug-MSROI on �Adversarial Image

Various perturbations with Augmented MSROI

45 of 50

Making MSROI secure against adversary

MSROI

Augmented MSROI

where, ∆ is random perturbation

- Aug MSROI is average of maps over several perturbations.

- Random perturbation helps overcome changes in the activation due to adversarial input

- Classifiers are robust enough that small perturbations do not change the overall class of the image

46 of 50

JPEG Encoder

Qhigh

JPEG Encoder

Qlow

JPEG Encoder

JPEG Encoder

JPEG Encoder

Qmedium

JPEG Encoder

Qfinal

Variable ‘Q’ JPEG

Bins

Bins

47 of 50

Aug MSROI - Accuracy

Predicted: Indian Elephant (99.7%)

Guacamole (99.9%)

Indian Elephant (21.1%)

Indian Elephant (70.3%)

Original Image

Adversarial Image

Adversarial Image �after JPEG

Adversarial Image �after Aug-MSROI

48 of 50

Aug MSROI - Accuracy

49 of 50

Aug MSROI - Image quality vs Accuracy

PSNR

Accuracy

Aug-MSROI JPEG�Standard JPEG

50 of 50

Summary

Thank You

Code: github.com/iamaaditya/protecting-jpeg

Contact: aprakash@brandeis.edu

  • JPEG can provide some level of protection from small perturbations�
  • Semantic JPEG can do better than standard JPEG�but using MSROI to get semantic JPEG is also susceptible to adversary�
  • Aug-MSROI leverages the localization capabilities of standard MSROI for robust localization in the presence of adversarial attacks�
  • Final image is decodable using any off-the-shelf JPEG decoder�