{"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/denoising-diffusion-models-for-plug-and-play","title":"Denoising Diffusion Models for Plug-and-Play Image Restoration","arxiv_id":"2305.08995","date":"2023-05-15","proceeding":null,"authors":["Yuanzhi Zhu","Kai Zhang","Jingyun Liang","JieZhang Cao","Bihan Wen","Radu Timofte","Luc van Gool"],"abstract":"Plug-and-play Image Restoration (IR) has been widely recognized as a flexible and interpretable method for solving various inverse problems by utilizing any off-the-shelf denoiser as the implicit image prior. However, most existing methods focus on discriminative Gaussian denoisers. Although diffusion models have shown impressive performance for high-quality image synthesis, their potential to serve as a generative denoiser prior to the plug-and-play IR methods remains to be further explored. While several other attempts have been made to adopt diffusion models for image restoration, they either fail to achieve satisfactory results or typically require an unacceptable number of Neural Function Evaluations (NFEs) during inference. This paper proposes DiffPIR, which integrates the traditional plug-and-play method into the diffusion sampling framework. Compared to plug-and-play IR methods that rely on discriminative Gaussian denoisers, DiffPIR is expected to inherit the generative ability of diffusion models. Experimental results on three representative IR tasks, including super-resolution, image deblurring, and inpainting, demonstrate that DiffPIR achieves state-of-the-art performance on both the FFHQ and ImageNet datasets in terms of reconstruction faithfulness and perceptual quality with no more than 100 NFEs. The source code is available at {\\url{https://github.com/yuanzhi-zhu/DiffPIR}}","url_abs":"https://arxiv.org/abs/2305.08995v1","url_pdf":"https://arxiv.org/pdf/2305.08995v1.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":"denoising-diffusion-models-for-plug-and-play","repo_url":"https://github.com/yuanzhi-zhu/diffpir","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"denoising-diffusion-models-for-plug-and-play","repo_url":"https://github.com/francois-rozet/mmps-benchmark","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"denoising-diffusion-models-for-plug-and-play","repo_url":"https://github.com/xypeng9903/k-diffusion-inverse-problems","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"deblurring","task_name":"Deblurring"},{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-deblurring","task_name":"Image Deblurring"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-restoration","task_name":"Image Restoration"},{"task_slug":"super-resolution","task_name":"Super-Resolution"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"fail","method_name":"fail"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.08995","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.08995"}},"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/yuanzhi-zhu/diffpir","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/francois-rozet/mmps-benchmark","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xypeng9903/k-diffusion-inverse-problems","reach":null}],"summary":{"ran_draft_wrong":4,"ran_honours":3,"ran":6,"unverified":3},"by_repo_kind":{"official":{"samples":15,"ran":12,"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":1,"samples":[{"code_sha256_prefix":"8ab9a97df8161f31","entry":"center_crop_arr","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/image_datasets.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/image_datasets.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8ab9a97df8161f31"}},{"code_sha256_prefix":"cfd76fd0d89574a4","entry":"approx_standard_normal_cdf","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/losses.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/losses.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cfd76fd0d89574a4"}},{"code_sha256_prefix":"2ab2316ac6fdd869","entry":"betas_for_alpha_bar","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/gaussian_diffusion.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/gaussian_diffusion.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2ab2316ac6fdd869"}},{"code_sha256_prefix":"cd33283d615fb3d7","entry":"discretized_gaussian_log_likelihood","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/losses.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/losses.py","link_basis":"harvester_set","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":"cd33283d615fb3d7"}},{"code_sha256_prefix":"a086d6286a40b889","entry":"get_named_beta_schedule","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/gaussian_diffusion.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/gaussian_diffusion.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a086d6286a40b889"}},{"code_sha256_prefix":"e41367ad14ff58fd","entry":"get_param_groups_and_shapes","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/fp16_util.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/fp16_util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e41367ad14ff58fd"}},{"code_sha256_prefix":"e20dd5102da3b050","entry":"make_master_params","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/fp16_util.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/fp16_util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e20dd5102da3b050"}},{"code_sha256_prefix":"bcd8b4acab199405","entry":"make_output_format","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/logger.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/logger.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bcd8b4acab199405"}},{"code_sha256_prefix":"cf2798b666b231ca","entry":"normal_kl","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/losses.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/losses.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cf2798b666b231ca"}},{"code_sha256_prefix":"d6f540f02c297eed","entry":"orthogonal_","repo":"xypeng9903/k-diffusion-inverse-problems","repo_kind":"listed","path":"k_diffusion/models/image_v1.py","file_url":"https://github.com/xypeng9903/k-diffusion-inverse-problems/blob/HEAD/k_diffusion/models/image_v1.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d6f540f02c297eed"}},{"code_sha256_prefix":"8b2b14a90a19fbe2","entry":"test","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"utils/utils_model.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/utils/utils_model.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8b2b14a90a19fbe2"}},{"code_sha256_prefix":"666e66f755ba5374","entry":"test_pad","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"utils/utils_model.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/utils/utils_model.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"666e66f755ba5374"}},{"code_sha256_prefix":"64fff1e30802b815","entry":"unflatten_master_params","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/fp16_util.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/fp16_util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"64fff1e30802b815"}},{"code_sha256_prefix":"e515a67f7f32e76d","entry":"mpi_weighted_mean","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/logger.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/logger.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e515a67f7f32e76d"}},{"code_sha256_prefix":"0c6607473a4c4c55","entry":"profile","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/logger.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/logger.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0c6607473a4c4c55"}},{"code_sha256_prefix":"53d5be4fdbcfac23","entry":"random_crop_arr","repo":"yuanzhi-zhu/diffpir","repo_kind":"official","path":"guided_diffusion/image_datasets.py","file_url":"https://github.com/yuanzhi-zhu/diffpir/blob/HEAD/guided_diffusion/image_datasets.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"53d5be4fdbcfac23"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}