Skip to main content
QUICK REVIEW

[Paper Review] N-Gram in Swin Transformers for Efficient Lightweight Image Super-Resolution

Haram Choi, Jeongmin Lee|arXiv (Cornell University)|Nov 21, 2022
Advanced Image Processing TechniquesComputer Science10 citations
TL;DR

This paper introduces N-Gram context in Swin Transformers for efficient lightweight image super-resolution, expanding the receptive field via sliding window self-attention across neighboring local windows. By applying channel-reducing group convolutions to generate uni-Gram embeddings and integrating them with scaled-cosine attention, the proposed NGswin model achieves state-of-the-art performance with reduced FLOPs, while SwinIR-NG further improves lightweight SR benchmarks across multiple datasets.

ABSTRACT

While some studies have proven that Swin Transformer (Swin) with window self-attention (WSA) is suitable for single image super-resolution (SR), the plain WSA ignores the broad regions when reconstructing high-resolution images due to a limited receptive field. In addition, many deep learning SR methods suffer from intensive computations. To address these problems, we introduce the N-Gram context to the low-level vision with Transformers for the first time. We define N-Gram as neighboring local windows in Swin, which differs from text analysis that views N-Gram as consecutive characters or words. N-Grams interact with each other by sliding-WSA, expanding the regions seen to restore degraded pixels. Using the N-Gram context, we propose NGswin, an efficient SR network with SCDP bottleneck taking multi-scale outputs of the hierarchical encoder. Experimental results show that NGswin achieves competitive performance while maintaining an efficient structure when compared with previous leading methods. Moreover, we also improve other Swin-based SR methods with the N-Gram context, thereby building an enhanced model: SwinIR-NG. Our improved SwinIR-NG outperforms the current best lightweight SR approaches and establishes state-of-the-art results. Codes are available at https://github.com/rami0205/NGramSwin.

Motivation & Objective

  • To address the limited receptive field of standard window self-attention (WSA) in Swin Transformers, which restricts context utilization for high-resolution image reconstruction.
  • To reduce computational complexity in deep learning-based super-resolution models, especially for real-world deployment with constrained parameter budgets.
  • To enhance performance in lightweight super-resolution by leveraging spatial context from neighboring local windows through a novel N-Gram mechanism.
  • To demonstrate the generalizability of the N-Gram context by improving existing Swin-based SR models like SwinIR-light and HNCT.

Proposed method

  • Define N-Gram as the interaction of neighboring local windows in Swin Transformers, where uni-Gram embeddings from adjacent windows are processed via sliding-WSA to expand the effective receptive field.
  • Introduce channel-reducing group convolution to generate low-dimensional uni-Gram embeddings, reducing computational cost of N-Gram interaction.
  • Propose NGswin, an efficient SR network with a hierarchical encoder (including patch-merging), an asymmetric small decoder, and an SCDP bottleneck that fuses multi-scale features.
  • Employ scaled-cosine attention from Swin V2 within N-Gram Swin Transformer Blocks (NSTBs) to improve attention efficiency and representation.
  • Apply the N-Gram context to existing Swin-based models, creating SwinIR-NG, which enhances performance without increasing model size significantly.
  • Use a SCDP bottleneck (pixel-shuffle, concatenation, depth-wise convolution, point-wise projection) to efficiently combine multi-scale features from the encoder for improved reconstruction.
Figure 1 : Two tracks of this paper using the N-Gram context. (Left) NGswin outperforms previous leading SR methods with an efficient structure. (Right) Our proposed N-Gram context improves different Swin Transformer-based SR models.
Figure 1 : Two tracks of this paper using the N-Gram context. (Left) NGswin outperforms previous leading SR methods with an efficient structure. (Right) Our proposed N-Gram context improves different Swin Transformer-based SR models.

Experimental results

Research questions

  • RQ1Can expanding the receptive field of window self-attention in Swin Transformers improve image super-resolution performance without increasing computational cost?
  • RQ2How effective is the proposed N-Gram context, derived from neighboring local windows, in capturing long-range spatial dependencies for image restoration?
  • RQ3Can the N-Gram mechanism be generalized to improve existing Swin Transformer-based super-resolution models?
  • RQ4What is the impact of the SCDP bottleneck and hierarchical encoder-decoder design on model efficiency and performance in lightweight SR?
  • RQ5Does the N-Gram context lead to visible improvements in image quality and quantitative metrics across diverse benchmark datasets?

Key findings

  • NGswin achieves competitive performance on Set5, Set14, BSD100, Urban100, and Manga109 with only 82.39G FLOPs for ×2 SR, outperforming previous leading methods in efficiency.
  • SwinIR-NG, the enhanced version of SwinIR-light with N-Gram context, establishes state-of-the-art results in lightweight super-resolution, achieving 38.10/0.9610 on Set5 for ×2 SR.
  • The N-Gram context improves HNCT by 0.02 dB in PSNR on Set5 for ×2 SR (38.10 vs. 38.08) and 0.01 dB on ×3 and ×4, with only a small increase in FLOPs.
  • The SCDP bottleneck contributes significantly to performance, improving PSNR by 0.05 dB on Set5 for ×2 SR when added to the default architecture (38.05 vs. 38.08).
  • Visual comparisons show that NGswin and SwinIR-NG produce sharper textures and clearer edges than baseline models, especially in complex regions like textures and scene text.
  • SwinIR-NG improves scene text detection performance on the ST-VQA test set, indicating potential benefits for downstream vision tasks requiring high-resolution inputs.
Figure 2 : The feature maps after window self-attention in each intermediary layer of NGswin with and without N-Gram.
Figure 2 : The feature maps after window self-attention in each intermediary layer of NGswin with and without N-Gram.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.