Official implementation of our CVPR Workshop NTIRE 2025 accepted paper:
XYScanNet: A State Space Model for Single Image Deblurring
Hanzhou Liu, Chengkai Liu, Jiacong Xu, Peng Jiang, Mi Lu
arXiv 2412.10338
Deep state-space models (SSMs), like recent Mamba architectures, are emerging as a promising alternative to CNN and Transformer networks. Existing Mamba-based restoration methods process visual data by leveraging a flatten-and-scan strategy that converts image patches into a 1D sequence before scanning. However, this scanning paradigm ignores local pixel dependencies and introduces spatial misalignment by positioning distant pixels incorrectly adjacent, which reduces local noise-awareness and degrades image sharpness in low-level vision tasks.
To overcome these issues, we propose a novel slice-and-scan strategy that alternates scanning along intra- and inter-slices. We further design a new Vision State Space Module (VSSM) for image deblurring and tackle the inefficiency challenges of the current Mamba-based vision module. Building upon this, we develop XYScanNet, an SSM architecture integrated with a lightweight feature fusion module for enhanced image deblurring. XYScanNet maintains competitive distortion metrics and significantly improves perceptual performance. Experimental results show that XYScanNet enhances KID by 17% compared to the nearest competitor.
- Accepted at CVPR 2025 - NTIRE Workshop
- Novel slice-and-scan scanning for spatially aware state-space modeling
- Lightweight Vision State Space Module (VSSM) designed for efficiency
- Competitive results on GoPro, HIDE, RealBlur_J/R, and RWBI datasets
conda create -n XYScanNet python=3.8 -y
conda activate XYScanNet
conda install pytorch==2.0.0 torchvision==0.15.0 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -r requirements.txt
Download "GoPro" dataset into './datasets'
for example: './datasets/GoPro'. Note: we say the blur images is A and the sharp images is B, e.g., ./GOPRO/test/sharp <-> .GOPRO/test/testB.
Download "VGG19 Pretrained Weights" into './models',
which is used to calculate ContrastLoss.
We train our XYScanNetPlus in two stages:
- We pre-train XYScanNetPlus for 4000 epochs with patch size 252x252
- Run the following command
python train_XYScanNet_stage1.py --job_name xyscannetp_gopro
- After 4000 epochs, we keep training XYScanNetPlus for 4000 epochs with patch size 320x320
- Run the following command
python train_XYScanNet_stage2.py --job_name xyscannetp_gopro
📄 Training Log: GoPro (can be viewed with linux cat commands)
I forgot the training details on RealBlur datasets. As much as I can remember, I used the gopro-trained model (final .pth in stage 1) and fine-tuned it based on the provided config file.
📄 Training Log: RealBlur_J 📄 Training Log: RealBlur_R
For testing on GoPro dataset
- Create folders with a structure results/xyscannetp_gopro/models, where models is the folder that saves the network weights.
- Download "GoPro" full dataset or test set into './datasets' (For example: './datasets/GoPro/test')
- Change the dataset path in predict_GoPro_test_results.py line 34.
- Run the following command
python predict_GoPro_test_results.py --job_name xyscannetp_gopro
For testing on HIDE dataset
- Create folders with a structure results/xyscannetp_hide/models, where models is the folder that saves the network weights.
- Download "HIDE" into './datasets'
- Run the following command
python predict_HIDE_results.py --job_name xyscannetp_gopro
For testing on RealBlur test sets
- Create folders with a structure results/xyscannetp_realj(or realr)/models, where models is the folder that saves the network weights.
- Download "RealBlur_J" and "RealBlur_R" into './datasets'
- Run the following command
python predict_RealBlur_J_test_results.py --job_name xyscannetp_realj
python predict_RealBlur_R_test_results.py --job_name xyscannetp_realr
The following table lists our released pretrained models and qualitative visual examples. All models are available from Google Drive.
PS: We have trained multiple versions of XYScanNetPlus. We are still double-checking whether the released models and images match with the paper results.
| Dataset | Trained On | Model Weights | Sample Results Preview |
|---|---|---|---|
| GoPro | GoPro | Download | GoPro Sample |
| HIDE | GoPro | Download | HIDE Sample |
| RWBI | GoPro | Download | RWBI Sample |
| RealBlur_J | RealBlur_J | Download | RealBlurJ Sample |
| RealBlur_R | RealBlur_R | Download | RealBlurR Sample |
- Release Pretrained Models
- Release Test Images
- Release Training Logs
- Release Environment Setup
If you find our work useful, please consider citing us:
@InProceedings{Liu_2025_CVPR,
author = {Liu, Hanzhou and Liu, Chengkai and Xu, Jiacong and Jiang, Peng and Lu, Mi},
title = {XYScanNet: A State Space Model for Single Image Deblurring},
booktitle = {Proceedings of the Computer Vision and Pattern Recognition Conference (CVPR) Workshops},
month = {June},
year = {2025},
pages = {779-789}
}