code for "Feature Importance-aware Transferable Adversarial Attacks"

Related tags

Deep Learning FIA
Overview

Feature Importance-aware Attack(FIA)

This repository contains the code for the paper:

Feature Importance-aware Transferable Adversarial Attacks (ICCV 2021)

Requirements

  • Python 3.6.8
  • Keras 2.2.4
  • Tensorflow 1.14.0
  • Numpy 1.16.2
  • Pillow 6.0.0
  • Scipy 1.2.1

Experiments

Introduction

Example Usage

Generate adversarial examples:
  • FIA
python attack.py --model_name vgg_16 --attack_method FIA --layer_name vgg_16/conv3/conv3_3/Relu --ens 30 --probb 0.7 --output_dir ./adv/FIA/
  • PIM:
python attack.py --model_name vgg_16 --attack_method PIM --amplification_factor 10 --gamma 1 --Pkern_size 3 --output_dir ./adv/PIM/
  • FIA+PIDIM
python attack.py --model_name vgg_16 --attack_method FIAPIM --layer_name vgg_16/conv3/conv3_3/Relu --ens 30 --probb 0.7 --amplification_factor 2.5 --gamma 0.5 --Pkern_size 3 --image_size 224 --image_resize 250 --prob 0.7 --output_dir ./adv/FIAPIDIM/

Different attack methods have different parameter setting, and the detailed setting can be found in our paper.

Evaluate the attack success rate
python verify.py --ori_path ./dataset/images/ --adv_path ./adv/FIA/ --output_file ./log.csv

Citing this work

If you find this work is useful in your research, please consider citing:

@article{wang2021feature,
  title={Feature Importance-aware Transferable Adversarial Attacks},
  author={Wang, Zhibo and Guo, Hengchang and Zhang, Zhifei and Liu, Wenxin and Qin, Zhan and Ren, Kui},
  journal={arXiv preprint arXiv:2107.14185},
  year={2021}
}
Comments
  • There is something wrong when i run the program。

    There is something wrong when i run the program。

    Hello,thank you very much for sharing the program.But when i run the attack.py on IncRes_V2 and Inc_v3,there is something wrong with the program.With the IncRes_V2,there is an error:ValueError: Negative dimension size caused by subtracting 5 from 3 for 'InceptionResnetV2/AuxLogits/Conv2d_2a_5x5/Conv2D' (op: 'Conv2D') with input shapes: [40,3,3,128], [5,5,128,768].And with the Inc_v3,there is an error:Tensor name "InceptionV3/AuxLogits/Conv2d_2a_3x3/BatchNorm/beta" not found in checkpoint files ./models_tf/inception_v3.ckpt [[node save/RestoreV2 (defined at attack.py:267) ]] Can you tell me what's wrong? Thank you very much!

    opened by sdds-torch 8
  • Hi, there is a issue when I run verify.py

    Hi, there is a issue when I run verify.py

    (0) Data loss: Unable to open table file ./models_tf/ens3_adv_inception_v3/ens3_adv_inception_v3.ckpt: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?

    the model i use is ens3_adv_incetption_v3, Could you reply me?

    opened by Aristozhang 4
  • The mid-layer parameter?

    The mid-layer parameter?

    Hello,Could tell me when inception-resnet-v2 as the source model,what mid layer to be attack,I set the parameter ‘InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/Relu’ that follows your paper Conv_4a. But the permance is lower 10% comparing the result in your paper. So what is the mid parameter when you attack inception-resnet-v2? Thx.

    opened by jackylyy 4
  • Wondering the exact layer name

    Wondering the exact layer name

    Thanks for sharing the code! I've tried to run attack.py on InceptionV3(using layer InceptionV3/InceptionV3/Mixed_5b/concat), InceptionV4(using layer InceptionV4/InceptionV4/Mixed_6f/concat) and Resnet_v1_50(using layer resnet_v1_50/block4/unit_3/bottleneck_v1/conv2/Relu), but got poor results, so could you please share the EXACT LAYER NAME you used to attack?

    opened by arcus99 1
  • Hi, thanks very much for sharing these valuable codes. There still remains an issue about the used dataset.

    Hi, thanks very much for sharing these valuable codes. There still remains an issue about the used dataset.

    According to the published paper, the ImageNet-Compatible dataset is used to conduct experiments. By downloading the above dataset from the website in reference [1], it is strange to find that there are only 904 images can be downloaded, rather than 1000 images illustrated in the paper. Therefore, could you please validate how many images were actually used in the experimental phase? Of course, if all 1000 images were used in your experiments, could you please share these images through Google Clouds or Baidu Clouds (urls of the missed 96 images are invalid now)?

    Thanks very much!

    opened by ddghjikle 0
  • low ori_acc rate(原始精度异常低)

    low ori_acc rate(原始精度异常低)

    Hi, thanks for your contribution! But some problems arose during the process. image The ori_acc is 1.2% or 1.3%, and the adv_suc is around 60%~70%. Is there somthing wrong?

    opened by oppsAirel 0
  • low attack success rate(攻击成功率不正常的低)

    low attack success rate(攻击成功率不正常的低)

    Hi! Thanks for your contribution! But when I run the command line you mentioned in readme file "python attack.py --model_name vgg_16 --attack_method FIAPIM --layer_name vgg_16/conv3/conv3_3/Relu --ens 30 --probb 0.7 --amplification_factor 2.5 --gamma 0.5 --Pkern_size 3 --image_size 224 --image_resize 250 --prob 0.7 --output_dir ./adv/FIAPIDIM/" and "python verify.py --ori_path ./dataset/images/ --adv_path ./adv/FIAPIDIM/ --output_file ./log.csv". I got adv_acc around 70%-80% and adv_succ around 20%-30%. Is there something wrong with your defulat parameter? 在运行readme里面提到的指令时,仅仅得到20%-30%的准确率,请问是否是默认参数不小心给错了呢?还是什么其他问题? 030f3af4c0a5769afe342ce01736def

    opened by bl4bl4hhh 8
