Null-text Inversion for Editing Real Images using Guided Diffusion Models

Ron Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, Daniel Cohen-Or
11/17/2022
1,571 citations
cs.CV
diffusion-flow

Official code: google/prompt-to-prompt (3,454 stars, Jupyter Notebook, Apache-2.0, last commit 2024-05-14).

Abstract

Recent text-guided diffusion models provide powerful image generation capabilities. Currently, a massive effort is given to enable the modification of these images using text only as means to offer intuitive and versatile editing.

Show full abstract

To edit a real image using these state-of-the-art tools, one must first invert the image with a meaningful text prompt into the pretrained model's domain. In this paper, we introduce an accurate inversion technique and thus facilitate an intuitive text-based modification of the image. Our proposed inversion consists of two novel key components: (i) Pivotal inversion for diffusion models. While current methods aim at mapping random noise samples to a single input image, we use a single pivotal noise vector for each timestamp and optimize around it. We demonstrate that a direct inversion is inadequate on its own, but does provide a good anchor for our optimization. (ii) NULL-text optimization, where we only modify the unconditional textual embedding that is used for classifier-free guidance, rather than the input text embedding. This allows for keeping both the model weights and the conditional embedding intact and hence enables applying prompt-based editing while avoiding the cumbersome tuning of the model's weights. Our Null-text inversion, based on the publicly available Stable Diffusion model, is extensively evaluated on a variety of images and prompt editing, showing high-fidelity editing of real images.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
3,454319Jupyter Notebook, PythonOct 3, 20222 years agoApache-2.0

Similar Papers

Cite this paper

@article{mokady2022nulltext,
  title  = {Null-text Inversion for Editing Real Images using Guided Diffusion Models},
  author = {Ron Mokady and Amir Hertz and Kfir Aberman and Yael Pritch and Daniel Cohen-Or},
  year   = {2022},
  eprint = {2211.09794},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.09794},
  journal = {CVPR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2211.09794.svg)](https://codeofpaper.com/paper/2211.09794)

Discussion