Skip to content

PyTorch implements `Learning A Single Network for Scale-Arbitrary Super-Resolution` paper.

License

Notifications You must be signed in to change notification settings

Lornatang/ArbSR-PyTorch

Repository files navigation

ArbSR-PyTorch

Overview

This repository contains an op-for-op PyTorch reimplementation of Learning A Single Network for Scale-Arbitrary Super-Resolution .

Table of contents

Download weights

Download datasets

Contains DIV2K, DIV8K, Flickr2K, OST, T91, Set5, Set14, BSDS100 and BSDS200, etc.

Please refer to README.md in the data directory for the method of making a dataset.

How Test and Train

Both training and testing only need to modify the config.py file.

Test ArbSR_RCAN

modify the config.py

  • line 31: model_arch_name change to arbsr_rcan.
  • line 40: upscale_factor change to 4.
  • line 50: mode change to test.
  • line 52: exp_name change to ArbSR_RCAN_x1_x4-DIV2K.
  • line 101: model_weights_path change to ./results/pretrained_models/ArbSR_RCAN_x1_x4-DIV2K-8c206342.pth.tar.
python3 test.py

Train ArbSR_RCAN model

modify the config.py

  • line 31: model_arch_name change to arbsr_rcan.
  • line 40: upscale_factor change to 4.
  • line 50: mode change to train.
  • line 52: exp_name change to ArbSR_RCAN_x1_x4-DIV2K.
python3 train.py

Resume train ArbSR_RCAN model

modify the config.py

  • line 31: model_arch_name change to arbsr_rcan.
  • line 40: upscale_factor change to 4.
  • line 50: mode change to train.
  • line 52: exp_name change to ArbSR_RCAN_x1_x4-DIV2K.
  • line 57: resume_model_weights_path change to ./results/ArbSR_RCAN_x1_x4-DIV2K/epoch_xxx.pth.tar.
python3 train.py

Result

Source of original paper results: https://openaccess.thecvf.com/content/ICCV2021/papers/Wang_Learning_a_Single_Network_for_Scale-Arbitrary_Super-Resolution_ICCV_2021_paper.pdf

In the following table, the psnr value in () indicates the result of the project, and - indicates no test.

  • None
# Download `ArbSR_RCAN_x1_x4-DIV2K-8c206342.pth.tar` weights to `./results/pretrained_models/ArbSR_RCAN_x1_x4-DIV2K-8c206342.pth.tar`
# More detail see `README.md<Download weights>`
python3 ./inference.py

Input:

Output:

Build `arbsr_rcan` model successfully.
Load `arbsr_rcan` model weights `./results/pretrained_models/ArbSR_RCAN_x1_x4-DIV2K-8c206342.pth.tar` successfully.
SR image save to `./figure/119082_lr.png`

Contributing

If you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.

I look forward to seeing what the community does with these models!

Credit

Learning A Single Network for Scale-Arbitrary Super-Resolution

Longguang Wang, Yingqian Wang, Zaiping Lin, Jungang Yang, Wei An, Yulan Guo

Abstract
Recently, the performance of single image super-resolution (SR) has been significantly improved with powerful networks. However, these networks are developed for image SR with a single specific integer scale (e.g., x2;x3,x4), and cannot be used for non-integer and asymmetric SR. In this paper, we propose to learn a scale-arbitrary image SR network from scale-specific networks. Specifically, we propose a plug-in module for existing SR networks to perform scale-arbitrary SR, which consists of multiple scale-aware feature adaption blocks and a scale-aware upsampling layer. Moreover, we introduce a scale-aware knowledge transfer paradigm to transfer knowledge from scale-specific networks to the scale-arbitrary network. Our plug-in module can be easily adapted to existing networks to achieve scale-arbitrary SR. These networks plugged with our module can achieve promising results for non-integer and asymmetric SR while maintaining state-of-the-art performance for SR with integer scale factors. Besides, the additional computational and memory cost of our module is very small.

[Paper] [Code]

@InProceedings{Wang2020Learning,
  title={Learning A Single Network for Scale-Arbitrary Super-Resolution},
  author={Longguang Wang, Yingqian Wang, Zaiping Lin, Jungang Yang, Wei An, and Yulan Guo},
  booktitle={ICCV},
  year={2021}
}

About

PyTorch implements `Learning A Single Network for Scale-Arbitrary Super-Resolution` paper.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages