Coder Social home page Coder Social logo

k-arm_backdoor_optimization's Introduction

K-Arm Backdoor Optimization

This is the official repository of the ICML2021 paper Backdoor Scanning for Deep Neural Networks through K-Arm Optimization in PyTorch.

If you find this code is useful for your research, please cite the following:

@article{shen2021backdoor,
  title={Backdoor Scanning for Deep Neural Networks through K-Arm Optimization},
  author={Shen, Guangyu and Liu, Yingqi and Tao, Guanhong and An, Shengwei and Xu, Qiuling and Cheng, Siyuan and Ma, Shiqing and Zhang, Xiangyu},
  journal={arXiv preprint arXiv:2102.05123},
  year={2021}
}

Setup Environments

We suggest to use Conda for testing the code on TrojAI datasets. Detailed instruction can be found here.

Install Anaconda Python

https://www.anaconda.com/distribution/

Setup the Conda Environment

  1. conda create --name trojai-example python=3.8 -y

  2. conda activate trojai-example

  3. Install required packages into this conda environment

    1. conda install pytorch=1.7.0 torchvision=0.8.0 torchtext==0.8.0 cudatoolkit=11.0 -c pytorch -c conda-forge
    2. pip install --upgrade trojai
    3. conda install jsonpickle

Datasets

TrojAI

The code is tested on TrojAI datasets (round1-4). TrojAI datasets can be accessed at TrojAI website

ImageNet

We will release the ImageNet pre-trained models and code in the near future.

Quick Start

To test the code on TrojAI datasets, simply run command

$ python main.py --result_filepath <resultFilepath> --examples_dirpath <dataDirpath> --model_filepath <modelFilepath>

To run the code on custom models, make sure your sample images in the <examples_dirpath> have the following format:

examples_dirpath/class_<class_id>_example_<example_id>.png

Description about the main parameters:

  • <Beta>: Coefficient in the K-Arm schedulor objective function
  • <gamma,global(local)_theta>: Parameters in the Arm Pre-screening procedure
  • <global(local,ratio)_det_bound>: Trigger size bound for detecting different types of backdoors
  • <epsilon_for_bandits>: Controls the randomness during the K-Arm optimization

Results

Please check our results here under the team name Perspecta-PurdueRutgers. The default settings of the parameters in this repo can achieve 90% detection accuracy on TrojAI round3 training and testing datasets. For scanning different types of models, some parameters might need tunning.

Contacts

Guangyu Shen, [email protected]
Yingqi Liu, [email protected]

k-arm_backdoor_optimization's People

Contributors

solidshen avatar naiyeleo 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.