TALE: Training-free Cross-domain Image Composition via Adaptive Latent Manipulation and Energy-guided Optimization

Kien T. Pham, Jingye Chen, Qifeng Chen · DOI

Introduction

Image composition is the process of extracting an object from a foreground image and seamlessly integrating it into a background scene. While this task is challenging even within photorealistic domains, it becomes significantly more complex when the domains do not match—for example, placing a real-world car into a comic book or a photograph of a dog into a Van Gogh painting.

Existing approaches to this problem generally fall into two categories: training-based methods and training-free methods. Training-based methods often require massive datasets and extensive GPU resources to train identity extractors, yet they frequently fail to generalize to artistic styles absent from their training data. Conversely, training-free methods are more accessible but typically rely on manipulating attention maps, which often results in "ghostly" artifacts where the object loses its identity or fails to adopt the background's artistic texture.

TALE (Training-free Cross-domain Image Composition) bridges this gap. It is a "plug-and-play" framework that operates within the latent space of pre-trained diffusion models, enabling high-fidelity composition across diverse domains without any additional training or fine-tuning.

Methodology

TALE shifts the focus from attention-map manipulation to direct latent space control. The framework introduces two primary mechanisms to ensure both identity preservation and stylistic harmony.

Adaptive Latent Manipulation (ALM)

ALM focuses on the initial stages of the diffusion process to ensure the object's structure is maintained while its appearance is adapted. It consists of two components:

  • Selective Initiation: Rather than starting the denoising process from pure noise at timestep $T$, TALE begins at a later timestep $T'$. By utilizing the "inverted" latents of both the foreground and background, the model retains a strong structural memory of the object, which is crucial for preserving its unique identity.
  • Adaptive Latent Normalization: Inspired by Adaptive Instance Normalization (AdaIN), this step adjusts the statistical distribution of the object’s latent features to match those of the background. This prevents color bleeding and ensures that the object adopts the specific color palette and tonal range of the target environment (e.g., a colorful bird becoming grayscale in a pencil sketch).

Energy-guided Latent Optimization (ELO)

To ensure the object fits the specific description and artistic style of the background, TALE employs energy functions to optimize the latents during the denoising process:

  • CLIP-based Loss: This ensures the generated image remains aligned with the text prompt.
  • Gram Matrix-based Style Loss: This loss function ensures that the local texture of the object matches the specific brushstrokes or patterns of the background domain, such as the cross-hatching of a sketch or the thick impasto of an oil painting.

Experimental Setup and Results

The researchers evaluated TALE using two primary benchmarks:

  1. TF-ICON Benchmark: A standard dataset containing 332 samples across photorealism, oil painting, sketching, and cartoon domains.
  2. Extended Dataset: A new, more challenging benchmark introduced by the authors consisting of 207 high-quality samples specifically focused on non-photorealistic domains like watercolor and comics to address the "photorealism bias" in existing datasets.

Performance

  • Quantitative Results: TALE achieved the best or second-best scores across all key metrics, including LPIPS (for identity preservation) and CLIP scores (for text alignment), outperforming both training-free and training-based state-of-the-art (SOTA) methods like AnyDoor and TF-ICON.
  • Qualitative Results: Visual comparisons demonstrate TALE's superior ability to "repaint" objects. For instance, when placing a realistic car into a comic background, TALE successfully applies characteristic black outlines and flat shading, whereas competing methods often leave the car looking jarringly realistic.
  • User Preference: In a study involving 50 users, TALE was preferred over existing methods by a wide margin, including a 71% preference rate over the previous SOTA, TF-ICON.

Discussion and Limitations

TALE demonstrates that direct latent manipulation is a more explicit and effective way to control composition than attention-based methods. By treating style as a set of second-order statistics (via Normalization and Gram matrices), the framework can transfer artistic style without destroying the underlying content.

However, the method has some limitations:

  • Efficiency: Because TALE performs optimization during the denoising process, it takes approximately 23 seconds per image on an NVIDIA RTX 3090. While faster than training a new model, it is not yet instantaneous.
  • Boundary Artifacts: If normalization and optimization are applied for too many timesteps, artifacts can appear at the boundaries where the object meets the background. The authors mitigate this using a "Timestep Constraint," but it remains a delicate balance.
  • Model Dependency: As a training-free method, TALE's performance is inherently tied to the generative capabilities of the underlying pre-trained model (e.g., Stable Diffusion v2.1).

Conclusion

TALE provides a robust and flexible solution for cross-domain image composition. By manipulating the latent space directly and employing energy-guided optimization, it achieves a level of stylistic harmony and identity preservation that was previously difficult to reach without extensive training.

Summary updated

BibTeX
@inproceedings{pham2024tale,
  author = {Kien T. Pham and Jingye Chen and Qifeng Chen},
  title = {{TALE: Training-free Cross-domain Image Composition via Adaptive Latent Manipulation and Energy-guided Optimization}},
  booktitle = {ACM Multimedia},
  year = {2024},
  url = {https://openreview.net/forum?id=z1vuuz86iQ},
}
Figure