Abstract
ROICtrl is a lightweight adapter for diffusion models that enables precise, multi-instance control using bounding boxes and free-form text. By introducing a novel "ROI-Unpool" operation, it achieves superior spatial accuracy and attribute separation (preventing "color bleeding" between objects) while being up to 9.8x faster than previous state-of-the-art methods.
Introduction
Current text-to-image models like DALL-E 3 or Stable Diffusion are incredible at generating single objects, but they struggle with complex scenes containing multiple instances. If you ask for "a brown dog on the left and a white cat on the right," the model often mixes up the colors or places them incorrectly. This happens because natural language is inherently ambiguous for spatial coordinates, and the "global" attention mechanism in these models often leads to attribute leakage—where characteristics of one object spill over into another.
Existing solutions usually fall into two camps: implicit methods that attempt to bake coordinates into text embeddings (often resulting in poor spatial alignment) and explicit methods that use attention masks to isolate regions. While more accurate, explicit methods are computationally expensive because they perform heavy calculations on the full-resolution feature map for every single object in the scene.
Methods: The ROI-Unpool Paradigm
The authors introduce ROICtrl, an adapter that brings the efficiency of object detection logic to generative AI. The core innovation is a pair of complementary operations:
- ROI-Align (Extraction): Borrowed from the Mask R-CNN architecture, this extracts features from specific bounding boxes on a high-resolution feature map.
- ROI-Unpool (Pasting): This is the paper's primary contribution. Instead of using a mask to zero out everything outside a box, ROI-Unpool "pastes" the processed instance features back into their original coordinates on the feature map. This allows the model to process each instance independently at a fixed, small scale (e.g., 14x14) before re-integrating them.
The Workflow
- Instance Injection: For each bounding box, the model extracts features via ROI-Align, injects the specific text description using the model's existing cross-attention, and refines them with a local self-attention layer.
- Learnable Attention Blending: Since objects often overlap, the model uses a learnable convolution layer to decide how to blend the "global" background features with the "instance" features, effectively handling occlusions.
- Compatibility: Because ROICtrl reuses the pretrained cross-attention layers of the base model, it is "plug-and-play" with other popular tools like ControlNet, IP-Adapter, and community LoRAs.
Datasets and Evaluation
The model was trained on the MS-COCO dataset (118k images), with instances "recaptioned" using CogVLM to improve description quality. Evaluation was conducted using MIG-Bench and InstDiff-Bench, alongside a new, more rigorous ROICtrl-Bench that includes both template-based and complex free-form captions to better reflect real-world usage.
Key Results
ROICtrl demonstrates significant improvements in both accuracy and efficiency:
- Superior Accuracy: On the MIG-Bench, ROICtrl achieved a 0.66 mIoU (Mean Intersection over Union), significantly outperforming previous leaders like MIGC (0.56) and GLIGEN (0.27).
- Massive Speedup: ROICtrl is roughly 9.8x faster than Instance Diffusion. While Instance Diffusion takes ~129 seconds to generate a complex image on an A100 GPU, ROICtrl does it in ~13 seconds.
- Memory Efficiency: It requires nearly 50% less training memory (34.3G vs 65.5G) compared to masked-attention variants.
The model successfully passes the "nine-grid test" (generating a 3x3 grid of distinct objects with specific attributes), a task where even DALL-E 3 frequently fails. By processing instances in their own local coordinate space, ROICtrl avoids the quadratic computational cost of global attention and eliminates coordinate quantization errors that often make masked-attention methods look misaligned.
Limitations and Future Work
While ROICtrl performs excellently, it slightly trails models trained on massive internal datasets when faced with extremely rare or weirdly phrased captions. Scaling up the training data is a likely solution to close this gap. Additionally, the authors did not focus on specific human identities due to ethical considerations. A promising next step is extending this ROI-based control to video generation, where maintaining instance consistency across frames is a significant challenge.
Summary updated