/CRAN

Unofficial pytorch implementation of the paper "Context Reasoning Attention Network for Image Super-Resolution (ICCV 2021)"

Primary LanguagePython

CRAN

Unofficial pytorch implementation of the paper "Context Reasoning Attention Network for Image Super-Resolution (ICCV 2021)"

This code doesn't exactly match what the paper describes.

  • I delete the module "CDRR" (Section 3.2) in the code because of low training speed and performance drop (maybe I wrongly make the code for "CDRR")
  • If you want to use "CDRR", just uncomment the remarks in "common.py" capture capture1

The environmental settings are described below. (I cannot gaurantee if it works on other environments)

  • Pytorch=1.7.1+cu110
  • numpy=1.18.3
  • cv2=4.2.0
  • tqdm=4.45.0

Train

First, you need to download weights of ResNet50 pretrained on ImageNet database.

Second, you need to download the DF2K dataset.

캡처

  • Set the database path in "./opt/option.py" (It is represented as "dir_data")

After those settings, you can run the train code by running "train.py"

  • python3 train.py --gpu_id 0 (execution code)
  • This code works on single GPU. If you want to train this code in muti-gpu, you need to change this code
  • Options are all included in "./opt/option.py". So you should change the variable in "./opt/option.py"

Inference

First, you need to specify variables in "./opt/option.py"

  • dir_test: root folder of test images
  • weights: checkpoint file (trained on DF2K dataset)
  • results: inference results will be saved on this folder

After those settings, you can run the inference code by running "inference.py"

  • python3 inference.py --gpu_id 0 (execution code)

Acknolwdgements

We refer to repos below to implement this code.