GithubHelp home page GithubHelp logo

kondiz / adv_framing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michalzajac-ml/adv_framing

0.0 0.0 0.0 471 KB

Repository for the paper "Adversarial Framing for Image and Video Classification"

License: MIT License

Python 100.00%

adv_framing's Introduction

Adversarial Framing

This is the official implementation of the experiments from the paper "Adversarial Framing for Image and Video Classification" (video) by Michał Zając, Konrad Żołna, Negar Rostamzadeh and Pedro Pinheiro.

The code from the paper "Can Spatiotemporal 3D CNNs Retrace the History of 2D CNNs and ImageNet?" is also included in deps/resnets_3d folder, as we attack the model from that paper.

Our code was originally forked from Classifier-agnostic saliency map extraction repository.

Requirements

The code uses Python 3 and packages listed in requirements.txt. If you use pip, you can install them by pip install -r requirements.txt.

Datasets preparation

Imagenet

  1. Follow the instructions to download and unpack the dataset.
  2. Set environment variable IMAGENET_DATA_DIR with the directory to the dataset by export IMAGENET_DATA_DIR=/your/imagenet/dir, where /your/imagenet/dir should contain train and val folders (as in the instructions above).

UCF101

  1. Follow the instructions to download, unpack and preprocess the dataset.
  2. Set data environment variables UCF101_DATA_DIR and UCF101_ANNOTATION_PATH.
  • export UCF101_DATA_DIR=/your/data/dir, where /your/data/dir is jpg_video_directory from the instruction above.
  • export UCF101_ANNOTATION_PATH=/your/annotation/path, where /your/annotation/path is a path to the file ucf101_01.json created with the above instruction.
  1. Download a pretrained model called resnext-101-kinetics-ucf101_split1.pth from here. The model comes from the paper Can Spatiotemporal 3D CNNs Retrace the History of 2D CNNs and ImageNet?
  2. Set model environment variable UCF101_MODEL by export UCF101_MODEL=/your/model/path.

Running

  • First run export PYTHONPATH=$PYTHONPATH:deps from the main project directory.
  • To reproduce untargeted ImageNet experiments, run python3 main.py --dataset imagenet --width $WIDTH --epochs 5 --lr 0.1 --lr-decay-wait 2 --lr-decay-coefficient 0.1, where you should set WIDTH of the framing.
  • To reproduce untargeted UCF101 experiments, run python3 main.py --dataset ucf101 --width $WIDTH --epochs 60 --lr 0.03 --lr-decay-wait 15 --lr-decay-coefficient 0.3, where you should set WIDTH of the framing.
  • To draw some examples of attacks on ImageNet, run python3 draw_examples_imagenet.py --framing $CHECKPOINT. As a CHECKPOINT you can use some model from pretrained directory.

Citation

If you found this code useful, please use the following citation:

@paper{zajac2019framing,
  title={Adversarial Framing for Image and Video Classification},
  author={Zaj\k{a}c, Micha\l{} and \.Zo\l{}na, Konrad and Rostamzadeh, Negar and Pinheiro, Pedro},
  conference={AAAI Conference on Artificial Intelligence},
  year={2019}
}

adv_framing's People

Contributors

michalzajac-ml 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.