Created by Qingguo Liu, Chenyi Zhuang, [Pan Gao]()*, [Jie Qin]()*
[arXiv] [[supp]]()
This repository contains PyTorch implementation for CDFormer: When Degradation Prediction Embraces Diffusion Model for Blind Image Super-Resolution (Accepted by CVPR 2024).
Existing Blind image Super-Resolution (BSR) methods focus on estimating either kernel or degradation information, but have long overlooked the essential content details. In this paper, we propose a novel BSR approach, Content-aware Degradation-driven Transformer (CDFormer), to capture both degradation and content representations. However, low-resolution images cannot provide enough content details, and thus we introduce a diffusion-based module $CDFormer{diff}$ to first learn Content Degradation Prior (CDP) in both low- and high-resolution images, and then approximate the real distribution given only low-resolution information. Moreover, we apply an adaptive SR network $CDFormer{SR}$ that effectively utilizes CDP to refine features. Compared to previous diffusion-based SR methods, we treat the diffusion model as an estimator that can overcome the limitations of expensive sampling time and excessive diversity. Experiments show that CDFormer can outperform existing methods, establishing a new SOTA performance on various benchmarks under blind settings.
🔥News
- 2024-02-27 CDFormer is accepted by CVPR 2024.
Python 3.8.8 and Pytorch 2.0.1. Details can be found in requirements.txt
.
1.1 Download the DIV2K dataset and the Flickr2K dataset.
1.2 Combine the HR images from these two datasets in your_data_path/DF2K/HR
to build the DF2K dataset.
Run python main.py
to train on the DF2K dataset. Please update dir_data
in the bash file as your_data_path
.
Download benchmark datasets (e.g., Set5, Set14 and other test sets) and prepare HR/LR images in your_data_path/benchmark
.
Download pretrained model in your_data_path
(e.g., for x2
scale, download experiment\cdformer_x2_bicubic_iso\model\model_1200pt
in your_data_path\experiment\cdformer_x2_bicubic_iso\model\model_1200pt
).
Run python test_x2.py
to test scale 2 on benchmark datasets.
Run python test_x3.py
to test scale 3 on benchmark datasets.
Run python test_x4.py
to test scale 4 on benchmark datasets.
Please update dir_data
in the bash file as your_data_path
and selection parameter.
This code is built on DASR, DAT and DiffIR. We thank the authors for sharing the excellent codes.
If you find our work useful in your research, please consider citing: