Abstract: Recent advancements in text-to-image diffusion models have demonstrated remarkable success, yet they often struggle to fully capture the user's intent. Existing approaches using textual inputs combined with bounding boxes or region masks fall short in providing precise spatial guidance, often leading to misaligned or unintended object orientation. To address these limitations, we propose Scribble-Guided Diffusion (ScribbleDiff), a training-free approach that utilizes simple user-provided scribbles as visual prompts to guide image generation. However, incorporating scribbles into diffusion models presents challenges due to their sparse and thin nature, making it difficult to ensure accurate orientation alignment. To overcome these challenges, we introduce moment alignment and scribble propagation, which allow for more effective and flexible alignment between generated images and scribble inputs. Experimental results on the PASCAL-Scribble dataset demonstrate significant improvements in spatial control and consistency, showcasing the effectiveness of scribble-based guidance in diffusion models.
The Spatial Control Problem
While text-to-image models like Stable Diffusion have reached incredible levels of photorealism, they remain notoriously difficult to "steer" spatially. If a user wants a dog to face left or a bridge to curve in a specific way, text prompts often fail to convey these geometric nuances.
Existing solutions have significant trade-offs:
- Bounding Boxes: Easy to draw, but too coarse. They fail to convey an object's orientation or abstract shape.
- Region Masks: Precise, but high-effort and tedious for a casual user to create.
- ControlNet: Highly effective but requires expensive training or fine-tuning for every new type of input.
ScribbleDiff identifies a "Goldilocks" zone in scribbles. They are easy to draw but rich in intent. However, scribbles are inherently "sparse and thin," making it difficult for diffusion models to align complex objects with a single line. ScribbleDiff aims to bridge this gap without requiring any additional training.
Methodology
ScribbleDiff operates during the "reverse process" (denoising) of a pre-trained diffusion model by optimizing the noisy latent code at each step. It introduces three key components to ensure the generated image adheres to the user's strokes:
- Attention Control with Focal Loss: The model utilizes cross-attention maps—which link text tokens to image patches—and applies a focal loss. This ensures the attention for a specific word (e.g., "cat") is concentrated within the region defined by the scribble.
- Moment Alignment: This is the core mechanism for orientation. The authors treat the attention maps as probability distributions and calculate their statistical moments. First-order moments align the centroid (position), while second-order moments align the orientation (angle). This allows the model to ensure a generated "airplane" is flying in the exact direction the user’s scribble points.
- Scribble Propagation: Because a thin scribble is a difficult target for a model to "hit," the authors use an iterative expansion technique. During the early stages of denoising, they use self-attention similarity to "grow" the thin scribble into a denser mask. This creates a larger, more flexible "landing zone" for the object to form while maintaining the original intent.
Key Insights and Ideas
- Classical CV meets Generative AI: The use of image moments—a classical computer vision technique—to solve the orientation problem in modern diffusion models is a clever innovation. It treats the "fuzzy" attention map as a physical object with a center of mass and an axis.
- Leveraging the Denoising Timeline: Scribble propagation works because it targets the "coarse" phase of the diffusion process. By expanding the scribble early (timesteps 5–15), the model establishes a structural foundation before moving into the "fine-detail" phase.
- Training-Free is the Future: By modifying the latent optimization rather than the weights of the U-Net, the method is "plug-and-play" for existing models like Stable Diffusion or GLIGEN.
Evaluation and Results
The authors primarily used the PASCAL-Scribble dataset to evaluate how well generated images align with ground-truth scribbles. ScribbleDiff significantly outperformed existing training-free baselines like BoxDiff and DenseDiffusion:
- mIoU (Mean Intersection over Union): Achieved 0.406, nearly doubling the performance of BoxDiff (0.228).
- Scribble Ratio: A new metric introduced to measure how much of the scribble is covered by the generated object. ScribbleDiff hit 0.717, compared to 0.406 for BoxDiff.
- Orientation Accuracy: Qualitatively, the model was far more successful at matching the "pose" of objects. In a user study, 75.33% of participants preferred ScribbleDiff’s alignment over other methods.
- Vs. Fine-tuning: Remarkably, ScribbleDiff (training-free) outperformed a fine-tuned ControlNet on the PASCAL-Scribble validation set in terms of mIoU and Scribble Ratio, proving that explicit geometric guidance can be more effective than learned weights for sparse inputs.
Discussion and Future Work
While ScribbleDiff excels at spatial guidance, it is a "steering" mechanism rather than an "engine" upgrade; it does not inherently improve the base model's ability to generate high-quality textures or complex lighting.
Future research directions include expanding the method to handle different types of sketches, such as "boundary scribbles" (outlines) or "axial scribbles" (skeletons), and combining these guidance techniques with more advanced base models to see if the spatial control holds up as image complexity increases.
Summary updated