/AnySR

The official implementation of AnySR.

Primary LanguagePythonApache License 2.0Apache-2.0

AnySR

Code release for "AnySR: Realizing Image Super-Resolution as Any-Scale, Any-Resource"

Paper: AnySR: Realizing Image Super-Resolution as Any-Scale, Any-Resource

Our code is based on Ubuntu 18.04, pytorch 1.10.2, CUDA 11.3 and python 3.9.

Environment

  • python 3.9
  • pytorch 1.10.2
  • tensorboard、tensorboardX
  • pyyaml
  • numpy
  • tqdm
  • imageio
  • matplotlib
  • opencv-python

Train

EDSR:

python train.py --config configs/train_edsr-anysr.yaml --gpu 0,1,2,3

RDN:

python train.py --config configs/train_rdn-anysr.yaml --gpu 0,1,2,3

Please download the pretrain model (EDSR, RDN) to the folder /AnySR, or modify the model['path'], model['args']['encoder_spec']['path'], and 'pretrain' field in the configs file to your model path.

Test

Using AnySR variants (through different subnets):

bash test-benchmark.sh save/_train_edsr-anysr/epoch-500.pth True 1 0

Using AnySR-retrained version (through the largest network):

bash test-benchmark.sh save/_train_edsr-anysr/epoch-500.pth True 1 1

Demo

Using AnySR variants (through different subnets):

python demo.py --input lr.png --model save/_train_edsr-anysr/epoch-500.pth --scale 2 --output output.png --test_only 1 --entire_net 0

Using AnySR-retrained version (through the largest network):

python demo.py --input lr.png --model save/_train_edsr-anysr/epoch-500.pth --scale 2 --output output.png --test_only 1 --entire_net 1

Checkpoints

To train AnySR:

srno_edsr_baseline_epoch_1000.pth

srno_rdn_baseline_epoch_1000.pth

To test AnySR:

anysr_edsr_500.pth(updated)

anysr_rdn_500.pth(updated)