Generalizing to Out-of-Sample Degradations via Model Reprogramming

Runhua Jiang, Yahong Han

Abstract

Traditional image restoration models are often designed as specialists, excelling at removing specific degradations like haze or noise but failing when encountering unseen artifacts. This paper introduces the Out-of-Sample Restoration (OSR) task, which requires models to generalize to degradations not present during training. We propose a Model Reprogramming framework that treats images as quantum-mechanical wave functions to decouple content from degradation "style." By utilizing lightweight, trainable transform modules around a frozen backbone, this approach allows models to handle unknown artifacts without the need for extensive fine-tuning. Experimental results demonstrate that this framework significantly outperforms standard training and domain adaptation methods, even when using randomly initialized backbones.

Introduction

In the field of computer vision, image restoration—the process of recovering a clean image from a degraded version—has seen significant progress. However, most state-of-the-art models are highly specialized. A model trained to remove rain typically performs poorly when presented with motion blur or sensor noise. In real-world applications, such as autonomous driving or surveillance, images often suffer from complex, unpredictable combinations of degradations that are impossible to fully represent in a training dataset.

This gap highlights the need for Out-of-Sample Restoration (OSR). The goal of OSR is to develop models with inherent generalization abilities that can gracefully handle unseen degradation types. This paper addresses this challenge by introducing a Model Reprogramming framework that adapts frozen, pre-trained (or even untrained) models to new tasks by modifying the input and output spaces rather than the internal weights of the model itself.

Methodology: Model Reprogramming via Wave Functions

The core of the proposed framework is the decoupling of image content from its degradation. The authors achieve this by wrapping a heavy, frozen restoration backbone (such as a Transformer or CNN) in two lightweight, trainable modules.

1. Input Transform Module

Drawing inspiration from quantum mechanics, the input transform module represents the degraded image as a complex wave function:

$$\hat{z} = |z| \odot e^{\theta i}$$

In this representation, the Amplitude ($|z|$) encapsulates the underlying structural content of the image, while the Phase ($\theta$) modulates the "style" or specific degradation pattern. By training the phase term, the module can "translate" an unknown degradation into a format that the frozen backbone is capable of processing. This allows the system to adapt to new artifacts without altering the core knowledge stored in the backbone's weights.

2. The Reprogrammed Backbone

The framework utilizes a frozen restoration backbone, such as Res12, SwinIR, or MPRNet. A significant finding of this research is that even untrained, randomly initialized models can be effectively reprogrammed. Because these models lack the specific physical priors associated with a single task, they often provide a more flexible foundation for OSR than models pre-trained on a single, narrow dataset.

3. Output Transform Module

After the processed wave functions pass through the backbone, the output transform module remaps them back into the standard image space. This module uses a series of fully-connected layers and MLP modules to refine details, restore color accuracy, and ensure the final output meets the requirements of a clean, high-quality image.

Experimental Setup and Results

Datasets and Protocol

The authors evaluated the framework using several standard benchmarks, including DIV2K (Low-Resolution), Rain1200 (Rain), MIT-Adobe Five5K (Noise), GoPro (Blur), and RESIDE (Haze). To test generalization, they employed Protocol 2: the transform modules were trained on only two degradation types (e.g., Haze and Low-Resolution) and then tested across all five categories.

Performance Metrics

The results indicate a substantial improvement in generalization over traditional methods:

  • Superior Generalization: On the OSR task, a reprogrammed Res12 backbone achieved an average PSNR of 20.84 dB, compared to just 19.16 dB for standard training.
  • Comparison with Domain Adaptation: The framework outperformed established domain adaptation methods like DAN (20.57 dB) and MCD (19.79 dB), which are often less effective for pixel-level restoration tasks.
  • Scaling State-of-the-Art Models: When applied to heavyweights like MPRNet and MIRNet, the reprogramming framework boosted generalization by 7.8% and 9.0%, respectively, with minimal parameter overhead.

Discussion: Insights into Decoupling

A key insight from this research is the effectiveness of the phase-amplitude decoupling. Visualizations using t-SNE confirm that the phase term effectively captures the unique "style" of different degradations, while the amplitude remains consistent with the ground truth content. This confirms that the model is successfully separating the degradation from the image structure.

Furthermore, the "Power of Randomness" observation challenges the conventional wisdom that pre-training is always beneficial. In OSR contexts, a pre-trained model's fixed priors can act as a hindrance when facing a completely new type of artifact. A random backbone, when reprogrammed, offers a "blank slate" that the transform modules can more easily navigate.

Conclusion and Future Work

Model Reprogramming offers a promising path toward more robust and generalizable image restoration systems. By freezing the backbone and focusing on input/output transformations, the framework avoids the pitfalls of catastrophic forgetting and overfitting common in traditional fine-tuning.

However, some trade-offs remain. The authors noted a slight performance dip on the specific tasks used during training (e.g., a small decrease in dehazing quality) in exchange for broader generalization. Future research will focus on handling simultaneous, "in-the-wild" degradations and identifying which neural architectures are most inherently "reprogrammable" for diverse visual tasks.

Summary updated

Abstract

Existing image restoration models are typically designed for specific tasks and struggle to generalize to out-of-sample degradations not encountered during training. While zero-shot methods can address this limitation by fine-tuning model parameters on testing samples, their effectiveness relies on predefined natural priors and physical models of specific degradations. Nevertheless, determining out-of-sample degradations faced in real-world scenarios is always impractical. As a result, it is more desirable to train restoration models with inherent generalization ability. To this end, this work introduces the Out-of-Sample Restoration (OSR) task, which aims to develop restoration models capable of handling out-of-sample degradations. An intuitive solution involves pre-translating out-of-sample degradations to known degradations of restoration models. However, directly translating them in the image space could lead to complex image translation issues. To address this issue, we propose a model reprogramming framework, which translates out-of-sample degradations by quantum mechanic and wave functions. Specifically, input images are decoupled as wave functions of amplitude and phase terms. The translation of out-of-sample degradation is performed by adapting the phase term. Meanwhile, the image content is maintained and enhanced in the amplitude term. By taking these two terms as inputs, restoration models are able to handle out-of-sample degradations without fine-tuning. Through extensive experiments across multiple evaluation cases, we demonstrate the effectiveness and flexibility of our proposed framework. Our codes are available at https://github.com/ddghjikle/Out-of-sample-restoration .
BibTeX
@article{jiang2024generalizing,
  author = {Runhua Jiang and Yahong Han},
  title = {{Generalizing to Out-of-Sample Degradations via Model Reprogramming}},
  journal = {IEEE Trans. Image Process.},
  year = {2024},
  url = {https://openreview.net/forum?id=HYr5bh89Af},
}
Figure