Enhancing Prompt Following with Visual Control Through Training-Free Mask-Guided Diffusion

Hongyu Chen, Yiqi Gao, Min Zhou, Peng Wang, Xubin Li, Tiezheng Ge, Bo ZhengarXiv 2024 · DOI

Introduction

Text-to-image (T2I) diffusion models, particularly when augmented with tools like ControlNet, have enabled precise layout specification via edges, depth maps, or poses. However, a significant challenge persists: Prompt Following Under Visual Control. In real-world scenarios, visual control signals and text prompts are often misaligned. This misalignment typically results in two failure modes: Object Missing, where the model ignores prompt elements not present in the control signal, and Attribute Mismatch, where attributes like color are incorrectly bound to objects due to the rigid spatial constraints of the control image.

Methodology: Mask-guided Prompt Following (MGPF)

To bridge this gap, we introduce Mask-guided Prompt Following (MGPF), a training-free approach integrated into the diffusion denoising process. MGPF utilizes a two-pronged strategy to ensure generated images respect both the provided layout and the full text description:

  1. Masked ControlNet: To solve the "Object Missing" problem, MGPF uses object masks to selectively gate ControlNet features. In regions where the prompt describes new elements absent from the visual control, the ControlNet features are masked out. This "frees up" the base U-Net to generate the missing objects without conflicting with the empty regions of the control signal.
  2. Attribute-Matching Loss: To resolve "Attribute Mismatch," a specialized loss function is applied during each denoising step. This loss optimizes the latent noise ($z_t$) to ensure that cross-attention maps for attribute words (e.g., "yellow") correctly overlap with the attention maps for their corresponding object words (e.g., "dog") within the spatial regions defined by the masks.
Figure 1: Overview of the MGPF architecture, illustrating the use of object masks to gate ControlNet features and the application of Attribute-matching Loss within the U-Net denoising process.

Evaluation and Key Results

As no standard benchmark existed for this specific problem, a new dataset was curated from the COCO dataset, consisting of 1,384 samples with misaligned prompt-image pairs. MGPF was tested across four common visual controls: depth maps, Canny edges, soft edges, and segmentation maps.

Quantitative evaluation demonstrates that MGPF significantly outperforms standard ControlNet and other training-free baselines. On Canny edge conditions, MGPF improved Attribute Matching (VQA-AM) by over 23% and Object Generation (VQA-OG) by over 25%. Qualitative results confirm that MGPF is uniquely capable of generating objects missing from the control signal (such as a "red mouse" or "yellow flowers") while maintaining correct color binding for all entities.

Figure 2: Qualitative comparison of MGPF against various baselines. MGPF consistently generates objects missing from the visual control while maintaining correct attribute binding across diverse conditions.

Conclusion and Future Work

MGPF provides a robust, training-free solution for complex T2I generation tasks where text and visual signals conflict. By treating prompt following as an optimization problem during denoising, it avoids the need for expensive retraining. A primary limitation remains the resolution of cross-attention maps; in highly complex scenes with many small objects, attribute binding can still be challenging. Future research will focus on incorporating mask-guided constraints into higher-resolution layers of the diffusion model to handle more intricate compositions.

Summary updated

BibTeX
@misc{chen2024enhancing,
  author = {Hongyu Chen and Yiqi Gao and Min Zhou and Peng Wang and Xubin Li and Tiezheng Ge and Bo Zheng},
  title = {{Enhancing Prompt Following with Visual Control Through Training-Free Mask-Guided Diffusion}},
  year = {2024},
  eprint = {2404.14768},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.14768},
}
Figure