Coder Social home page Coder Social logo

songbaihust / regional-homogeneity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liyingwei/regional-homogeneity

0.0 3.0 0.0 418 KB

Source code for Regional Homogeneity: Towards Learning Transferable Universal Adversarial Perturbations Against Defenses

License: MIT License

Python 99.85% Shell 0.15%

regional-homogeneity's Introduction

Regional Homogeneity: Towards Learning Transferable Universal Adversarial Perturbations Against Defenses

Introduction

This repository contains the code for paper Regional Homogeneity: Towards Learning Transferable Universal Adversarial Perturbations Against Defenses. This paper shows that a simple universal perturbation can fool a series of state-of-the-art defenses.

Usage

Dependencies

  • Anaconda
  • Python3.6
  • Tensorflow 1.10.0
  • Tensorpack 0.9.0.1
  • easydict
  • scipy
  • pillow

Here is a sample scrip to install Dependencies after you have Anaconda.

conda create -n python3 python=3.6
source activate python3
pip install --upgrade tensorflow-gpu
pip install --upgrade git+https://github.com/tensorpack/tensorpack.git
pip install easydict
conda install -c anaconda scipy
pip install pillow

Dataset and model checkpoints

We use images from ImageNet LSVRC 2012 Validation Set and resized them to 299x299. You can download the preprocessed images HERE if you accept the terms.

We support generate adversarial examples with 3 clean trained models (Inception-{v3, v4}, Inception-Resnet-v2), and evaluate them by 3 ensemble adversarial trained models (ens3_inception_v3, ens4_inception_v3, ens_inception_resnet_v2). We will release more defense models that are mentioned in the paper. We original download them from here and here and then slightly modified the tensor name. You can download the modified checkpoints from HERE.

After download them, edit and use data/link_to_data.sh to build soft link data/checkpoints and data/val_data by

bash data/link_to_data.sh

We assign every network with an id, so that they can be shortly mentioned in one character. Here is a table to provide ids for each network. You can see line 69 to 70 of config.py for more details.

ID 0 1 2
Networks for Training IncV3 IncV4 IncRes
Networks for Evaluation Ens3IncV3 Ens4IncV3 EnsIncRes

Train, Attack and Eval

python train.py                          # train based on IncV3
python attack.py --GPU_ID 0              # attack
python eval.py --GPU_ID 0                # evaluate
python attack.py --universal --GPU_ID 0  # universal attack  
python eval.py --universal --GPU_ID 0    # evaluate

If you find the code useful, please consider citing the following paper.

@article{li2019regional,
  title={Regional Homogeneity: Towards Learning Transferable Universal Adversarial Perturbations Against Defenses},
  author={Li, Yingwei and Bai, Song and Xie, Cihang and Liao, Zhenyu and Shen, Xiaohui and Yuille, Alan},
  journal={arXiv preprint arXiv:1904.00979},
  year={2019}
}

If you encounter any problems or have any inquiries, please contact us at [email protected].

regional-homogeneity's People

Contributors

liyingwei avatar

Watchers

James Cloos avatar Song Bai avatar paper2code - bot avatar

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.