GithubHelp home page GithubHelp logo

irish-kw / pgn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trustworthy-ai-group/pgn

0.0 0.0 0.0 1.01 MB

[NeurIPS 2023] Boosting Adversarial Transferability by Achieving Flat Local Maxima

License: MIT License

Python 100.00%

pgn's Introduction

PGN

This repository contains the PyTorch code for the paper:

Boosting Adversarial Transferability by Achieving Flat Local Maxima (NeurIPS 2023)

Zhijin Ge, Hongying Liu, Xiaosen Wang, Fanhua Shang, Yuanyuan Liu.

We also include the code in the framework TransferAttack.

loss surface map

Requirements

  • Python == 3.7.11
  • pytorch == 1.8.0
  • torchvision == 0.8.0
  • numpy == 1.21.2
  • pandas == 1.3.5
  • opencv-python == 4.5.4.60
  • scipy == 1.7.3
  • pillow == 8.4.0
  • pretrainedmodels == 0.7.4
  • tqdm == 4.62.3
  • imageio == 2.6.1

Qucik Start

Prepare the dataset and models.

  1. You can download the ImageNet-compatible dataset from here and put the data in './dataset/'.

  2. The normally trained models (i.e., Inc-v3, Inc-v4, IncRes-v2, Res-50, Res-101, Res-100) are from "pretrainedmodels", if you use it for the first time, it will download the weight of the model automatically, just wait for it to finish.

  3. The adversarially trained models (i.e, ens3_adv_inc_v3, ens4_adv_inc_v3, ens_adv_inc_res_v2) are from SSA or tf_to_torch_model. For more detailed information on how to use them, visit these two repositories.

Runing attack

  1. You can run our proposed attack as follows.
python Incv3_PGN_Attack.py
  1. The generated adversarial examples would be stored in the directory ./incv3_xx_xx_outputs. Then run the file verify.py to evaluate the attack success rate of each model used in the paper:
python verify.py
  1. You can run the file 'surface_map.py' to visualize the loss surface maps for the adversarial examples, the maps will be stored in the directory './loss_surfaces/'.
python surface_map.py

Citation

If our paper or this code is useful for your research, please cite our paper.

@inproceedings{ge2023boosting,
     title={{Boosting Adversarial Transferability by Achieving Flat Local Maxima}},
     author={Zhijin Ge and Hongying Liu and Xiaosen Wang and Fanhua Shang and Yuanyuan Liu},
     booktitle={Proceedings of the Advances in Neural Information Processing Systems},
     year={2023},
}

pgn's People

Contributors

zhijin-ge avatar xiaosen-wang 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.