Toward a Diffusion-Based Generalist for Dense Vision Tasks

Yue Fan, Yongqin Xian, Xiaohua Zhai, Alexander Kolesnikov, Muhammad Ferjad Naeem, Bernt Schiele, Federico TombariarXiv 2024 · DOI

Introduction

This paper introduces a unified diffusion-based generalist model capable of handling diverse "dense" vision tasks—ranging from semantic segmentation to image deraining—using a single set of parameters. By reformulating these tasks as conditional image generation and performing diffusion directly in pixel space (rather than latent space), the authors overcome the precision errors that typically plague generative models in discriminative tasks.

The Fragmentation of Computer Vision

In Natural Language Processing, a single architecture (like GPT) can handle almost any task. Computer Vision (CV), however, remains fragmented. Most state-of-the-art models for depth estimation, segmentation, or image restoration use specialized, task-specific "heads" and architectures.

While recent "vision generalists" have attempted to unify these tasks by treating them as image-inpainting or sequence-generation problems, diffusion models—the current state-of-the-art in image generation—have struggled to join the party. Specifically, standard Latent Diffusion Models (LDMs) like Stable Diffusion use a Variational Autoencoder (VAE) to compress images. This compression creates "quantization errors": small mathematical approximations in the latent space that manifest as messy, inaccurate boundaries when predicting precise pixel-level masks or depth maps.

Methodology: Pixel-Space Diffusion

The proposed framework treats every dense vision task as a conditional image generation problem. To maintain high precision, the model bypasses the latent space entirely.

The Diffusion Generalist architecture reformulates dense vision tasks as conditional image generation using pixel-space diffusion and a powerful image encoder.

Core Components

  1. Data Reformation: All non-image outputs (like depth maps or segmentation masks) are converted into RGB images. Class labels are mapped to specific colors, and depth values are normalized into a 0-255 range across RGB channels.
  2. Pixel-Space Diffusion: To avoid the quantization issues of latent models, the authors perform diffusion directly in the pixel space. They fine-tune a pre-trained Stable Diffusion v1.4 model but remove the VAE's bottleneck for the output.
  3. Conditioning Architecture:
    • Image Encoder: Instead of feeding raw input pixels directly into the UNet, the model uses a pre-trained ConvNeXt-Large encoder to extract multi-scale semantic features.
  4. Task Prompting: The model receives a text instruction (e.g., "Perform semantic segmentation") via a frozen CLIP text encoder, which guides the UNet through cross-attention layers.
  5. Memory Optimization: Because pixel-space diffusion is memory-intensive, the authors removed self-attention layers from the outermost UNet blocks to maintain computational feasibility.

Key Insights and Results

The model was evaluated on standard benchmarks including NYUv2 (depth), ADE20K (semantic segmentation), and MS-COCO (panoptic segmentation).

The Pixel-Space Advantage

A primary finding is that while latent diffusion is excellent for generating aesthetically pleasing images, it fails at precision-critical tasks. Moving to pixel space improved semantic segmentation performance from a meager 17.1% mIoU to 48.0% mIoU, as shown in the comparison below.

Quantitative comparison demonstrating that Pixel Diffusion significantly outperforms Latent Diffusion in precision-oriented tasks like segmentation.

Performance Highlights

  • Segmentation: At a 128x128 resolution, the model achieved 48.7% mIoU on ADE20K, nearly doubling the performance of the previous best generalist (Painter) at the same resolution (28.4%).
  • Panoptic Quality: It reached 40.3% PQ on COCO, showing a significant lead over non-diffusion-based unified models.
  • Versatility: The model successfully demonstrated that a single UNet can switch between "restoration" (e.g., deraining) and "perception" (e.g., object mapping) simply by changing the text prompt.

Limitations and Future Work

Despite its success, the "pixel-space tax" presents challenges. Because the model lacks latent compression, it is highly memory-hungry, limiting most experiments to 128x128 or 256x256 resolutions. Furthermore, like all diffusion models, inference is relatively slow, requiring 50 denoising steps compared to the single pass of traditional CNNs or Transformers. Future work will likely focus on parameter-efficient fine-tuning (like LoRA) and improving inference speed to make this generalist approach more practical for real-world deployment.

Summary updated

BibTeX
@misc{fan2024toward,
  author = {Yue Fan and Yongqin Xian and Xiaohua Zhai and Alexander Kolesnikov and Muhammad Ferjad Naeem and Bernt Schiele and Federico Tombari},
  title = {{Toward a Diffusion-Based Generalist for Dense Vision Tasks}},
  year = {2024},
  eprint = {2407.00503},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.00503},
}
Figure