{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/uformer-a-general-u-shaped-transformer-for","title":"Uformer: A General U-Shaped Transformer for Image Restoration","arxiv_id":"2106.03106","date":"2021-06-06","proceeding":"CVPR 2022 1","authors":["Zhendong Wang","Xiaodong Cun","Jianmin Bao","Wengang Zhou","Jianzhuang Liu","Houqiang Li"],"abstract":"In this paper, we present Uformer, an effective and efficient Transformer-based architecture for image restoration, in which we build a hierarchical encoder-decoder network using the Transformer block. In Uformer, there are two core designs. First, we introduce a novel locally-enhanced window (LeWin) Transformer block, which performs nonoverlapping window-based self-attention instead of global self-attention. It significantly reduces the computational complexity on high resolution feature map while capturing local context. Second, we propose a learnable multi-scale restoration modulator in the form of a multi-scale spatial bias to adjust features in multiple layers of the Uformer decoder. Our modulator demonstrates superior capability for restoring details for various image restoration tasks while introducing marginal extra parameters and computational cost. Powered by these two designs, Uformer enjoys a high capability for capturing both local and global dependencies for image restoration. To evaluate our approach, extensive experiments are conducted on several image restoration tasks, including image denoising, motion deblurring, defocus deblurring and deraining. Without bells and whistles, our Uformer achieves superior or comparable performance compared with the state-of-the-art algorithms. The code and models are available at https://github.com/ZhendongWang6/Uformer.","url_abs":"https://arxiv.org/abs/2106.03106v2","url_pdf":"https://arxiv.org/pdf/2106.03106v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"uformer-a-general-u-shaped-transformer-for","repo_url":"https://github.com/ZhendongWang6/Uformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"uformer-a-general-u-shaped-transformer-for","repo_url":"https://github.com/jorgmateos/uformer-google-colab","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"uformer-a-general-u-shaped-transformer-for","repo_url":"https://github.com/lucidrains/ddpm-proteins","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"uformer-a-general-u-shaped-transformer-for","repo_url":"https://github.com/lucidrains/uformer-pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"deblurring","task_name":"Deblurring"},{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-deblurring","task_name":"Image Deblurring"},{"task_slug":"image-defocus-deblurring","task_name":"Image Defocus Deblurring"},{"task_slug":"image-denoising","task_name":"Image Denoising"},{"task_slug":"image-enhancement","task_name":"Image Enhancement"},{"task_slug":"image-restoration","task_name":"Image Restoration"},{"task_slug":"rain-removal","task_name":"Rain Removal"},{"task_slug":"single-image-desnowing","task_name":"Single Image Desnowing"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/deblurring-on-gopro","task":"Deblurring","dataset":"GoPro","model":"Uformer-B","rank_in_archive_order":28,"of":56,"metrics":{"PSNR":"32.97","SSIM":"0.967"},"uses_additional_data":false},{"leaderboard":"/sota/deblurring-on-hide-trained-on-gopro","task":"Deblurring","dataset":"HIDE (trained on GOPRO)","model":"Uformer-B","rank_in_archive_order":18,"of":26,"metrics":{"PSNR (sRGB)":"30.83","Params (M)":"50.88","SSIM (sRGB)":"0.952"},"uses_additional_data":false},{"leaderboard":"/sota/deblurring-on-rsblur","task":"Deblurring","dataset":"RSBlur","model":"Uformer-B","rank_in_archive_order":7,"of":12,"metrics":{"Average PSNR":"33.98"},"uses_additional_data":false},{"leaderboard":"/sota/deblurring-on-realblur-j-trained-on-gopro","task":"Deblurring","dataset":"RealBlur-J (trained on GoPro)","model":"Uformer-B","rank_in_archive_order":4,"of":15,"metrics":{"PSNR (sRGB)":"29.06","SSIM (sRGB)":"0.884"},"uses_additional_data":false},{"leaderboard":"/sota/deblurring-on-realblur-r-trained-on-gopro","task":"Deblurring","dataset":"RealBlur-R (trained on GoPro)","model":"Uformer-B","rank_in_archive_order":3,"of":19,"metrics":{"PSNR (sRGB)":"36.22","SSIM (sRGB)":"0.957"},"uses_additional_data":false},{"leaderboard":"/sota/image-deblurring-on-gopro","task":"Image Deblurring","dataset":"GoPro","model":"Uformer-B","rank_in_archive_order":30,"of":55,"metrics":{"PSNR":"32.97","Params (M)":"50.88","SSIM":"0.967"},"uses_additional_data":false},{"leaderboard":"/sota/image-dehazing-on-sots-indoor","task":"Image Dehazing","dataset":"SOTS Indoor","model":"Uformer","rank_in_archive_order":26,"of":34,"metrics":{"PSNR":"31.91","SSIM":"0.971"},"uses_additional_data":false},{"leaderboard":"/sota/image-dehazing-on-sots-outdoor","task":"Image Dehazing","dataset":"SOTS Outdoor","model":"Uformer","rank_in_archive_order":25,"of":31,"metrics":{"PSNR":"26.52","SSIM":"0.945"},"uses_additional_data":false},{"leaderboard":"/sota/image-denoising-on-dnd","task":"Image Denoising","dataset":"DND","model":"Uformer-B","rank_in_archive_order":5,"of":16,"metrics":{"PSNR (sRGB)":"39.98","SSIM (sRGB)":"0.955"},"uses_additional_data":false},{"leaderboard":"/sota/image-denoising-on-sidd","task":"Image Denoising","dataset":"SIDD","model":"Uformer-B","rank_in_archive_order":9,"of":22,"metrics":{"PSNR (sRGB)":"39.89","SSIM (sRGB)":"0.960"},"uses_additional_data":false},{"leaderboard":"/sota/image-enhancement-on-tip-2018","task":"Image Enhancement","dataset":"TIP 2018","model":"Uformer-B","rank_in_archive_order":4,"of":6,"metrics":{"PSNR":"29.28","SSIM":"0.917"},"uses_additional_data":false},{"leaderboard":"/sota/single-image-desnowing-on-csd","task":"Single Image Desnowing","dataset":"CSD","model":"UFormer","rank_in_archive_order":5,"of":6,"metrics":{"Average PSNR (dB)":"33.80"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2106.03106","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.03106"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/ddpm-proteins","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ZhendongWang6/Uformer","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jorgmateos/uformer-google-colab","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lucidrains/uformer-pytorch","reach":null}],"summary":{"ran_violates":3,"ran_draft_wrong":2,"ran_fixture":1},"by_repo_kind":{"official":{"samples":3,"ran":3,"repositories":1},"listed":{"samples":1,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":2,"samples":[{"code_sha256_prefix":"d9a9e2f685256932","entry":"cast_tuple","repo":"lucidrains/uformer-pytorch","repo_kind":"listed","path":"uformer_pytorch/uformer_pytorch.py","file_url":"https://github.com/lucidrains/uformer-pytorch/blob/HEAD/uformer_pytorch/uformer_pytorch.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9a9e2f685256932"}},{"code_sha256_prefix":"ad4c565716dab068","entry":"conv","repo":"ZhendongWang6/Uformer","repo_kind":"official","path":"model.py","file_url":"https://github.com/ZhendongWang6/Uformer/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ad4c565716dab068"}},{"code_sha256_prefix":"60fff7c3c400d7ff","entry":"default","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"60fff7c3c400d7ff"}},{"code_sha256_prefix":"aa5486a3650902d8","entry":"exists","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"aa5486a3650902d8"}},{"code_sha256_prefix":"c4b5a8b25f271a68","entry":"window_partition","repo":"ZhendongWang6/Uformer","repo_kind":"official","path":"model.py","file_url":"https://github.com/ZhendongWang6/Uformer/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c4b5a8b25f271a68"}},{"code_sha256_prefix":"e2cf4a766e987768","entry":"window_reverse","repo":"ZhendongWang6/Uformer","repo_kind":"official","path":"model.py","file_url":"https://github.com/ZhendongWang6/Uformer/blob/HEAD/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e2cf4a766e987768"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}