Giter Club home page Giter Club logo

dpattack's Introduction

Introduction

This is a project for the Tianchi competition: adversarial attack for universal object detection. Here is the url: https://tianchi.aliyun.com/competition/entrance/531806/information. We obtain the third in this contest.

Data preparation and model checkpoint.

  • Download 1000 pictures needed for the competition on the official website
  • You can get data (images.zip) and the definition, weight and evaluation code of two white box models (eval_code.zip). We use yolov4 and faster_rcnn as whitebox models.
  • Create two new folders, images and models, Unzip images.zip to images, and move all checkpoint and config files to models.

Requirements

This code is based on pytorch. Some basic dependencies are recorded in requirements.txt

  • torch
  • torchvision
  • pillow
  • numpy
  • tqdm
  • scipy
  • scikit-image

You can run yolov4 now if all above requirements are satisfied.

Another faster rcnn model is implemented based on mmdetection. So, ensure that the mmdetection library has been installed and can be run on your machine. You can refer install guide of mmdetection to github

After installation, put the mmdetection directory into eval_code/ below. Alternatively, it is optional that using docker provided by mmdetection.

Usage

Unzip eval_code.zip,move and unzip images.zip to images, ensure the following structure:

|--images
    |-- XXX.png
    |-- XXX.png
    |-- XXX.png
    …
    |-- XXX.png

Move all checkpoints and config files to models as:

|--models
    |-- faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth
    |-- yolov4.cfg
    |-- yolov4.weights

Run Attack algorithm

python attack.py --patch_type grid --lines 3 --box_scale 1.0
python attack.py --patch_type grid --lines 2 --box_scale 1.0
python attack.py --patch_type grid --lines 1 --box_scale 1.0


python attack.py --patch_type astroid

Run ensemble algorithm

python ensemble.py

dpattack's People

Contributors

wu-shudeng avatar

Watchers

 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.