Coder Social home page Coder Social logo

xiaofanustc / kaggle-nips-adversarial-attacks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edwardtyantov/kaggle-nips-adversarial-attacks

0.0 1.0 0.0 19 KB

Pytorch code for NIPS adversarial attack/defence https://www.kaggle.com/c/nips-2017-defense-against-adversarial-attack

Dockerfile 10.04% Shell 3.68% Python 86.28%

kaggle-nips-adversarial-attacks's Introduction

Overview

This is pytorch code for NIPS adversarial attack/defence.

Stack: Python3.5, Pytorch, foolbox

DockerImage based on def. pytorch, contains: miniconda 3.5, pytorch, foolbox

Structure

  • defence/ - code for the defence competition. For now simple inceptionv3 model on 6 TTA.
    • metadata.json uses my docker image with pytorch & foolbox (fork of pytorch default Dockerfile)
      • model_name point to a model in torch_defence/models.py
    • models/ contains pretrained CNN models

Defence

To download default model execute: cd defence/models; wget https://download.pytorch.org/models/inception_v3_google-1a9a5a14.pth or specify path inside run-defense.sh

Example of running the defence using Docker image (to replace prefixes):

OUTPUT_DATA=/home/tyantov/workspace/kaggle-nips-adversarial-attacks/output_torch
SUBMISSION_DIRECTORY=/home/tyantov/workspace/kaggle-nips-adversarial-attacks/defence
INPUT_IMAGES=/home/tyantov/workspace/kaggle-nips-adversarial-attacks/images_tf
DOCKER_CONTAINER_NAME=tyantov/nips-adv-pytorch

time nvidia-docker run --shm-size="1024m"\
  -v ${INPUT_IMAGES}:/input_images \
  -v ${OUTPUT_DATA}:/output_data \
  -v ${SUBMISSION_DIRECTORY}:/code \
  -w /code \
  ${DOCKER_CONTAINER_NAME} \
  ./run_defense.sh \
  /input_images \
  /output_data/result.csv

Docker installation

Some notes:

  • install Docker CE
    • to run docker without sudo: sudo gpasswd -a <USERNAME docker
  • install Nvidia-docker (nvidia drivers should be installes on the host)

kaggle-nips-adversarial-attacks's People

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.