- Python >= 3.11, <3.12
- CUDA >= 11.8
- GCC >= 4.5
- poetry >= 1.4.2
curl -sSL https://install.python-poetry.org | python3 -
poetry env use <python-version>
If you use pyenv
, you have to run pyenv local <python-version>
in advance.
poetry install
- imagenet
cd data/imagenet
- Download
ILSVRC2012_img_val.tar
andILSVRC2012_devkit_t12.tar.gz
from ImageNet official site mkdir val && tar -xf ILSVRC2012_img_val.tar -C ./val
tar -xzf ILSVRC2012_devkit_t12.tar.gz
python build_dataset.py
mv val val_original && mv ILSVRC2012_img_val_for_ImageFolder val
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
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
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
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
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
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.