The implementation of "Learning Single Image Defocus Deblurring with Misaligned Training Pairs".
- The code has been tested with the following environment
- Ubuntu 18.04
- Python 3.7.9
- PyTorch 1.7.0
- cudatoolkit 10.0.130
- NVIDIA TITAN RTX GPU
- Training dataset: SDD train set
- Testing dataset: SDD test set
- Training dataset: DPDD train set
- Testing datasets: DPDD test set and RealDOF test set.
Download pwc-weight and put it under './pwc' folder.
- Download mprnet-jdrl-sdd, mprnet-jdrl-dpdd and unet-jdrl-sdd, then move them to
./checkpoint
.
$ cd JDRL
- Test on SDD:
MPRNet*: MPRNet with JDRL trained on SDD:
$ python test.py --test_path './SDD/test/' --checkpoint_path './checkpoint/mprnet-jdrl-sdd.pth' --model 'MPRNet'
UNet*: UNet with JDRL trained on SDD:
$ python test.py --test_path './SDD/test/' --checkpoint_path './checkpoint/unet-jdrl-sdd.pth' --model 'UNet'
- Test on DPDD:
MPRNet*: MPRNet with JDRL trained on DPDD:
$ python test.py --test_path './DPDD/test/' --checkpoint_path './checkpoint/mprnet-jdrl-dpdd.pth' --model 'MPRNet'
- Others:
ifan-jdrl-dpdd: IFAN with JDRL trained on DPDD dataset. To test this model, please refer to IFAN.
- SDD: 512*512 image patches have been provided in './SDD/train_patches'.
- DPDD: crop the images of DPDD training set into 512*512 patches using the same settings as DPDNet.
After getting the training patches, please organize the training dataset according to our code implementation.
$ cd JDRL
$ python train.py
To apply JDRL to other models trained on DPDD dataset: (i) initialize the reblurring module: keep the pretrained deblurring model weights fixed, and train the reblurring module for several epochs. (ii) decay the learning rate by 0.1~0.01, and jointly train the reblurring module and deblurring module (your model).