zhang943 / Face-Adversarial-Attack

An easy approach for the competition "Facial Adversary Examples" in TIANCHI
https://tianchi.aliyun.com/competition/entrance/231745/introduction?lang=en-us
32 stars 5 forks source link
adversarial-attacks face-recognition pytorch

Face-Adversarial-Attack

Introduction

This is an easy approach for the competition "Facial Adversary Examples" in TIANCHI, which can get 3.5 in score based the evaluation criterion of the competition.

Preparation

  1. Download the dataset from TIANCHI. Suppose the directory is $DATA_DIR.

  2. Download the pretrained Face-Recognition models from Baidu (Extraction code: sjqs).

  3. Download the feature files from Baidu (Extraction code: jf2z). Or you can use the script attack/preprocess_eval.py to generate these files.

  4. Init attack mask directory:

    mkdir attack/masks

    Your directory tree should look like this:

    ${PROJECT_HOME}
    ├── attack
        ├── log
        ├── masks
        ├── state
        └── *.py
    ├── model
        └── downloaded models
    ├── result
        └── downloaded features
    ├── ...
    └── ...

Dependencies

Usage

cd $PROJECT_HOME/attack

python attack.py \
    --root $DATA_DIR/securityAI_round1_images \
    --dev_path $DATA_DIR/securityAI_round1_dev.csv \
    --output_path $OUTPUT_PATH

Acknowledgement

We develop our attack codes based wujiyang's Face_Pytorch.