https://github.com/vita-group/sparseadv_homotopy
[ICML 2021 Long Talk] "Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm" by Mingkang Zhu, Tianlong Chen, Zhangyang Wang
https://github.com/vita-group/sparseadv_homotopy
adversarial-attacks adversarial-robustness homotopy-algorithm homotopy-type-theory sparse-adversarial
Last synced: about 1 month ago
JSON representation
[ICML 2021 Long Talk] "Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm" by Mingkang Zhu, Tianlong Chen, Zhangyang Wang
- Host: GitHub
- URL: https://github.com/vita-group/sparseadv_homotopy
- Owner: VITA-Group
- License: mit
- Created: 2021-06-06T19:08:18.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-30T07:42:30.000Z (over 3 years ago)
- Last Synced: 2025-03-29T09:51:12.709Z (about 2 months ago)
- Topics: adversarial-attacks, adversarial-robustness, homotopy-algorithm, homotopy-type-theory, sparse-adversarial
- Language: Python
- Homepage:
- Size: 604 KB
- Stars: 9
- Watchers: 8
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm
[](https://opensource.org/licenses/MIT)
[ICML 2021 Long Talk] [Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm.](https://arxiv.org/abs/2106.06027)
Mingkang Zhu, Tianlong Chen, Zhangyang Wang
## Overview
We proposed Homotopy Attack, a homotopy algorithm for sparse adversarial attack that aim to find sparse adversarial perturbations with relatively small magnitudes. The sparsity of the perturbation is regularized by the L_0 norm and the magnitude is constrained by the L_inf norm. The proposed algorithm can achieve much sparser results under the same L_inf constraint when compared to the SOTA.
![]()
## Prerequisites
```
pytorchtorchvision
scipy 1.2.1
pillow
Download the pretrained Inception-v3 model from https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth and put it into the pretrain folder
```## Usage
```
python demo_attack.py --img_dir path/to/imgs
```## Parameter Setting
```
--imgdir path to input images
--target_class target class
--dec_factor decreasing factor for lambda per iteration
--val_c constant multiplied with searched intial lambda
--val_w1 weight for post attack stage
--val_w2 weight for post attack stage
--val_gamma threshold of triggering the post attack stage
--max_update max L_0 update per outer iteration
--max_epsilon L_inf constraint
--maxiter max inner iteration to run nmAPG per outer iteration of homotopy
```Hint:
For lower `--max_epsilon`, `--val_c` should be lower and `--max_update` should be higher.
For higher `--max_epsilon`, `--val_c` should be higher and `--max_update` should be lower.
Please adjust the parameters accordingly so that the average perturbation per entry is close to the L_inf constraint `--max_epsilon`, which can lead to sparser results.
For detailed parameter setting, please refer to the Appendix.
## Citation
```
@misc{zhu2021sparse,
title={Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm},
author={Mingkang Zhu and Tianlong Chen and Zhangyang Wang},
year={2021},
eprint={2106.06027},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
```