Seg2Any: Open-set Segmentation-Mask-to-Image Generation with Precise Shape and Semantic Control

Danfeng li, Hui Zhang, Sheng Wang, Jiachen Li, Zu-Xuan Wu
6/1/2025
12 citations
diffusion-flowtransformer-attention

No official code found. Best implementation: 0xLDF/Seg2Any (53 stars, Python, last commit 2026-04-01).

Abstract

Despite recent advances in diffusion models, top-tier text-to-image (T2I) models still struggle to achieve precise spatial layout control, i.e. accurately generating entities with specified attributes and locations. Segmentation-mask-to-image (S2I) generation has emerged as a promising solution by incorporating pixel-level spatial guidance and regional text prompts.

Show full abstract

However, existing S2I methods fail to simultaneously ensure semantic consistency and shape consistency. To address these challenges, we propose Seg2Any, a novel S2I framework built upon advanced multimodal diffusion transformers (e.g. FLUX). First, to achieve both semantic and shape consistency, we decouple segmentation mask conditions into regional semantic and high-frequency shape components. The regional semantic condition is introduced by a Semantic Alignment Attention Mask, ensuring that generated entities adhere to their assigned text prompts. The high-frequency shape condition, representing entity boundaries, is encoded as an Entity Contour Map and then introduced as an additional modality via multi-modal attention to guide image spatial structure. Second, to prevent attribute leakage across entities in multi-entity scenarios, we introduce an Attribute Isolation Attention Mask mechanism, which constrains each entity's image tokens to attend exclusively to themselves during image self-attention. To support open-set S2I generation, we construct SACap-1M, a large-scale dataset containing 1 million images with 5.9 million segmented entities and detailed regional captions, along with a SACap-Eval benchmark for comprehensive S2I evaluation. Extensive experiments demonstrate that Seg2Any achieves state-of-the-art performance on both open-set and closed-set S2I benchmarks, particularly in fine-grained spatial and attribute control of entities.

View on arXivView PDF

Code Implementations(1)

0xLDF/Seg2AnyCommunity25%

[NIPS 2025] Seg2Any: Open-set Segmentation-Mask-to-Image Generation with Precise Shape and Semantic Control

533Python, ShellSep 26, 20258 months ago

Similar Papers

Cite this paper

@article{li2025segany,
  title  = {Seg2Any: Open-set Segmentation-Mask-to-Image Generation with Precise Shape and Semantic Control},
  author = {Danfeng li and Hui Zhang and Sheng Wang and Jiachen Li and Zu-Xuan Wu},
  year   = {2025},
  eprint = {2506.00596},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2506.00596},
  url    = {https://doi.org/10.48550/arXiv.2506.00596},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.00596.svg)](https://codeofpaper.com/paper/2506.00596)

Discussion