Abstract
Image colorization is a challenging ill-posed problem where a single grayscale input can correspond to multiple valid color outputs. Traditional methods often produce desaturated, "brownish" results due to pixel-level regression. We present DiffColor, a two-stage framework that leverages the generative power of diffusion models to achieve high-fidelity, text-guided colorization. By combining a CLIP-based contrastive loss with in-context embedding optimization, DiffColor provides precise object-level control and vivid colorization while maintaining the structural integrity of the original image.
Introduction
The primary challenge in image colorization is the inherent ambiguity of mapping luminance to chrominance. While deep learning has advanced the field, many models suffer from the "average color" effect, leading to dull results. Recent text-to-image models like Stable Diffusion offer rich color priors but often fail to preserve the exact spatial details of a grayscale reference. DiffColor bridges this gap by decoupling color generation from structural preservation.
Methodology
The DiffColor pipeline consists of two distinct stages designed to balance creativity with fidelity:
1. Generative Color Prior and Spatial Alignment
The framework begins with a pre-trained Latent Diffusion Model (LDM). To prevent the model from defaulting to safe, desaturated tones, a CLIP-based contrastive loss is introduced. This loss encourages the model to move toward vibrant color descriptions and away from "negative" prompts such as "grayscale" or "blurry." To ensure the generated colors align perfectly with the input's geometry, a Spatial Alignment Module warps the diffusion output to match the source grayscale structure.
2. In-context Controllable Colorization
To enable precise user control, DiffColor employs an "in-context" optimization strategy. The model is fine-tuned on the specific input image to find an optimized text embedding ($e_{opt}$) that represents the reconstructed scene. Users can then manipulate colors by interpolating between $e_{opt}$ and a target text embedding. This allows for localized changes—such as changing a car's color—without affecting the rest of the image or requiring a full re-generation.
Experimental Results
DiffColor was evaluated on a dataset of 60 high-resolution images across diverse categories, including animals, architecture, and landscapes.
Quantitative Performance
DiffColor achieves state-of-the-art results in both visual quality and text adherence:
- Visual Fidelity: The model reached an FID of 48.67 and an LPIPS of 0.22, outperforming traditional baselines like DeOldify and ColTran.
- Instruction Following: It achieved a CLIP Score of 28.62, demonstrating superior alignment with user-provided text prompts compared to UniColor and ControlNet.
Qualitative Analysis
User studies involving 25 participants confirmed a strong preference for DiffColor's outputs. The model's ability to handle complex semantic scenes—such as a "green boat under a red sky"—without color bleeding highlights its robustness in object-level control. Furthermore, the framework preserves fine details, such as animal fur, with high realism.
Conclusion and Future Work
DiffColor represents a significant step toward controllable, high-fidelity colorization. While the current optimization process takes approximately 11 minutes on an NVIDIA A100, the framework's ability to leverage generative priors while maintaining structural fidelity is a powerful paradigm. Future research will focus on reducing computational overhead and extending the framework to broader image editing tasks.
Summary updated