HanzhouLiu / DeblurDiNAT

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

Home Page:https://arxiv.org/abs/2403.13163

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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 3000 epochs with patch size 256x256
  • Run the following command
python train_DeblurDiNAT_pretrained.py
  • After 3000 epochs, we keep training DeblurDiNAT for 1000 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 --weights_path ./DeblurDiNATL.pth 

For testing on RealBlur test sets

python predict_RealBlur_J_test_results.py --weights_path ./DeblurDiNATL.pth 
python predict_RealBlur_R_test_results.py --weights_path ./DeblurDiNATL.pth 

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".

https://arxiv.org/abs/2403.13163

License:Other


Languages

Language:Python 100.0%