Giter Club home page Giter Club logo

latent_diffusion_face_anonymization's Introduction

Static Badge

Latent Diffusion Face Anonymisation LDFA

This repository contains the code for the paper LDFA: Latent Diffusion Face Anonymization for Self-driving Applications.

Personal Contributions:

Requirements

Setup

bash setup_requirements.sh # Downloads stable diffusion weights & nvidia-container-toolkit
bash setup_compose_env.sh # Sets the container variables

Usage

After you run setup_requirements.sh and setup_compose_env.sh, you can start the docker instances with docker compose up. The script will look for all images with the given extension in the provided root folder. Make sure you are using bash to execute the scripts. Once the docker container is running you can generate masks with:

bash generate_masks.sh

and anonymize the detected faces using:

bash anonymize.sh

Structure

Dockerfile

The dockerfile is used to start container which runs the Automatic1111 web UI for stable diffusion. LDFA uses the API to conveniently use a stable diffusion model for the anonymization of human faces.

Scripts

  • detect_faces.py - This script uses RetinaFace to detect faces on a given dataset.
  • ldfa_face_anon.py - This script implements the LDFA anonymization method.
  • simple_face_anon.py - This script implements the naive anonymization methods cropping, gaussian noise and pixelaziation which are applied on detected faces.

Bash Scripts

  • setup_requirements.sh - Downloads stable-diffusion-2-inpainting weights from HuggingFace, saves it at models/stable-diffusion with the name last.ckpt.
  • setup_compose_env.sh - Creates .env which includes port, directories (input, output) and image extension.
  • generate_masks.sh - Runs detect_faces.py in the container.
  • anonymize.sh - Runs ldfa_face_anon.py in the container.

Citation

If you are using LDFA in your research, please consider to cite us.

@InProceedings{Klemp_2023_CVPR,
    author    = {Klemp, Marvin and R\"osch, Kevin and Wagner, Royden and Quehl, Jannik and Lauer, Martin},
    title     = {LDFA: Latent Diffusion Face Anonymization for Self-Driving Applications},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2023},
    pages     = {3198-3204}
}

latent_diffusion_face_anonymization's People

Contributors

ataatasoy avatar keroe avatar marvinklemp avatar roydenwa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.