# One pixel attack for fooling deep neural networks

Single-pixel changes can fool deep neural networks

Su, Jiawei, Vargas, Danilo Vasconcellos, Kouichi, Sakurai · arXiv · 2017-10-24

- **Problem** Most adversarial attacks change many pixels, so the change can be visible. Attacks limited to a single pixel had not been measured systematically.
- **Method** The authors pick one pixel's position and color with differential evolution, a gradient-free search. Each candidate competes with its child and the fitter one survives, using only output probabilities.
- **Results** Non-targeted one-pixel attacks reached a 68.71% success rate on AllConv over Kaggle CIFAR-10 test images, against 49.70% for random search.

## Why limit an attack to one pixel

Most adversarial attacks change every pixel a little, under a bound on the overall size of the change. A change spread over the whole image can still be noticeable, and the authors argue that earlier methods cannot guarantee an imperceptible change. Limiting how many pixels change is therefore a practical proxy for perceptibility, so this study counts modified pixels rather than the length of the perturbation vector.

Within this count, one pixel is the strongest restriction, and three and five pixels serve as comparison points. The restriction also probes the input geometry: a universal perturbation searches a sphere around a natural image, while a few-pixel perturbation cuts the input space along very low-dimensional slices.

## Restricting the perturbation to d pixels

The starting point is the usual constrained formulation, in which an additive perturbation e(x) to a correctly classified image x is chosen to maximize the target-class value under a bound on its length. \\\[ \\underset{e(x)}{\\mathrm{maximize}}\\; f\_{adv}(x+e(x)) \\quad \\text{subject to} \\quad \\\|e(x)\\\| \\le L \\\] The length bound L is replaced by \\( \\\|e(x)\\\|\_0 \\le d \\), where d is a small number, so that at most d coordinates of e(x) are nonzero.

Earlier attacks spread a bounded change over many coordinates, whereas here only the chosen coordinates move and the others stay at zero. With d = 1, the perturbation is a move along one axis of the n-dimensional input with arbitrary strength; with 3 or 5 pixels the move stays inside a 3- or 5-dimensional cube.

## Searching the pixel space with differential evolution

Differential evolution keeps a population of candidate solutions, builds a child from each parent, and keeps whichever of the pair has the higher fitness. Because the update uses no gradient, the objective does not need to be differentiable, which matters for networks whose gradients are unavailable or hard to compute. Only probability labels are needed as feedback from the target network, so the attack is black-box in the sense that it reads outputs and not internal information.

A candidate solution is an array of perturbation tuples, and each tuple holds x-y coordinates and an RGB value, so a candidate with one tuple changes one pixel. The population starts at 400 candidate solutions, and each iteration produces another 400 children. Children are generated with the DE update \\\[ x\_i(g+1) = x\_{r\_1}(g) + F\\,(x\_{r\_2}(g) - x\_{r\_3}(g)), \\quad r\_1 \\neq r\_2 \\neq r\_3 \\\] where g is the generation index and F is the scale parameter, set to 0.5.

Each child competes with its parent at the same population index, and the winner moves to the next iteration.

Initial coordinates are drawn from uniform distributions over 1 to 32 for CIFAR-10 and over 1 to 227 for ImageNet, and RGB values from a Gaussian with mean 128 and sigma 127. The fitness is the probability label of the target class on CIFAR-10 and the probability label of the true class on ImageNet, and crossover is not used. The search runs for at most 100 iterations and stops early when the target-class label exceeds 90% in targeted CIFAR-10 runs, or when the true-class label falls below 5% in non-targeted ImageNet runs.

Success is decided by comparing the true-class label with the highest non-true label.

## Kaggle CIFAR-10 results

Three networks, AllConv, NiN and VGG16, were trained as targets, and 500 natural images per network were drawn from the Kaggle CIFAR-10 test set. Each image was attacked toward each of the nine other classes, and a non-targeted attack counts as successful when at least one of those targeted attacks succeeds, giving 36000 adversarial images in total.

Non-targeted success reached 68.71% for AllConv, 71.66% for NiN and 63.53% for VGG16. Each natural image could be perturbed to 1.8, 2.1 and 1.5 other classes on the three networks, and VGG16 was slightly more robust than the other two.

Targeted success rates were 19.82% for AllConv, 23.15% for NiN and 16.48% for VGG16. The confidence of successful one-pixel attacks was 79.40% for AllConv, 75.02% for NiN and 67.67% for VGG16, and the abstract summarizes the Kaggle result as 67.97% of images perturbed and 74.03% confidence on average.

