Second-order Attention Network for Single Image Super-resolution (CVPR-2019)

Related tags

Deep Learning SAN
Overview

Second-order Attention Network for Single Image Super-resolution (CVPR-2019)

"Second-order Attention Network for Single Image Super-resolution" is published on CVPR-2019. The code is built on RCAN(pytorch) and tested on Ubuntu 16.04 (Pytorch 0.4.0)

Main Contents

1. Introduction

  • Abstract: Recently, deep convolutional neural networks (CNNs) have been widely explored in single image super-resolution (SISR) and obtained remarkable performance. However, most of the existing CNN-based SISR methods mainly focus on wider or deeper architecture design, neglecting to explore the feature correlations of intermediate layers, hence hindering the representational power of CNNs. To address this issue, in this paper, we propose a second-order attention network (SAN) for more powerful feature expression and feature correlation learning. Specifically, a novel train- able second-order channel attention (SOCA) module is developed to adaptively rescale the channel-wise features by using second-order feature statistics for more discriminative representations. Furthermore, we present a non-locally enhanced residual group (NLRG) structure, which not only incorporates non-local operations to capture long-distance spatial contextual information, but also contains repeated local-source residual attention groups (LSRAG) to learn increasingly abstract feature representations. Experimental results demonstrate the superiority of our SAN network over state-of-the-art SISR methods in terms of both quantitative metrics and visual quality.

2. Train code

Prepare training datasets

    1. Download the DIV2K dataset (900 HR images) from the link DIV2K.
    1. Set '--dir_data' as the HR and LR image path.

Train the model

  • You can retrain the model:
      1. CD to 'TrainCode/code';
      1. Run the following scripts to train the models:

BI degradation, scale 2, 3, 4,8

input= 48x48, output = 96x96

python main.py --model san --save save_name --scale 2 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --patch_size 96

input= 48x48, output = 144x144

python main.py --model san --save save_name --scale 3 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --patch_size 96

input= 48x48, output = 192x192

python main.py --model san --save save_name --scale 4 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --patch_size 96

input= 48x48, output = 392x392

python main.py --model san --save save_name --scale 8 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --patch_size 96

3. Test code

BI degradation, scale 2, 3, 4,8

SAN_2x

python main.py --model san --data_test MyImage --save save_name --scale 2 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --test_only --testpath 'your path' --testset Set5 --pre_train ../model/SAN_BIX2.pt

SAN_3x

python main.py --model san --data_test MyImage --save save_name --scale 3 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --test_only --testpath 'your path' --testset Set5 --pre_train ../model/SAN_BIX3.pt

SAN_4x

python main.py --model san --data_test MyImage --save save_name --scale 4 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --test_only --testpath 'your path' --testset Set5 --pre_train ../model/SAN_BIX4.pt

SAN_8x

python main.py --model san --data_test MyImage --save save_name --scale 8 --n_resgroups 20 --n_resblocks 10 --n_feats 64 --reset --chop --save_results --test_only --testpath 'your path' --testset Set5 --pre_train ../model/SAN_BIX8.pt

4. Results

5. Citation

If the the work or the code is helpful, please cite the following papers

@inproceedings{dai2019second,

title={Second-order Attention Network for Single Image Super-Resolution}, author={Dai, Tao and Cai, Jianrui and Zhang, Yongbing and Xia, Shu-Tao and Zhang, Lei}, booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}, pages={11065--11074}, year={2019} }

@inproceedings{zhang2018image,

title={Image super-resolution using very deep residual channel attention networks}, author={Zhang, Yulun and Li, Kunpeng and Li, Kai and Wang, Lichen and Zhong, Bineng and Fu, Yun}, booktitle={Proceedings of the European Conference on Computer Vision (ECCV)}, pages={286--301}, year={2018} }

@inproceedings{li2017second, title={Is second-order information helpful for large-scale visual recognition?}, author={Li, Peihua and Xie, Jiangtao and Wang, Qilong and Zuo, Wangmeng}, booktitle={Proceedings of the IEEE International Conference on Computer Vision}, pages={2070--2078}, year={2017} }

6. Acknowledge

The code is built on RCAN (Pytorch) and EDSR (Pytorch). We thank the authors for sharing the codes.

Comments
  • 几个有关网络结构的问题

    几个有关网络结构的问题

    1、看上去SOCA是一个很厉害的加强版CA,能否做一个将RCAN中所有CA换成SOCA的实验,这样可以证明SOCA比CA更强? 2、大组(SSRG)和小组(LSRAG)都是堆叠,但是结构略有区别,能否解释下为什么这样设计(为什么不同)吗? (1)大组结尾有一个3x3卷积,而小组没有; (2)小组结尾是SOCA,但是大组开头和结尾是RL-NL; (3)大组用了对开头做残差,但是小组没有。 3、SSRG中的残差gamma,为什么是共享的同一个,而不是每一个小组用一个不同的gamma? 4、为什么SSRG前后的non-local是共享同一个,而不是用两个不同的?

    opened by splinter21 9
  • Pretrained Model on a different location

    Pretrained Model on a different location

    Hi, Congratulations on getting some great results with SAN. I was wondering if it's possible for you to put the pretrained models somewhere else than Baidu network. I wanted to try out the model on some of my personal benchmarks but seems like Baidu bloatware won't let me do the same in Germany. Can you perhaps put the model on Google Drive or Model Zoo or Git Large File Storage? It would be much appreciated given that the model is pretty big and expensive to train from scratch.

    opened by ghost 7
  • Validation set?

    Validation set?

    Hello,

    I've been searching the codebase for a validation routine, and it seems the current framework is not using a separate validation set. Are you using the test set as the validation set?

    Thanks, Kwang

    opened by kmyi 2
  • Any other way to download pre-trained model?

    Any other way to download pre-trained model?

    I cannot download the pre-trained weights because it is placed in baidu. Baidu require Chinese telephone numbers, so foreigners cannot try to SAN.

    Will you plan to place pre-trained model in other place?

    opened by nomaddo 2
  • Attempting to Upscale 720p images, CUDA Out of Memory

    Attempting to Upscale 720p images, CUDA Out of Memory

    Hello,

    Thank you so much for the excellent contribution! I am attempting to upscale a standard 720p image using SAN. I am using the 3x model, and have tried the following GPUs

    1. 2060
    2. 2x 2080Tis
    3. Tesla V100

    And the model is OOM (out of memory) in all of them. I'm actually at a loss, how should I proceed with regards to the same in order to run inference?

    Thank you.

    opened by SreeHarshaNelaturu 2
  • ZeroDivisionError: division by zero

    ZeroDivisionError: division by zero

    When i run the code to test, got the this error.

    ./SAN/TestCode/code/trainer.py, line 113 in test

    self.ckp.log[-1, idx_scale] = eval_acc / len(self.loader_test) ZeroDivisionError: division by zero.

    I have no idea why len(self.loader_test) is zero.

    How can i fix this error?

    opened by choieq 1
  • difference in the TrainCode and TestCode

    difference in the TrainCode and TestCode

    Hello, thank you for your wonderful work . As a beginner, I find that the TrainCode and TestCode are mostly similar, and at first glance they look the same. Could you please tell me the main difference?

    opened by CVencode 0
  • undefined variable 'der_sacleTrace'

    undefined variable 'der_sacleTrace'

    SAN\TrainCode\model\MPNCOV\python\MPNCOV.py 84 line der_sacleTrace I can not find the location of this variable definition. I also don't understand what this variable mean. Can the author explain this? Thank you.

    opened by AWSDJIKL 1
  • Paper error!! (RCAN's parameter is 15.44M, which is less than SAN 15.7M)!!!

    Paper error!! (RCAN's parameter is 15.44M, which is less than SAN 15.7M)!!!

    Hi, @daitao Sorry to disturb, I think you have made an error in your SAN paper. RCAN have less parameters than SAN that RCAN contains 15.44M and SAN contains 15.7M. (This value is reported by RCAN's author) Because of your wrong conclusion, now all the work has made the same mistakes as you, which is completely deviated from the development track. image

    opened by Senwang98 2
  • Why scale 8 of 48x48 is 392x392 not 384x384?

    Why scale 8 of 48x48 is 392x392 not 384x384?

    I think super resolved 48x48 with scale x8 is 384x384, but it's written as 392x392 in the README.md. Is it just a simple typo, or is there any reason?

    Thank you.

    opened by Kitsunetic 1
  • AssertionError: Invalid device id

    AssertionError: Invalid device id

    Hi Everyone, I am getting an error AssertionError: Invalid device id, when i set --n_GPUs to 2 (args.n_GPUs to 2). can anyone help me. I am getting error at this line(Line number 29) in model/init.py self.model = nn.DataParallel(self.model, range(args.n_GPUs)) I tried nvidia-smi , it is showing 2 gpus also i tried, torch.cuda.device_count() it shows 2

    opened by Akshaypatil7 0
  • ValueError: _set_worker_pids should be called only once for each _BaseDataLoaderIter.

    ValueError: _set_worker_pids should be called only once for each _BaseDataLoaderIter.

    My environment is pytorch 1.6, cuda 10.2 in ubuntu

    I replace _update_worker_pids with _set_worker_pids in code/dataloader.py, then i got this error. "ValueError: _set_worker_pids should be called only once for each _BaseDataLoaderIter. "

    Help me ..

    opened by choieq 1
Owner
null
Lowest memory consumption and second shortest runtime in NTIRE 2022 challenge on Efficient Super-Resolution

FMEN Lowest memory consumption and second shortest runtime in NTIRE 2022 on Efficient Super-Resolution. Our paper: Fast and Memory-Efficient Network T

null 33 Dec 1, 2022
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 436 Jan 9, 2023
A Text Attention Network for Spatial Deformation Robust Scene Text Image Super-resolution (CVPR2022)

A Text Attention Network for Spatial Deformation Robust Scene Text Image Super-resolution (CVPR2022) https://arxiv.org/abs/2203.09388 Jianqi Ma, Zheto

MA Jianqi, shiki 104 Jan 5, 2023
Practical Single-Image Super-Resolution Using Look-Up Table

Practical Single-Image Super-Resolution Using Look-Up Table [Paper] Dependency Python 3.6 PyTorch glob numpy pillow tqdm tensorboardx 1. Training deep

Younghyun Jo 116 Dec 23, 2022
PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

About PyTorch 1.2.0 Now the master branch supports PyTorch 1.2.0 by default. Due to the serious version problem (especially torch.utils.data.dataloade

Sanghyun Son 2.1k Jan 1, 2023
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"

NTIRE2017 Super-resolution Challenge: SNU_CVLab Introduction This is our project repository for CVPR 2017 Workshop (2nd NTIRE). We, Team SNU_CVLab, (B

Bee Lim 625 Dec 30, 2022
PyTorch code for 'Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning'

Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning This repository is for EMSRDPN introduced in the foll

null 7 Feb 10, 2022
Augmentation for Single-Image-Super-Resolution

SRAugmentation Augmentation for Single-Image-Super-Resolution Implimentation CutBlur Cutout CutMix Cutup CutMixup Blend RGBPermutation Identity OneOf

Yubo 6 Jun 27, 2022
Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN

Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN Introduction Image super-resolution (SR) is the process of recovering high-resoluti

null 8 Apr 15, 2022
ESGD-M - A stochastic non-convex second order optimizer, suitable for training deep learning models, for PyTorch

ESGD-M - A stochastic non-convex second order optimizer, suitable for training deep learning models, for PyTorch

Katherine Crowson 53 Dec 29, 2022
Second Order Optimization and Curvature Estimation with K-FAC in JAX.

KFAC-JAX - Second Order Optimization with Approximate Curvature in JAX Installation | Quickstart | Documentation | Examples | Citing KFAC-JAX KFAC-JAX

DeepMind 90 Dec 22, 2022
The official pytorch implemention of the CVPR paper "Temporal Modulation Network for Controllable Space-Time Video Super-Resolution".

This is the official PyTorch implementation of TMNet in the CVPR 2021 paper "Temporal Modulation Network for Controllable Space-Time VideoSuper-Resolu

Gang Xu 95 Oct 24, 2022
《Single Image Reflection Removal Beyond Linearity》(CVPR 2019)

Single-Image-Reflection-Removal-Beyond-Linearity Paper Single Image Reflection Removal Beyond Linearity. Qiang Wen, Yinjie Tan, Jing Qin, Wenxi Liu, G

Qiang Wen 51 Jun 24, 2022
PyTorch code for our paper "Image Super-Resolution with Non-Local Sparse Attention" (CVPR2021).

Image Super-Resolution with Non-Local Sparse Attention This repository is for NLSN introduced in the following paper "Image Super-Resolution with Non-

null 143 Dec 28, 2022
PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

Yulun Zhang 1.2k Dec 26, 2022
【Arxiv】Exploring Separable Attention for Multi-Contrast MR Image Super-Resolution

SANet Exploring Separable Attention for Multi-Contrast MR Image Super-Resolution Dependencies numpy==1.18.5 scikit_image==0.16.2 torchvision==0.8.1 to

null 36 Jan 5, 2023
Unofficial pytorch implementation of the paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution"

DFSA Unofficial pytorch implementation of the ICCV 2021 paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution" (p

null 2 Nov 15, 2021
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 14 Oct 14, 2022
Repository for "Exploring Sparsity in Image Super-Resolution for Efficient Inference", CVPR 2021

SMSR Reposity for "Exploring Sparsity in Image Super-Resolution for Efficient Inference" [arXiv] Highlights Locate and skip redundant computation in S

Longguang Wang 225 Dec 26, 2022