Skip to content

Official implementation of the paper "DeblurDiNAT: A Lightweight and Effective Transformer for Image Deblurring".

License

Notifications You must be signed in to change notification settings

HanzhouLiu/DeblurDiNAT

Repository files navigation

DeblurDiNAT: A Lightweight and Effective Transformer for Image Deblurring


Hanzhou Liu, Binghan Li, Chengkai Liu, Mi Lu

PWC PWC PWC PWC

This is the Official Pytorch Implementation of DeblurDiNAT.

Update:

  • 2024.03.19 Release the initial version of codes for our DeblurDiNAT.
  • 2024.06.21 Improve the PSNR/SSIM scores and release the second version of codes for our DeblurDiNAT.
  • 2024.06.25 The updated preprint paper is available.

Visual Results

Blurry DeblurDiNAT-L FFTformer Uformer-B Stripformer Restormer

Quantitative Results

Installation

The implementation is modified from "DeblurGANv2".

git clone https://github.com/HanzhouLiu/DeblurDiNAT.git
cd DeblurDiNAT
conda create -n DeblurDiNAT python=3.8
source activate DeblurDiNAT
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
pip install opencv-python tqdm pyyaml joblib glog scikit-image tensorboardX albumentations
pip install -U albumentations[imgaug]
pip install albumentations==1.1.0

The NATTEN package is required. Please follow the NATTEN installation instructions "NATTEN Homepage". Make sure Python, PyTorch, and CUDA versions are compatible with NATTEN.

Training

Download "GoPro" dataset into './datasets'
For example: './datasets/GoPro'

We train our DeblurDiNAT in two stages:

  • We pre-train DeblurDiNAT for 4000 epochs with patch size 256x256
  • Run the following command
python train_DeblurDiNAT_pretrained.py
  • After 4000 epochs, we keep training DeblurDiNAT for 2000 epochs with patch size 512x512
  • Run the following command
python train_DeblurDiNAT_gopro.py

Testing

For reproducing our results on GoPro and HIDE datasets, download "DeblurDiNATL.pth"

For testing on GoPro dataset

  • Download "GoPro" full dataset or test set into './datasets' (For example: './datasets/GoPro/test')
  • Run the following command
python predict_GoPro_test_results.py --job_name DeblurDiNATL --weight_name DeblurDiNATL.pth --blur_path ./datasets/GOPRO/test/blur

For testing on HIDE dataset

  • Download "HIDE" into './datasets'
  • Run the following command
python predict_HIDE_results.py --job_name DeblurDiNATL --weight_name DeblurDiNATL.pth --blur_path ./datasets/HIDE/test/blur

For testing on RealBlur test sets

python predict_RealBlur_J_test_results.py --job_name DeblurDiNATL --weight_name DeblurDiNATL.pth --blur_path ./datasets/RealBlur_J/test/blur
python predict_RealBlur_R_test_results.py --job_name DeblurDiNATL --weight_name DeblurDiNATL.pth --blur_path ./datasets/RealBlur_R/test/blur

Citation

@misc{liu2024deblurdinat,
      title={DeblurDiNAT: A Lightweight and Effective Transformer for Image Deblurring}, 
      author={Hanzhou Liu and Binghan Li and Chengkai Liu and Mi Lu},
      year={2024},
      eprint={2403.13163},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

About

Official implementation of the paper "DeblurDiNAT: A Lightweight and Effective Transformer for Image Deblurring".

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published