Abstract
We present a novel algorithm for text-driven image-to-image translation based on a pretrained text-to-image diffusion model. Our method aims to generate a target image by selectively editing the regions of interest in a source image, defined by a modifying text, while preserving the remaining parts. In contrast to existing techniques that solely rely on a target prompt, we introduce a new score function that additionally considers both the source image and the source text prompt, tailored to address specific translation tasks. To this end, we derive the conditional score function in a principled manner, decomposing it into the standard score and a guiding term for target image generation. For the gradient computation of the guiding term, we assume a Gaussian distribution of the posterior distribution and estimate its mean and variance to adjust the gradient without additional training. In addition, to improve the quality of the conditional score guidance, we incorporate a simple yet effective mixup technique, which combines two cross-attention maps derived from the source and target latents. This strategy is effective for promoting a desirable fusion of the invariant parts in the source image and the edited regions aligned with the target prompt, leading to high-fidelity target image generation. Through comprehensive experiments, we demonstrate that our approach achieves outstanding image-to-image translation performance on various tasks.
Introduction
Text-to-image diffusion models, such as Stable Diffusion, have demonstrated remarkable capabilities in generating high-quality imagery from natural language. However, leveraging these models for image-to-image (I2I) translation—the process of modifying a specific source image according to a text prompt—remains a significant challenge. The difficulty lies in balancing two competing objectives: the model must be flexible enough to transform the subject (e.g., changing a "cat" to a "dog") while remaining rigid enough to preserve the "invariant" parts of the scene, such as the background, lighting, and camera angle.
Existing methods often struggle with this balance, either requiring time-consuming fine-tuning for every image or failing to maintain the original layout when the requested edit is substantial. Researchers from Seoul National University have addressed these issues with Conditional Score Guidance (CSG), a training-free algorithm that enables precise, high-fidelity I2I translation without the need for expensive backpropagation.
Methodology
The CSG framework introduces three primary innovations to achieve surgical precision in image editing:
1. Conditional Score Guidance (CSG)
Rather than relying exclusively on the target text prompt, the authors derived a new score function that incorporates both the source image and the source text. This function is decomposed into a standard generative term and a "guiding term." To make this computationally feasible without additional training, the researchers assumed that the relationship between the source and target latents follows a Gaussian distribution. This allows for the estimation of a "precision matrix" that informs the model which pixels to preserve (high precision) and which to edit (low precision) during the denoising process.
2. Cross-Attention Mixup
To accurately distinguish between the subject and the background, the method analyzes the model's internal cross-attention maps. The authors proposed a mixup strategy that blends the attention maps of the source and target images. This ensures that invariant regions (like a forest or a living room) remain anchored to the source image's structure, while the edited regions are allowed to morph into the target subject defined by the prompt.
3. Regularized Content Masking
To prevent edits from appearing "patchy" or disjointed, the method employs self-attention maps to smooth out the content masks. This ensures that the entire object of interest (e.g., the full body of an animal) is considered for translation, rather than just its high-contrast edges, leading to more cohesive visual results.
Experimental Evaluation
The researchers evaluated CSG using a combination of real-world and synthetic data:
- LAION 5B: 250 high-quality images were selected to test various translation tasks, such as "cat → dog" or "zebra → horse."
- Synthesized Images: Images generated by Stable Diffusion were used to test complex or creative edits, such as "Snowman → Robot."
Key Metrics
- Structure Preservation: CSG achieved superior scores in Structure Distance (SD) and BG-LPIPS, indicating it is objectively better at keeping the background and layout identical to the original.
- Relational Distance (RD): A major insight of the paper is that a successful translation should preserve the relationships between different parts of the image. CSG outperformed competitors in maintaining the pose and "essence" of the original subject.
Results and Discussion
When compared against established methods like Prompt-to-Prompt and Pix2Pix-Zero, CSG demonstrated several advantages:
- Efficiency: Because CSG avoids backpropagation through the UNet during the editing process, it is more memory-efficient and faster than gradient-heavy alternatives.
- Qualitative Fidelity: Visual results indicate that CSG performs a surgical "cut-and-paste" of the new subject into the old environment, whereas other methods often inadvertently alter background colors or lose fine textures.
- Training-Free Application: CSG works "out of the box" with pretrained models, making it highly accessible for real-world applications where per-image fine-tuning is impractical.
Limitations and Future Work
Despite its success, the authors noted that CSG is limited by the underlying diffusion model's prompt comprehension. If the base model cannot grasp a complex request, CSG cannot rectify that failure. Additionally, the method is designed for structure preservation and currently struggles with "non-rigid" transformations—tasks that require moving an object to a different part of the frame or significantly changing its scale.
Future research may focus on extending these conditional guidance principles to handle non-rigid transformations while maintaining the realistic relationship between the edited subject and its background.
Summary updated