Table V reports three-pixel attacks with a targeted success rate of 40.57% and a non-targeted success rate of 86.53%, and five-pixel attacks with 44.00% and 86.34%. The caption of that table assigns the three-pixel runs to AllConv and the five-pixel runs to NiN, whereas the text describes the three- and five-pixel experiment on AllConv, so the network for each column is not settled by the table alone.

Across these budgets the confidence-type row falls from 79.17% at three pixels to 77.09% at five pixels, and the authors read the larger budgets as raising the number of reachable target classes.

## ImageNet with BVLC AlexNet

The attack was run against BVLC AlexNet on 105 ILSVRC 2012 test images chosen at random. The images were converted from jpeg to png and resized to 227X227, and the same DE settings as on CIFAR-10 were kept, although the ImageNet search space is 50 times larger. The fitness here decreases the true-class probability, so the non-targeted run is scored on the true label rather than on a target label.

Under these conditions 16.04% of the test images were perturbed to a target class, with an average confidence of 22.91%. The authors read the low confidence as a nearly uniform soft label distribution, since the other 999 classes are lower, and they attribute it to the non-targeted fitness, which only lowers the true-class probability.

## Differential evolution against random search and cost

The random search baseline changes one random pixel with a random RGB value on each attempt, repeats the attempt 100 times per natural image, and uses the same 80000 evaluations as differential evolution. Differential evolution succeeded on 68.71% of AllConv images, 71.66% of NiN images and 63.53% of VGG16 images, against 49.70%, 41.72% and 15.57% for random search.

The authors report differential evolution as 19.01%, 29.94% and 47.96% more efficient than random search for AllConv, NiN and VGG16.

Random search reaches a higher confidence on AllConv (87.73% against 79.40%) and NiN (75.83% against 75.02%), but a lower one on VGG16 (59.90% against 67.67%). The authors explain the high random-search success on AllConv and NiN by vulnerable pixels being common, and note that this is not the case for VGG16.

Fitness curves were drawn for 30 Kaggle CIFAR-10 images and 15 ImageNet images that were successfully attacked, over 100 generations. The average fitness decreases monotonically with the generation count, though single generations can drop abruptly, and BVLC AlexNet shows a smaller decrease, which the authors take to mean it is harder to fool.

Perturbation strength is the average modification over the three color channels of the attacked pixel, with average distortions of 123, 133, 145 and 158 on the same four models, in that order.

## Original CIFAR-10 and comparison with earlier attacks

On the original test set only correctly classified images were used, and the networks were retrained to reach accuracy similar to the Kaggle models, with the second average pooling layer of NiN and the first batch normalization of AllConv removed. The early-stop rule ends the targeted runs once the target label exceeds the original class.

Non-targeted success under the true criterion was 22.60% for AllConv, 35.20% for NiN and 31.40% for VGG16, using 500 non-targeted and 300 targeted images. Targeted success was 3.41%, 4.78% and 5.63% for AllConv, NiN and VGG16.

The authors find the three networks more robust here than on the Kaggle set, which they relate to higher accuracy and confidence, while NiN stays the least robust and VGG16 becomes more vulnerable. Non-targeted 1 in the table, computed from targeted results, gives 22.67%, 32.00% and 30.33%, close to the true-criterion values.

Table IX places the one-pixel rows next to LSA and FGSM rows for NiN and VGG16. The one-pixel rows reach 35.20% with a confidence of 60.08% on NiN and 31.40% with 53.58% on VGG16, while modifying 1 pixel (0.098%). LSA reports 97.89% with 33 pixels (3.24%) on NiN and 97.98% with 30 pixels (2.99%) on VGG16, and FGSM reports 93.67% and 90.93% with 1024 pixels (100%).

Those rows are reported values from the table and do not share the same network training or evaluation protocol with the one-pixel rows, so the comparison is about pixel budget rather than a matched run.

## Limitations

The authors deliberately used few DE iterations and a small initial population to mimic an attacker. They expect larger iteration counts or populations to raise success rates, and they expect CMA-ES to give similar gains, but neither was tested here.

The authors do not expect one-pixel attacks to be markedly more robust than other L0 attacks against the detection methods of prior work. They note that detection methods of this kind add a pre-processing step that increases response time.

The ImageNet part covers one model, BVLC AlexNet, with 105 images, one pixel only, and one pre-processing choice, and the authors note that other pre-processing could change the rate. The Kaggle CIFAR-10 set contains unknown modifications, so results on it describe that set and not the clean CIFAR-10 images. The Table V caption and the text disagree on which network the three- and five-pixel runs used, so the network for those columns should be checked against the experiment description.

