Official PyTorch implementation for CVPR 2024 paper:
Generative Unlearning for Any Identity
Juwon Seo*, Sung-Hoon Lee*, Tae-Young Lee*, Seungjun Moon, and Gyeong-Moon Park
- Python 3.9.x
- PyTorch 2.1.0
- Torchvision 0.16.0
- NVIDIA GeForce RTX 3090 / A5000 / A6000
- CUDA 11.8
git clone [email protected]/KHU-AGI/GUIDE.git
cd GUIDE
conda env create -f environment.yaml
conda activate guide
Filename | Description |
---|---|
ffhqrebalanced512-128.pkl | Pretrained weights of EG3D network. |
w_avg_ffhqrebalanced512-128.pt | Average latent code computed from pretrained EG3D network. |
model_ir_se50.pth | Pretrained weights of ArcFace network to compute identity loss. |
encoder_FFHQ.pt | Pretrained weights of GOAEncoder for 3D GAN inversion. |
CurricularFace_Backbone.pth | Pretrained weights of CurricularFace network to compute identity similarity. |
ffhq_real_feat.npy | Statistics of Inception-v3 feature to easily compute ΔFIDreal. |
To run code, please download all of files via Google Drive.
We provide sample data (./data/CelebAHQ/512) to run our code.
The commands for Random and In-Domain scenarios will be updated in near future.
# Baseline
python unlearn.py --exp baseline \
--inversion goae \
--inversion_image_path ./data/CelebAHQ/512 \
--target average \
--local \
--seed 0
# GUIDE
python unlearn.py --exp guide \
--inversion goae \
--inversion_image_path ./data/CelebAHQ/512 \
--target extra \
--target_d 30.0 \
--local \
--adj \
--glob \
--seed 0
It takes about 15 minutes in a single 3090 GPU.
If you want to erasure in the wild identities, please preprocess the images via Deep3DFaceRecon.
Otherwise, both the inversion encoder and pretrained generatior can't recognize them correctly.
Evaluation on identity erasure:
python evaluate_id.py --exp [baseline | guide]
Evaluation on pretrained distribution preservation:
python evaluate_fid.py --exp [baseline | guide]
By running the above commands, we could obtain the results of:
ID | IDothers | FIDpre | ΔFIDreal | |
---|---|---|---|---|
baseline | 0.0818 | 0.4122 | 9.487 | 4.891 |
GUIDE | 0.0183 | 0.2797 | 7.497 | 3.331 |
Our code is based on EG3D, GOAE, Deep3DFaceRecon, PerceptualSimilarity, pytorch-fid, InsightFace, and CurricularFace.
@inproceedings{seo2024generative,
author = {Seo, Juwon and Lee, Sung-Hoon and Lee, Tae-Young and Moon, Seungjun and Park, Gyeong-Moon},
title = {Generative Unlearning for Any Identity},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2024},
pages = {9151-9161}
}