Giter Club home page Giter Club logo

vt's Introduction

Variance Tuning

This repository contains code to reproduce results from the paper:

Enhancing the Transferability of Adversarial Attacks through Variance Tuning (CVPR 2021)

Xiaosen Wang, Kun He

We also include the torch version code in the framework TransferAttack.

Requirements

  • Python >= 3.6.5
  • Tensorflow >= 1.12.0
  • Numpy >= 1.15.4
  • opencv >= 3.4.2
  • scipy > 1.1.0
  • pandas >= 1.0.1
  • imageio >= 2.6.1

Qucik Start

Prepare the data and models

You should download the data and pretrained models and place the data and pretrained models in dev_data/ and models/, respectively.

Variance Tuning Attack

All the provided codes generate adversarial examples on inception_v3 model. If you want to attack other models, replace the model in graph and batch_grad function and load such models in main function.

Runing attack

Taking vmi_di_ti_si_fgsm attack for example, you can run this attack as following:

CUDA_VISIBLE_DEVICES=gpuid python vmi_di_ti_si_fgsm.py 

The generated adversarial examples would be stored in directory ./outputs. Then run the file simple_eval.py to evaluate the success rate of each model used in the paper:

CUDA_VISIBLE_DEVICES=gpuid python simple_eval.py

EVaulations setting for Table 4

  • HGD, R&P, NIPS-r3: We directly run the code from the corresponding repo.
  • Bit-Red: step_num=4, alpha=200, base_model=Inc_v3_ens.
  • JPEG: No extra parameters.
  • FD: resize to 304*304 for FD and then resize back to 299*299, base_model=Inc_v3_ens
  • ComDefend: resize to 224*224 for ComDefend and then resize back to 299*299, base_model=Resnet_101
  • RS: noise=0.25, N=100, skip=100
  • NRP: purifier=NRP, dynamic=True, base_model=Inc_v3_ens

More details in third_party

Acknowledgments

Code refers to SI-NI-FGSM.

Contact

Questions and suggestions can be sent to [email protected].

vt's People

Contributors

xiaosen-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vt's Issues

关于RS

在RS.sh第19行,

python convert_to_pytorch_dataset.py \

请问能提供一下convert_to_pytorch_dataset.py的代码吗?

Question about the ensemble attack

Hello.
First of all, thank you for providing your code.
I have a question about your implementation of ensemble attack in vmi_di_ti_si_fgsm.py.
As you mentioned in your paper, I averaged the logits from four normally trained models in batch_grad and graph function. However, when i ran the code, error(cuda out of memory) occur, even if i reduced the batch size. Could you let me know environment for ensemble attack or provide the code for ensemble attack ?
(My GPU : Titan RTX 24Gb)
I will wait for your reply.

Thank you!

Ensemble attack

Thank you for sharing your nice work!

I have a question about ensemble attack.
Is there any code to run an ensemble attack? I can't find the ensemble in your codes.

代码运行报错

您好!我在运行您的代码时候,程序报错最后一行提示找不到dev_data/val_rs文件,我将val_rs.csv的后缀名删除后,又报错提示找不到dev_data/val_rs.csv,我全部加上后,还是报错提示找不到dev_data/val_rs文件。
请问该如何解决

Different success rates when reproducing results from Table 1

The differences in success rates are minor, but I wanted to check whether this difference is expected (and if so, why?). I chose to reproduce two arbitrary attack rows of Table 1 from the paper where the Inc-v3 is used: MI-FGSM and VNI-FGSM.

Steps taken:

  1. Downloaded data and models from provided README link.
  2. Ran mi_fgsm.py followed by simple_eval.py, then logged results.
  3. Ran vni_fgsm.py followed by simple_eval.py, then logged results.

Results for MI-FGSM:

Model Attack Inc-v3 Inc-v4 IncRes-v2 Res-101 Inc-v3_ens3 Inc-v3_ens4 IncRes-v2_ens
Paper Inc-v3 MI-FGSM 100.0 45.3 42.9 36.1 13.9 13.2 6.2
My run Inc-v3 MI-FGSM 100.0 43.6 42.4 35.7 13.1 12.8 6.2

Results for VNI-FGSM:

Model Attack Inc-v3 Inc-v4 IncRes-v2 Res-101 Inc-v3_ens3 Inc-v3_ens4 IncRes-v2_ens
Paper Inc-v3 VNI-FGSM 100.0 76.1 74.8 65.7 34.3 32.7 19.4
My run Inc-v3 VNI-FGSM 100.0 76.5 74.9 66.0 35.0 32.8 18.8

In the case of MI-FGSM, my run shows that the attack sometimes underperforms reported results (by at most 1.7%). I haven't checked other rows of the table, but thought I should surface this and ask about it. Thanks!

论文的实验细节

作者你好!阅读了你的论文,想问下论文的实验细节。用的显卡是啥,用了几张卡,跑了多久

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.