High-Fidelity Diffusion-Based Image Editing

Chen Hou, Guoqiang Wei, Zhibo Chen

Introduction

Diffusion models have emerged as the state-of-the-art for image generation, yet applying them to high-fidelity image editing remains a significant challenge. While these models can reconstruct images with remarkable accuracy, the process of editing—such as changing a facial expression or adding an attribute—often introduces unwanted artifacts or causes the image to lose the original subject's identity. This paper introduces a novel "Rectifier" framework and a score-matching-inspired training strategy designed to bridge the gap between editability and fidelity.

The Fidelity-Editability Trade-off

In standard diffusion-based editing, there is a counter-intuitive relationship between the number of denoising steps and the quality of the edit. For simple reconstruction, increasing steps generally improves fidelity. However, for editing tasks, more steps often lead to worse results. The authors identify two primary causes for this "drift":

  1. The Fidelity Gap: A mathematical discrepancy exists between the predicted posterior mean and the true posterior mean during the reverse diffusion process.
  2. Error Accumulation: Most current methods are Markovian, meaning they modify the image step-by-step. Small errors introduced at one step are amplified in subsequent steps, eventually leading to a "drifted" image that loses fine details like jewelry, background textures, or the subject's core identity.

The Rectifier Framework

To address these issues, the authors propose the Rectifier, a hypernetwork-based module that modulates the weights of a pretrained diffusion model.

Weight Modulation via Hypernetwork

Instead of simply injecting features into the U-Net, the Rectifier takes the original image and the current step's estimation as input to predict "offsets" ($\Delta$) for the pretrained model's weights. This modulation specifically targets the convolutional filters in the middle and up-sampling blocks of the U-Net. By adjusting the weights rather than regenerating features from scratch, the model effectively "remembers" the powerful generative priors of the original pretrained model while adapting to the specific editing task.

Efficiency through Separable Convolutions

To prevent a massive increase in parameters, the Rectifier utilizes separable convolutions to generate these weight offsets. This design choice significantly reduces memory usage and computational overhead, making the framework more practical for high-resolution image processing.

Training Strategy: Anchoring to the Clean Trajectory

The most significant conceptual shift in this work is the move away from Markovian training. Traditional methods train on sequences of edited steps, which allows errors to propagate. Inspired by denoising score-matching, the authors' strategy treats editing as a single-step correction from the original clean trajectory.

At any given timestep $t$, the model starts from the original clean path rather than the previously edited (and potentially distorted) step. This effectively "resets" the error counter at every step, allowing for much longer denoising sequences without the typical quality degradation. The training process employs a combination of Directional CLIP loss to ensure the image matches the text prompt and an $\ell_1$ loss to preserve irrelevant attributes and background details.

Key Results

The proposed method was evaluated on several high-resolution datasets, including FFHQ, CelebA-HQ, AFHQ-dog, and LSUN natural scenes. It also demonstrated impressive zero-shot generalization on out-of-domain images from the METFACES dataset, such as sculptures and oil paintings.

Qualitative comparison of editing results across different methods and denoising steps.

Quantitative and Qualitative Performance

  • Reconstruction Accuracy: On the CelebA-HQ dataset, the framework achieved a lower $\ell_1$ error (0.085) compared to iDDPM (0.090) while maintaining high structural similarity (SSIM).
  • Identity Preservation: Using the CurricularFace metric, the method significantly outperformed competitors. For instance, in "Man" attribute editing, it achieved a similarity score of 0.45, compared to 0.33 for DiffusionCLIP and 0.22 for Asyrp.
  • Visual Fidelity: As shown in the comparison figures, while other methods lose details like earrings, glasses, or specific background textures during an edit, the Rectifier framework keeps them perfectly intact even across 1000 denoising steps.

Conclusion and Future Work

By combining weight modulation with a non-Markovian training strategy, this research provides a robust solution to the fidelity-editability trade-off in diffusion models. While the current implementation relies on specific attribute directions via CLIP, future work may explore generalizing this to complex, multi-attribute text prompts without requiring per-attribute retraining. Additionally, further optimization could reduce the computational overhead introduced by weight modulation, making high-fidelity editing even more accessible.

Summary updated

BibTeX
@inproceedings{hou2024high,
  author = {Chen Hou and Guoqiang Wei and Zhibo Chen},
  title = {{High-Fidelity Diffusion-Based Image Editing}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i3.27991},
}
Figure