CoSimGen: Controllable Diffusion Model for Simultaneous Image and Mask Generation

Rupak Bose, Chinedu Innocent Nwoye, Aditya Bhat, Nicolas PadoyarXiv 2025 · DOI

Abstract

In computer vision, the scarcity of high-quality, labeled data remains a significant hurdle, particularly for tasks like semantic segmentation in specialized domains. We present CoSimGen, a novel diffusion-based framework that simultaneously generates high-fidelity images and their corresponding segmentation masks from a single control input. By leveraging a unique "hot-swapping" mechanism to align text and class embeddings, CoSimGen offers a scalable solution for generating perfectly annotated synthetic datasets across diverse fields, including medical imaging, remote sensing, and general-purpose vision.

Introduction

The performance of semantic segmentation models is heavily dependent on the availability of large-scale, pixel-perfect annotated datasets. However, acquiring such data is often a bottleneck. In domains like medical imaging or autonomous driving, manual annotation requires significant expertise and is prohibitively expensive. While modern generative models can produce realistic images, they typically lack the ability to generate the precise, spatially-aligned masks required for training.

CoSimGen addresses this challenge by generating both images and masks concurrently within a single diffusion process. This ensures that the generated modalities are semantically entangled and perfectly aligned, providing a robust tool for synthetic data augmentation.

Overview of the CoSimGen framework showing control inputs (text prompts or class vectors) and the resulting conditioned image-mask pairs across multiple domains.

Methodology

CoSimGen is built upon a Denoising Diffusion Probabilistic Model (DDPM) utilizing a conditional U-Net architecture. The framework introduces several key innovations to ensure controllability and high-fidelity output:

1. Spatio-Spectral Embedding Fusion (Spectron)

Unlike traditional conditioning methods that treat all inputs globally, Spectron distinguishes between class information and temporal noise levels. Class embeddings are fused along the spatial axis to better capture shape and texture, while timestep features are fused along the spectral (channel) axis to model noise levels uniformly across the feature map.

2. Text-Grounded Class Conditioning (Textron)

To enable natural language control, Textron employs a contrastive triplet loss to align text prompts with class labels in a shared embedding space. This allows the model to be trained on discrete class vectors but prompted during inference with natural language (e.g., "A photo of an aeroplane taking off"), a process the authors call "hot-swapping."

3. Hybrid Loss and Super-Resolution

The model is trained using a combination of standard diffusion loss, a triplet loss for semantic grounding, and an adversarial loss to improve output crispness. To maintain computational efficiency, the diffusion process operates at $128 \times 128$ resolution. These outputs are subsequently upscaled to $512 \times 512$ using an ESPCNN (Efficient Sub-Pixel CNN) module, which preserves structural details more effectively than standard GAN-based upscalers.

The detailed DDPM architecture of CoSimGen, illustrating the iterative denoising process and the subsequent super-resolution stage.

Experiments and Results

The framework was evaluated across four diverse datasets: Cholecseg8k (surgical), BTCV (abdominal CT), MBRSC (satellite), and PASCAL-VOC (general).

CoSimGen achieved state-of-the-art (SOTA) performance in both image quality and mask alignment. Key metrics include:

  • Fidelity: Lowest Kernel Inception Distance (KID) of 0.11 and LPIPS of 0.53 across datasets.
  • Alignment: On the BTCV medical dataset, it achieved an FID of 159.92, significantly outperforming baseline methods like CVAE.
  • Qualitative Quality: Visual inspections confirm that CoSimGen produces sharper boundaries for complex structures, such as surgical tools and anatomical organs, compared to traditional GAN-based approaches like Pix2Pix.

Discussion and Conclusion

While CoSimGen demonstrates remarkable versatility, it remains "data-hungry," showing slightly lower performance on smaller datasets like PASCAL-VOC. Additionally, it requires an initial set of paired data for training.

Future work will explore few-shot learning techniques to reduce the initial data requirement. The authors also envision CoSimGen as a powerful tool for domain adaptation, allowing models to be pre-trained on high-fidelity synthetic data before transitioning to real-world applications in sensitive environments like the operating room.

Summary updated

BibTeX
@misc{bose2025cosimgen,
  author = {Rupak Bose and Chinedu Innocent Nwoye and Aditya Bhat and Nicolas Padoy},
  title = {{CoSimGen: Controllable Diffusion Model for Simultaneous Image and Mask Generation}},
  year = {2025},
  eprint = {2503.19661},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.19661},
}
Figure