yuxincao22 / StyleFool

This is the source code for StyleFool: Fooling Video Classification Systems via Style Transfer (SP'23).
8 stars 2 forks source link

StyleFool

This is the source code for our SP'23 paper "StyleFool: Fooling Video Classification Systems via Style Transfer", partly based on style transfer code by Manuel Ruder https://github.com/manuelruder/artistic-videos.

Our algorithm uses style transfer for video black-box attacks, and ensures the indistinguishability and consistency of the adversarial video.

Setup

Tested with Ubuntu 18.04.

Requirements

Dataset

Pretrained model

We use the pre-trained C3D model from here.

Usage

Attack preparation

Targeted attack

Run python prepare.py --model C3D --dataset UCF101 --target.

Untargeted attack

Run python prepare.py --model C3D --dataset UCF101.

The processes of generating styles, calculating color themes and calculating target class confidence are needed only once. If you have finished those processes, run python prepare.py --model C3D --dataset UCF101 --generate-styles --color --superposition --target for targeted attack preparation and python prepare.py --model C3D --dataset UCF101 --generate-styles --color --superposition for untargeted attack preparation.

Then, you will find 'batch_command_target.sh' and 'batch_command_untarget.sh' in your directory.

Basic arguments:

Style transfer

Targeted attack

Run sh ./batch_command_target.sh.

Untargeted attack

Run sh ./batch_command_untarget.sh.

Adversarial attack preparation

Targeted attack

Run python attack_prepare.py --model C3D --dataset UCF101 --target.

Untargeted attack

Run python attack_prepare.py --model C3D --dataset UCF101.

Basic arguments:

Then, you will find 'target_attack_batch.sh' and 'untarget_attack_batch.sh' in your directory.

Adversarial attack

Targeted attack

Run sh ./target_attack_batch.sh.

Untargeted attack

Run sh ./untarget_attack_batch.sh.

Generate videos (optional)

If you want to visualize the adversarial video and the initial video, run python generate_videos.py.

Basic arguments:

Acknowledgement

Citation

If you use this code or its parts in your research, please cite the following paper:

@inproceedings{cao2023stylefool,
  title={StyleFool: Fooling Video Classification Systems via Style Transfer},
  author={Cao, Yuxin and Xiao, Xi and Sun, Ruoxi and Wang, Derui and Xue, Minhui and Wen, Sheng},
  booktitle={2023 IEEE Symposium on Security and Privacy (SP)},
  year={2023},
  organization={IEEE},
  address={San Francisco, CA, USA},
  month={May}
}