Skip to content
 
 

Repository files navigation

Transfer Attack Framework

This repository contains code to reproduce results from some basic transfer attack methods.

Requirements

  • python >= 3.6.5
  • torch >= 1.7.0
  • torchvision >= 0.8.2
  • pretrainedmodels >= 0.7.4
  • numpy >= 1.19.5
  • scipy > 1.5.4

Supported Methods

Quick Start

Prepare Models

All pretrained models can be found online: pretrainedmodels

Run the Code

Generate adversairal examples and save them into path ./output/. The running log will be saved in ./output_log. This code is to generate adversarial examples using I-FGSM on all source models separately and validate the attack success rate on all target models.

If the prediction of adversarial example is different from clean one, it will be considered as attacking successfully. And the 'y' used during attack process are the predictions of clean imgaes, so the true labels of images are not necessary.

About attack method

python3 main.py \
        --attack-method i_fgsm \
        --source-model xxx xxx xxx (optional) \
        --target-model xxx xxx xxx xxx xxx (optinal)

I-FGSM based

  • I-FGSM: --attack-method i_fgsm
  • MI-FGSM: --attack-method mi_fgsm
  • DI-FGSM: --attack-method di_fgsm
  • TI-FGSM: --attack-method ti_fgsm
  • combine: --attack-method mi_di_ti_fgsm

VMI based

  • VMI-FGSM: --attack-method vi_mi_fgsm
  • combine: --attack-method vi_mi_xxx_fgsm

Patch-wise based

  • Patch-wise: --attack-method pi_fgsm
  • combine : --attack-method pi_xxx_fgsm

SGM based

  • SGM: --attack-method sgm
  • combine: --attack-method sgm_xxx

Admix based

  • Admix: --attack-method admix
  • combine: --attack-method admix_xxx

FIA based

  • FIA: --attack-method fia
  • combine: --attack-method fia_xxx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages