Code Monkey home page Code Monkey logo

reacg's Introduction

Rescaling ACG

Requirements

  • Python >= 3.11, <3.12
  • CUDA >= 11.8
  • GCC >= 4.5
  • poetry >= 1.4.2

Installation

Poetry

curl -sSL https://install.python-poetry.org | python3 -

Specify the python-version

poetry env use <python-version>

If you use pyenv, you have to run pyenv local <python-version> in advance.

Dependencies

poetry install

Dataset

  • imagenet
    1. cd data/imagenet
    2. Download ILSVRC2012_img_val.tar and ILSVRC2012_devkit_t12.tar.gz from ImageNet official site
    3. mkdir val && tar -xf ILSVRC2012_img_val.tar -C ./val
    4. tar -xzf ILSVRC2012_devkit_t12.tar.gz
    5. python build_dataset.py
    6. mv val val_original && mv ILSVRC2012_img_val_for_ImageFolder val

Usage

Run attacks

APGD

poetry run python -B run_evaluation.py -p ../configs/config_apgd.yaml -g 0 -o ../result --log_level 20 --cmd_param attacker_name:str:APGD 

ACG

poetry run python -B run_evaluation.py -p ../configs/config_acg.yaml -g 0 -o ../result --log_level 20 --cmd_param attacker_name:str:ACG 

ACG+T

poetry run python -B run_evaluation.py -p ../configs/config_acg_t.yaml -g 0 -o ../result --log_level 20 --cmd_param attacker_name:str:ACG 

ACG+R

poetry run python -B run_evaluation.py -p ../configs/config_acg_r.yaml -g 0 -o ../result --log_level 20 --cmd_param attacker_name:str:ReACG 

ReACG

poetry run python -B run_evaluation.py -p ../configs/config_reacg.yaml -g 0 -o ../result --log_level 20 --cmd_param attacker_name:str:ReACG 

Models used in the experiments

selected_models.yaml shows the model names used in the experiments. You can generate adversarial examples for <model_name> by specifying model_name:str:<model_name> after --cmd_param. Similarly, you can specify the dataset and batch size as dataset:str:<dataset>, batch_size:int:<batch_size>.

config/config_<attacker_name>.yaml specifies the hyperparameters of the attack <attacker_name>. You can set different parameters by editing this file.

reacg's People

Contributors

yamamura-k 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.