SpatialLock: Precise Spatial Control in Text-to-Image Synthesis

Biao Liu, Yuanzhi LiangarXiv 2025 · DOI

Introduction

While modern text-to-image (T2I) models like Stable Diffusion excel at generating high-quality imagery from semantic prompts, they often struggle with precise spatial control. When users provide specific layouts—such as bounding boxes for multiple objects—these models frequently suffer from "semantic drowning," where the rich text description overwhelms the sparse coordinate data, leading to misplaced or merged objects. SpatialLock addresses this challenge by decoupling grounding information from text captions and introducing a dedicated perception-based supervision module.

The SpatialLock Framework

SpatialLock introduces two core innovations to the standard diffusion architecture to ensure that generated images strictly adhere to user-defined layouts.

Position-Engaged Injection (PoI)

To prevent spatial signals from being lost, SpatialLock employs Position-Engaged Injection (PoI). Instead of concatenating coordinates with text tokens, PoI treats grounding data (bounding boxes and category labels) as an independent stream. A specialized Grounding-Attention layer uses cross-attention to integrate these spatial signals directly into the visual features of the U-Net. This separation ensures that the model maintains the integrity of the location information throughout the generation process.

SpatialLock demonstrates precise alignment between generated objects (person, skis) and their intended bounding boxes.

Position-Guided Learning (PoG)

Complementing PoI is the Position-Guided Learning (PoG) module, which acts as an internal supervisor during training. PoG is a perception module that extracts multi-scale features from the U-Net and processes them through classification and regression branches. By penalizing the model when generated objects deviate from the input layout, PoG forces the diffusion process to respect spatial constraints. To provide global context, the authors integrated a Transformer-based "Enh-Fusion" module, preventing the perception module from focusing too narrowly on local features.

Experimental Evaluation

The framework was rigorously tested on the MSCOCO and Flickr benchmarks. MSCOCO, with its 118k annotated images, served as the primary training ground, while Flickr was used to evaluate generalization in complex, real-world scenes.

Key Results

SpatialLock establishes a new state-of-the-art for layout-to-image synthesis. On the MSCOCO dataset, it achieved an FID of 18.32 and a mean Average Precision (mAP) of 32.1, outperforming previous methods like DetDiffusion and GeoDiffusion.

The model achieves exceptionally high Intersection over Union (IOU) scores, often exceeding 0.9, indicating near-perfect spatial accuracy.

Beyond quantitative metrics, the model demonstrates superior "Small Object Mastery," accurately placing difficult elements like baseball gloves or small accessories that typically vanish in other T2I models. Qualitative analysis shows that generated objects consistently achieve IOU scores above 0.9, reflecting a high degree of spatial fidelity.

Conclusion and Future Work

SpatialLock successfully "locks" spatial control in T2I synthesis through the strategic decoupling of text and coordinates and the use of perception-based regularizers. While the dual-module approach introduces some inference overhead (2.1s vs. 1.8s for baseline methods) and training complexity, the gains in precision are significant. Future research may extend this framework to video generation, where maintaining object consistency across frames is a critical requirement.

Summary updated

BibTeX
@misc{liu2025spatiallock,
  author = {Biao Liu and Yuanzhi Liang},
  title = {{SpatialLock: Precise Spatial Control in Text-to-Image Synthesis}},
  year = {2025},
  eprint = {2511.04112},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.04112},
}
Figure