Skip to main content
QUICK REVIEW

[Paper Review] InstructPix2Pix: Learning to Follow Image Editing Instructions

Tim Brooks, Aleksander Holynski|arXiv (Cornell University)|Nov 17, 2022
Multimodal Machine Learning ApplicationsComputer Science40 citations
TL;DR

A diffusion-based model learns to edit images from human-written instructions by training on a large synthetic paired dataset generated from GPT-3 and Stable Diffusion, enabling zero-shot editing of real images without per-example fine-tuning.

ABSTRACT

We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our model follows these instructions to edit the image. To obtain training data for this problem, we combine the knowledge of two large pretrained models -- a language model (GPT-3) and a text-to-image model (Stable Diffusion) -- to generate a large dataset of image editing examples. Our conditional diffusion model, InstructPix2Pix, is trained on our generated data, and generalizes to real images and user-written instructions at inference time. Since it performs edits in the forward pass and does not require per example fine-tuning or inversion, our model edits images quickly, in a matter of seconds. We show compelling editing results for a diverse collection of input images and written instructions.

Motivation & Objective

  • Motivate a system that can edit images based on natural language instructions rather than full image descriptions.
  • Address the data bottleneck by generating large multi-modal training data from pretrained models.
  • Develop a diffusion-based editor that can apply a wide range of edits in a single forward pass without per-example finetuning.

Proposed method

  • Create a large paired dataset of input captions, edit instructions, and output captions by finetuning GPT-3 on a small human-written set and applying it to LAION captions.
  • Convert caption pairs into image pairs using Stable Diffusion with Prompt-to-Prompt to encourage visual consistency across edits.
  • Train a latent diffusion model (InstructPix2Pix) conditioned on both the input image and the edit instruction to perform forward-pass edits.
  • Apply classifier-free guidance with two conditioning streams (input image cI and instruction cT) and tune guidance weights sI and sT to balance fidelity to the input and adherence to the instruction.
  • Initialize the editor from a pretrained Stable Diffusion checkpoint and extend the input with a channel for the encoded input image.
  • Filter generated image pairs with a CLIP-based directional similarity to improve data quality.
Figure 2 : Our method consists of two parts: generating an image editing dataset, and training a diffusion model on that dataset. (a) We first use a finetuned GPT-3 to generate instructions and edited captions. (b) We then use StableDiffusion [ 52 ] in combination with Prompt-to-Prompt [ 17 ] to gen
Figure 2 : Our method consists of two parts: generating an image editing dataset, and training a diffusion model on that dataset. (a) We first use a finetuned GPT-3 to generate instructions and edited captions. (b) We then use StableDiffusion [ 52 ] in combination with Prompt-to-Prompt [ 17 ] to gen

Experimental results

Research questions

  • RQ1Can a diffusion-based editor learn to follow natural language editing instructions using synthetic multi-modal training data?
  • RQ2How does the combination of two conditionings (input image and edit instruction) with classifier-free guidance affect edit fidelity and instruction adherence?
  • RQ3What is the impact of dataset size and filtering on the model's ability to perform larger or more complex edits?
  • RQ4How well does the model generalize to real images and human-written instructions at inference time?
  • RQ5What are the main limitations and biases when following editing instructions with a data-driven, synthetic training pipeline?

Key findings

  • The model achieves zero-shot generalization to real images and human-written instructions without per-example fine-tuning.
  • The dataset of roughly 454k generated edits enables diverse edits including style, background replacement, and object changes.
  • Two-condition classifier-free guidance allows balancing fidelity to the input image and adherence to the instruction, with sT around 5–10 and sI around 1–1.5 yielding strong results.
  • Compared to SDEdit and Text2Live, InstructPix2Pix preserves more input-image consistency while achieving clear edits guided by instructions.
  • Ablations show that larger training data and CLI P filtering improve ability to perform larger edits and maintain image consistency.
(a) Without Prompt-to-Prompt.
(a) Without Prompt-to-Prompt.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.