GLMHA A Guided Low-rank Multi-Head Self-Attention for Efficient Image Restoration and Spectral Reconstruction

Zaid Ilyas, Naveed Akhtar, David Suter, Syed Zulqarnain GilaniarXiv 2024 · DOI · arXiv

Abstract

State-of-the-art image restoration and spectral reconstruction models often rely on Channel-wise Self-Attention (CSA) to capture global dependencies. However, CSA is computationally expensive and parameter-heavy. We propose Guided Low-rank Multi-Head Self-Attention (GLMHA), which exploits the inherent low-rank nature of attention matrices. By utilizing a lightweight calibration network to guide feature projection, GLMHA reduces computational costs by up to 7.7 GFLOPs and parameters by 370K with negligible performance loss across multiple benchmarks.

Introduction

Image restoration tasks such as deblurring and deraining, along with spectral reconstruction, have seen significant progress through hybrid CNN-Transformer architectures. These models typically employ Channel-wise Self-Attention (CSA), which attends to feature channels rather than spatial patches, offering better efficiency for high-resolution images. Despite this, CSA remains a bottleneck. Existing efficient Transformer variants like Linformer or Performer often fail to provide meaningful gains for the shorter sequences typical in CSA or reduce FLOPs at the cost of increased parameters.

Motivation: The Low-Rank Nature of Attention

The primary motivation for GLMHA stems from the observation that attention matrices in restoration models are highly redundant. Through Singular Value Decomposition (SVD) analysis of models like Restormer and MST++, the authors found that a small fraction of eigenvalues accounts for over 95% of the signal energy.

SVD analysis showing that a small number of eigenvalues capture 95% of the energy in various restoration models.

This empirical evidence suggests that full-rank attention calculations are computationally wasteful, as most information is concentrated in a low-rank subspace. GLMHA aims to exploit this redundancy to build a leaner attention mechanism.

Proposed Method: GLMHA

Guided Low-rank Multi-Head Self-Attention (GLMHA) is designed as a drop-in replacement for CSA. It introduces three key innovations to maintain quality while reducing complexity:

  1. Calibration Network ($\varphi_{calibrate}$): A small sub-network processing the Query ($Q$) to generate an instance-specific calibration vector. This network uses max-pooling and depth-wise convolutions to identify important features.
  2. Instance-Guided Weighting: This vector re-weights the input feature map, ensuring semantically critical features are preserved during rank reduction.
  3. Direct Low-Rank Projection: GLMHA projects the weighted input directly into a lower-dimensional space ($C' < C$), reducing both FLOPs and parameters simultaneously.
The architecture of GLMHA (a) and the detailed components of the calibration network (b).

Unlike previous methods that compress full-sized matrices, GLMHA avoids generating large intermediate tensors, providing consistent efficiency gains across various sequence lengths.

Experimental Results

GLMHA was integrated into three state-of-the-art base models: Restormer, MST-L, and MST++. Evaluations were conducted across spectral reconstruction (NTIRE 2022), motion deblurring (GoPro), and image deraining (Rain13k).

Key findings include:

  • Efficiency Gains: In Restormer for deraining, GLMHA saved 6.46 GFLOPs and 350K parameters.
  • Performance Retention: PSNR drops were minimal. For HSI reconstruction, MST++ with GLMHA achieved 34.21 dB compared to the original's 34.32 dB.
  • Superiority Over Rivals: GLMHA outperformed Reformer, Linformer, and Performer, which often suffered significant quality degradation (up to 4dB PSNR loss) or failed to reduce parameter counts.

Conclusion

GLMHA demonstrates that the redundancy in channel-wise self-attention can be effectively exploited through guided low-rank projection. By using a calibration network to maintain signal energy, GLMHA offers a more efficient path for high-performance image restoration without the heavy computational burden of traditional attention mechanisms.

Summary updated

Abstract

Image restoration and spectral reconstruction are longstanding computer vision tasks. Currently, CNN-transformer hybrid models provide state-of-the-art performance for these tasks. The key common ingredient in the architectural designs of these models is Channel-wise Self-Attention (CSA). We first show that CSA is an overall low-rank operation. Then, we propose an instance-Guided Low-rank Multi-Head selfattention (GLMHA) to replace the CSA for a considerable computational gain while closely retaining the original model performance. Unique to the proposed GLMHA is its ability to provide computational gain for both short and long input sequences. In particular, the gain is in terms of both Floating Point Operations (FLOPs) and parameter count reduction. This is in contrast to the existing popular computational complexity reduction techniques, e.g., Linformer, Performer, and Reformer, for whom FLOPs overpower the efficient design tricks for the shorter input sequences. Moreover, parameter reduction remains unaccounted for in the existing methods.We perform an extensive evaluation for the tasks of spectral reconstruction from RGB images, spectral reconstruction from snapshot compressive imaging, motion deblurring, and image deraining by enhancing the best-performing models with our GLMHA. Our results show up to a 7.7 Giga FLOPs reduction with 370K fewer parameters required to closely retain the original performance of the best-performing models that employ CSA.
BibTeX
@misc{ilyas2024glmha,
  author = {Zaid Ilyas and Naveed Akhtar and David Suter and Syed Zulqarnain Gilani},
  title = {{GLMHA A Guided Low-rank Multi-Head Self-Attention for Efficient Image Restoration and Spectral Reconstruction}},
  year = {2024},
  eprint = {2410.00380},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.00380},
}
Figure