Code Monkey home page Code Monkey logo

sparseadv_homotopy's Introduction

Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm

License: MIT

[ICML 2021 Long Talk] Sparse and Imperceptible Adversarial Attack via a Homotopy Algorithm.

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

pytorch

torchvision

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}
}

sparseadv_homotopy's People

Contributors

mkzhu-2000 avatar tianlong-chen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparseadv_homotopy's Issues

Algorithms take too long to run

Hi, I am trying to reproduce the thesis using the code you provided. However when I use the CIFAR-10 dataset under untargeted attack, the algorithm runs very slowly, taking about 2000s. I would like to ask how I can shorten the running time of the algorithm. Thank you ๏ผ

Appendix

Hello, I would like to read the appendix about this paper, but I can't find it, could you please provide the appendix about this paper? Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.