readme.md

February 11, 2023 · View on GitHub

PWC PWC PWC PWC PWC PWC PWC PWC PWC PWC

NAFNet: Nonlinear Activation Free Network for Image Restoration

The official pytorch implementation of the paper Simple Baselines for Image Restoration (ECCV2022)

Liangyu Chen*, Xiaojie Chu*, Xiangyu Zhang, Jian Sun

Although there have been significant advances in the field of image restoration recently, the system complexity of the state-of-the-art (SOTA) methods is increasing as well, which may hinder the convenient analysis and comparison of methods. In this paper, we propose a simple baseline that exceeds the SOTA methods and is computationally efficient. To further simplify the baseline, we reveal that the nonlinear activation functions, e.g. Sigmoid, ReLU, GELU, Softmax, etc. are not necessary: they could be replaced by multiplication or removed. Thus, we derive a Nonlinear Activation Free Network, namely NAFNet, from the baseline. SOTA results are achieved on various challenging benchmarks, e.g. 33.69 dB PSNR on GoPro (for image deblurring), exceeding the previous SOTA 0.38 dB with only 8.4% of its computational costs; 40.30 dB PSNR on SIDD (for image denoising), exceeding the previous SOTA 0.28 dB with less than half of its computational costs.

NAFNet For Image DenoiseNAFNet For Image DeblurNAFSSR For Stereo Image Super Resolution
DenoiseDeblurStereoSR(NAFSSR)

PSNR_vs_MACs

News

2022.08.02 The Baseline, including the pretrained models and train/test configs, are available now.

2022.07.03 Related work, Improving Image Restoration by Revisiting Global Information Aggregation (TLC, a.k.a TLSC in our paper) is accepted by ECCV2022 :tada: . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 :tada:

2022.06.19 NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop :tada: Presentation video, slides and poster are available now.

2022.04.15 NAFNet based Stereo Image Super-Resolution solution (NAFSSR) won the 1st place on the NTIRE 2022 Stereo Image Super-resolution Challenge! Training/Evaluation instructions see here.

Installation

This implementation based on BasicSR which is a open source toolbox for image/video restoration tasks and HINet

python 3.9.5
pytorch 1.11.0
cuda 11.3
git clone https://github.com/megvii-research/NAFNet
cd NAFNet
pip install -r requirements.txt
python setup.py develop --no_cuda_ext

Quick Start

  • Image Denoise Colab Demo: google colab logo
  • Image Deblur Colab Demo: google colab logo
  • Stereo Image Super-Resolution Colab Demo: google colab logo
  • Single Image Inference Demo:
    • Image Denoise:
    python basicsr/demo.py -opt options/test/SIDD/NAFNet-width64.yml --input_path ./demo/noisy.png --output_path ./demo/denoise_img.png
    
    • Image Deblur:
    python basicsr/demo.py -opt options/test/REDS/NAFNet-width64.yml --input_path ./demo/blurry.jpg --output_path ./demo/deblur_img.png
    
    • --input_path: the path of the degraded image
    • --output_path: the path to save the predicted image
    • pretrained models should be downloaded.
    • Integrated into Huggingface Spaces 🤗 using Gradio. Try out the Web Demo for single image restorationHugging Face Spaces
  • Stereo Image Inference Demo:
    • Stereo Image Super-resolution:
    python basicsr/demo_ssr.py -opt options/test/NAFSSR/NAFSSR-L_4x.yml \
    --input_l_path ./demo/lr_img_l.png --input_r_path ./demo/lr_img_r.png \
    --output_l_path ./demo/sr_img_l.png --output_r_path ./demo/sr_img_r.png
    
    • --input_l_path: the path of the degraded left image
    • --input_r_path: the path of the degraded right image
    • --output_l_path: the path to save the predicted left image
    • --output_r_path: the path to save the predicted right image
    • pretrained models should be downloaded.
    • Integrated into Huggingface Spaces 🤗 using Gradio. Try out the Web Demo for stereo image super-resolutionHugging Face Spaces
  • Try the web demo with all three tasks here: Replicate

Results and Pre-trained Models

nameDatasetPSNRSSIMpretrained modelsconfigs
NAFNet-GoPro-width32GoPro32.87050.9606gdrive | 百度网盘train | test
NAFNet-GoPro-width64GoPro33.71030.9668gdrive | 百度网盘train | test
NAFNet-SIDD-width32SIDD39.96720.9599gdrive | 百度网盘train | test
NAFNet-SIDD-width64SIDD40.30450.9614gdrive | 百度网盘train | test
NAFNet-REDS-width64REDS29.09030.8671gdrive | 百度网盘train | test
NAFSSR-L_4xFlickr102424.170.7589gdrive | 百度网盘train | test
NAFSSR-L_2xFlickr102429.680.9221gdrive | 百度网盘train | test
Baseline-GoPro-width32GoPro32.47990.9575gdrive | 百度网盘train | test
Baseline-GoPro-width64GoPro33.39600.9649gdrive | 百度网盘train | test
Baseline-SIDD-width32SIDD39.88570.9596gdrive | 百度网盘train | test
Baseline-SIDD-width64SIDD40.29700.9617gdrive | 百度网盘train | test

Image Restoration Tasks

TaskDatasetTrain/Test InstructionsVisualization Results
Image DeblurringGoProlinkgdrive | 百度网盘
Image DenoisingSIDDlinkgdrive | 百度网盘
Image Deblurring with JPEG artifactsREDSlinkgdrive | 百度网盘
Stereo Image Super-ResolutionFlickr1024+Middleburylinkgdrive | 百度网盘

Citations

If NAFNet helps your research or work, please consider citing NAFNet.

@article{chen2022simple,
  title={Simple Baselines for Image Restoration},
  author={Chen, Liangyu and Chu, Xiaojie and Zhang, Xiangyu and Sun, Jian},
  journal={arXiv preprint arXiv:2204.04676},
  year={2022}
}

If NAFSSR helps your research or work, please consider citing NAFSSR.

@InProceedings{chu2022nafssr,
    author    = {Chu, Xiaojie and Chen, Liangyu and Yu, Wenqing},
    title     = {NAFSSR: Stereo Image Super-Resolution Using NAFNet},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2022},
    pages     = {1239-1248}
}

Contact

If you have any questions, please contact chenliangyu@megvii.com or chuxiaojie@megvii.com


statistics

visitors