TL;DR
This paper introduces the Adaptive Token Dictionary (ATD), a novel Transformer architecture for image restoration that addresses the computational cost and limited receptive field of traditional self-attention. ATD uses a learnable "token dictionary" to capture external image priors and a new category-based attention mechanism to model global dependencies efficiently, achieving state-of-the-art results on super-resolution, denoising, and JPEG artifact removal.
What Problem Does This Paper Address?
Transformers have revolutionized image restoration tasks like super-resolution and denoising due to their ability to model long-range dependencies. However, the self-attention mechanism at their core has a quadratic computational complexity with respect to image size. This limitation forces most existing Transformer-based methods to restrict attention to small, local windows, which restricts their receptive field and leads to suboptimal performance, especially for complex degradations or fine details. While some methods try to expand these windows, it comes at a significant computational cost. The authors aim to bridge this gap by enabling global dependency modeling with linear complexity, drawing inspiration from traditional dictionary learning techniques.
Methods
The core of ATD lies in its novel attention mechanisms:
- Adaptive Token Dictionary (ATD): This is a learnable dictionary that summarizes typical image structures and external priors learned during training. It acts as a repository of useful information that the model can draw upon.
- Token Dictionary Cross-Attention (TDCA): This mechanism allows the input image features to interact with the learned token dictionary. It helps the model leverage external image priors by attending to the most relevant dictionary tokens. A key innovation here is a reparameterized scaling factor for the attention that helps mitigate dilution issues when the dictionary is large.
- Adaptive Category-based Self-Attention (AC-MSA): Instead of relying on fixed spatial windows, AC-MSA uses the attention maps from TDCA to group image features into categories based on their similarity to dictionary tokens. This allows for global interactions beyond local windows while maintaining linear complexity. The features within each category are then processed by self-attention.
- Category-aware Feed-Forward Network (CFFN): The FFN is enhanced by incorporating category information derived from TDCA. This allows the FFN to condition its feature fusion on the identified category, further improving representation.
The ATD architecture is built using these components within a residual structure, while ATD-U employs a U-Net-like encoder-decoder structure for tasks like denoising and JPEG artifact removal.
Datasets
The paper uses standard datasets for training and evaluation:
- Image Super-Resolution: DIV2K, Flickr2K, and DF2K (a combination of DIV2K and Flickr2K) for training. Evaluation is performed on Set5, Set14, BSD100, Urban100, and Manga109.
- Image Denoising: DFWB (DIV2K, Flickr2K, WED, BSD500) for training. Evaluation on grayscale datasets Set12, BSD68, Urban100, and color datasets CBSD68, Kodak24, McMaster, Urban100.
- JPEG Compression Artifacts Removal: Datasets include Classic5, LIVE1, and Urban100.
Key Insights and Ideas
- Bridging Dictionary Learning and Attention: The authors draw a compelling analogy between dictionary learning's sparse coding and weighted reconstruction and Transformer's self-attention mechanism. This insight is crucial for understanding how to inject external priors into attention.
- Token Dictionary as External Prior: Using a learnable dictionary to summarize image structures is a novel way to provide the model with "knowledge" beyond the immediate input, akin to how humans use prior experience.
- Category-based Attention for Global Context: Moving away from fixed spatial windows to content-based categories for attention grouping is a key enabler for efficient global dependency modeling. This allows the model to connect semantically similar but spatially distant features.
- Reparameterized Scaling Factor: The proposed adjustment to the scaling factor in TDCA is a clever solution to prevent attention dilution when dealing with larger dictionaries, ensuring that the most relevant information is emphasized.
Key Results
- State-of-the-Art Performance: ATD and its variants (ATD-light, ATD-U) achieve state-of-the-art results on multiple image super-resolution, denoising, and JPEG compression artifact removal benchmarks.
- Quantitative Gains: For super-resolution, ATD consistently outperforms existing methods, showing improvements of up to 0.40 dB over HAT and 0.35 dB over MambaIRv2 on challenging datasets like Urban100. For denoising, ATD-U shows gains of up to 0.18 dB on Kodak24 and 0.12 dB on Urban100. For JPEG CAR, ATD-U outperforms ART and MambaIR by 0.05-0.07 dB on Classic5.
- Efficiency: ATD strikes a superior balance between performance and computational efficiency. While having comparable or slightly higher FLOPs than some methods, it offers faster inference and significantly less GPU memory usage compared to some Transformer-based approaches.
- Qualitative Improvements: Visual comparisons demonstrate ATD's ability to restore sharper details, preserve textures, and effectively handle severe degradations and artifacts, outperforming competitors in challenging scenarios.
Limitations and Future Work
- Dictionary Size Trade-off: While larger dictionaries can capture more priors, the authors note that without proper scaling, performance can degrade due to attention dilution. The proposed reparameterized scaling factor helps, but finding the optimal balance between dictionary size and performance remains an area of interest.
- Computational Cost: Although ATD achieves linear complexity relative to image size for its core attention mechanisms, the overall model still involves multiple layers and operations, and further optimization for extremely high-resolution inputs might be explored.
- Future Work: The authors suggest exploring further applications of their ATD framework to other image restoration tasks and investigating more sophisticated ways to leverage the learned token dictionary and category information. The paper also mentions providing visualizations of dictionary tokens and their corresponding activated features in the appendix, which could offer deeper insights into what the model learns.
Summary updated