{"id":32986035,"url":"https://github.com/csdwren/SelfDeblur","last_synced_at":"2025-11-18T02:02:06.187Z","repository":{"id":46147134,"uuid":"200502236","full_name":"csdwren/SelfDeblur","owner":"csdwren","description":"Neural Blind Deconvolution Using Deep Priors (CVPR 2020)","archived":false,"fork":false,"pushed_at":"2020-08-17T06:51:50.000Z","size":2958,"stargazers_count":334,"open_issues_count":15,"forks_count":66,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-07-24T04:33:25.718Z","etag":null,"topics":[],"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/csdwren.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}},"created_at":"2019-08-04T14:23:21.000Z","updated_at":"2024-07-20T19:41:35.000Z","dependencies_parsed_at":"2022-09-21T18:42:08.276Z","dependency_job_id":null,"html_url":"https://github.com/csdwren/SelfDeblur","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/csdwren/SelfDeblur","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdwren%2FSelfDeblur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdwren%2FSelfDeblur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdwren%2FSelfDeblur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdwren%2FSelfDeblur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csdwren","download_url":"https://codeload.github.com/csdwren/SelfDeblur/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdwren%2FSelfDeblur/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284988465,"owners_count":27095952,"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-11-18T02:00:05.759Z","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":[],"created_at":"2025-11-13T08:00:36.460Z","updated_at":"2025-11-18T02:02:06.176Z","avatar_url":"https://github.com/csdwren.png","language":"Python","readme":"## [Neural Blind Deconvolution Using Deep Priors](https://www.researchgate.net/publication/335013294_Neural_Blind_Deconvolution_Using_Deep_Priors) \n[[pdf](https://www.researchgate.net/publication/335013294_Neural_Blind_Deconvolution_Using_Deep_Priors)] [[supp](https://csdwren.github.io/papers/SelfDeblur_supp.pdf)]\n\n\n### Introduction\nBlind deconvolution is a classical yet challenging low-level vision problem with many real-world applications.\nTraditional maximum a posterior (MAP) based methods rely heavily on fixed and handcrafted priors that certainly are insufficient in characterizing clean images and blur kernels, and usually adopt specially designed alternating minimization to avoid trivial solution.\nIn contrast, existing deep motion deblurring networks learn from massive training images the mapping to clean image or blur kernel, but are limited in handling various complex and large size blur kernels.\nMotivated by deep image prior (DIP) [1], we in this paper present two generative networks for respectively modeling the deep priors of clean image and blur kernel, and propose an unconstrained neural optimization solution to blind deconvolution (SelfDeblur).\nExperimental results show that our SelfDeblur can achieve notable quantitative gains as well as more visually plausible deblurring results in comparison to state-of-the-art blind deconvolution methods on benchmark datasets and real-world blurry images.\n\n\n## Prerequisites\n- Python 3.6, PyTorch \u003e= 0.4 \n- Requirements: opencv-python, tqdm\n- Platforms: Ubuntu 16.04, TITAN V, cuda-10.0 \u0026 cuDNN v-7.5\n- MATLAB for computing [evaluation metrics](statistic/)\n\n\n## Datasets\n\nSelfDeblur is evaluated on datasets of Levin et al. [2] and Lai et al. [3]. \nPlease download the testing datasets from [BaiduYun](https://pan.baidu.com/s/1FRqEzhkfs0ZIy0TuZm7Cnw)\nor [OneDrive](https://1drv.ms/u/s!An-BNLJWOClliGSEa6QY9TVedqJH?e=8vSWld), \nand place the unzipped folders into `./datasets/`.\n\n\n## Getting Started\n\n### 1. Run SelfDeblur\n\n\n-(1) SelfDeblur on Levin dataset. The code has been improved, and usually can achieve better retults than those reported in the paper.\n```bash\npython selfdeblur_levin.py \n```\n\n-(2) SelfDeblur on Lai dataset, where blurry images have firstly been converted to their Y channel. Several images may converge to \"black\" deblurring images, but their estimated blur kernels are good. I will check why this happened. In these cases, you need to run `selfdeblur_nonblind.py` to generate final deblurring images.\n```bash\npython selfdeblur_lai.py \npython selfdeblur_nonblind.py --data_path path_to_blurry --save_path path_to_estimated_kernel # Optional nonblind SelfDeblur. Given kernel estimated by Gk, only update Gx.\n```\n\n-(3) Handle color images in YCbCr space. 2500 iterations are adopted. If you need better texture details, more iterations will help. \n```bash\npython selfdeblur_ycbcr.py # Deblur several color images in `./datasets/real/`.\n```\n\n_*In current SelfDeblur code, TV regularization has been removed. The improved code is more robust to blur kernel estimation. But for some images with high level noises and non-uniform blurry images, the deblurring results may suffer from ringing effects due to our uniform convolution-based loss function. In this case, adding TV regularization to SelfDeblur loss function or running another nonblind deblur method may be a choice._\n\n\n-(4) Reproduce results reported in the paper. The codes for reproducing results require Pytorch 1.0.0 to load the models. Higher versions may work well, but I do not test. Pytorch 0.4 fails to load these trained models. \n\nAs for Levin dataset, one should download the SelfDeblur models from [BaiduYun](https://pan.baidu.com/s/1u0TZqmmHEzt6TX6Te75VRA) (`levin/SelfDeblur.zip`), and then run the following script to load trained models for reproducing the results reported in the paper. \nWe note that the deblurring images may be slightly different due to the random perturbations of input to Gx, while generated blur kernels keep same.  \n```bash\npython selfdeblur_levin_reproduce.py # Reproduce results in the paper. \n```\n\nAs for Lai dataset, one should download the SelfDeblur models from [BaiduYun](https://pan.baidu.com/s/1I42WVCLz2SwPjJD7nydJvg) (`lai/SelfDeblur_models.zip`), and then run the following script to load trained models for reproducing the results reported in the paper. \nWe note that the deblurring images may be slightly different due to the random perturbations of input to Gx, while generated blur kernels keep same. \n```bash\npython selfdeblur_lai_reproduce.py # Reproduce results in the paper. \n```\n\n_*Actually, the trained SelfDeblur models can be regarded as an optimization solution to a given blurry image, and cannot be generalized to other blurry images. So these trained models can only be used to reproduce the results.I suggest to re-run scripts in (1) and (2) to see the performance of SelfDeblur on Levin and Lai datasets. Since I have updated the code, the results on Levin dataset are usually better than the paper, and the results on Lai dataset are also comparable._\n\n\n\nAll the deblurring results are also available. Please read [results/levin/readme.docx](/results/levin/readme.docx) and [results/lai/readme.docx](results/lai/readme.docx) for the details. \nYou can place the downloaded results into `./results/`, and directly compute all the [evaluation metrics](statistic/) in this paper.  \n\n### 2. Evaluation metrics\n\nWe provide the MATLAB scripts to compute the average PSNR and SSIM values reported in the paper.\n \n\n```Matlab\n cd ./statistic\n run statistic_levin.m \n run statistic_lai.m \n```\n\n\nSelfDeblur succeeds in simultaneously estimating blur kernel and generating clean image with finer texture details. \n\u003cimg src=\"results/demo/levin.png\" width=\"800px\"/\u003e\n\u003cimg src=\"results/demo/lai.jpg\" width=\"800px\"/\u003e \n\n\n## References\n[1] D. Ulyanov, A. Vedaldi, and V. Lempitsky. Deep image prior. In IEEE CVPR 2018. \n\n[2] A. Levin, Y. Weiss, F. Durand, and W. T. Freeman. Understanding and evaluating blind deconvolution algorithms. In IEEE CVPR 2009. \n\n[3] W.-S. Lai, J.-B. Huang, Z. Hu, N. Ahuja, and M.-H. Yang. A comparative study for single image blind deblurring. In IEEE CVPR 2016.\n\n\n\n\n","funding_links":[],"categories":["LowLevelVision"],"sub_categories":["3D SemanticSeg"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdwren%2FSelfDeblur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsdwren%2FSelfDeblur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdwren%2FSelfDeblur/lists"}