--- license: mit library_name: pytorch tags: - diffusion - controlnet - face-anonymization - privacy - computer-vision - research datasets: - FFHQ --- # FFHQ ControlNet for Diffusion Sign-Flip Anonymization This repository contains the code for the paper "Secure and reversible face anonymization based on a diffusion model with face mask guidance" (*to be published*) by Pol Labarbarie, Vincent Itier and William Puech. See the github repository for the full code and instructions: (https://github.com/PLabarbarie/diffusion-signflip-anon) This hugging face repository contains a custom ControlNet checkpoint trained for the diffusion sign-flip anonymization pipeline. The model is used to condition an FFHQ latent diffusion model during face anonymization and reconstruction. This variant uses segmentation-mask conditioning. The included `ffhq-diffusers/` directory contains the FFHQ diffusion weights from the original paper (https://arxiv.org/abs/2112.10752), converted to match the Hugging Face Diffusers library format. The repository also includes the precomputed sign-flip keys used by the paper experiments. These keys are provided for reproducibility. ## Loading ```python import os import torch from anonymization.diffusion import DiffusionModel from anonymization.controlnet import ControlNet from config.config_main import config device = "cuda" diffusion_model = DiffusionModel( name="ffhq", torch_device=device, models_root=config.models_root, weights_root=config.weights_root, ) controlnet = ControlNet( model_config=diffusion_model.unet.config, model_ckpt="ffhq-diffusers", hint_channels=3, down_sample_factor=4, device=device, ) state_dict = torch.load("controlnet_epoch_15.pth", map_location=device) controlnet.load_state_dict(state_dict) controlnet.eval() ``` ## Files ```text controlnet_epoch_15.pth controlnet_config.json ffhq-diffusers/ keys/ |-- keys_CelebA_HQ.pt |-- sub_keys_diversity_0.pt |-- sub_keys_diversity_1.pt |-- ... `-- sub_keys_diversity_9.pt README.md ``` ## Citation If you use this checkpoint, please cite the associated paper once available. ```bibtex @article{diffusion_signflip_anonymization, title = {Secure and reversible face anonymization based on a diffusion model with face mask guidance}, author = {Pol Labarbarie and Vincent Itier and William Puech}, journal = {}, year = {2026} } ```