This is the official source code for the paper "Realistic Full-Body Anonymization with Surface-Guided GANs".
[Arixv Paper] [Appendix] [Google Colab demo] [WACV 2023 Conference Presentation]
Surface-guided GANs is an automatic full-body anonymization technique based on Generative Adversarial Networks.
The key idea of surface-guided GANs is to guide the generative model with dense pixel-to-surface information (based on continuous surface embeddings). This yields highly realistic anonymization result and allows for diverse anonymization.
Check out the new DeepPrivacy2! It significantly improves anonymization quality compared to this repository.
- Pytorch >= 1.9
- Torchvision >= 0.11
- Python >= 3.8
- CUDA capable device for training. Training was done with 1-4 32GB V100 GPUs.
We recommend to setup and install pytorch with anaconda following the pytorch installation instructions.
- Clone repository:
git clone https://github.com/hukkelas/full_body_anonymization/
. - Install using
setup.py
:
pip install -e .
Otherwise, you can setup your environment with our provided Dockerfile.
The file anonymize.py
can anonymize image paths, directories and videos. python anonymize.py --help
prints the different options.
To anonymize, visualize and save an output image, you can write:
python3 anonymize.py configs/surface_guided/configE.py coco_val2017_000000001000.jpg --visualize --save
The truncation value decides the "creativity" of the generator, which you can specify in the range (0, 1). Setting -t 1
will generate diverse anonymization between runs.
For config A/B/C, the truncation value accepts range of (0, -t=None
will apply to latent truncation.
python3 anonymize.py configs/surface_guided/configE.py coco_val2017_000000001000.jpg --visualize --save -t 1
Check out the interactive demo with our gradio implementation. Run
python3 app.py
See docs/TRAINING.md.
See docs/REPRODUCING.md.
All code, except the stated below, is released under MIT License.
Code under:
torch_utils/
: Code modified from github.com/NVlabs/stylegan2-ada-pytorch. Separate license is attached in the directory.dnnlib/
: Code modified from github.com/NVlabs/stylegan2-ada-pytorch. Separate license is attached in the directory.- Detection network: See Detectron2 License.
If you use this code for your research, please cite:
@inproceedings{hukkelas23FBA,
author={Hukkelås, Håkon and Smebye, Morten and Mester, Rudolf and Lindseth, Frank},
booktitle={2023 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
title={Realistic Full-Body Anonymization with Surface-Guided GANs},
year={2023},
volume={},
number={},
pages={1430-1440},
doi={10.1109/WACV56688.2023.00148}}