Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); GitHub - BlueRiverTechnology/NAFNet: Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions. · GitHub
Skip to content

Repository files navigation

NAFNet - 4-Channel NRGB Image Support

Note: This is a fork of the original megvii-research/NAFNet repository. Modified by: Christian Lee (Blue River Technology) Modifications: Extended to support training and inference on 4-channel NRGB (Near-Infrared + RGB) images, including NIRScene dataset support and custom model configurations.


PWCPWCPWCPWCPWCPWCPWCPWCPWCPWC

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 🎉 . Code is available at https://github.com/megvii-research/TLC.

2022.07.03 Our paper is accepted by ECCV2022 🎉

2022.06.19NAFSSR (as a challenge winner) is selected for an ORAL presentation at CVPR 2022, NTIRE workshop 🎉 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

python3.9.5pytorch1.11.0cuda11.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

About

Fork of NAFNet for NRGB images. The state-of-the-art image restoration model without nonlinear activation functions.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages