Skip to content

Official implementation for the paper "Taming Normalizing Flows"

Notifications You must be signed in to change notification settings

ShimonMalnick/taming_norm_flows

Repository files navigation

Taming Normalizing Flows
WACV 2024

We propose an algorithm for taming Normalizing Flow models - changing the probability that the model will produce a specific image or image category. We focus on Normalizing Flows because they can calculate the exact generation probability likelihood for a given image. We demonstrate taming using models that generate human faces, a subdomain with many interesting privacy and bias considerations. Our method can be used in the context of privacy, e.g., removing a specific person from the output of a model, and also in the context of debiasing by forcing a model to output specific image categories according to a given distribution. Taming is achieved with a fast fine-tuning process without retraining from scratch, achieving the goal in a matter of minutes. We evaluate our method qualitatively and quantitatively, showing that the generation quality remains intact, while the desired changes are applied.

Official implementation of the paper: Taming Normalizing Flows

Setup

1. Download Data

2. Create Environment

conda create -n taming python=3.11
conda activate taming
cd taming_norm_flows
pip install -r requirements.txt

3. Set variables in setup.py

CELEBA_ROOT="/path/to/celeba/dataset"
ARCFACE_CKPT="/path/to/arcface/model"
BASE_MODEL_PATH="/path/to/base/pretrained/model"

Run

Taming an identity

the forget_identity attribute in the configs/forget_identity.json determines the id of the identity in celeba to forget. See all parameters by running python taming_an_identity -h

python taming_an_identity.py --config configs/forget_identity.json

Taming an attribute

Will be uploaded soon

Acknowledgments

This repository builds on code from the on the glow-pytorch repository. In addition, we also use code from ArcFace for a face classifer.

BibTex

@inproceedings{malnick2024taming,
  title={Taming Normalizing Flows},
  author={Malnick, Shimon and Avidan, Shai and Fried, Ohad},
  booktitle={Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision},
  pages={4644--4654},
  year={2024}
}

About

Official implementation for the paper "Taming Normalizing Flows"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages