Abstract
Image restoration has traditionally relied on task-specific models, leading to significant storage overhead and limited flexibility in real-world scenarios where multiple degradations coexist. While universal restoration models have emerged, they often suffer from feature interference and a lack of user interactivity. We propose Prompt-In-Prompt (PIP) learning, a novel framework that treats restoration as a hierarchical prompting problem. By nesting high-level "degradation-aware" prompts within low-level "basic restoration" prompts, PIP effectively decouples degradation identification from texture reconstruction. Our method, implemented as a plug-and-play module for U-Net architectures, achieves state-of-the-art performance across various tasks—including denoising, dehazing, and deblurring—while maintaining high computational efficiency.
Introduction
The field of image restoration is moving away from the "one model, one task" paradigm toward universal solutions capable of handling diverse corruptions like noise, blur, rain, and haze. However, existing universal models face two primary hurdles. First, they often lack a mechanism for users or automated systems to prioritize specific degradations. Second, they struggle with "feature interference," where the network's attempt to identify a high-level degradation (e.g., haze) conflicts with its ability to reconstruct low-level details (e.g., fine textures), often resulting in over-smoothed outputs.
To address these challenges, we introduce Prompt-In-Prompt (PIP) learning. PIP leverages a hierarchical structure to separate high-level degradation knowledge from task-agnostic restoration cues, allowing for more precise and flexible image recovery.
Methods
The core of our approach is the PIP module, designed to be integrated into the skip connections of standard U-Net backbones like Restormer or NAFNet.
The Dual-Prompt Strategy
PIP employs two distinct types of prompts:
- Degradation-aware prompt ($d$): A 1D vector encoding high-level information about the specific corruption type. To ensure these prompts remain distinct, we utilize a Directional Decoupled Loss ($L_{ddl}$), which enforces mathematical orthogonality between prompts for different tasks (e.g., "blur" vs. "noise") in the latent space.
- Basic restoration prompt ($B$): A learnable tensor that captures fundamental restoration cues, such as edges and textures, which are generally task-agnostic.
Hierarchical Interactions
The framework facilitates two main types of interactions:
- Prompt-to-Prompt (P2P) Interaction: This module uses cross-attention to fuse the high-level degradation knowledge ($d$) into the basic restoration prompt ($B$), generating a Universal Restoration Prompt ($U$).
- Selective Prompt-to-Feature (P2F) Interaction: Rather than modulating all image features, PIP employs a "selective" mechanism. It identifies the "top-$m$" most relevant features within the skip connections and applies the universal prompt only to those. This sparsity prevents the model from inadvertently altering clean regions of the image, preserving natural textures.
Experimental Setup
We evaluated PIP across five major restoration tasks using a variety of standard benchmarks:
- Denoising: BSD400 and WED for training; BSD68 and Urban100 for testing.
- Deraining: Rain100L.
- Dehazing: SOTS.
- Deblurring: GoPro.
- Low-light Enhancement: LOL dataset.
- Medical Imaging: Generalization was tested on the AAPM CT denoising dataset.
Key Results
PIP demonstrates significant improvements over existing state-of-the-art (SOTA) universal models. On a joint task involving noise, rain, and haze, PIP (with a Restormer backbone) achieved an average PSNR of 32.91 dB, significantly outperforming PromptIR's 32.06 dB.
Efficiency and Generalization
Despite its performance gains, PIP is remarkably lightweight. Adding the PIP module to a Restormer backbone increases the parameter count by only 2.77% and inference time by approximately 8.6%. Furthermore, the model exhibits strong zero-shot generalization, effectively handling unseen noise levels and even performing well on medical CT scans without task-specific fine-tuning.
Interpretability
The use of decoupled degradation prompts allows for better interpretability. Visualizing these prompts using t-SNE reveals clear, distinct clusters for different tasks, confirming that the model successfully learns to distinguish between various types of image corruption.
Conclusion
Prompt-In-Prompt (PIP) learning offers a powerful and efficient solution for universal image restoration. By decoupling high-level degradation awareness from low-level restoration cues through a hierarchical prompting strategy, PIP avoids feature interference and achieves superior results across multiple tasks. Its plug-and-play nature and minimal computational overhead make it a practical choice for real-world applications. Future work will focus on improving performance for complex, mixed degradations and further reducing the computational footprint for mobile deployment.
Summary updated