Abstract
Instruction driven image editing with standard CLIP text encoders often fails in complex scenes with many objects. We present QL-Adapter, a framework for multiple object editing that tackles two challenges: enforcing object counts and spatial layouts, and accommodating diverse categories. QL-Adapter consists of two core modules: the Image-Layout Fusion Module (ILFM) and the Cross-Modal Augmentation Module (CMAM). ILFM fuses layout priors with ViT patch tokens from the CLIP image encoder to strengthen spatial structure understanding. CMAM injects image features into the text branch to enrich textual embeddings and improve instruction following. We further build QL-Dataset, a benchmark that spans broad category, layout, and count variations, and define the task of quantity and layout consistent image editing (QL-Edit). Extensive experiments show that QL-Adapter achieves state of the art performance on QL-Edit and significantly outperforms existing models.
Introduction
Instruction-driven image editing allows users to modify images using natural language. However, models relying on standard CLIP text encoders often struggle with counting and spatial reasoning in complex scenes. For instance, editing a scene with multiple objects frequently results in incorrect counts or "blobbing," where distinct objects are merged into fragmented parts. This misalignment between user instructions and the model's structural understanding necessitates a more robust approach to multi-object consistency.
The QL-Adapter Framework
The proposed QL-Adapter is built upon Stable Diffusion XL (SDXL) and IP-Adapter, introducing two novel modules to enforce strict layout and quantity constraints:
- Image-Layout Fusion Module (ILFM): Instead of semantic masks, ILFM utilizes explicit bounding box layouts extracted via a frozen object detector. These coordinates are fused with ViT patch tokens from the CLIP image encoder, grounding the model's understanding of object locations.
- Cross-Modal Augmentation Module (CMAM): This module facilitates bidirectional cross-attention between text instructions and image features. It enriches text embeddings with visual semantics, ensuring the generated content aligns with both the textual prompt and the spatial layout.
A key architectural decision is the Targeted Injection of these fused features into the U-Net's "Down 4 Block." This specific layer has been identified as highly sensitive to spatial layout, allowing for precise control without compromising overall generative quality.
QL-Dataset and Benchmarking
To evaluate quantity and layout-consistent image editing (QL-Edit), the authors introduced the QL-Dataset. This benchmark contains 100 base image-caption pairs with object counts ranging from 1 to 10, sourced from COCO, Pinterest, and synthetic data. The dataset includes 500 test instructions designed to rigorously test the model's ability to add, remove, or alter specific numbers of objects while maintaining layout fidelity.
Key Insights and Results
The QL-Adapter framework offers several advantages over traditional mask-based or prompt-only methods:
- Instance Separation: Explicit bounding boxes prevent the "blobbing" effect common in diffusion models by treating objects as distinct instances.
- Attention Distribution: ILFM successfully mitigates the "center bias" in standard cross-attention maps, distributing attention accurately across multiple bounding box regions.
- Performance: QL-Adapter significantly outperforms state-of-the-art models like InstructPix2Pix and IC-Edit. In class editing tasks, it achieved an Object Accuracy (OA) of 76.2% and a layout consistency Average Precision (AP) of 73.7.
Conclusion
QL-Adapter demonstrates that combining explicit layout priors with cross-modal augmentation can solve the long-standing challenges of counting and spatial consistency in image editing. While a trade-off exists between guidance strength and visual realism, the framework provides a solid foundation for future work in fine-grained visual generation.
Summary updated