Code for reproducing the result of paper [Blind Image Deconvolution by Generative-based Kernel Prior and Initializer via Latent Encoding]
- PyTorch >= 1.10.0
- Requirements: opencv-python, tqdm
Download the pretrained models of kernel Generator(netG) and Initializer(netE) from Google Drive to the models
folder.
Put the test images in the ./datasets/Lai/uniform
folder. Reproduce results reported in the paper.
python deblur_lai.py
The generated N blur kernels are combined into a three-dimensional array of shape (N, kernel_size, kernel_size), and stored as an npz file in the ./datasets/kernel
folder.
To train the kernel initializer, a clean image dataset is used for convolving with the blur kernels to produce blurred images. We used the OpenImage dataset and place the folder open_val
into ./datasets
. Other clean image datasets could also be considered.
python train_generator.py --kernel_size [size of kernel] --kernel_path [path to kernel] --save_path [path to save model]
python train_initializer.py --kernel_size [size of kernel] --kernel_path [path to kernel] --save_path [path to save model]
If our work is useful for your research, please cite our paper: