Git Product home page Git Product logo

ftrojan's Introduction

Backdoor Attack in Frequency Domain

DEPENDENCIES

python==3.8.3
numpy==1.19.4
tensorflow==2.4.0
opencv==4.5.1
idx2numpy==1.2.3
pytorch==1.7.0

Dataset Preparation

For GTSRB, PubFig(60 labels) and ImageNet(16 labels), you can download from data/download.txt and uncompress them in data directory. For cifar10 dataset, you can obtain from tensorflow.keras.datasets.

Change Config

You can modify the param dict in the train.py to train your own backdoored model. There are 6 parameters as follows:

  • dataset: CIFAR10, GTSRB, MNIST, PubFig, ImageNet16. Default: CIFAR10
  • target_label: The target label to backdoor. Default: 8
  • poisoning_rate: The ratio of poisoning sample. A float number range (0,1)
  • channel_list: Which channels to implant backdoor, [1,2] means UV, [0,1,2] means YUV.
  • YUV: True, YUV; False, RGB
  • magnitude: The magnitude of trigger frequency
  • clean_label: clean_label attack or changed label attack. For clean label attack, it is required to train a clean model saved to model directory.
  • pos_list: trigger frequency position, for (32, 32) belongs to high-frequency, (15, 15) belongs to mid-frequency

Run Backdoor Attack Code

For Tensorflow2.0, you can directly run(default cifar10 dataset):

python train.py

For Pytorch, you can run:

python th_train.py

ftrojan's People

Contributors

tonggege001 avatar

Stargazers

Cho Yena avatar Oterea avatar Jiawei Li avatar xiao avatar Gates Bin avatar  avatar  avatar TIAN Xin avatar h avatar YUAN Xu avatar Yiming Li avatar

Watchers

Yuan Yao avatar cellzero avatar  avatar  avatar

Forkers

jsslrks

ftrojan's Issues

维纳滤波

作者你好,我看到你们论文中提到Ftrojan经过维纳滤波过滤后,攻击成功率降了很多。但我复现了你们的方法后,为什么发现只有高斯滤波的ASR降到了接近0,而维纳滤波的ASR仍然是100呢?

hdf5

your code have this model.load_weights("model/{}.hdf5".format(param["dataset"]))
but i can't find this file in the repository. Can you push it ? please

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.