Coder Social home page Coder Social logo

tongkangheng / feature-distillation-dnn-oriented-jpeg-compression-against-adversarial-examples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zihaoliu123/feature-distillation-dnn-oriented-jpeg-compression-against-adversarial-examples

0.0 0.0 0.0 24.62 MB

License: MIT License

Python 97.36% MATLAB 2.64%

feature-distillation-dnn-oriented-jpeg-compression-against-adversarial-examples's Introduction

Feature Distillation

This is an implementation of our work "Feature Distillation DNN-Oriented JPEG Compression Against Adversarial Examples" https://arxiv.org/pdf/1803.05787.pdf

  • We add our feature distillation defense method in ./utils
  • Thanks for the decent code from EvadeML-Zoo. This work is extended from EvadeML-Zoo (https://github.com/mzweilin/EvadeML-Zoo)
  • If you use this code please cite our paper.

Cite this work

@article{liu2018feature,
  title={Feature Distillation: DNN-Oriented JPEG Compression Against Adversarial Examples},
  author={Liu, Zihao and Liu, Qi and Liu, Tao and Wang, Yanzhi and Wen, Wujie},
  journal={arXiv preprint arXiv:1803.05787},
  year={2018}
}

1. Install dependencies.

pip install -r requirements_cpu.txt

If you are going to run the code on GPU, install this list instead:

pip install -r requirements_gpu.txt

2. Fetch submodules.

git submodule update --init --recursive

3. Download pre-trained models.

mkdir downloads; curl -sL https://github.com/mzweilin/EvadeML-Zoo/releases/download/v0.1/downloads.tar.gz | tar xzv -C downloads

4. Usage of python main.py

usage: python main.py [-h] [--model_name MODEL_NAME]
               [--select [SELECT]] [--noselect] [--nb_examples NB_EXAMPLES]
               [--balance_sampling [BALANCE_SAMPLING]] [--nobalance_sampling]
               [--test_mode [TEST_MODE]] [--notest_mode] [--attacks ATTACKS]


optional arguments:
  -h, --help            show this help message and exit
  --model_name MODEL_NAME
                        Supported: cleverhans, cleverhans_adv_trained and
                        carlini for MNIST; carlini and DenseNet for CIFAR-10;
                        ResNet50, VGG19, Inceptionv3 and MobileNet for
                        ImageNet.
  --select [SELECT]     Select correctly classified examples for the
                        experiement.
  --noselect
  --nb_examples NB_EXAMPLES
                        The number of examples selected for attacks.
  --balance_sampling [BALANCE_SAMPLING]
                        Select the same number of examples for each class.
  --nobalance_sampling
  --test_mode [TEST_MODE]
                        Only select one sample for each class.
  --notest_mode
  --attacks ATTACKS     Attack name and parameters in URL style, separated by
                        semicolon.

5. Example.

python main.py --model_name MobileNet --nb_examples 100 --attacks "fgsm?eps=0.0078"

feature-distillation-dnn-oriented-jpeg-compression-against-adversarial-examples's People

Contributors

zihaoliu123 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.