{"id":13488845,"url":"https://github.com/I2-Multimedia-Lab/CDFormer","last_synced_at":"2025-03-28T02:31:16.010Z","repository":{"id":238980570,"uuid":"773270575","full_name":"I2-Multimedia-Lab/CDFormer","owner":"I2-Multimedia-Lab","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-07T01:43:18.000Z","size":23707,"stargazers_count":95,"open_issues_count":7,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-10-31T01:34:48.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/I2-Multimedia-Lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T07:49:13.000Z","updated_at":"2024-10-24T03:42:54.000Z","dependencies_parsed_at":"2024-09-07T04:22:15.719Z","dependency_job_id":null,"html_url":"https://github.com/I2-Multimedia-Lab/CDFormer","commit_stats":null,"previous_names":["i2-multimedia-lab/cdformer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/I2-Multimedia-Lab%2FCDFormer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/I2-Multimedia-Lab%2FCDFormer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/I2-Multimedia-Lab%2FCDFormer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/I2-Multimedia-Lab%2FCDFormer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/I2-Multimedia-Lab","download_url":"https://codeload.github.com/I2-Multimedia-Lab/CDFormer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245957643,"owners_count":20700312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T18:01:22.897Z","updated_at":"2025-03-28T02:31:12.054Z","avatar_url":"https://github.com/I2-Multimedia-Lab.png","language":"Python","funding_links":[],"categories":["Super Resolution"],"sub_categories":[],"readme":"# CDFormer: When Degradation Prediction Embraces Diffusion Model for Blind Image Super-Resolution\n\nCreated by [Qingguo Liu](https://github.com/users/zbhfc712), [Chenyi Zhuang](https://github.com/Sheryl-Z), [Pan Gao]()\\*, [Jie Qin]()\\*\n\n[[arXiv]](https://arxiv.org/abs/2405.07648) [[supp]]()\n\nThis repository contains PyTorch implementation for __CDFormer: When Degradation Prediction Embraces Diffusion Model for Blind Image Super-Resolution__ (Accepted by CVPR 2024).\n## 🔥Abstract\n\u003e 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.\n## 🔥News\n- **2024-02-27** CDFormer is accepted by CVPR 2024.\n\n\n## 🔥Environment\nPython 3.8.8 and Pytorch 2.0.1. Details can be found in `requirements.txt`. \n\n## 🔥Train\n### 1. Prepare training data \n\n1.1 Download the [DIV2K](https://data.vision.ee.ethz.ch/cvl/DIV2K/)  dataset and the [Flickr2K](http://cv.snu.ac.kr/research/EDSR/Flickr2K.tar) dataset.\n\n1.2 Combine the HR images from these two datasets in `your_data_path/DF2K/HR` to build the DF2K dataset. \n\n### 2. Resume training from pretrained model\nRun `python main.py` to train on the DF2K dataset. Please update `dir_data` in the bash file as `your_data_path`.\n\n### 3. Start training from scratch\nRun `python main.py --start_epoch 0` to train on the DF2K dataset. Please update `dir_data` in the bash file as `your_data_path`.\n\n## Test\n### 1. Prepare test data \nDownload [benchmark datasets](https://github.com/xinntao/BasicSR/blob/a19aac61b277f64be050cef7fe578a121d944a0e/docs/Datasets.md) (e.g., Set5, Set14 and other test sets) and prepare HR/LR images in `your_data_path/benchmark`.\n### 2. Prepare pretrained model \nDownload [pretrained model](https://drive.google.com/drive/folders/1zWAPqE23VBBy7bpTyM7omTERrn6bXq0x?usp=sharing)  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`).\n\n### 3. Begin to test\nRun `python test_x2.py` to test scale 2 on benchmark datasets. \nRun `python test_x3.py` to test scale 3 on benchmark datasets.\nRun `python test_x4.py` to test scale 4 on benchmark datasets.\nPlease update `dir_data` in the bash file as `your_data_path` and selection parameter.\n# Acknowledgements\nThis code is built on [DASR](https://github.com/The-Learning-And-Vision-Atelier-LAVA/DASR), [DAT](https://github.com/zhengchen1999/DAT) and [DiffIR](https://github.com/Zj-BinXia/DiffIR). We thank the authors for sharing the excellent codes.\n\n## Citation\nIf you find our work useful in your research, please consider citing: \n```\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FI2-Multimedia-Lab%2FCDFormer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FI2-Multimedia-Lab%2FCDFormer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FI2-Multimedia-Lab%2FCDFormer/lists"}