Source-linked AI summary

LayerDiff: Exploring Text-guided Multi-layered Composable Image Synthesis via Layer-Collaborative Diffusion Model

Runhui Huang, Kaixin Cai, Jianhua Han, Xiaodan Liang, Renjing Pei, Guansong Lu, Songcen Xu, Wei Zhang, Hang Xu

arXiv:2403.11929v1cs.CV

TL;DR

LayerDiff addresses the lack of object-wise manipulation in monolithic text-to-image generation by modeling images as composable background, foreground, and mask layers. Its layer-collaborative diffusion framework uses global and layer-specific prompts, specialized attention, self-mask guidance, and a data construction pipeline. The resulting model achieves image quality comparable to whole-image generation while supporting layer-specific editing and style transfer.

  • Problem

    Existing text-to-image methods generate monolithic images, limiting object-wise manipulation and fine-grained control needed for layered creative workflows.

    Source: §1 · pp. 2–3
  • Method

    LayerDiff jointly generates background, foreground, and mask layers using layer-collaborative attention, prompt enhancement, self-mask guidance, and a multi-layer data construction pipeline.

    Source: §1 · p. 3
  • Results

    LayerDiff achieves image quality comparable to traditional whole-image generation while generating high-fidelity multi-layered images.

    Source: §1 · pp. 3–4, §6 · p. 14
  • Takeaways & Limitations

    LayerDiff supports controllable applications including layer-specific image editing, composable manipulation, and style transfer.

    Source: §6 · p. 14

    Existing multi-layer training-data pipelines are inefficient, limiting effective production of large-scale training data and model performance.

    Source: §6 · p. 15

Abstract

from arXiv · show

Despite the success of generating high-quality images given any text prompts by diffusion-based generative models, prior works directly generate the entire images, but cannot provide object-wise manipulation capability. To support wider real applications like professional graphic design and digital artistry, images are frequently created and manipulated in multiple layers to offer greater flexibility and control. Therefore in this paper, we propose a layer-collaborative diffusion model, named LayerDiff, specifically designed for text-guided, multi-layered, composable image synthesis. The composable image consists of a background layer, a set of foreground layers, and associated mask layers for each foreground element. To enable this, LayerDiff introduces a layer-based generation paradigm incorporating multiple layer-collaborative attention modules to capture inter-layer patterns. Specifically, an inter-layer attention module is designed to encourage information exchange and learning between layers, while a text-guided intra-layer attention module incorporates layer-specific prompts to direct the specific-content generation for each layer. A layer-specific prompt-enhanced module better captures detailed textual cues from the global prompt. Additionally, a self-mask guidance sampling strategy further unleashes the model's ability to generate multi-layered images. We also present a pipeline that integrates existing perceptual and generative models to produce a large dataset of high-quality, text-prompted, multi-layered images. Extensive experiments demonstrate that our LayerDiff model can generate high-quality multi-layered images with performance comparable to conventional whole-image generation methods. Moreover, LayerDiff enables a broader range of controllable generative applications, including layer-specific image editing and style transfer.

1 Introduction

LayerDiff addresses the limited object-wise control of monolithic text-to-image generation by introducing unified, text-guided multi-layer synthesis. Its layer-collaborative model and data pipeline support high-quality composable images and controllable applications.

Motivation

  • The task targets object-wise manipulation needed for professional graphic design and digital artistry, where images are created and refined across multiple layers.Prior methods generally produce single-layer monolithic images, limiting fine-grained adjustment and object-specific control.Source: §1 · pp. 2–3

LayerDiff

  • LayerDiff introduces a layer-based diffusion paradigm that generates background, foreground, and mask layers using global and layer-specific prompts.The model combines layer-collaborative attention, prompt enhancement, and self-mask guidance sampling.Source: §1 · p. 3

Data construction

  • The dataset pipeline combines object localization, image captioning, segmentation, and inpainting to construct high-quality multi-layered composable training images.It produces whole-image and per-layer descriptions while filling missing regions after layer extraction.Source: §1 · p. 3

Results

  • LayerDiff achieves performance comparable to traditional whole-image generation while enabling layer-specific editing and style transfer.The reported comparison includes two-layer synthesis and notes a performance gap for settings with more layers because training data is sparse.Source: §1 · p. 4

2 Related Work

Prior work covers text-to-image generation and controllable synthesis, but LayerDiff extends these directions to multi-layer composable generation with simple text-based, layer-specific control.

Text-to-Image Synthesis

  • LayerDiff differs from Text2Layer [38] by supporting two or more layers rather than only dual-layer image synthesis.It also introduces layer-specific prompts for controlling content per layer.Source: §2 · p. 4

Controllable Image Synthesis

  • Existing controllable methods use signals such as personalized embeddings, attention editing, layouts, or structural maps, whereas LayerDiff relies on global and layer-specific text prompts.The approach is intended to provide multi-level control after pre-training without complex control signals.Source: §2 · p. 4

3 Preliminary on Diffusion Models

Diffusion models corrupt clean images with scheduled Gaussian noise and learn to predict that noise for iterative denoising from random noise.

Forward diffusion

  • The forward process produces noisy images by adding Gaussian noise to clean image x0 according to a noise schedule, with xt formed using ᾱt and ε.Source: §3 · pp. 4–5

Denoising objective

  • Training minimizes the expected squared error between the added noise ε and the denoising model’s prediction ε_θ(x_t, t).The timestep t is sampled uniformly from {1, ..., T}.Source: §3 · p. 5

Sampling

  • After training, sampling begins from random noise x_T and repeatedly removes predicted noise to recover an image x_0.The model can also estimate clean data during sampling from its predicted noise.Source: §3 · p. 5

4 Method

LayerDiff formulates composable synthesis over background, foreground, and mask layers, then jointly generates them from global and layer-specific prompts. Its architecture coordinates cross-layer interaction, layer-specific text guidance, mask-guided sampling, and a constructed multi-layer dataset.

4.1 Task Formulation

  • A composable image contains a background layer plus non-overlapping foreground image–mask pairs that are stacked to form the final image.The background mask is the complement of the foreground masks.Source: Definition of Multi-Layered Composable… · p. 5
  • LayerDiff trains diffusion over image and mask latents jointly, conditioned on a global prompt and separate prompts for the background and each foreground layer.Masks are represented in RGB-compatible form for encoding and decoding.Source: Text-Guided Multi-Layered Image… · p. 6

4.2 Layer-Collaborative Diffusion Model

  • The model combines image and mask encoders, text encoders, a layer-specific prompt enhancer, and a layer-collaborative diffusion model.Layer latents are concatenated across channels and stacked along the layer dimension.Source: Architecture Overview · pp. 6–7
  • The layer-collaborative attention block uses inter-layer attention for dependencies and text-guided intra-layer attention for layer-specific content generation.A feed-forward network refines the attention outputs.Source: Layer-Collaborative Attention Block · pp. 7–8, Figure 3 · p. 8
  • The layer-specific prompt enhancer applies self-attention to distinguish layer prompts and cross-attention to incorporate global context and inter-layer object relationships.Layer prompts serve as queries, while global prompt features provide keys and values.Source: Layer-Specific Prompt Enhancer · p. 8
  • Self-Mask Guidance sampling uses predicted masks to conceal marked regions and adjust predicted noise toward generation within each layer.The guidance scale s controls the noise adjustment, while masked and unmasked regions are recombined at each step.Source: Self-Mask Guidance Sampling · pp. 8–9

4.3 Dataset Construction

  • The dataset pipeline detects objects with DetCLIP, segments them with SAM, inpaints the background, and captions global and layer-specific content with InstructBLIP.The resulting sample contains a global prompt, layer images, layer prompts, and masks.Source: §4.3 · pp. 9–10, Figure 4 · p. 9
  • MLCID contains 2M training examples from LAION400M and a private dataset, plus a distinct 27k-image test set covering two-, three-, and four-layer compositions.The reported training quantities are 1.7M two-layer, 0.3M three-layer, and 0.08M four-layer examples.Source: §4.3 · p. 10

5 Experiments

LayerDiff is evaluated for implementation choices, text-to-image synthesis, qualitative multi-layer generation, and layer-specific applications. Results show comparable two-layer image quality to Stable Diffusion while supporting layer inpainting and style transfer.

5.1 Implementation Details

  • The model is trained with Stable Diffusion initialization, mask-processing choices, mixed layer timesteps, and dedicated optimization settings for multi-layer synthesis.Training uses a 256 × 256 resolution, 2M image-text pairs, frozen autoencoder and text encoder, and AdamW optimization.Source: §5.1 · pp. 10–11, §5.2 · p. 11

5.2 Experimental Details

  • Evaluation uses FID, global CLIP-Score, and layer CLIP-Score on a 27k-sample MLCID test set, with Stable Diffusion serving as a whole-image baseline.Stable Diffusion outputs are generated at 512 resolution and resized to 256 for comparison.Source: §5.2 · pp. 11–12

5.3 Quantitative Results

  • LayerDiff’s two-layer synthesis performance is comparable to Stable Diffusion’s whole-image synthesis, while performance declines for three- and four-layer settings with limited training data.The dataset contains only about 15% three-layer and 3% four-layer images, which the authors associate with insufficient training for those layer counts.Source: §5.3 · p. 12
  • Ablations show that layer-specific prompts, prompt enhancement, dilated masks, and self-mask guidance each contribute to multi-layer generation quality.Layer-specific prompts guide per-layer content and inter-layer relationships, while self-mask guidance improves generation quality.Source: Table 2 · p. 11, §5.3 · pp. 12–13

5.4 Qualitative Results

  • Qualitative results show that LayerDiff composes layer images and masks into multi-layer images with competitive quality relative to Stable Diffusion and comparison with Text2Layer.Figures visualize individual layers, masks, and final composites for two-, three-, and four-layer synthesis.Source: Figure 5 · p. 12, §5.4 · p. 13, Figure 6 · p. 13

