Skip to content
/ FG-UAP Public

Source code of paper "FG-UAP: Feature-Gathering Universal Adversarial Perturbation"

Notifications You must be signed in to change notification settings

yzx1213/FG-UAP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FG-UAP: Feature-Gathering Universal Adversarial Perturbation

This is the code for the experiments of our paper. You can find the arXiv version of the paper here

Environment

pip install torch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0
pip install tqdm

Path setting

Please change the data path and result path to your own path in the following three lines.

parser.add_argument('--train_data_dir', default='path_of_train_data', type=str)
parser.add_argument('--val_data_dir', default='path_of_validation_data', type=str)
parser.add_argument('--result_dir', default='path_of_result_dir', type=str)

Generate FG-UAP

Now you can craft an FG-UAP for vgg16 by running

python find_uap.py --model_name vgg16 

Change the target to generate targeted FG-UAP

python find_uap.py --model_name vgg16 --target 1

Top-k parameter is used for calculating Dominance Ratios. Run the following code to get the $1st$, $3rd$, and $5th$ dominance ratio.

python find_uap.py --model_name vgg16 --top_k 1 3 5

About

Source code of paper "FG-UAP: Feature-Gathering Universal Adversarial Perturbation"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages