[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-71160":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":43,"readmeContent":44,"aiSummary":45,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":46,"discoverSource":47},71160,"SwinIR","JingyunLiang\u002FSwinIR","JingyunLiang","SwinIR: Image Restoration Using Swin Transformer (official repository)","https:\u002F\u002Farxiv.org\u002Fabs\u002F2108.10257",null,"Python",5511,657,49,72,0,2,10,36,6,77.05,"Apache License 2.0",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"compression-artifact-reduction","deblocking","decompression","denoising","image-deblocking","image-denoising","image-restoration","image-sr","image-super-resolution","lightweight-image-super-resolution","low-level-vision","real-world-image-super-resolution","restoration","super-resolution","transformer","vision-transformer","2026-06-12 04:00:59","# SwinIR: Image Restoration Using Swin Transformer\n[Jingyun Liang](https:\u002F\u002Fjingyunliang.github.io), [Jiezhang Cao](https:\u002F\u002Fwww.jiezhangcao.com\u002F), [Guolei Sun](https:\u002F\u002Fvision.ee.ethz.ch\u002Fpeople-details.MjYzMjMw.TGlzdC8zMjg5LC0xOTcxNDY1MTc4.html), [Kai Zhang](https:\u002F\u002Fcszn.github.io\u002F), [Luc Van Gool](https:\u002F\u002Fscholar.google.com\u002Fcitations?user=TwMib_QAAAAJ&hl=en), [Radu Timofte](http:\u002F\u002Fpeople.ee.ethz.ch\u002F~timofter\u002F)\n\nComputer Vision Lab, ETH Zurich\n\n---\n\n[![arXiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-Paper-\u003CCOLOR>.svg)](https:\u002F\u002Farxiv.org\u002Fabs\u002F2108.10257)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FSwinIR?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR)\n[![download](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fdownloads\u002FJingyunLiang\u002FSwinIR\u002Ftotal.svg)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases)\n![visitors](https:\u002F\u002Fvisitor-badge.glitch.me\u002Fbadge?page_id=jingyunliang\u002FSwinIR)\n[ \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fa5e3e54bc9ef8d7bf594f6fee8208533\u002Fswinir-demo-on-real-world-image-sr.ipynb\">\u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"google colab logo\">\u003C\u002Fa>](https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fa5e3e54bc9ef8d7bf594f6fee8208533\u002Fswinir-demo-on-real-world-image-sr.ipynb)\n\u003Ca href=\"https:\u002F\u002Freplicate.ai\u002Fjingyunliang\u002Fswinir\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=Replicate&message=Demo and Docker Image&color=blue\">\u003C\u002Fa>\n[![PlayTorch Demo](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fplaytorch\u002Fblob\u002Fmain\u002Fwebsite\u002Fstatic\u002Fassets\u002Fplaytorch_badge.svg)](https:\u002F\u002Fplaytorch.dev\u002Fsnack\u002F@playtorch\u002Fswinir\u002F)\n[Gradio Web Demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fakhaliq\u002FSwinIR)\n\nThis repository is the official PyTorch implementation of SwinIR: Image Restoration Using Shifted Window Transformer\n([arxiv](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2108.10257.pdf), [supp](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases), [pretrained models](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases), [visual results](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases)). SwinIR achieves **state-of-the-art performance** in\n- bicubic\u002Flighweight\u002Freal-world image SR\n- grayscale\u002Fcolor image denoising\n- grayscale\u002Fcolor JPEG compression artifact reduction\n\n\u003C\u002Fbr>\n\n:rocket:  :rocket:  :rocket: **News**:\n- **Aug. 16, 2022**: Add PlayTorch Demo on running the real-world image SR model on mobile devices [![PlayTorch Demo](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fplaytorch\u002Fblob\u002Fmain\u002Fwebsite\u002Fstatic\u002Fassets\u002Fplaytorch_badge.svg)](https:\u002F\u002Fplaytorch.dev\u002Fsnack\u002F@playtorch\u002Fswinir\u002F).\n- **Aug. 01, 2022**: Add pretrained models and results on JPEG compression artifact reduction for color images. \n- **Jun. 10, 2022**: See our work on video restoration :fire::fire::fire: [VRT: A Video Restoration Transformer](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FVRT) \n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FVRT?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FVRT)\n[![download](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fdownloads\u002FJingyunLiang\u002FVRT\u002Ftotal.svg)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FVRT\u002Freleases)\nand [RVRT: Recurrent Video Restoration Transformer](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FRVRT) \n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FRVRT?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FRVRT)\n[![download](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fdownloads\u002FJingyunLiang\u002FRVRT\u002Ftotal.svg)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FRVRT\u002Freleases)\nfor video SR, video deblurring, video denoising, video frame interpolation and space-time video SR.\n- **Sep. 07, 2021**: We provide an interactive online Colab demo for real-world image SR \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fa5e3e54bc9ef8d7bf594f6fee8208533\u002Fswinir-demo-on-real-world-image-sr.ipynb\">\u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"google colab logo\">\u003C\u002Fa>:fire: for comparison with [the first practical degradation model BSRGAN (ICCV2021) ![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fcszn\u002FBSRGAN?style=social)](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN) and a recent model RealESRGAN. Try to super-resolve your own images on Colab!\n\n|Real-World Image (x4)|[BSRGAN, ICCV2021](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN)|[Real-ESRGAN](https:\u002F\u002Fgithub.com\u002Fxinntao\u002FReal-ESRGAN)|SwinIR (ours)|SwinIR-Large (ours)|\n|       :---       |     :---:        |        :-----:         |        :-----:         |        :-----:         | \n| \u003Cimg width=\"200\" src=\"figs\u002FETH_LR.png\">|\u003Cimg width=\"200\" src=\"figs\u002FETH_BSRGAN.png\">|\u003Cimg width=\"200\" src=\"figs\u002FETH_realESRGAN.jpg\">|\u003Cimg width=\"200\" src=\"figs\u002FETH_SwinIR.png\">|\u003Cimg width=\"200\" src=\"figs\u002FETH_SwinIR-L.png\">\n|\u003Cimg width=\"200\" src=\"figs\u002FOST_009_crop_LR.png\">|\u003Cimg width=\"200\" src=\"figs\u002FOST_009_crop_BSRGAN.png\">|\u003Cimg width=\"200\" src=\"figs\u002FOST_009_crop_realESRGAN.png\">|\u003Cimg width=\"200\" src=\"figs\u002FOST_009_crop_SwinIR.png\">|\u003Cimg width=\"200\" src=\"figs\u002FOST_009_crop_SwinIR-L.png\">|\n  \n - ***Aug. 26, 2021**: See our recent work on [real-world image SR: a pratical degrdation model BSRGAN, ICCV2021](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fcszn\u002FBSRGAN?style=social)](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN)*\n - ***Aug. 26, 2021**: See our recent work on [generative modelling of image SR and image rescaling: normalizing-flow-based HCFlow, ICCV2021](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FHCFlow)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FHCFlow?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FHCFlow)[ \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fcdb3fef89ebd174eaa43794accb6f59d\u002Fhcflow-demo-on-x8-face-image-sr.ipynb\">\u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"google colab logo\">\u003C\u002Fa>](https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fcdb3fef89ebd174eaa43794accb6f59d\u002Fhcflow-demo-on-x8-face-image-sr.ipynb)*\n - ***Aug. 26, 2021**: See our recent work on [blind SR: spatially variant kernel estimation (MANet, ICCV2021)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FMANet) [![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FMANet?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FMANet)\n[ \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002F4ed2524d6e08343710ee408a4d997e1c\u002Fmanet-demo-on-spatially-variant-kernel-estimation.ipynb\">\u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"google colab logo\">\u003C\u002Fa>](https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002F4ed2524d6e08343710ee408a4d997e1c\u002Fmanet-demo-on-spatially-variant-kernel-estimation.ipynb) and [unsupervised kernel estimation (FKP, CVPR2021)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FFKP)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FJingyunLiang\u002FFKP?style=social)](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FFKP)*\n\n---\n\n> Image restoration is a long-standing low-level vision problem that aims to restore high-quality images from low-quality images (e.g., downscaled, noisy and compressed images). While state-of-the-art image restoration methods are based on convolutional neural networks, few attempts have been made with Transformers which show impressive performance on high-level vision tasks. In this paper, we propose a strong baseline model SwinIR for image restoration based on the Swin Transformer. SwinIR consists of three parts: shallow feature extraction, deep feature extraction and high-quality image reconstruction. In particular, the deep feature extraction module is composed of several residual Swin Transformer blocks (RSTB), each of which has several Swin Transformer layers together with a residual connection. We conduct experiments on three representative tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. Experimental results demonstrate that SwinIR outperforms state-of-the-art methods on different tasks by up to 0.14~0.45dB, while the total number of parameters can be reduced by up to 67%.\n>\u003Cp align=\"center\">\n  \u003Cimg width=\"800\" src=\"figs\u002FSwinIR_archi.png\">\n\u003C\u002Fp>\n\n\n\n#### Contents\n\n1. [Training](#Training)\n1. [Testing](#Testing)\n1. [Results](#Results)\n1. [Citation](#Citation)\n1. [License and Acknowledgement](#License-and-Acknowledgement)\n\n\n### Training\n\n\nUsed training and testing sets can be downloaded as follows:\n\n| Task                                                |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Training Set                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Testing Set|    Visual Results |    \n|:----------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|     :---:      |   :---:      |\n| classical\u002Flightweight image SR                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                               [DIV2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FDIV2K.tar) (800 training images) or DIV2K +[Flickr2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FFlickr2K.tar) (2650 images)                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Set5 + Set14 + BSD100 + Urban100 + Manga109 [download all](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1B3DJGQKB6eNdwuQIhdskA64qUuVKLZ9u) | [here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases) |\n| real-world image SR                                 | SwinIR-M (middle size): [DIV2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FDIV2K.tar) (800 training images) +[Flickr2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FFlickr2K.tar) (2650 images) + [OST](https:\u002F\u002Fopenmmlab.oss-cn-hangzhou.aliyuncs.com\u002Fdatasets\u002FOST_dataset.zip) ([alternative link](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1iZfzAxAwOpeutz27HC56_y5RNqnsPPKr), 10324 images for sky,water,grass,mountain,building,plant,animal) \u003Cbr \u002F> SwinIR-L (large size): DIV2K + Flickr2K + OST + [WED](http:\u002F\u002Fivc.uwaterloo.ca\u002Fdatabase\u002FWaterlooExploration\u002Fexploration_database_and_code.rar)(4744 images) + [FFHQ](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1tZUcXDBeOibC6jcMCtgRRz67pzrAHeHL) (first 2000 images, face) + Manga109 (manga) + [SCUT-CTW1500](https:\u002F\u002Funiversityofadelaide.box.com\u002Fshared\u002Fstatic\u002Fpy5uwlfyyytbb2pxzq9czvu6fuqbjdh8.zip) (first 100 training images, texts) \u003Cbr \u002F>\u003Cbr \u002F>  ***We use the pionnerring practical degradation model from [BSRGAN, ICCV2021  ![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fcszn\u002FBSRGAN?style=social)](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN)** | [RealSRSet+5images](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases\u002Fdownload\u002Fv0.0\u002FRealSRSet+5images.zip) |  [here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases) |\n| color\u002Fgrayscale image denoising                     |                                                                                                                                                                                                                                                                                                             [DIV2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FDIV2K.tar) (800 training images) + [Flickr2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FFlickr2K.tar) (2650 images) + [BSD500](http:\u002F\u002Fwww.eecs.berkeley.edu\u002FResearch\u002FProjects\u002FCS\u002Fvision\u002Fgrouping\u002FBSR\u002FBSR_bsds500.tgz) (400 training&testing images) + [WED](http:\u002F\u002Fivc.uwaterloo.ca\u002Fdatabase\u002FWaterlooExploration\u002Fexploration_database_and_code.rar)(4744 images)  \u003Cbr \u002F>\u003Cbr \u002F>  *BSD68\u002FBSD100 images are not used in training.                                                                                                                                                                                                                                                                                                              |  grayscale: Set12 + BSD68 + Urban100 \u003Cbr \u002F>  color: CBSD68 + Kodak24 + McMaster + Urban100 [download all](https:\u002F\u002Fgithub.com\u002Fcszn\u002FFFDNet\u002Ftree\u002Fmaster\u002Ftestsets) |  [here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases) |\n| grayscale\u002Fcolor JPEG compression artifact reduction |                                                                                                                                                                                                                                                                                                                                            [DIV2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FDIV2K.tar) (800 training images) + [Flickr2K](https:\u002F\u002Fcv.snu.ac.kr\u002Fresearch\u002FEDSR\u002FFlickr2K.tar) (2650 images) + [BSD500](http:\u002F\u002Fwww.eecs.berkeley.edu\u002FResearch\u002FProjects\u002FCS\u002Fvision\u002Fgrouping\u002FBSR\u002FBSR_bsds500.tgz) (400 training&testing images) + [WED](http:\u002F\u002Fivc.uwaterloo.ca\u002Fdatabase\u002FWaterlooExploration\u002Fexploration_database_and_code.rar)(4744 images)                                                                                                                                                                                                                                                                                                                                             |  grayscale: Classic5 +LIVE1 [download all](https:\u002F\u002Fgithub.com\u002Fcszn\u002FDnCNN\u002Ftree\u002Fmaster\u002Ftestsets) | [here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases) |\n\n\n\u003C!--\n| Task                 | Training Set | Testing Set|        Pretrained Model and Visual Results of SwinIR     | \n| :---                 | :---:        |     :---:      |:---:      |\n| image denoising (real)      | [SIDD-Medium-sRGB](https:\u002F\u002Fwww.eecs.yorku.ca\u002F~kamel\u002Fsidd\u002Fdataset.php) (320 images, [preprocess]()) + [RENOIR](http:\u002F\u002Fani.stat.fsu.edu\u002F~abarbu\u002FRenoir.html) (221 images, [preprocess](https:\u002F\u002Fgithub.com\u002FzsyOAOA\u002FDANet\u002Fblob\u002Fmaster\u002Fdatasets\u002Fpreparedata\u002FRenoir_big2small_all.py)) + [Poly](https:\u002F\u002Fgithub.com\u002Fcsjunxu\u002FPolyU-Real-World-Noisy-Images-Dataset) (40 images in .\u002FOriginalImages) |    [SIDD validation set](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1S44fHXaVxAYW3KLNxK41NYCnyX9S79su) (1280 patches, identical to official [.mat](https:\u002F\u002Fwww.eecs.yorku.ca\u002F~kamel\u002Fsidd\u002Fbenchmark.php) version) +  [DND](https:\u002F\u002Fnoise.visinf.tu-darmstadt.de\u002Fdownloads\u002F) (pre-defined 100 patches of 50 images, [online eval](https:\u002F\u002Fnoise.visinf.tu-darmstadt.de\u002Fsubmit\u002F)) + [Nam](https:\u002F\u002Fwww.dropbox.com\u002Fs\u002F24kds7c436i5i11\u002Freal_image_noise_dataset.zip?dl=0) (random 100 patches of 17 images, [preprocess](https:\u002F\u002Fgithub.com\u002FzsyOAOA\u002FDANet\u002Fblob\u002Fmaster\u002Fdatasets\u002Fpreparedata\u002FNam_patch_prepare.py))|[download model]() [download results]() |\n| image deblurring (synthetic)   | [GoPro](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1AsgIP9_X0bg0olu2-1N6karm2x15cJWE) (2103 training images)  |  [GoPro](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1a2qKfXWpNuTGOm2-Jex8kfNSzYJLbqkf) (1111 images) + [HIDE](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1nRsTXj4iTUkTvBhTcGg8cySK8nd3vlhK) (2050 images) + [RealBlur_J](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1KYtzeKCiDRX9DSvC-upHrCqvC4sPAiJ1) (real blur, 980 images) + [RealBlur_R](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1EwDoajf5nStPIAcU4s9rdc8SPzfm3tW1) (real blur, 980 images) | [download model]() [download results]()|\n| image deraining (synthetic)  | [Multiple datasets](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1Hnnlc5kI0v9_BtfMytC2LR5VpLAFZtVe) (13711 training images, see Table 1 of [MPRNet](https:\u002F\u002Fgithub.com\u002Fswz30\u002FMPRNet) for details.)  |  Rain100H (100 images) + Rain100L (100 images) + Test100 (100 images) + Test2800 (2800 images) + Test1200 (1200 images), [download all](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F1PDWggNh8ylevFmrjo-JEvlmqsDlWWvZs)  | [download model]() [download results]()|\n\nNote: above datasets may come from the official release or some awesome collections ([BasicSR](https:\u002F\u002Fgithub.com\u002Fxinntao\u002FBasicSR), [MPRNet](https:\u002F\u002Fgithub.com\u002Fswz30\u002FMPRNet)).\n\n-->\n\nThe training code is at [KAIR](https:\u002F\u002Fgithub.com\u002Fcszn\u002FKAIR\u002Fblob\u002Fmaster\u002Fdocs\u002FREADME_SwinIR.md).\n\n## Testing (without preparing datasets)\nFor your convience, we provide some example datasets (~20Mb) in `\u002Ftestsets`. \nIf you just want codes, downloading `models\u002Fnetwork_swinir.py`, `utils\u002Futil_calculate_psnr_ssim.py` and `main_test_swinir.py` is enough.\nFollowing commands will download [pretrained models](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases) **automatically** and put them in `model_zoo\u002Fswinir`. \n**[All visual results of SwinIR can be downloaded here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases)**. \n\nWe also provide an [online Colab demo for real-world image SR  \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fa5e3e54bc9ef8d7bf594f6fee8208533\u002Fswinir-demo-on-real-world-image-sr.ipynb\">\u003Cimg src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\" alt=\"google colab logo\">\u003C\u002Fa>](https:\u002F\u002Fcolab.research.google.com\u002Fgist\u002FJingyunLiang\u002Fa5e3e54bc9ef8d7bf594f6fee8208533\u002Fswinir-demo-on-real-world-image-sr.ipynb) for comparison with [the first practical degradation model BSRGAN (ICCV2021)  ![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fcszn\u002FBSRGAN?style=social)](https:\u002F\u002Fgithub.com\u002Fcszn\u002FBSRGAN) and a recent model [RealESRGAN](https:\u002F\u002Fgithub.com\u002Fxinntao\u002FReal-ESRGAN). Try to test your own images on Colab!\n\nWe provide a PlayTorch demo [![PlayTorch Demo](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fplaytorch\u002Fblob\u002Fmain\u002Fwebsite\u002Fstatic\u002Fassets\u002Fplaytorch_badge.svg)](https:\u002F\u002Fplaytorch.dev\u002Fsnack\u002F@playtorch\u002Fswinir\u002F) for real-world image SR to showcase how to run the SwinIR model in mobile application built with React Native.\n\n```bash\n# 001 Classical Image Super-Resolution (middle size)\n# Note that --training_patch_size is just used to differentiate two different settings in Table 2 of the paper. Images are NOT tested patch by patch.\n# (setting1: when model is trained on DIV2K and with training_patch_size=48)\npython main_test_swinir.py --task classical_sr --scale 2 --training_patch_size 48 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DIV2K_s48w8_SwinIR-M_x2.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX2 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 3 --training_patch_size 48 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DIV2K_s48w8_SwinIR-M_x3.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX3 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 4 --training_patch_size 48 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DIV2K_s48w8_SwinIR-M_x4.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX4 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 8 --training_patch_size 48 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DIV2K_s48w8_SwinIR-M_x8.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX8 --folder_gt testsets\u002FSet5\u002FHR\n\n# (setting2: when model is trained on DIV2K+Flickr2K and with training_patch_size=64)\npython main_test_swinir.py --task classical_sr --scale 2 --training_patch_size 64 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DF2K_s64w8_SwinIR-M_x2.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX2 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 3 --training_patch_size 64 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DF2K_s64w8_SwinIR-M_x3.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX3 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 4 --training_patch_size 64 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DF2K_s64w8_SwinIR-M_x4.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX4 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task classical_sr --scale 8 --training_patch_size 64 --model_path model_zoo\u002Fswinir\u002F001_classicalSR_DF2K_s64w8_SwinIR-M_x8.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX8 --folder_gt testsets\u002FSet5\u002FHR\n\n\n# 002 Lightweight Image Super-Resolution (small size)\npython main_test_swinir.py --task lightweight_sr --scale 2 --model_path model_zoo\u002Fswinir\u002F002_lightweightSR_DIV2K_s64w8_SwinIR-S_x2.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX2 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task lightweight_sr --scale 3 --model_path model_zoo\u002Fswinir\u002F002_lightweightSR_DIV2K_s64w8_SwinIR-S_x3.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX3 --folder_gt testsets\u002FSet5\u002FHR\npython main_test_swinir.py --task lightweight_sr --scale 4 --model_path model_zoo\u002Fswinir\u002F002_lightweightSR_DIV2K_s64w8_SwinIR-S_x4.pth --folder_lq testsets\u002FSet5\u002FLR_bicubic\u002FX4 --folder_gt testsets\u002FSet5\u002FHR\n\n\n# 003 Real-World Image Super-Resolution (use --tile 400 if you run out-of-memory)\n# (middle size)\npython main_test_swinir.py --task real_sr --scale 4 --model_path model_zoo\u002Fswinir\u002F003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth --folder_lq testsets\u002FRealSRSet+5images --tile\n\n# (larger size + trained on more datasets)\npython main_test_swinir.py --task real_sr --scale 4 --large_model --model_path model_zoo\u002Fswinir\u002F003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq testsets\u002FRealSRSet+5images\n\n\n# 004 Grayscale Image Deoising (middle size)\npython main_test_swinir.py --task gray_dn --noise 15 --model_path model_zoo\u002Fswinir\u002F004_grayDN_DFWB_s128w8_SwinIR-M_noise15.pth --folder_gt testsets\u002FSet12\npython main_test_swinir.py --task gray_dn --noise 25 --model_path model_zoo\u002Fswinir\u002F004_grayDN_DFWB_s128w8_SwinIR-M_noise25.pth --folder_gt testsets\u002FSet12\npython main_test_swinir.py --task gray_dn --noise 50 --model_path model_zoo\u002Fswinir\u002F004_grayDN_DFWB_s128w8_SwinIR-M_noise50.pth --folder_gt testsets\u002FSet12\n\n\n# 005 Color Image Deoising (middle size)\npython main_test_swinir.py --task color_dn --noise 15 --model_path model_zoo\u002Fswinir\u002F005_colorDN_DFWB_s128w8_SwinIR-M_noise15.pth --folder_gt testsets\u002FMcMaster\npython main_test_swinir.py --task color_dn --noise 25 --model_path model_zoo\u002Fswinir\u002F005_colorDN_DFWB_s128w8_SwinIR-M_noise25.pth --folder_gt testsets\u002FMcMaster\npython main_test_swinir.py --task color_dn --noise 50 --model_path model_zoo\u002Fswinir\u002F005_colorDN_DFWB_s128w8_SwinIR-M_noise50.pth --folder_gt testsets\u002FMcMaster\n\n\n# 006 JPEG Compression Artifact Reduction (middle size, using window_size=7 because JPEG encoding uses 8x8 blocks)\n# grayscale\npython main_test_swinir.py --task jpeg_car --jpeg 10 --model_path model_zoo\u002Fswinir\u002F006_CAR_DFWB_s126w7_SwinIR-M_jpeg10.pth --folder_gt testsets\u002Fclassic5\npython main_test_swinir.py --task jpeg_car --jpeg 20 --model_path model_zoo\u002Fswinir\u002F006_CAR_DFWB_s126w7_SwinIR-M_jpeg20.pth --folder_gt testsets\u002Fclassic5\npython main_test_swinir.py --task jpeg_car --jpeg 30 --model_path model_zoo\u002Fswinir\u002F006_CAR_DFWB_s126w7_SwinIR-M_jpeg30.pth --folder_gt testsets\u002Fclassic5\npython main_test_swinir.py --task jpeg_car --jpeg 40 --model_path model_zoo\u002Fswinir\u002F006_CAR_DFWB_s126w7_SwinIR-M_jpeg40.pth --folder_gt testsets\u002Fclassic5\n\n# color\npython main_test_swinir.py --task color_jpeg_car --jpeg 10 --model_path model_zoo\u002Fswinir\u002F006_colorCAR_DFWB_s126w7_SwinIR-M_jpeg10.pth --folder_gt testsets\u002FLIVE1\npython main_test_swinir.py --task color_jpeg_car --jpeg 20 --model_path model_zoo\u002Fswinir\u002F006_colorCAR_DFWB_s126w7_SwinIR-M_jpeg20.pth --folder_gt testsets\u002FLIVE1\npython main_test_swinir.py --task color_jpeg_car --jpeg 30 --model_path model_zoo\u002Fswinir\u002F006_colorCAR_DFWB_s126w7_SwinIR-M_jpeg30.pth --folder_gt testsets\u002FLIVE1\npython main_test_swinir.py --task color_jpeg_car --jpeg 40 --model_path model_zoo\u002Fswinir\u002F006_colorCAR_DFWB_s126w7_SwinIR-M_jpeg40.pth --folder_gt testsets\u002FLIVE1\n\n```\n\n---\n\n## Results\nWe achieved state-of-the-art performance on classical\u002Flightweight\u002Freal-world image SR, grayscale\u002Fcolor image denoising and JPEG compression artifact reduction. Detailed results can be found in the [paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F2108.10257). All visual results of SwinIR can be downloaded [here](https:\u002F\u002Fgithub.com\u002FJingyunLiang\u002FSwinIR\u002Freleases). \n\n\u003Cdetails>\n\u003Csummary>Classical Image Super-Resolution (click me)\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Fclassic_image_sr.png\">\n  \u003Cimg width=\"900\" src=\"figs\u002Fclassic_image_sr_visual.png\">\n\u003C\u002Fp>\n  \n- More detailed comparison between SwinIR and a representative CNN-based model RCAN (classical image SR, X4)\n\n| Method             | Training Set    |  Training time  \u003Cbr \u002F> (8GeForceRTX2080Ti \u003Cbr \u002F> batch=32, iter=500k) |Y-PSNR\u002FY-SSIM \u003Cbr \u002F> on Manga109 | Run time  \u003Cbr \u002F> (1GeForceRTX2080Ti,\u003Cbr \u002F> on 256x256 LR image)* |  #Params   | #FLOPs |  Testing memory |\n| :---      | :---:        |        :-----:         |     :---:      |     :---:      |     :---:      |   :---:      |  :---:      |\n| RCAN | DIV2K | 1.6 days | 31.22\u002F0.9173 | 0.180s | 15.6M | 850.6G | 593.1M | \n| SwinIR | DIV2K | 1.8 days |31.67\u002F0.9226 | 0.539s | 11.9M | 788.6G | 986.8M | \n\n\\* We re-test the runtime when the GPU is idle. We refer to the evluation code [here](https:\u002F\u002Fgithub.com\u002Fcszn\u002FKAIR\u002Fblob\u002Fmaster\u002Fmain_challenge_sr.py).\n\n  \n- Results on DIV2K-validation (100 images)\n  \n|  Training Set | scale factor | PSNR (RGB) | PSNR (Y) | SSIM (RGB)  | SSIM (Y) |\n| :--- | :---: | :---:        |     :---:      | :---: | :---:        |\n|  DIV2K (800 images) | 2 | 35.25 | 36.77 | 0.9423 | 0.9500 |\n|  DIV2K+Flickr2K (2650 images) | 2 | 35.34 | 36.86 | 0.9430 |0.9507 |\n|  DIV2K (800 images) | 3 | 31.50 | 32.97 | 0.8832 |0.8965 |\n|  DIV2K+Flickr2K (2650 images) | 3 | 31.63 | 33.10 | 0.8854 |0.8985 |\n|  DIV2K (800 images) | 4 | 29.48 | 30.94 | 0.8311|0.8492 |\n|  DIV2K+Flickr2K (2650 images) | 4 | 29.63 | 31.08 | 0.8347|0.8523 |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Lightweight Image Super-Resolution\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Flightweight_image_sr.png\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Real-World Image Super-Resolution\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Freal_world_image_sr.png\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Grayscale Image Deoising\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Fgray_image_denoising.png\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Color Image Deoising\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Fcolor_image_denoising.png\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>JPEG Compression Artifact Reduction\u003C\u002Fsummary>\n\non grayscale images\n\u003Cp align=\"center\">\n  \u003Cimg width=\"900\" src=\"figs\u002Fjepg_compress_artfact_reduction.png\">\n\u003C\u002Fp>\n\non color images\n\n| Training Set | quality factor | PSNR (RGB) | PSNR-B (RGB) | SSIM (RGB) |\n|:-------------|:--------------:|:----------:|:------------:|:----------:|\n| LIVE1        |       10       |   28.06    |    27.76     |   0.8089   |\n| LIVE1        |       20       |   30.45    |    29.97     |   0.8741   |\n| LIVE1        |       30       |   31.82    |    31.24     |   0.9018   |\n| LIVE1        |       40       |   32.75    |    32.12     |   0.9174   |\n\u003C\u002Fdetails>\n\n\n\n## Citation\n    @article{liang2021swinir,\n      title={SwinIR: Image Restoration Using Swin Transformer},\n      author={Liang, Jingyun and Cao, Jiezhang and Sun, Guolei and Zhang, Kai and Van Gool, Luc and Timofte, Radu},\n      journal={arXiv preprint arXiv:2108.10257},\n      year={2021}\n    }\n\n\n## License and Acknowledgement\nThis project is released under the Apache 2.0 license. The codes are based on [Swin Transformer](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FSwin-Transformer) and [KAIR](https:\u002F\u002Fgithub.com\u002Fcszn\u002FKAIR). Please also follow their licenses. Thanks for their awesome works.\n","SwinIR 是一个基于 Swin Transformer 的图像恢复项目，旨在实现高质量的图像超分辨率、去噪和压缩伪影减少。该项目使用了先进的变换器架构来处理低层次视觉任务，能够在多种图像恢复场景下达到领先水平的表现，包括双三次插值、轻量级及真实世界图像超分辨率、灰度\u002F彩色图像去噪以及JPEG压缩伪影去除等。SwinIR 适合需要提升图像质量的应用环境，如数字内容创作、医疗影像分析等领域。通过提供预训练模型和直观的演示案例，使得开发者能够快速上手并应用于实际项目中。","2026-06-11 03:36:22","high_star"]