icandle / CAMixerSR

CAMixerSR: Only Details Need More “Attention” (CVPR 2024)
https://arxiv.org/abs/2402.19289
Apache License 2.0
228 stars 13 forks source link

CAMixerSR: Only Details Need More “Attention”

[Yan Wang](https://scholar.google.com/citations?user=SXIehvoAAAAJ&hl=en)1,2, Yi Liu1\*, Shijie Zhao1\*†, [Junlin Li](https://scholar.google.com/citations?user=daHqpg8AAAAJ&hl=en&oi=ao)1, [Li Zhang](https://scholar.google.com/citations?hl=en&user=8G5-2OMAAAAJ)1

1ByteDance, 2Nankai University

Overview: We propose CAMixerSR, a new approach integrating content-aware accelerating framework and token mixer design, to pursue more efficient SR inference via assigning convolution for simple regions but window-attention for complex textures. It exhibits excellent generality and attains competitive results among state-of-the-art models with better complexity-performance trade-offs on large-image SR, lightweight SR, and omnidirectional-image SR.

This repository contains PyTorch implementation for CAMixerSR (CVPR 2024).

Table of contents

1. [Requirements](#%EF%B8%8F-requirements) 2. [Datasets](#-datasets) 3. [Test](#%EF%B8%8F-how-to-test) 4. [Results](#-results) 5. [Acknowledgments](#-acknowledgments) 6. [Citation](#-citation)


⚙️ Requirements

Dependencies

🎈 Datasets

Large-Image SR

Training: DIV2K.

Testing: F2K, Test2K, Test4K, Test8K (Google Drive/Baidu Netdisk).

Lightweight SR

Training: DIV2K or DF2K.

Testing: Set5, Set14, BSD100, Urban100, Manga109 (Google Drive/Baidu Netdisk).

Preparing: Please refer to the Dataset Preparation of BasicSR.

Omni-Directional-Image SR

Training/Testing: lau dataset (Google Drive/Baidu Netdisk).

Preparing: Please refer to the Step 1&2&3 of OSRT.

▶️ How to Test

Clone this repository and change the directory to ./codes.

git clone https://github.com/icandle/CAMixerSR.git
cd codes

Large-Image SR

Testing: Change the dataset path of example option to your datasets and test with the command:

# 2K
python basicsr/test.py -opt options/test/test_2K.yml
# 4K/8K
python basicsr/test.py -opt options/test/test_8K.yml

Note: We use TileModel with Tile 64x64 and Overlap 4 to constrain the calculations.

Lightweight SR

Testing: Change the dataset path of example option to your datasets and test with the command:

# x2
python basicsr/test.py -opt options/test/test_x2.yml
# x4
python basicsr/test.py -opt options/test/test_x4.yml

✨ Results

Visual comparison (click me)

[](https://imgsli.com/MjUyMzE3)

Large-Image SR

Lightweight SR

Omni-Directional-Image SR

💖 Acknowledgments

We would thank BasicSR, ClassSR, and OSRT for their enlightening work!

🎓 Citation

@article{wang2024camixersr,
  title={CAMixerSR: Only Details Need More ``Attention"},
  author={Wang, Yan and Liu, Yi and Zhao, Shijie and Li, Junlin and Zhang, Li},
  journal={arXiv preprint arXiv:2402.19289},
  year={2024}
}