Home

Awesome

📖 Spatially-Adaptive Feature Modulation for Efficient Image Super-Resolution

<a href="https://colab.research.google.com/drive/19DdsNFeOYR8om8QCCi9WWzr_WkWTLHZd?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"></a> OpenXLab Hugging Face Demo Hugging Face Models video visitors GitHub Stars <br> [Paper]   [Supp]   [Poster] <br>

Long Sun, Jiangxin Dong, Jinhui Tang, and Jinshan Pan <br> IMAG Lab, Nanjing University of Science and Technology


<p align="center"> <img width="800" src="./figs/framework.png"> </p>

An overview of the proposed SAFMN. SAFMN first transforms the input LR image into the feature space using a convolutional layer, performs feature extraction using a series of feature mixing modules (FMMs), and then reconstructs these extracted features by an upsampler module. The FMM block is mainly implemented by a spatially-adaptive feature modulation (SAFM) layer and a convolutional channel mixer (CCM).


News


Requirements

Installation

# Clone the repo
git clone https://github.com/sunny2109/SAFMN.git
# Install dependent packages
cd SAFMN
pip install -r requirements.txt
# Install BasicSR
python setup.py develop

You can also refer to this INSTALL.md for installation

Training

Run the following commands for training:

# train SAFMN for x4 effieicnt SR
python basicsr/train.py -opt options/train/SAFMN/train_DF2K_x4.yml
# train SAFMN for x4 classic SR
python basicsr/train.py -opt options/train/SAFMN/train_L_DF2K_x4.yml

Testing

# test SAFMN for x4 efficient SR
python basicsr/test.py -opt options/test/SAFMN/test_benchmark_x4.yml
# test SAFMN for x4 classic SR
python basicsr/test.py -opt options/test/SAFMN/test_L_benchmark_x4.yml
# test SAFMN for x4 real-world SR (without ground-truth)
python basicsr/test.py -opt options/test/SAFMN/test_real_img_x4.yml
# test SAFMN for x4 real-world SR (large input)
python inference/inference_real_safmn.py --input test_demo --output results/test_demo --scale 4 --large_input 

Results

DegradationModel ZooVisual Results
BI-Efficient SRGoogle Drive/Baidu Netdisk with code: SAFMGoogle Drive/Baidu Netdisk with code: SAFM
BI-Classic SRGoogle Drive/Baidu Netdisk with code: SAFMGoogle Drive/Baidu Netdisk with code: SAFM
x4 Real-worldGoogle Drive/Baidu Netdisk with code: SAFM

<img src="figs/compression_1.png" width="400" height="300"/> <img src="figs/compression_2.png" width="400" height="300"/>

<img src="figs/dalle.png" width="400"/> <img src="figs/midjourney.png" width="400"/>

<img src="figs/sdxl.png" width="400"/> <img src="figs/stable_diffusion.png" width="400"/>

Real-World Image (x4)Real-ESRGANSwinIRSAFMN (ours)
<img width="350" src="figs/real_figs/five_golden_flowers_02.png"><img width="350" src="figs/real_figs/five_golden_flowers_02_realESRGAN.png"><img width="350" src="figs/real_figs/five_golden_flowers_02_SwinIR.png"><img width="350" src="figs/real_figs/five_golden_flowers_02_SAFMN.png">
<img width="350" src="figs/real_figs/five_golden_flowers_01.png"><img width="350" src="figs/real_figs/five_golden_flowers_01_realESRGAN.png"><img width="350" src="figs/real_figs/five_golden_flowers_01_SwinIR.png"><img width="350" src="figs/real_figs/five_golden_flowers_01_SAFMN.png">
<img width="350" src="figs/real_figs/kobe_curry.png"><img width="350" src="figs/real_figs/kobe_curry_realESRGAN.png"><img width="350" src="figs/real_figs/kobe_curry_SwinIR.png"><img width="350" src="figs/real_figs/kobe_curry_SAFMN.png">
<img width="350" src="figs/real_figs/little_carp.png"><img width="350" src="figs/real_figs/little_carp_realESRGAN.png"><img width="350" src="figs/real_figs/little_carp_SwinIR.png"><img width="350" src="figs/real_figs/little_carp_SAFMN.png">

<img src="figs/real_figs/anime_results.png">

Citation

If this work is helpful for your research, please consider citing the following BibTeX entry.

@inproceedings{sun2023safmn,
    title={Spatially-Adaptive Feature Modulation for Efficient Image Super-Resolution},
    author={Sun, Long and Dong, Jiangxin and Tang, Jinhui and Pan, Jinshan},
    booktitle={ICCV},
    year={2023}
 }

Acknowledgement

This code is based on BasicSR toolbox. Thanks for the awesome work.

Contact

If you have any questions, please feel free to reach me out at cs.longsun@gmail.com