How Powerful Potential of Attention on Image Restoration?

Cong Wang, Jinshan Pan, Yeying Jin, Liyan Wang, Wei Wang, Gang Fu, Wenqi Ren, Xiaochun CaoarXiv 2024 · DOI

Introduction

Image restoration—the process of recovering a clean image from a degraded version (e.g., removing rain, snow, or haze)—is a classic "ill-posed" problem. For any single degraded input, there are theoretically infinite possible clear outputs. While Convolutional Neural Networks (CNNs) dominated this field for years, their limited receptive fields often struggled with global structures. The advent of Transformers, utilizing Multi-Head Self-Attention (MHSA), solved this by capturing long-range dependencies.

However, standard Transformer architectures almost universally pair MHSA with a Feed-Forward Network (FFN). Recent theoretical work suggests that FFNs are indispensable because they act as the model's "key-value memory." This paper challenges that status quo by asking: Is it possible to build a high-performance restoration model using only attention?

The Challenge of FFN-less Design

In traditional Transformer blocks, the FFN provides the necessary non-linearity and memory capacity that simple linear attention lacks. To remove the FFN without sacrificing performance, the authors had to fundamentally redesign the attention mechanism. They introduce Continuous Scaling Attention (CSAttn), an architecture that replaces the standard "Attention + FFN" sandwich with a multi-stage, non-linear attention process.

Comparison of standard residual and transformer blocks with the proposed CSAttn block.

As shown in the comparison above, while standard blocks rely on a sequential combination of operations, CSAttn integrates spatial scaling and progressive complexity directly into the attention flow, effectively internalizing the functions previously handled by the FFN.

Methods: Continuous Scaling Attention (CSAttn)

The CSAttn block is characterized by three continuous stages of attention within a single block. This design incorporates several key innovations to compensate for the absence of an FFN:

  • Nonlinear Activation in Attention: Standard attention is largely linear. By inserting nonlinear activation functions (like GELU) directly into the modeling process, the authors found a significant boost in performance, suggesting that non-linearity is a bottleneck for complex restoration tasks.
  • Spatial Scaling Learning: To maintain computational efficiency, the second and third attention stages operate at reduced spatial scales (1/2 and 1/4) using "shuffle down" operations. This allows the model to capture multi-scale features without the massive memory overhead typically associated with high-resolution attention.
  • Intra Progressive More Heads: As the stages progress and spatial resolution decreases, the model increases the number of attention heads (e.g., from $N$ to $2N$ to $4N$). This allows the model to learn increasingly complex representations at coarser scales.
  • Value Nonlinear Transformation Adjustment (NTA): Before entering subsequent stages, "Value" (V) features are adaptively adjusted using 1x1 convolutions and non-linearities, further enhancing the model's representational power.
Detailed architecture of the CSAttn block showing the three stages of attention, spatial scaling, and progressive head counts.

Experimental Performance

The CSAttn model was evaluated against state-of-the-art (SOTA) CNN and Transformer models across several benchmarks, including deraining (Rain13K), desnowing (CSD), low-light enhancement (LOL), and real-image dehazing (Dense-Haze).

  • Deraining: CSAttn achieved an average PSNR of 34.22 dB, outperforming the previous best (SFNet) by 0.41 dB.
  • Low-light Enhancement: On the LOL dataset, the model reached 27.31 dB PSNR—a massive jump of 4.22 dB over previous methods.
  • Dehazing: On the difficult Dense-Haze benchmark, it improved the Structural Similarity Index (SSIM) by 6.03%, indicating superior preservation of image structures through heavy haze.

Importantly, despite its multi-stage complexity, the model maintains a comparable parameter count (~21.7M) and FLOPs (~137G) to existing high-end models like Restormer, proving that efficiency does not have to be sacrificed for performance.

Key Insights and Conclusion

The primary takeaway from this research is that the "memory" provided by FFNs is not strictly necessary if the attention mechanism is sufficiently sophisticated. By incorporating non-linearity, multi-scale spatial scaling, and progressive head counts, CSAttn achieves SOTA results while being entirely FFN-free.

This "attention-only" philosophy suggests new directions for computer vision. While the current implementation is tailored for image restoration, future work may explore whether similar FFN-less designs can generalize to high-level semantic tasks like object detection or segmentation. The success of CSAttn proves that the potential of attention mechanisms is far greater than previously realized.

Summary updated

BibTeX
@misc{wang2024how,
  author = {Cong Wang and Jinshan Pan and Yeying Jin and Liyan Wang and Wei Wang and Gang Fu and Wenqi Ren and Xiaochun Cao},
  title = {{How Powerful Potential of Attention on Image Restoration?}},
  year = {2024},
  eprint = {2403.10336},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.10336},
}
Figure