{"id":13487612,"url":"https://github.com/caojiezhang/deqir","last_synced_at":"2025-10-13T10:41:35.797Z","repository":{"id":208409379,"uuid":"720898970","full_name":"caojiezhang/DeqIR","owner":"caojiezhang","description":"PyTorch implementation of \"Deep Equilibrium Diffusion Restoration with Parallel Sampling (CVPR 2024)\" ","archived":false,"fork":false,"pushed_at":"2024-05-10T17:01:30.000Z","size":10615,"stargazers_count":87,"open_issues_count":6,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-27T22:36:35.494Z","etag":null,"topics":["colorization","deblurring","inpainting","old-photo-restoration","real-world-super-resolution","super-resolution"],"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/caojiezhang.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-11-19T23:12:38.000Z","updated_at":"2025-03-25T05:06:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"121addd7-5285-43f9-96c3-80760688a4c3","html_url":"https://github.com/caojiezhang/DeqIR","commit_stats":null,"previous_names":["caojiezhang/deqir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/caojiezhang/DeqIR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caojiezhang%2FDeqIR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caojiezhang%2FDeqIR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caojiezhang%2FDeqIR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caojiezhang%2FDeqIR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caojiezhang","download_url":"https://codeload.github.com/caojiezhang/DeqIR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caojiezhang%2FDeqIR/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014647,"owners_count":26085555,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["colorization","deblurring","inpainting","old-photo-restoration","real-world-super-resolution","super-resolution"],"created_at":"2024-07-31T18:01:01.182Z","updated_at":"2025-10-13T10:41:35.761Z","avatar_url":"https://github.com/caojiezhang.png","language":"Python","funding_links":[],"categories":["VAR model"],"sub_categories":[],"readme":"## Deep Equilibrium Diffusion Restoration with Parallel Sampling (CVPR 2024)\n[![arXiv](https://img.shields.io/badge/arXiv-Paper-\u003cCOLOR\u003e.svg)](https://arxiv.org/abs/2311.11600)\n[![download](https://img.shields.io/github/downloads/caojiezhang/DeqIR/total.svg)](https://github.com/caojiezhang/DeqIR/releases)\n![visitors](https://visitor-badge.laobi.icu/badge?page_id=caojiezhang/DeqIR)\n\n[Jiezhang Cao](https://www.jiezhangcao.com/), [Yue Shi](https://scholar.google.com/citations?user=BrQQHiEAAAAJ\u0026hl=en), [Kai Zhang](https://cszn.github.io/), [Yulun Zhang](http://yulunzhang.com/), [Radu Timofte](https://www.informatik.uni-wuerzburg.de/computervision/), [Luc Van Gool](https://scholar.google.com/citations?user=TwMib_QAAAAJ\u0026hl=en)\n\nComputer Vision Lab, ETH Zurich\n\n---\n\n\u003cp align=\"center\"\u003e\n    \u003cimg width=100% src=\"figs/eth.gif\"/\u003e\n\u003c/p\u003e\n\n**Abstract:** Diffusion-based image restoration (IR) methods aim to use diffusion models to recover high-quality (HQ) images from degraded images and achieve promising performance. Due to the inherent property of diffusion models, most of these methods need long serial sampling chains to restore HQ images step-by-step. As a result, it leads to expensive sampling time and high computation costs. Moreover, such long sampling chains hinder understanding the relationship between the restoration results and the inputs since it is hard to compute the gradients in the whole chains. In this work, we aim to rethink the diffusion-based IR models through a different perspective, i.e., a deep equilibrium (DEQ) fixed point system. Specifically, we derive an analytical solution by modeling the entire sampling chain in diffusion-based IR models as a joint multivariate fixed point system. With the help of the analytical solution, we are able to conduct single-image sampling in a parallel way and restore HQ images without training. Furthermore, we compute fast gradients in DEQ and found that initialization optimization can boost performance and control the generation direction. Extensive experiments on benchmarks demonstrate the effectiveness of our proposed method on typical IR tasks and real-world settings. \n![](figs/comp_sampling.png)\n\n\n## 🔗 Contents\n\n- [x] [Installation](#Installation)\n- [x] [Pre-trained Models](#Pre-trained-Models)\n- [x] [Inference](#Inference)\n- [x] [Results](#Results)\n- [x] [Citation](#Citation)\n\n\n## Installation\n\n\u003e - Python 3.8.5, PyTorch \u003e= 1.11.0\n\u003e - Requirements: see requirements.txt\n\u003e - Platforms: Ubuntu 18.04, cuda-11.3\n\n```bash\n# download code\ngit clone https://github.com/caojiezhang/DeqIR\ncd DeqIR\nconda create --name \u003cenv\u003e --file requirements.txt\nconda activate \u003cenv\u003e\n```\n\n## Pre-trained Models\n\nFor human face data, download this [model](https://drive.google.com/file/d/1wSoA5fm_d6JBZk4RZ1SzWLMgev4WqH21/view?usp=share_link) (from [SDEdit](https://github.com/ermongroup/SDEdit)) and put it into `pretrain_model/`. \n```\nhttps://drive.google.com/file/d/1wSoA5fm_d6JBZk4RZ1SzWLMgev4WqH21/view?usp=share_link\n```\nFor general images, download this [model](https://openaipublic.blob.core.windows.net/diffusion/jul-2021/256x256_diffusion_uncond.pt) (from [guided-diffusion](https://github.com/openai/guided-diffusion)) and put it into `pretrain_model/`.\n```\nwget https://openaipublic.blob.core.windows.net/diffusion/jul-2021/256x256_diffusion_uncond.pt\n```\n\n## Inference\n\n```bash\n# usage\npython main.py --config {DATASET}.yml --model Diffusion --exp {PROJECT_PATH} --out_name {OUT_NAME} --doc {DATASET} --sample --deg {DEGRADATION} --scale {SCALE} --timesteps {STEPS} --use_svd --etw {etw}\n\n# Example: Deblurring\npython main.py --config celeba_hq.yml --model Diffusion --exp experiments/ --out_name outputs_proj --doc celeba --sample --deg 'deblur_gauss' --timesteps 25 --use_svd --etw 0.1\n```\n\n## Results\n\nWe apply DeqIR in some image restoration tasks. More results can be found in the paper.\n\n\u003cdetails\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"50%\" src=\"figs/sr.gif\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"50%\" src=\"figs/deblurring.gif\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"50%\" src=\"figs/inpainting.gif\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"50%\" src=\"figs/colorization.gif\"\u003e\n\u003c/p\u003e\n\n\n\u003c/details\u003e\n\n## Citation\n\nIf you find the code helpful in your research or work, please cite the following paper(s).\n\n```\n@InProceedings{cao2024deqir,\n    title     = {Deep Equilibrium Diffusion Restoration with Parallel Sampling}, \n    author    = {Jiezhang Cao and Yue Shi and Kai Zhang and Yulun Zhang and Radu Timofte and Luc Van Gool},\n    booktitle = {CVPR},\n    year      = {2024},\n}\n```\nThis implementation is based on / inspired by:\n\n- [https://github.com/locuslab/deq-ddim](https://github.com/locuslab/deq-ddim)\n- [https://github.com/wyhuai/DDNM](https://github.com/wyhuai/DDNM)\n- [https://github.com/bahjat-kawar/ddrm](https://github.com/bahjat-kawar/ddrm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaojiezhang%2Fdeqir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaojiezhang%2Fdeqir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaojiezhang%2Fdeqir/lists"}