This repository provides the official PyTorch implementation of the following paper:
Install dependencies:
cd SimAC
conda create -n simac python=3.9
conda activate simac
pip install -r requirements.txt
Pretrained checkpoints of different Stable Diffusion versions can be downloaded from provided links in the table below:
Version | Link |
---|---|
2.1 | stable-diffusion-2-1-base |
1.5 | stable-diffusion-v1-5 |
1.4 | stable-diffusion-v1-4 |
Please download the pretrain weights and define "$MODEL_PATH" in the script. Note: Stable Diffusion version 2.1 is the default version in all of our experiments.
GPU allocation: All experiments are performed on a single NVIDIA 48GB A6000 GPU.
Thanks for Anti-Dreambooth's great efforts, there are two datasets: VGGFace2 and CelebA-HQ which are provided at here.
For convenient testing, we have provided a split set of one subject in CelebA-HQ at ./data/CelebA-HQ/103
as the Anti-dreambooth does.
To defense Stable Diffusion version 2.1 (default) with ASPL, you can run
bash scripts/attack_aspl.sh
To defense Stable Diffusion version 2.1 (default) with SimAC, you can run
bash scripts/attack_timesteps.sh
If you want to train a DreamBooth model from your own data, whether it is clean or perturbed, you may run the following script:
bash scripts/train_dreambooth_alone.sh
Inference: generates examples with multiple-prompts
python infer.py --model_path <path to DREAMBOOTH model>/checkpoint-1000 --output_dir $<path to DREAMBOOTH model>/checkpoint-1000-test-infer
If you have any problems, please open an issue in this repository or send an email to wangfeifei@mail.ustc.edu.cn.
This repo is heavil based on Anti-DB. Thanks for their impressive works!
Details of algorithms and experimental results can be found in our following paper:
@inproceedings{wang2024simac,
title={SimAC: A Simple Anti-Customization Method for Protecting Face Privacy against Text-to-Image Synthesis of Diffusion Models},
author={Feifei Wang and Zhentao Tan and Tianyi Wei and Yue Yue and Qidong Huang},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={12047--12056},
year={2024}
}
Please CITE our paper if you find this work useful for your research.