Coder Social home page Coder Social logo

ajevnisek / concept-ablation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nupurkmr9/concept-ablation

0.0 0.0 0.0 6.67 MB

Ablating Concepts in Text-to-Image Diffusion Models (ICCV 2023)

Home Page: https://www.cs.cmu.edu/~concept-ablation

License: MIT License

Shell 0.43% Python 99.57%

concept-ablation's Introduction

Concept Ablation

[NEW!] Huggingface demo link.

concept_ablation.mp4

Our method can ablate (remove) copyrighted materials and memorized images from pretrained Stable Diffusion models. Here we change the target concept distribution to an anchor concept, e.g., Van Gogh painting to paintings or Grumpy cat to Cat.

Ablating Concepts in Text-to-Image Diffusion Models
Nupur Kumari, Bingliang Zhang, Sheng-Yu Wang, Eli Shechtman, Richard Zhang, Jun-Yan Zhu
CMU, Tsinghua, Adobe
ICCV, 2023

Introduction

Large-scale text-to-image diffusion models can generate high-fidelity images with powerful compositional ability. However, these models are typically trained on an enormous amount of Internet data, often containing copyrighted material, licensed images, and personal photos. Furthermore, they have been found to replicate the style of various living artists or memorize exact training samples. How can we remove such copyrighted concepts or images without retraining the model from scratch?

We propose an efficient method of ablating concepts in the pretrained model, i.e., preventing the generation of a target concept. Our algorithm learns to match the image distribution for a given target style, instance, or text prompt we wish to ablate to the distribution corresponding to an anchor concept, e.g., Grumpy Cat to Cats.

Results

Our method works well on various concept ablation tasks, including specific object instances, artistic styles, and memorized images. We can successfully ablate target concepts while minimally affecting closely-related surrounding concepts that should be preserved (e.g., other cat breeds when ablating Grumpy Cat). All our results are based on stable-diffusion-v1-4 model.

For more generations and comparisons, please refer to our webpage.

Style Ablation

We ablate different target artistic style concepts and generate normal paintings instead.

Instance Ablation

We ablate various instances and overwrite them with general category anchor concepts.

Memorized Image Ablation

Our method can ablate memorized training images and instead generate variations.

Method Details

Given a target concept Grumpy Cat to ablate and an anchor concept Cat, we fine-tune the model to have the same prediction given the target concept prompt A cute little Grumpy Cat as when the prompt is A cute little cat.

Getting Started

Diffusers: Please refer here for ablating concepts using diffusers based stable-diffusion model.

CompVis: Please refer here for ablating concepts using CompVis based stable-diffusion model.

Note: all our results in the paper were obtained using CompVis based implementation.

Citation

If you use this code for your research, please cite our paper.

@inproceedings{kumari2023conceptablation,
  author = {Kumari, Nupur and Zhang, Bingliang and Wang, Sheng-Yu and Shechtman, Eli and Zhang, Richard and Zhu, Jun-Yan},
  title = {Ablating Concepts in Text-to-Image Diffusion Models},
  booktitle = ICCV,
  year = {2023},
}

concept-ablation's People

Contributors

nupurkmr9 avatar junyanz avatar jacklangerman avatar zhangbingliang2019 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.