Owner
Hengchang Guo
Hengchang Guo
Inference code for "StylePeople: A Generative Model of Fullbody Human Avatars" paper. This code is for the part of the paper describing video-based avatars.

NeuralTextures This is repository with inference code for paper "StylePeople: A Generative Model of Fullbody Human Avatars" (CVPR21). This code is for

Visual Understanding Lab @ Samsung AI Center Moscow 18 Oct 6, 2022
A code generator from ONNX to PyTorch code

onnx-pytorch Generating pytorch code from ONNX. Currently support onnx==1.9.0 and torch==1.8.1. Installation From PyPI pip install onnx-pytorch From

Wenhao Hu 94 Jan 6, 2023
This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code for training a DPR model then continuing training with RAG.

KGI (Knowledge Graph Induction) for slot filling This is the code for our KILT leaderboard submission to the T-REx and zsRE tasks. It includes code fo

International Business Machines 72 Jan 6, 2023
Convert Python 3 code to CUDA code.

Py2CUDA Convert python code to CUDA. Usage To convert a python file say named py_file.py to CUDA, run python generate_cuda.py --file py_file.py --arch

Yuval Rosen 3 Jul 14, 2021
Empirical Study of Transformers for Source Code & A Simple Approach for Handling Out-of-Vocabulary Identifiers in Deep Learning for Source Code

Transformers for variable misuse, function naming and code completion tasks The official PyTorch implementation of: Empirical Study of Transformers fo

Bayesian Methods Research Group 56 Nov 15, 2022
Reference implementation of code generation projects from Facebook AI Research. General toolkit to apply machine learning to code, from dataset creation to model training and evaluation. Comes with pretrained models.

This repository is a toolkit to do machine learning for programming languages. It implements tokenization, dataset preprocessing, model training and m

Facebook Research 408 Jan 1, 2023
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Low-code/No-code approach for deep learning inference on devices

EzEdgeAI A concept project that uses a low-code/no-code approach to implement deep learning inference on devices. It provides a componentized framewor

On-Device AI Co., Ltd. 7 Apr 5, 2022
Code for all the Advent of Code'21 challenges mostly written in python

Advent of Code 21 Code for all the Advent of Code'21 challenges mostly written in python. They are not necessarily the best or fastest solutions but j

null 4 May 26, 2022
Code to use Augmented Shapiro Wilks Stopping, as well as code for the paper "Statistically Signifigant Stopping of Neural Network Training"

This codebase is being actively maintained, please create and issue if you have issues using it Basics All data files are included under losses and ea

J K Terry 32 Nov 9, 2021
Opinionated code formatter, just like Python's black code formatter but for Beancount

beancount-black Opinionated code formatter, just like Python's black code formatter but for Beancount Try it out online here Features MIT licensed - b

Launch Platform 16 Oct 11, 2022
a delightful machine learning tool that allows you to train, test and use models without writing code

igel A delightful machine learning tool that allows you to train/fit, test and use models without writing code Note I'm also working on a GUI desktop

Nidhal Baccouri 3k Jan 5, 2023
Pytorch Lightning code guideline for conferences

Deep learning project seed Use this seed to start new deep learning / ML projects. Built in setup.py Built in requirements Examples with MNIST Badges

Pytorch Lightning 1k Jan 2, 2023
Automatically Build Multiple ML Models with a Single Line of Code. Created by Ram Seshadri. Collaborators Welcome. Permission Granted upon Request.

Auto-ViML Automatically Build Variant Interpretable ML models fast! Auto_ViML is pronounced "auto vimal" (autovimal logo created by Sanket Ghanmare) N

AutoViz and Auto_ViML 397 Dec 30, 2022
Code samples for my book "Neural Networks and Deep Learning"

Code samples for "Neural Networks and Deep Learning" This repository contains code samples for my book on "Neural Networks and Deep Learning". The cod

Michael Nielsen 13.9k Dec 26, 2022
Code for: https://berkeleyautomation.github.io/bags/

DeformableRavens Code for the paper Learning to Rearrange Deformable Cables, Fabrics, and Bags with Goal-Conditioned Transporter Networks. Here is the

Daniel Seita 121 Dec 30, 2022
Code for our method RePRI for Few-Shot Segmentation. Paper at http://arxiv.org/abs/2012.06166

Region Proportion Regularized Inference (RePRI) for Few-Shot Segmentation In this repo, we provide the code for our paper : "Few-Shot Segmentation Wit

Malik Boudiaf 138 Dec 12, 2022
Applications using the GTN library and code to reproduce experiments in "Differentiable Weighted Finite-State Transducers"

gtn_applications An applications library using GTN. Current examples include: Offline handwriting recognition Automatic speech recognition Installing

Facebook Research 68 Dec 29, 2022
Code for "Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search"

Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search This is an implementation for our paper Contextual Non-Loca

Tencent YouTu Research 50 Dec 3, 2022