TL;DR
Raster2Seq redefines floorplan reconstruction by framing the conversion of raster images to vector graphics as a sequence-to-sequence learning task. By autoregressively predicting labeled polygon sequences using learnable spatial anchors, it bypasses the strict capacity limits of prior query-based models, achieving state-of-the-art performance and remarkable zero-shot generalization on complex, real-world blueprints.
What Problem Does This Paper Address?
While architectural floorplans are designed using vector-based CAD software, they are almost always distributed as rasterized images (like PNGs or JPEGs). This rasterization strips away structural and semantic metadata, making automated editing, 3D simulation, and algorithmic floorplan analysis incredibly difficult.
To unlock these capabilities, researchers use "raster-to-vector" conversion methods. However, existing deep learning approaches face severe bottlenecks:
- Multi-stage pipelines: They often rely on separate, error-prone steps (e.g., detecting corners first, then predicting lines, then grouping them into rooms).
- Fixed-query constraints: Recent Transformer-based models treat rooms as object detection queries (similar to DETR). When a complex floorplan contains more rooms or corners than the model's predefined query budget, performance plummets or the model runs out of memory due to quadratic attention costs.
Raster2Seq tackles these challenges by unifying geometry and semantics into a single, variable-length sequence generation problem.
Methods
Instead of predicting all structural elements simultaneously, Raster2Seq formulates floorplan reconstruction as a sequence-to-sequence (seq2seq) task.
1. Labeled Polygon Sequence Representation
A floorplan is represented as a continuous sequence of tokens separated by special <SEP> tokens. Each room or structural element (like a window or door) is parameterized as an ordered sequence of corners:
$$c_i = (x_i, y_i, p_i)$$
where $(x_i, y_i)$ are the spatial coordinates and $p_i$ is the semantic class probability vector. To enforce a strong geometric prior, polygons are sorted during training using a top-left to bottom-right scanning order.
2. Anchor-Based Autoregressive Decoder
The core architecture features an autoregressive decoder enhanced by two key mechanisms:
- FeatFusion: Early in the decoding block, image features from a ResNet-50 encoder are concatenated directly with coordinate-token embeddings. This acts as a contextual prefix for the attention mechanism.
- Learnable Anchors & Deformable Attention: Rather than regressing absolute coordinates directly, the model learns spatial coordinate offsets relative to learnable anchors. These anchors interact with a deformable attention module, forcing the network to focus strictly on sparse, highly informative image regions (like wall intersections) rather than the entire image map.
Datasets
The model was trained and evaluated across several diverse benchmarks:
- Structured3D-B: A dataset derived from 3D point clouds, converted by the authors into binary raster images to mimic clean, black-and-white floorplans.
- CubiCasa5K: A challenging real-world dataset containing complex multi-floor layouts and irregular room shapes, annotated with 11 semantic classes.
- Raster2Graph: A benchmark dataset containing 12 semantic classes, optimized for graph-based floorplan evaluation.
- WAFFLE: A dataset of 20,000 real-world floorplan images scraped from the internet. The authors used this strictly for zero-shot evaluation to test how well the model generalizes to unseen, highly intricate architectural styles.
Key Insights and Ideas
- The Power of Left-to-Right Bias: By sorting polygons deterministically during training, the autoregressive decoder implicitly learns the topological relationships between adjacent corners and rooms, mimicking the natural workflow of a human CAD designer.
- Granular Token-Level Supervision: Unlike models that average embeddings across an entire room sequence (which dilutes semantic clarity with padding tokens), Raster2Seq applies a token-level loss. Every single corner receives direct gradient updates for its specific semantic class.
- Breaking the Query Limit: Because it generates elements sequentially until an
<EOS>token is reached, the model naturally scales to handle dense layouts with an arbitrary number of rooms without hitting memory walls.
Key Results
Raster2Seq consistently outperforms competitive baselines (such as RoomFormer, HEAT, and FRI-Net) across geometric metrics (Room, Corner, and Angle F1 scores) and semantic accuracy.
Robustness to Complexity
As floorplans grow more complex (exceeding 15 polygons or 150 corners), baseline models suffer massive performance drops. Raster2Seq maintains stable accuracy, demonstrating its architectural resilience.
Zero-Shot Generalization
When evaluated on the raw, "in-the-wild" internet images of the WAFFLE dataset without any fine-tuning, Raster2Seq achieved an IoU of 73.9, substantially outperforming RoomFormer (60.5) and FRI-Net (56.7).
Efficiency
While sequential generation is inherently slower at inference time than single-pass query models (0.52s vs 0.04s per image), Raster2Seq achieves the highest training throughput (63 images/second), making it highly practical to train in low-resource settings.
Limitations and Future Work
The authors note a few areas ripe for improvement:
- Minor Semantic Elements: The model occasionally struggles to perfectly localize less prevalent structures like doors and windows, sometimes generating artifacts like "cross-over" windows that intersect walls incorrectly.
- Hard Geometric Constraints: The network does not explicitly enforce strict architectural rules (like perfect $90^\circ$ wall alignments). While the authors successfully demonstrated that a Vision-Language Model (VLM) like Gemini 2.5 Pro can be used as a post-processing step to snap edges to a Manhattan-style grid, integrating these geometric constraints directly into the loss function remains an open avenue for future research.
Summary updated