Abstract
Traditional layout-to-image synthesis (LIS) models are typically confined to a "closed-set" of semantic labels defined during training, limiting their creative utility. We present FreestyleNet, a framework for Freestyle Layout-to-Image Synthesis (FLIS) that allows for the placement of arbitrary objects and styles into specific spatial masks. By utilizing a parameter-free Rectified Cross-Attention (RCA) module, FreestyleNet successfully combines the precise spatial control of layout-based models with the open-vocabulary capabilities of large-scale text-to-image diffusion models.
Introduction
In the evolving landscape of AI-driven image generation, a significant gap exists between text-to-image models, which offer high semantic flexibility but poor spatial precision, and layout-to-image models, which offer spatial control but are restricted to predefined categories. For instance, a model trained on the COCO-Stuff dataset can generate a generic "car" within a mask but often fails with specific or out-of-distribution concepts like a "lego train." This "closed-set" limitation restricts users to the narrow vocabulary of the training data.
Methodology: FreestyleNet and Rectified Cross-Attention
To overcome these limitations, the researchers introduced FreestyleNet, built upon the Latent Diffusion Model (LDM) architecture. The core innovation is the Rectified Cross-Attention (RCA) module.
In standard cross-attention, every pixel can attend to every text token, often leading to "semantic bleeding" where objects appear outside their intended regions. RCA rectifies this by enforcing the input layout as a hard constraint. For each text token, the model identifies the corresponding mask and assigns an attention score of $-\infty$ to all pixels outside that mask. This forces the text features to influence only the designated spatial region. Crucially, RCA is parameter-free, allowing the model to leverage the frozen text encoder's general knowledge while the U-Net is fine-tuned to respect the layout.
Key Insights: Decoupling "Where" from "What"
A primary advantage of FreestyleNet is the decoupling of spatial structure from semantic identity. The layout mask dictates the shape and location, while the text prompt defines the identity and style.
Stretching Semantics and Global Style
The model demonstrates a remarkable ability to "squeeze" complex or unexpected concepts into simple masks—for example, rendering a "lego train" in a mask originally intended for a standard train. Furthermore, the researchers found that "style" tokens should remain unrectified. While object tokens are confined to masks, global style tokens (e.g., "in the style of a sketch") are allowed to influence the entire image, ensuring stylistic coherence across the scene.
Results and Evaluation
FreestyleNet was evaluated on the COCO-Stuff and ADE20K benchmarks. Quantitatively, it achieved a state-of-the-art Fréchet Inception Distance (FID) of 14.4 on COCO-Stuff, significantly outperforming previous models like PITI (16.1) and OASIS (17.0).
Qualitatively, the model excels at generating out-of-distribution content. It can successfully render specific car models, unique textures like sushi, or specialized objects like lego sets within generic semantic masks, maintaining high fidelity to both the prompt and the layout.
Limitations and Conclusion
While FreestyleNet provides significant advancements, it faces challenges with highly contradictory "counterfactual" prompts where the diffusion model's prior knowledge conflicts with the layout (e.g., "a horse riding a person"). Additionally, the strict rectification can occasionally lead to artifacts if the mask is too small for the requested object's features.
In conclusion, FreestyleNet represents a major step toward flexible, spatially-controllable image synthesis, bridging the gap between open-vocabulary creativity and precise layout constraints.
Summary updated