diff --git a/.DS_Store b/.DS_Store index 2722bd9..13a9bbf 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/README.md b/README.md index 30e5aea..4de2eaa 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,57 @@ -# Disrupting Deepfakes: Adversarial Attacks on Conditional Image Translation Networks +## Disrupting Deepfakes: Adversarial Attacks on Conditional Image Translation Networks -## StarGAN Testing +

+ +**[[Paper]](https://arxiv.org/abs/2003.01279)** + +Official PyTorch implementation of **[Disrupting Deepfakes](https://arxiv.org/abs/2003.01279)**. This repository contains code for adversarial attacks (disruptions) for (conditional) image translation networks. The StarGAN, GANimation, pix2pixHD and CycleGAN networks are included - and the attacks can be adapted to any image translation network. We include adaptations of FGSM, I-FGSM and PGD attacks. + +## Datasets +TODO: Include download instructions for datasets. + +## Attack Testing +Here are bash commands for testing our vanilla attacks on each different architecture. ``` +# StarGAN Attack Test +cd stargan python main.py --mode test --dataset CelebA --image_size 256 --c_dim 5 --selected_attrs Black_Hair Blond_Hair Brown_Hair Male Young --model_save_dir='stargan_celeba_256/models' --result_dir='stargan_celeba_256/results_test' --test_iters 200000 --batch_size 1 + +# GANimation Attack Test +cd ganimation +python main.py --mode animation + +# pix2pixHD Attack Test +cd pix2pixHD +python test.py --name label2city_1024p --netG local --ngf 32 --resize_or_crop none + +# CycleGAN Attack Test +python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout ``` -## StarGAN Training +If you want to change the attack method being used, look into the attack.py scripts in each architecture folder and change the number of iterations, attack magnitude and step size. You can also re-run the class transferring and blur evasion experiments on StarGAN by commenting/uncommenting lines 54-61 in stargan/main.py or modifying the stargan/solver.py script to change the attack type. + +In order to change attack types for GANimation you can modify lines 386-470 by commenting out the vanilla attack and uncommenting the attack you want to run. + +## Attack Testing +In order to run G+D adversarial training on StarGAN run: ``` +# StarGAN Adversarial Training python main.py --mode train --dataset CelebA --image_size 256 --c_dim 5 --sample_dir stargan_both/samples --log_dir stargan_both/logs --model_save_dir stargan_both/models --result_dir stargan_both/results --selected_attrs Black_Hair Blond_Hair Brown_Hair Male Young ``` +If you wish to run vanilla training or generator adversarial training, comment/uncomment the appropriate lines (l.44-49) in stargan/main.py -## GANimation -``` -python main.py --mode animation -``` +## Image Translation Network Implementations +We use code from [StarGAN](https://github.com/yunjey/stargan), [GANimation](https://github.com/vipermu/ganimation), [pix2pixHD](https://github.com/NVIDIA/pix2pixHD), [CycleGAN](https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix) and [advertorch](https://github.com/BorealisAI/advertorch). These are all great repositories and we encourage you to check them out and cite them in your work. -## pix2pixHD +## Citation +If you find this work useful for your research, please cite our [paper](https://arxiv.org/abs/2003.01279): ``` -python test.py --name label2city_1024p --netG local --ngf 32 --resize_or_crop none -``` - -## CycleGAN -``` -python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout +@article{ruiz2020disrupting, + title={Disrupting Deepfakes: Adversarial Attacks Against Conditional Image Translation Networks and Facial Manipulation Systems}, + author={Nataniel Ruiz and Sarah Adel Bargal and Stan Sclaroff}, + year={2020}, + eprint={2003.01279}, + archivePrefix={arXiv}, + primaryClass={cs.CV} +} ``` \ No newline at end of file diff --git a/imgs/demo.gif b/imgs/demo.gif new file mode 100644 index 0000000..88e0d8f Binary files /dev/null and b/imgs/demo.gif differ