GithubHelp home page GithubHelp logo

ldz666666 / dpatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from veralauee/dpatch

2.0 0.0 0.0 4.18 MB

An adversarial attack on object detectors

Python 81.68% C 9.98% Cuda 7.71% C++ 0.38% Shell 0.25%

dpatch's Introduction

DPatch: An Adversarial Patch Attack on Object Detectors

This is a PyTorch implementation of DPATCH. Please refer to the paper https://arxiv.org/abs/1806.02299

Installation

  1. Please install PyTorch following the instuctions on the official website. The version here should be 0.4.0

     conda install pytorch torchvision -c pytorch
  2. The yolo codes are referred to https://github.com/longcw/yolo2-pytorch. Download the pretrained yolo model yolo-voc.weights.h5

  3. Download the dataset VOCdevkit

    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
    wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
  4. Extract all of these tars into one directory named VOCdevkit

    tar xvf VOCtrainval_06-Nov-2007.tar
    tar xvf VOCtest_06-Nov-2007.tar
    tar xvf VOCdevkit_08-Jun-2007.tar
  5. It should have this basic structure

    $VOCdevkit/                           # development kit
    $VOCdevkit/VOCcode/                   # VOC utility code
    $VOCdevkit/VOC2007                    # image sets, annotations, etc.
    # ... and several other directories ...
  6. Since the program loading the data in DPatch/data by default, you can set the data path as following.

    cd DPatch
    mkdir data
    cd data
    ln -s $VOCdevkit VOCdevkit2007

Train a DPatch

The trained DPATCH are saved in trained_patch/${target_class}/ bash python train.py

Test

Download a trained DPATCH https://drive.google.com/open?id=1_G5xXWIJWNGuss4KZbBQ9pMvuthmL_wc , or you can test your trained DPatch and set the path in cfgs/config.py (Line 102) bash python test.py โ€“-attack untargeted python test.py โ€“-attack targeted

Demo

The demo pictures are saved in demo/patch, the detection results are saved in demo/ bash python demo.py

Click the following picture to watch the video demo. Watch the video

dpatch's People

Contributors

cory8249 avatar crazylyf avatar liuziwei7 avatar longcw avatar snowmasaya avatar veralauee avatar wilrich-msft avatar

Stargazers

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