Training-Free Sketch-Guided Diffusion with Latent Optimization
Sandra Zhang Ding, Jiafeng Mao, Kiyoharu Aizawa
TL;DR
This work tackles controllable image synthesis with diffusion models using sketches without any training or fine-tuning. It leverages DDIM inversion to preserve sketch-induced cross-attention maps and introduces latent optimization that aligns intermediate latents with targets derived from the sketch, under a user-provided text prompt. The key insight is that cross-attention maps are robust to domain shifts between sketches and real images and can serve as reliable guidance for structure-aware generation. The method achieves competitive realism and strong layout fidelity on Sketchy and ImageNet-Sketch, and extends to real-image editing with sketch-driven layout/style control, offering a practical, training-free pathway for controllable content creation.
Abstract
Based on recent advanced diffusion models, Text-to-image (T2I) generation models have demonstrated their capabilities to generate diverse and high-quality images. However, leveraging their potential for real-world content creation, particularly in providing users with precise control over the image generation result, poses a significant challenge. In this paper, we propose an innovative training-free pipeline that extends existing text-to-image generation models to incorporate a sketch as an additional condition. To generate new images with a layout and structure closely resembling the input sketch, we find that these core features of a sketch can be tracked with the cross-attention maps of diffusion models. We introduce latent optimization, a method that refines the noisy latent at each intermediate step of the generation process using cross-attention maps to ensure that the generated images adhere closely to the desired structure outlined in the reference sketch. Through latent optimization, our method enhances the accuracy of image generation, offering users greater control and customization options in content creation.
