Diff-Plugin: Revitalizing Details for Diffusion-based Low-level Tasks

Yuhao Liu, Fang Liu, Zhanghan Ke, Nanxuan Zhao, Rynson W. H. Lau

Abstract

Large-scale diffusion models excel at image synthesis but often struggle with detail preservation in low-level vision tasks due to their inherent stochasticity. We present Diff-Plugin, a lightweight framework that enables a single pre-trained diffusion model to perform multiple restoration tasks—such as deraining, deblurring, and low-light enhancement—while strictly preserving image details. By employing a dual-branch "Task-Plugin" and a natural language "Plugin-Selector," Diff-Plugin allows users to trigger specific restoration tasks through simple text prompts without retraining the base model.

Introduction

Large-scale diffusion models are masters of image synthesis, but they face a significant "randomness" problem when applied to low-level vision tasks. This randomness often leads to content distortion; for instance, removing rain from a portrait might inadvertently alter facial features or background textures. Existing solutions typically involve task-specific models that lack flexibility or unstable inversion techniques that are computationally expensive. Diff-Plugin seeks to leverage the generative power of pre-trained models while forcing them to respect the fine-grained spatial details of the input image.

Diff-Plugin enables various low-level vision tasks through natural language prompts while maintaining high fidelity.

Methodology

The framework introduces two primary components that act as "plug-and-play" modules for a frozen pre-trained diffusion model:

  1. Task-Plugin: This lightweight module (comprising only 1.67% of the base model's parameters) uses a dual-branch design:
  2. Task-Prompt Branch (TPB): Utilizes a CLIP vision encoder to extract "visual prompts" from the input, identifying the degradation type (e.g., snow or rain) without complex text engineering.
  3. Spatial Complement Branch (SCB): Extracts high-resolution features from the input image via a VAE encoder and injects them into the final stage of the diffusion decoder. This acts as a "spatial anchor," ensuring original details are preserved.
  4. Plugin-Selector: To facilitate a user-friendly interface, the selector uses multi-task contrastive learning. It calculates the similarity between text embeddings and Task-Plugins to activate the correct module based on natural language commands.

Experimental Results

Diff-Plugin was evaluated across eight distinct low-level tasks, including desnowing, dehazing, deblurring, and face restoration. The framework achieved state-of-the-art performance, recording the lowest FID and KID scores across nearly all benchmarks. For example, in dehazing, it achieved an FID of 34.68, significantly outperforming the base Stable Diffusion's 48.89.

The Plugin-Selector accurately differentiates between complex instructions, such as clearing haze versus removing both snow and haze.

In a user study with 46 participants, Diff-Plugin received an Average Ranking (AR) of 1.17 (where 1 is best), far outperforming competing methods. Furthermore, the Plugin-Selector demonstrated high reliability with an mAP of 0.936 on a test set of 120,000 samples, proving its ability to understand both single and multi-task instructions.

Conclusion and Future Work

Diff-Plugin provides a modular and scalable solution for high-fidelity image restoration. By injecting spatial details at the final stage of the decoder, it effectively counters the "forgetting" of fine-grained features common in deep diffusion layers. While currently operating on entire images, future work aims to integrate Large Language Models (LLMs) to provide more granular, region-based control for local editing tasks.

Summary updated

BibTeX
@inproceedings{liu2024diff,
  author = {Yuhao Liu and Fang Liu and Zhanghan Ke and Nanxuan Zhao and Rynson W. H. Lau},
  title = {{Diff-Plugin: Revitalizing Details for Diffusion-based Low-level Tasks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
}
Figure