{"id":18322536,"url":"https://github.com/tencentarc/desra","last_synced_at":"2025-04-05T23:31:02.744Z","repository":{"id":186503921,"uuid":"632276328","full_name":"TencentARC/DeSRA","owner":"TencentARC","description":"Official codes for DeSRA (ICML 2023)","archived":false,"fork":false,"pushed_at":"2024-02-02T12:44:27.000Z","size":308,"stargazers_count":133,"open_issues_count":5,"forks_count":0,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-21T13:23:17.653Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/TencentARC.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":"2023-04-25T04:40:34.000Z","updated_at":"2025-03-07T01:54:17.000Z","dependencies_parsed_at":"2024-02-02T14:27:34.940Z","dependency_job_id":null,"html_url":"https://github.com/TencentARC/DeSRA","commit_stats":null,"previous_names":["tencentarc/desra"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FDeSRA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FDeSRA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FDeSRA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TencentARC%2FDeSRA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TencentARC","download_url":"https://codeload.github.com/TencentARC/DeSRA/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415783,"owners_count":20935383,"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-11-05T18:25:02.962Z","updated_at":"2025-04-05T23:31:02.135Z","avatar_url":"https://github.com/TencentARC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeSRA (ICML 2023)\n\n🚩 Updates\n\n- ✅ The collected datasets, the codes of detecting artifacts and calculating metrics are released.\n- ✅ Release the MSE and GAN models (Real-ESRGAN, LDL, SwinIR) and SegFormer (the checkpoint and configuration).\n- ✅ Release the GAN-DeSRA models (RealESRGAN-DeSRA, LDL-DeSRA and SwinIR-DeSRA).\n\n---\n\nThis paper aims at **dealing with GAN-inference artifacts**.\n\u003cbr\u003e\n\nWe design a method to effectively detect regions with GAN-inference artifacts, and further propose a fine-tuning strategy that only requires a small number of artifact\nimages to eliminate the same kinds of artifacts, which bridges the gap of applying SR algorithms to practical scenarios.\n\n---\n\n### :book: DeSRA: Detect and Delete the Artifacts of GAN-based Real-World Super-Resolution Models\n\n\u003e [[Paper](https://openreview.net/pdf?id=M0bwbIl4Bl)] \u0026emsp; [Project Page] \u0026emsp; [[Video](https://recorder-v3.slideslive.com/#/share?share=82996\u0026s=e6ebdd07-a83b-4f4b-8eab-a5f103c6c46b)] \u0026emsp; [B站] \u0026emsp; [[Poster](https://docs.google.com/presentation/d/18-kVUBRgGKF4JUrN253yURJGDKcFNpaB/edit?usp=drive_web\u0026ouid=113023682396793851067\u0026rtpof=true)] \u0026emsp; [[PPT slides](https://docs.google.com/presentation/d/15zGKWNd6vPuGI-dMf0ZsGrfMnPhXO-8s/edit?rtpof=true)]\u003cbr\u003e\n\u003e [Liangbin Xie*](https://liangbinxie.github.io/), [Xintao Wang*](https://xinntao.github.io/), [Xiangyu Chen*](https://chxy95.github.io/), [Gen Li](https://scholar.google.com/citations?user=jBxlX7oAAAAJ\u0026hl=en), [Ying Shan](https://scholar.google.com/citations?user=4oXBp9UAAAAJ\u0026hl=en), [Jiantao Zhou](https://www.fst.um.edu.mo/personal/jtzhou/), [Chao Dong](https://scholar.google.com.hk/citations?user=OSDCB0UAAAAJ) \u003cbr\u003e\n\u003e Tencent ARC Lab; University of Macau; Shenzhen Institutes of Advanced Technology; Shanghai AI Lab\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/DeSRA_teasor.jpg\", height=400\u003e\n\u003c/p\u003e\n\n---\n\n## 🔧 Dependencies and Installation\n\n- Python \u003e= 3.7 (Recommend to use [Anaconda](https://www.anaconda.com/download/#linux) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html))\n- [PyTorch \u003e= 1.7](https://pytorch.org/)\n- Option: NVIDIA GPU + [CUDA](https://developer.nvidia.com/cuda-downloads)\n- Option: Linux\n\n### Installation (The version of mmsegmentation utilized in this project is 0.29.0.)\n\n1. Install [mmsegmentation](\u003chttps://github.com/open-mmlab/mmsegmentation\u003e) package and install dependent packages. **Note**: The version of mmsegmentation and mmcv-full that used in the experiment are \u003cb\u003e0.29.0\u003c/b\u003e and \u003cb\u003e1.6.1\u003c/b\u003e, respectively. Setting up the environment might take some time.\n\n    ```bash\n    git clone https://github.com/open-mmlab/mmsegmentation.git\n    cd mmsegmentation\n    pip install -r requirements.txt\n    ```\n\n2. Clone repo and move the provided scripts into the demo folder (a subfolder) in mmsegmentation folder.\n\n    ```bash\n    git clone https://github.com/TencentARC/DeSRA\n    cd DeSRA\n    mv scripts/* mmsegmentation/demo (you need to modify the path)\n    ```\n\nIf you encounter problem, I also provide the environment that I used in the experiments. You can refer to the [requirements.txt](./requirements.txt)\n\n---\n\n## 📦 Testing datasets\n\nFor three representative methods: [RealESRGAN](\u003chttps://github.com/xinntao/Real-ESRGAN#-demos-videos\u003e), [LDL](\u003chttps://github.com/csjliang/LDL\u003e) and [SwinIR](\u003chttps://github.com/JingyunLiang/SwinIR\u003e), we\nchoose nearly 200 representative images with GAN-inference artifacts to construct this GAN-SR artifact\ndataset. You can download from [GoogleDrive](\u003chttps://drive.google.com/drive/folders/1jPTvXq_uJvpOaP5uCZ6unmb13Gt2naVC?usp=sharing\u003e) and [BaiduDisk](\u003chttps://pan.baidu.com/s/1rwwEpATlPo9RFzTv6D7lBw?pwd=DGLF\u003e). (For each methods, we provide the MSE-SR, GAN-SR, DeSRA-Mask, LR, and human-labeled GT-Mask)\n\n---\n\n## 🏰 Pre-trained Models\n\nWe have provided the MSE-based and GAN-based models used to detect artifacts generated by the three methods: Real-ESRGAN, LDL, and SwinIR, as well as the corresponding checkpoint and configuration files of the SegFormer we used in the experiment. You can download from [GoogleDrive](https://drive.google.com/drive/folders/10vzKAJjHm5GEb0_LESnHYmuCnBwdoFpm?usp=sharing).\n\nThe GAN-DeSRA models are also released [GoogleDrive](https://drive.google.com/drive/folders/14cLRrE4GjbgxIlVz6RoeRr0-2-NiTHrf?usp=drive_link). For each method, we have released the corresponding three checkpoints. The effect of the model fine-tuned for 1000 iterations may not be significant under some methods. In this case, you can try other checkpoints that have been fine-tuned for a longer time.\n\n---\n\n## ⚔️ Quick Inference\n\n1. Detect the artifacts between the MSE-SR results and GAN-SR results. We store many intermediate results and the final detected binary artifact map are stored in *Final_Artifact_Map* folder. The config file and checkpoint of [SegFormer](\u003chttps://github.com/open-mmlab/mmsegmentation/tree/main/configs/segformer\u003e) can be found in the mmsegmentation package.\n\n    ```bash\n    python demo/artifact_detection.py --mse_root=\"./LDL/MSE-SR\" --gan_root=\"./LDL/GAN-SR\" --save_root=\"./results/LDL/DeSRA-Mask\"\n    ```\n\n2. Evaluate the performance. As mentioned in our paper, we provide three scripts to calculate **IOU**, **Precision** and **Recall**, respectively. You can find these scripts in *metrics* folder.\n\n    ```bash\n    python metrics/calc_iou.py\n    python metrics/calc_precision.py\n    python metrics/calc_recall.py\n    ```\n\n---\n\n## 📜 License and Acknowledgement\n\nDeSRA is released under Apache License Version 2.0.\n\n## BibTeX\n\n    @article{xie2023desra,\n        title={DeSRA: Detect and Delete the Artifacts of GAN-based Real-World Super-Resolution Models},\n        author={Xie, Liangbin and Wang, Xintao and Chen, Xiangyu and Li, Gen and Shan, Ying and Zhou, Jiantao and Dong, Chao},\n        year={2023}\n    }\n\n## 📧 Contact\n\nIf you have any question, please email `lb.xie@siat.ac.cn`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencentarc%2Fdesra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftencentarc%2Fdesra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftencentarc%2Fdesra/lists"}