Unified Diffusion-Based Rigid and Non-Rigid Editing with Text and Image Guidance

Jiacheng Wang, Ping Liu, Wei Xu

Abstract

Recent advancements in diffusion-based image editing have seen a divergence between methods specialized for rigid transformations (e.g., color and texture) and those designed for non-rigid transformations (e.g., shape and pose). This paper introduces a unified, training-free framework that bridges this gap. By employing a novel dual-path injection scheme and a unified self-attention mechanism, the proposed system enables high-fidelity editing guided by either text prompts or reference images, outperforming existing state-of-the-art methods in versatility and accuracy.

Introduction

Diffusion-based image editing has long been characterized by a "specialization gap." Existing tools typically excel at one type of transformation while struggling with another. For instance, methods like Plug-and-Play (PnP) are effective for rigid edits, such as changing an object's color, but often introduce artifacts when attempting to alter geometry. Conversely, methods like MasaCtrl are adept at non-rigid tasks, such as changing a teapot's shape, but fail to preserve identity during simple color shifts.

Comparison of rigid and non-rigid editing capabilities. While existing methods like PnP and MasaCtrl excel at one type but fail at the other, the proposed method handles both effectively.

Furthermore, the reliance on text prompts can be limiting, as text is often too ambiguous to describe complex structural or stylistic transfers. Integrating a reference image as a control modality remains a significant challenge for current attention-control mechanisms. This work addresses these limitations by providing a versatile framework that decouples appearance and structure to achieve unified editing.

Methodology

The framework achieves unified editing through three core technical innovations, leveraging pre-trained models like Stable Diffusion v1.5 without requiring additional fine-tuning.

Overview of the proposed framework. The dual-path injection scheme processes appearance and structure separately before fusing them into the target output via unified self-attention.

Dual-path Injection Scheme

Unlike single-path methods that attempt to process all information simultaneously, this framework utilizes two independent denoising paths: one for appearance ($Z^{app}$) and one for structure ($Z^{struct}$). These paths inject their respective features into a third, target output path ($Z^{out}$), allowing for a clean separation of concerns.

Unified Self-Attention Mechanism

At the heart of the system is the Unified Self-Attention mechanism. It calculates structural attention maps from the source and a similarity matrix from the appearance reference. To ensure precise mapping—such as applying tiger stripes to a bear's body—the mechanism employs contrast and rearrange operations. These operations sharpen semantic correspondences, preventing the blurring or misalignment common in standard attention-swapping techniques.

Latent Fusion Techniques

To maintain background consistency and prevent color bleeding, the authors incorporate AdaIN (Adaptive Instance Normalization) to align feature distributions and Blended Diffusion to ensure the background remains faithful to the original source image.

Evaluation and Results

The framework was evaluated using PIE-Bench for text-based editing and a curated Appearance Transfer dataset covering five domains: animal faces, animals, bedrooms, cars, and churches.

Key Findings

  • Versatility: The model successfully performs both rigid (e.g., turning a sitting dog into pixel art) and non-rigid (e.g., making a dog jump) transformations with high proficiency.
  • Quantitative Performance: In appearance transfer tasks, the method outperformed DiffuseIT, achieving a lower Structure Distance (7.96 vs. 8.55) and a significantly lower Appearance Distance (3.01 vs. 4.54).
  • Text Alignment: On the PIE-Bench, the method showed competitive results against Prompt-to-Prompt and PnP, particularly in scenarios requiring simultaneous structural and stylistic shifts.

Conclusion and Future Work

This unified framework demonstrates that appearance and structure are best handled as distinct signals within the diffusion process. By using self-attention as a bridge for semantic correspondence and refining those signals through contrast operations, the model achieves high-fidelity results across diverse editing tasks.

While highly versatile, the method's reliance on automatically generated cross-attention masks means that quality can suffer if the base model has a poor semantic understanding of a specific object. Future work may involve integrating external segmentation models to further refine the latent fusion process and improve background preservation in complex scenes.

Summary updated

Abstract

Existing text-to-image editing methods tend to excel either in rigid or non-rigid editing but encounter challenges when combining both, resulting in misaligned outputs with the provided text prompts. In addition, integrating reference images for control remains challenging. To address these issues, we present a versatile image editing framework capable of executing both rigid and non-rigid edits, guided by either textual prompts or reference images. We leverage a dual-path injection scheme to handle diverse editing scenarios and introduce an integrated self-attention mechanism for fusion of appearance and structural information. To mitigate potential visual artifacts, we further employ latent fusion techniques to adjust intermediate latents. Compared to previous work, our approach represents a significant advance in achieving precise and versatile image editing. Comprehensive experiments validate the efficacy of our method, showcasing competitive or superior results in text-based editing and appearance transfer tasks, encompassing both rigid and non-rigid settings.
BibTeX
@inproceedings{wang2024unified,
  author = {Jiacheng Wang and Ping Liu and Wei Xu},
  title = {{Unified Diffusion-Based Rigid and Non-Rigid Editing with Text and Image Guidance}},
  booktitle = {ICME},
  year = {2024},
  url = {https://openreview.net/forum?id=xmLjJeband},
}
Figure