Abstract
Image colorization using diffusion models frequently suffers from two primary issues: "color bleeding," where colors spill across object boundaries, and incorrect text-to-color binding in complex scenes. We present MT-Color, a novel diffusion-based framework designed for precise, instance-level color control. By integrating pixel-level masked attention and a multi-instance sampling strategy, MT-Color allows users to colorize specific objects using text descriptions and segmentation masks. Additionally, we introduce GPT-Color, a vision-language-generated dataset tailored for instance-level colorization tasks. Our approach achieves high-resolution (512x512) outputs with superior perceptual quality and text-image alignment compared to existing baselines.
Introduction
While large-scale diffusion models like Stable Diffusion have revolutionized image generation, adapting them for grayscale image colorization remains challenging. Standard attention mechanisms often mix information across the entire image, leading to color bleeding. Furthermore, when provided with complex prompts involving multiple objects, these models often fail to bind the correct color to the intended instance. MT-Color addresses these limitations by enforcing strict spatial and semantic constraints during the denoising process.
Methodology
MT-Color is built upon Stable Diffusion and ControlNet, incorporating three key architectural innovations to ensure precise color control:
1. Pixel-level Masked Attention
To prevent color bleeding, the framework replaces standard cross-attention with pixel-level masked attention. By utilizing user-provided segmentation masks, the model restricts the interaction between ControlNet’s grayscale features and the U-Net’s latent features. This ensures that pixels belonging to distinct objects do not exchange information, effectively halting the spread of color across boundaries.
2. Instance Mask and Text Guidance Module
We introduce a trainable branch within the U-Net’s self-attention layers. This module encodes instance masks and text descriptions (via CLIP) and uses the masks to explicitly restrict information flow during self-attention. This mechanism ensures that a prompt like "red apple" only influences the specific pixels designated by the apple's mask, solving the text-binding problem.
3. Multi-Instance Sampling
During inference, MT-Color employs a multi-instance sampling strategy. Recognizing that low-frequency information like color is determined in the early stages of diffusion, the model denoises each instance separately for the first few steps. These isolated noisy images are then fused into a global image for the remaining diffusion steps, ensuring both local color accuracy and global coherence.
The GPT-Color Dataset
To facilitate training, we developed GPT-Color, a specialized dataset derived from COCO-Stuff. We utilized the Recognize Anything Model (RAM) for segmentation and a combination of GPT-4 and BLIP-2 to generate precise "object + color" descriptions for approximately 12,000 training images. This dataset provides the fine-grained instance-level pairings necessary for the model to learn effective text-color binding.
Key Results and Discussion
MT-Color demonstrates significant improvements over previous diffusion-based and GAN-based colorization methods:
- Resolution and Quality: MT-Color produces 512x512 images, doubling the resolution of prior diffusion models like L-CAD. It achieved a state-of-the-art FID of 11.38 on the GPT-Color dataset.
- Text-Image Alignment: In ablation studies, the full model achieved a CLIP-score of 0.2273, confirming its superior ability to bind colors to the correct objects compared to versions without masked guidance.
- Qualitative Performance: Visual evaluations show that MT-Color eliminates the color bleeding common in transformer-based models (e.g., DDColor) and avoids the muted tones typical of older GAN-based approaches.
Conclusion and Future Work
MT-Color provides a robust solution for controllable image colorization by leveraging masked attention and instance-aware guidance. While the framework significantly improves color accuracy, it introduces higher computational overhead, requiring approximately 68.6 seconds and 18GB of VRAM per image. Future research will focus on optimizing inference efficiency and improving the preservation of fine, pixel-level details from the original grayscale inputs.
Summary updated