Skip to content

Kingsley-Cyl/DeRestormer

Repository files navigation

DeRestormer: Revisit Versatile Image Restoration via Deformable Attention Mechanism

Abstract

Image restoration still poses significant challenges due to the complexity and diversity of real-world degradations. However, such degradations often manifest as spatially non-uniform, locally concentrated, and irregular patterns, which calls for a restoration model that can adapt its feature sampling to the underlying degradation geometry while remaining computationally efficient. In this paper, we design a novel image restoration framework built on a deformable restoration Transformer, termed DeRestormer. DeRestormer adapts to irregular but localized degradations via deformable attention, where a small set of sampling positions is learned to pre-filter and highlight key elements, so the model can better focus on informative regions and handle complex degradation patterns efficiently. In addition, we incorporate deformable convolutions at the bottleneck stage to dynamically adjust sampling locations across different scales, thus facilitating flexible multi-scale aggregation and effective integration of fine-grained details and global context. Extensive experiments on 13 datasets across 4 tasks demonstrate the effectiveness of DeRestormer, since it achieves state-of-the-art performance across a wide range of image restoration scenarios. The project and pretrained models of our work are available at https://github.com/Kingsley-Cyl/DeRestormer.

Overview

[Overview Figure]

Usage

Installation

This code was tested with the following environment configurations. It may work with other versions.

  • CUDA 11.8
  • Python 3.8
  • PyTorch 2.1.0+cu118

You can manage your virtual environment with conda by conducting the following commands:

conda create -n DeRestormer python=3.8
conda activate DeRestormer
cd <this repository>
pip install -r requirements.txt

cd pytorch-gradual-warmup-lr
python setup.py install
cd ..

Pretrained Weights

You can find and download all the pretrained Weights at Baidu Netdisk (Password: t6w4).

Training

The training code will be updated soon.

Testing

The testing code will be updated soon.

Results

  1. for DID-Data and DDN-Data datasets: PSNR and SSIM results are computed by using this Matlab Code.
  2. for other datasets: PSNR and SSIM results are computed by using this Matlab Code.

Image deraining

Dataset PSNR SSIM Visual Results
Rain200L 41.61 0.9901 Baidu Netdisk (vuw8)
Rain200H 32.10 0.9343 Baidu Netdisk (px59)
DID-Data 35.52 0.9661 Baidu Netdisk (4v53)
DDN-Data 34.43 0.9594 Baidu Netdisk (67gj)
SPA-Data 49.21 0.9927 Baidu Netdisk (tuvv)

Image desnowing

Dataset PSNR SSIM Visual Results
CSD 40.84 0.99 Baidu Netdisk (6dej)
SRRS 35.77 0.99 Baidu Netdisk (uf3f)
Snow100K 35.36 0.96 Baidu Netdisk (4x6c)

Image dehazing

Dataset PSNR SSIM Visual Results
SOTS-Indoor 41.75 0.996 Baidu Netdisk (5vg3)
SOTS-Outdoor 37.77 0.995 Baidu Netdisk (25pp)
Haze4K 34.04 0.99 Baidu Netdisk (i4g9)

Image motion deblurring

Dataset PSNR SSIM Visual Results
GoPro 33.51 0.972 Baidu Netdisk (6fj3)
HIDE 31.60 0.962 Baidu Netdisk (8vw4)

Acknowledgement

This code is based on MSDT, NeRD-Rain, and DeformDeweatherNet. Thanks for their awesome work.

About

The implemention of DeRestormer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors