Abstract
InstructDiffusion is a unifying framework that treats diverse computer vision tasks—from object segmentation to image editing—as a single, human-intuitive image manipulation process. By leveraging denoising diffusion models to represent all outputs in a flexible pixel space, the model achieves state-of-the-art performance for generalist models and demonstrates "AGI-like" generalization to tasks it was never explicitly trained to perform.
Introduction
In the field of Natural Language Processing (NLP), models like GPT have successfully unified hundreds of tasks into a single "text-in, text-out" interface. Computer vision (CV), however, has historically struggled with such unification due to the extreme diversity of output formats. A detection model typically outputs coordinates, a segmentation model produces binary masks, and an enhancement model generates high-resolution pixels.
InstructDiffusion addresses this by asking: What if we treated every vision task as an image editing task? By casting every output into a continuous, high-dimensional pixel space, the model can handle a vast array of tasks through a single interface.
The InstructDiffusion Framework
Built upon the Stable Diffusion (v1.5) architecture, InstructDiffusion introduces a paradigm shift in how vision tasks are formulated and executed.
Unified Pixel Output
The core innovation is representing all task outputs as 3-channel RGB images. For instance, instead of returning a list of coordinates for keypoint detection, the model is instructed to "draw a small yellow circle" on a specific joint. For segmentation, it might be told to "apply a blue semi-transparent mask" to an object. This approach avoids the "quantization gap" often found in models that discretize coordinates into text tokens, preserving spatial precision.
Training Pipeline
The model undergoes a three-stage training process:
- Pretraining Adaptation: Fine-tuning Stable Diffusion to generate non-natural elements like masks and markers while maintaining its generative foundation.
- Task-Specific Training: Joint training on a massive mixture of datasets, including segmentation, keypoints, and editing, using diverse instruction templates.
- Human Alignment: A final refinement stage where the model is fine-tuned on a high-quality dataset of 1,000 human-selected outputs to ensure alignment with human preferences.
Datasets and the IEIW
The authors leveraged extensive existing datasets for keypoints (COCO, CrowdPose), segmentation (COCO-Stuff, RefCOCO), and enhancement (GoPro, SIDD). Crucially, they introduced the Image Editing in the Wild (IEIW) dataset. Containing 159,000 pairs, IEIW includes data for object removal, replacement, and 23,000 real-world Photoshop requests gathered from the internet, providing a robust foundation for general-purpose editing.
Key Insights
- Synergy of Multi-tasking: Training on "understanding" tasks (like segmentation) significantly improves performance on "generative" tasks (like editing). By learning where objects are, the model becomes more adept at changing them.
- Zero-Shot Generalization: Because the model understands natural language, it can perform tasks it wasn't explicitly trained for, such as object detection (by "marking boundaries"), demonstrating a level of emergent task flexibility.
- Instruction Granularity: Detailed, descriptive instructions (e.g., "Please use red to encircle the left shoulder") are vital for generalization to novel object categories compared to simple task tags.
Results
InstructDiffusion sets new benchmarks for generalist vision models:
- Keypoint Detection: Achieved 71.2 AP on COCO, outperforming specialized generalists like Painter (70.2).
- Referring Segmentation: Reached 49.58 cIoU on RefClef, a significant improvement over Unified-IO (40.13).
- Image Editing: Outperformed specialized models like InstructPix2Pix in both aesthetic quality and semantic alignment.
Limitations and Conclusion
The primary limitation is the VAE Bottleneck. Since the model relies on a Variational Autoencoder for image compression, there is an inherent loss of fine detail, which caps performance in low-level tasks like deblurring. Future work will explore alternative encoding schemes and self-supervised learning to further scale the model's capabilities.
InstructDiffusion represents a significant step toward a truly generalist vision model, demonstrating that the "image editing" paradigm is a powerful and flexible way to unify the diverse world of computer vision.
Summary updated