5.5 Application

  • Without fine-tuning, LayerDiff supports foreground and background layer inpainting by changing a target layer prompt while preserving or adapting other layers.Non-target mask changes can help produce natural target-layer content without altering specified structures in other layers.Source: §5.5 · pp. 13–14
  • LayerDiff also enables layer-level style transfer by adding noise and stylized text to a selected layer, such as applying a Van Gogh style to a background.The procedure performs denoising sampling for the specified layer rather than transferring style across the entire composite.Source: §5.5 · p. 14, Figure 7 · p. 14

6 Conclusions

The conclusion presents LayerDiff as a layer-wise text-guided synthesis model that achieves comparable image quality while providing greater control. It identifies inefficient multi-layer data generation as a limitation affecting scalable training.

6 Conclusions

  • LayerDiff achieves comparable image quality to whole-image generation while providing layer-wise generation, editing, and style-transfer control.The conclusion frames these capabilities as extensions of text-driven generative models.Source: §6 · p. 14
  • Existing multi-layer training-data pipelines are inefficient, limiting the effective production of large-scale training data.The paper identifies more efficient data-pipeline design as a future research direction.Source: §6 · p. 15

A Implementation Details

The implementation initializes LayerDiff largely from Stable Diffusion and uses self-mask guidance with fixed Gaussian-blur settings during sampling.

A Implementation Details

  • LayerDiff initializes image-generation components from Stable Diffusion while randomly initializing new layer-collaborative modules and controlling mask injection with a learnable zero-initialized scalar.The text-guided intra-layer attention module starts from Stable Diffusion’s cross-attention layer.Source: A Implementation Details · p. 18
  • Self-mask guidance sampling uses a Gaussian blur with kernel size 31 and sigma 3.These settings are applied during the self-mask guidance process.Source: A Implementation Details · p. 18

B Data Construction Details

The data-construction pipeline filters and refines detected foreground masks, then generates global and layer-specific prompts and completes extracted regions through inpainting.

B Data Construction Details

  • Foreground masks are filtered by detection confidence, SAM–saliency overlap, containment, and area before being retained for layer construction.Retained masks have areas between 1% and 80% of the total image, with overlap exceeding 10%.Source: B Data Construction Details · p. 18
  • Global prompts describe the entire image, while layer prompts describe cropped foreground subjects using separate captioning instructions.The global instruction requests color, shapes, and actions; the layer instruction requests the main subject.Source: B Data Construction Details · p. 18
  • Stable Diffusion inpainting fills extracted regions using an empty prompt and foreground-related negative prompts to refine the output.Foreground-object terms serve as negative prompts during the inpainting process.Source: B Data Construction Details · p. 18

C Dataset Details

The paper constructs MLCID as a large but long-tailed multi-layer dataset, then applies layer-specific inpainting and style-transfer procedures for controllable manipulation.

C Dataset Details

  • MLCID contains 1.7M two-layer, 0.3M three-layer, and 0.08M four-layer images, but its long-tailed distribution limits generalization to deeper compositions.The paper identifies expanding synthesized data as a future direction.Source: C Dataset Details · p. 18

D Application Details

  • The dataset visualizations include additional examples of background-first inpainting followed by foreground-layer inpainting.Source: Figure 8 · p. 19
  • Style transfer is likewise demonstrated by transferring style to the background layer first and then to foreground layers.Source: Figure 9 · p. 19
  • For layer inpainting, non-target layers retain their latent representations while non-target masks adapt after k steps, with k set to 1.Source: D Application Details · p. 19
  • For layer style transfer, the method uses strength 0.8 and denoises 80% of sampling steps while preserving non-target layer images and masks.Source: D Application Details · p. 19

E More Visualizations

The visualizations show LayerDiff’s layered synthesis, mask-prior control, and iterative construction of compositions beyond two layers, alongside applications in image manipulation.

E More Visualizations

  • LayerDiff examples are juxtaposed with Stable Diffusion to highlight layered generation’s distinct capabilities relative to whole-image generation.Source: E More Visualizations · p. 19
  • Additional examples demonstrate layer-specific inpainting and style transfer as applications of the approach.Source: E More Visualizations · p. 20
  • The sampling process establishes inter-layer structure early, refines textures later, and binarizes masks by comparing values between layers.Source: E More Visualizations · p. 20

F.1 Sampling with Mask Priors

  • Mask-prior sampling uses bounding boxes or object masks to initialize layer masks with spatial information about foreground location and approximate size.Source: §F.1 · p. 20
  • LayerDiff visualizes two-, three-, and four-layer samples from its constructed composable-image dataset.Source: Figure 10 · p. 21

E More Visualizations

  • The paper also presents attention maps for inter-layer and text-guided intra-layer attention, plus a 50-step visualization of the sampling process.Source: Figure 12 · p. 21, Figure 13 · p. 22

F.2 Iterative Generating Multi-layered Composable Images

  • Iterative synthesis repeatedly inpaints foreground layers, merging each new layer with the background to construct compositions such as four-layer images.Source: §F.2 · p. 21, Figure 14 · p. 22

G Discussion on Self-Mask Guidance Sampling

Self-Mask Guidance improves multi-layer sampling over Self-Attention Guidance, while the paper illustrates iterative compositing and synthesis of images with multiple layers.

G Discussion on Self-Mask Guidance Sampling

Loading 2403.11929v1…