ZONE: Zero-Shot Instruction-Guided Local Editing

Shanglin Li, Bohan Zeng, Yutang Feng, Sicheng Gao, Xuhui Liu, Jiaming Liu, Li Lin, Xu Tang, Yao Hu, Jianzhuang Liu, Baochang Zhang

This blog post summarizes the paper "ZONE: Zero-Shot Instruction-Guided Local Editing" by Li et al. (2024).

TL;DR

ZONE is a zero-shot framework that enables precise local image editing using simple, intuitive natural language instructions (e.g., "make his tie blue"). By combining instruction-guided localization with a novel Region-IoU mask refinement and an FFT-based edge smoother, ZONE performs targeted edits while perfectly preserving the rest of the image, outperforming current state-of-the-art methods in both fidelity and user-friendliness.

What Problem Does This Paper Address?

While vision-language models like Stable Diffusion have revolutionized image editing, two major hurdles remain:

  1. Prompt Engineering: Most models require highly specific, non-intuitive descriptions to achieve good results. Users often have to guess the "magic words" the model wants to hear.
  2. The "Over-Edit" Problem: Many current methods are globally sensitive. Even if you only want to change a small detail, the model often subtly alters the entire image—distorting faces, changing background textures, or losing high-frequency details.

Previous attempts to solve this usually require users to manually draw masks, which is tedious, or rely on complex "description-guided" prompts that are difficult to craft. ZONE aims for a "best of both worlds" approach: the ease of instruction-based editing with the precision of mask-based local editing, all without requiring the user to provide a mask.

Methods

The ZONE framework consists of three main modules, as illustrated in the overview below:

Overview of the ZONE architecture, showing the localization, refinement, and blending modules.

1. Instruction-Guided Localization

The authors discovered a fundamental difference in how instruction-guided models (like InstructPix2Pix) and description-guided models (like Stable Diffusion) handle cross-attention. While standard models associate specific tokens with spatial regions, instruction-guided models are "edit-aware"—their attention maps naturally concentrate on the region being modified by the instruction. By comparing the first and last attention maps during the denoising process, ZONE can automatically generate a rough mask of the intended edit area.

Comparison of cross-attention maps between IP2P (edit-aware) and Stable Diffusion (token-aware).

2. Mask Refinement (Region-IoU)

The rough mask from the localization step is often too blurry for high-quality editing. To fix this, ZONE leverages the Segment Anything Model (SAM). However, instead of requiring user points or boxes, they propose a Region-IoU (rIoU) scheme. This automatically selects the best segment from SAM's multi-level output by finding the one that best overlaps with the rough localization mask.

3. Layer Blending (FFT-based Edge Smoother)

Simply pasting an edited region back into the original image often results in jagged edges or "halo" artifacts. ZONE introduces a novel edge smoother based on the Fast Fourier Transform (FFT). By analyzing the low-frequency characteristics of the edited layer and the original image in the frequency domain, the system can create a seamless transition, ensuring the edit looks like a natural part of the scene.

Datasets

  • Action Classification Dataset: To steer the editing process (distinguishing between "add", "remove", and "change"), the authors used GPT-3.5 to generate a dataset of 600 sentence-label pairs based on COCO categories.
  • Evaluation Test Set: A custom benchmark of 100 samples, including 60 real-world images from the internet and 40 synthetic images. The set is balanced across different editing actions (32 "add", 54 "change", and 14 "remove").

Key Insights and Ideas

  • Edit-Aware Attention: The most significant "aha" moment is the realization that instruction-guided models implicitly "know" where they are editing. This allows for zero-shot localization without any extra user input.
  • Layer-Based Composition: By treating the edit as a separate RGBA layer to be composited, ZONE bypasses the fundamental limitation of diffusion models that tend to drift away from the original image's pixels in non-edited regions.
  • Frequency Domain Refinement: Using FFT for blending is a clever way to handle the "seams" of a local edit, which are often high-frequency artifacts that are easier to identify and smooth in the frequency domain than the spatial domain.

Key Results

ZONE significantly outperforms baselines like InstructPix2Pix, Text2LIVE, and MagicBrush across nearly all metrics.

  • Quantitative: In terms of structural similarity (L1 distance), ZONE achieved a score of 0.0146, compared to 0.0945 for InstructPix2Pix. This indicates much better preservation of the original image. It also led in CLIP-I (image similarity) with a score of 0.9688.
  • Qualitative: As shown in the comparison below, ZONE manages to change specific attributes (like a shirt color) while keeping the person's face and the background perfectly intact, whereas other methods often introduce "foggy" artifacts or change the person's identity.
Qualitative comparison showing ZONE's ability to perform precise local edits compared to other SOTA methods.
  • Human Evaluation: In user studies, ZONE obtained the highest success rate (69.4%) and user preference rate (26.6%).

Limitations and Future Work

While impressive, ZONE has a few acknowledged limitations:

  • Model Dependency: The quality of the edit is still capped by the underlying diffusion model (e.g., InstructPix2Pix). If the base model fails to understand the instruction, ZONE cannot fix it.
  • Complex Scenes: Localizing very tiny objects or distinguishing between multiple similar objects in a crowded scene remains a challenge.
  • Action Scope: The current version focuses on "add", "remove", and "change". The authors suggest that future work could expand this to more complex spatial manipulations like "move", "resize", or "copy".

Summary updated

BibTeX
@misc{li2023zone,
  author = {Shanglin Li and Bohan Zeng and Yutang Feng and Sicheng Gao and Xuhui Liu and Jiaming Liu and Li Lin and Xu Tang and Yao Hu and Jianzhuang Liu and Baochang Zhang},
  title = {{ZONE: Zero-Shot Instruction-Guided Local Editing}},
  year = {2023},
  eprint = {2312.16794},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.16794},
}
Figure