## Paper info

- **Authors**: Su, Jiawei, Vargas, Danilo Vasconcellos, Kouichi, Sakurai
- **Venue**: arXiv · Preprint
- **First published**: 2017-10-24
- **Added**: 2026-11-12
- **Updated**: 2019-10-17
- **Version**: v7
- **arXiv**: 1710.08864
- **DOI**: 10.1109/tevc.2019.2890858
- **Category**: cs.LG · cs.CV · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1710.08864v7) · [PDF ↗](https://arxiv.org/pdf/1710.08864v7)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Su, Jiawei, Vargas, Danilo Vasconcellos, Kouichi, Sakurai (2017). One pixel attack for fooling deep neural networks. arXiv:1710.08864v7. https://doi.org/10.1109/tevc.2019.2890858

**BibTeX**

```
@article{jiawei2017pixel,
  title = {{One pixel attack for fooling deep neural networks}},
  author = {Su, Jiawei and Vargas, Danilo Vasconcellos and Kouichi, Sakurai},
  year = {2017},
  eprint = {1710.08864},
  archivePrefix = {arXiv},
  doi = {10.1109/tevc.2019.2890858},
  url = {https://arxiv.org/abs/1710.08864v7}
}
```

## Other paper commentary

- [Self-training with Noisy Student improves ImageNet classification](https://refivu.com/en/papers/57e759e6-5034-4019-9e65-3fac466f7c21-self-training-with-noisy-student-improves-imagenet.md)
- [H-DenseUNet: Hybrid Densely Connected UNet for Liver and Tumor Segmentation from CT Volumes](https://refivu.com/en/papers/baba5f05-45fc-4d5b-84cb-c78d65c377a5-h-denseunet-hybrid-densely-connected-unet-for-liver.md)
- [Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet](https://refivu.com/en/papers/55385708-c65a-43d7-b2e0-c4751a8d2757-tokens-to-token-vit-training-vision-transformers-from.md)
- [Swin UNETR: Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images](https://refivu.com/en/papers/44c6c3a9-434b-4cb2-aed0-e8b3167653fc-swin-unetr-swin-transformers-for-semantic-segmentation-of.md)
- [Uformer: A General U-Shaped Transformer for Image Restoration](https://refivu.com/en/papers/f59714df-d19d-41d7-8c41-8c04e0636925-uformer-a-general-u-shaped-transformer-for-image.md)
- [Bridging the Gap Between Anchor-based and Anchor-free Detection via Adaptive Training Sample Selection](https://refivu.com/en/papers/a286d37a-f6cf-498c-9170-fa2a9627c54e-bridging-the-gap-between-anchor-based-and-anchor.md)
- [EDA: Easy Data Augmentation Techniques for Boosting Performance on Text Classification Tasks](https://refivu.com/en/papers/6bc7db3b-907c-40de-8993-2cc4b32ed04f-eda-easy-data-augmentation-techniques-for-boosting.md)
- [PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization](https://refivu.com/en/papers/d88e659c-e7cf-4fb4-acf4-46e297868666-posenet-a-convolutional-network-for-real-time-6.md)
- [Gate-Variants of Gated Recurrent Unit (GRU) Neural Networks](https://refivu.com/en/papers/15731593-7d6d-4afb-b434-961a20dea639-gate-variants-of-gated-recurrent-unit-gru-neural.md)
- [Federated Learning with Differential Privacy: Algorithms and Performance Analysis](https://refivu.com/en/papers/159abc6e-c571-4ed4-b7d1-e630e54b4510-federated-learning-with-differential-privacy-algorithms-and.md)
- [Deep Learning for 3D Point Clouds: A Survey](https://refivu.com/en/papers/ac14ada0-64c3-463e-b921-6ac08239ba22-deep-learning-for-3d-point-clouds-a-survey.md)
- [On the Convergence of Adam and Beyond](https://refivu.com/en/papers/0071643a-b21a-4f45-ab31-5fa27e061226-on-the-convergence-of-adam-and-beyond.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [Success rate](https://refivu.com/en/terms/0964df1dc5eb-success-rate)
- [Random search](https://refivu.com/en/terms/4122ba3151ed-random-search)
- [FGSM](https://refivu.com/en/terms/5e096cf3ee8d-fgsm)
- [Black-box attack](https://refivu.com/en/terms/9a52ce3c52f2-black-box-attack)
- [targeted attack](https://refivu.com/en/terms/26c51519286a-targeted-attack)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/d5d76088-1786-441c-91fa-bf247a220946-one-pixel-attack-for-fooling-deep-neural-networks)
