Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koushiksrivats/face_attribute_attack
Official implementation of the paper "Evading Forensic Classifiers with Attribute-Conditioned Adversarial Faces" (CVPR 23)
https://github.com/koushiksrivats/face_attribute_attack
Last synced: about 2 months ago
JSON representation
Official implementation of the paper "Evading Forensic Classifiers with Attribute-Conditioned Adversarial Faces" (CVPR 23)
- Host: GitHub
- URL: https://github.com/koushiksrivats/face_attribute_attack
- Owner: koushiksrivats
- Created: 2023-03-23T20:18:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T10:27:12.000Z (12 months ago)
- Last Synced: 2024-08-12T08:09:27.719Z (5 months ago)
- Language: Python
- Homepage: https://koushiksrivats.github.io/face_attribute_attack/
- Size: 33.5 MB
- Stars: 37
- Watchers: 6
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-MLSecOps - face_attribute_attack
README
Evading Forensic Classifiers with Attribute-Conditioned Adversarial Faces [CVPR 2023]
Fahad Shamshad,
Koushik Srivatsan,
Karthik Nandakumar
MBZUAI, UAE.
## Updates :loudspeaker:
- **28-07-2023**: Code released.
## Attribute-conditioned adversarial face image generation
### Setup
- **Get code**
```shell
git clone https://github.com/koushiksrivats/face_attribute_attack.git
```- **Build environment**
```shell
cd face_attribute_attack
# use anaconda to build environment
conda create -n faa python=3.8
conda activate faa
# install packages
pip install -r requirements.txt
```### Dataset and pre-trained weights
1. **Download the forensic classifier training data**:
- You can download the real FFHQ images [here](https://drive.google.com/drive/folders/1tZUcXDBeOibC6jcMCtgRRz67pzrAHeHL)
- You can download the fake (styleGAN generated) FFHQ images [here](https://drive.google.com/drive/folders/1-5HnXJuN1ofCrCSbbVSH3NnP62BZTh4s)
- Re-arrange them into the following folder structure.
```
data
|__ train
|__ fake
|__ real
|__ test
|__ fake
|__ real
```
2. **Download the pre-trained StyleGAN2 weights**:
- Download the pre-trained StyleGAN2 weights from [here](https://drive.google.com/file/d/1EM87UquaoQmk17Q8d5kYIAHqu0dkYqdT/view?usp=sharing).
- Place the weights in the 'pretrained_models' folder.### Usage
**Train forensic classifier**
```shell
python classifier_training.py \
--train_data data/train \
--test_data data/test \
--batch_size 128 \
--epochs 10 \
--classifier_name resnet50 \
--output_path forensic_classifier_trained_models/resnet50/ \
--wandb_project_name project_name \
--experiment_name resnet50_forensic_classifier \
--resume_training False# Note: The trained model will be saved in the output_path under the name 'best_epoch.pt'
```**Adversarial faces with text as reference**
```shell
python text_as_reference.py --config_file configs/config_text_as_reference.ini
```**Adversarial faces with image as reference**
```shell
python image_as_reference.py --config_file configs/config_image_as_reference.ini
```**Adversarial transferability with meta-optimization (Uses the text-as-reference method)**
```shell
python adversarial_transferability.py --config_file configs/config_adversarial_transferrability.ini
```#
If you're using this work in your research or applications, please cite using this BibTeX:
```bibtex
@inproceedings{shamshad2023evading,
title={Evading Forensic Classifiers With Attribute-Conditioned Adversarial Faces},
author={Shamshad, Fahad and Srivatsan, Koushik and Nandakumar, Karthik},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={16469--16478},
year={2023}
}
```