Giter VIP home page Giter VIP logo

rfb_esrgan-pytorch's Introduction

RFB_ESRGAN-PyTorch

Overview

This repository contains an op-for-op PyTorch reimplementation of Perceptual Extreme Super Resolution Network with Receptive Field Block.

Table of contents

Download weights

Download datasets

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

How Test and Train

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

Test

  • line 31: upscale_factor change to 16.
  • line 33: mode change to valid.
  • line 111: model_path change to results/pretrained_models/RFBESRNet_x16-DFO2K-0bcd554c.pth.tar.

Train RFBESRNet model

  • line 31: upscale_factor change to 16.
  • line 33: mode change to train_rfbesrnet.
  • line 35: exp_name change to RFBESRNet_baseline.

Resume train RFBESRNet model

  • line 31: upscale_factor change to 16.
  • line 33: mode change to train_rfbesrnet.
  • line 35: exp_name change to RFBESRNet_baseline.
  • line 49: resume change to samples/RFBESRNet_baseline/g_epoch_xxx.pth.tar.

Train ESRGAN model

  • line 31: upscale_factor change to 16.
  • line 33: mode change to train_rfbesrgan.
  • line 35: exp_name change to RFBESRGAN_baseline.
  • line 77: resume change to results/RFBESRNet_baseline/g_last.pth.tar.

Resume train ESRGAN model

  • line 31: upscale_factor change to 16.
  • line 33: mode change to train_rfbesrgan.
  • line 35: exp_name change to RFBESRGAN_baseline.
  • line 77: resume change to results/RFBESRNet_baseline/g_last.pth.tar.
  • line 78: resume_d change to samples/RFBESRGAN_baseline/g_epoch_xxx.pth.tar.
  • line 79: resume_g change to samples/RFBESRGAN_baseline/g_epoch_xxx.pth.tar.

Result

Source of original paper results: https://arxiv.org/pdf/2005.12597v1.pdf

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

Dataset Scale RFBNet (PSNR) RFB_ESRGAN (PSNR)
DIV8K 16 (23.45) 23.38(23.20)

Low resolution / Recovered High Resolution / Ground Truth

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

Perceptual Extreme Super Resolution Network with Receptive Field Block

Taizhang Shang, Qiuju Dai, Shengchen Zhu, Tong Yang, Yandong Guo

Abstract
Perceptual Extreme Super-Resolution for single image is extremely difficult, because the texture details of different images vary greatly. To tackle this difficulty, we develop a super resolution network with receptive field block based on Enhanced SRGAN. We call our network RFB-ESRGAN. The key contributions are listed as follows. First, for the purpose of extracting multi-scale information and enhance the feature discriminability, we applied receptive field block (RFB) to super resolution. RFB has achieved competitive results in object detection and classification. Second, instead of using large convolution kernels in multi-scale receptive field block, several small kernels are used in RFB, which makes us be able to extract detailed features and reduce the computation complexity. Third, we alternately use different upsampling methods in the upsampling stage to reduce the high computation complexity and still remain satisfactory performance. Fourth, we use the ensemble of 10 models of different iteration to improve the robustness of model and reduce the noise introduced by each individual model. Our experimental results show the superior performance of RFB-ESRGAN. According to the preliminary results of NTIRE 2020 Perceptual Extreme Super-Resolution Challenge, our solution ranks first among all the participants.

[Paper]

@misc{2005.12597,
    Author = {Taizhang Shang and Qiuju Dai and Shengchen Zhu and Tong Yang and Yandong Guo},
    Title = {Perceptual Extreme Super Resolution Network with Receptive Field Block},
    Year = {2020},
    Eprint = {arXiv:2005.12597},
}

rfb_esrgan-pytorch's People

Contributors

lornatang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rfb_esrgan-pytorch's Issues

无法使用DIV2K数据集进行训练

按照教程准备好了DIV2K数据集的train和test,使用训练命令python train.py --arch rfb_esrgan data,但结果如下图:
1628404883(1)
并没有训练的过程

效果较差

为什么使用已训练好的模型进行测试,效果很差

Exception: CUBLAS_STATUS_ALLOC_FAILED

When running on GPU I've got this error, while on CPU I don't and it's not due to out of resources of the GPU since I changed the batch size in order to fit in it.

Exception has occurred: RuntimeError
CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`

Pretrained weights for RFB_ESRGAN

When are you planning to release the pretrained weights for RFB_ESRGAN?
I'm interested in the weights for the x16 model.
It would be great to have them so that I can try out the model on images.

test_image.py error

I got the following error when I run test_image.py on a test image

COMMAND:
E:\Projects\RFB_ESRGAN-PyTorch>python test_image.py -a rfb --lr E:/Projects/ESRGAN/LR/baboon.png --pretrained --gpu 0

RESULT:

##################################################

Run Testing Engine.

[ WARNING ] Directory `E:\Projects\RFB_ESRGAN-PyTorch\tests` already exists!
[ INFO ] TestingEngine:
        API version .......... 0.2.0
        Build ................ 2021.04.15
##################################################

[ INFO ] Using pre-trained model `rfb`.
Traceback (most recent call last):
  File "test_image.py", line 136, in <module>
    main()
  File "test_image.py", line 68, in main
    main_worker(args.gpu, args)
  File "test_image.py", line 77, in main_worker
    model = configure(args)
  File "E:\Projects\RFB_ESRGAN-PyTorch\rfb_esrgan_pytorch\utils\common.py", line 48, in configure
    model = models.__dict__[args.arch](pretrained=True)
  File "E:\Projects\RFB_ESRGAN-PyTorch\rfb_esrgan_pytorch\models\generator.py", line 122, in rfb
    return _gan("rfb", 16, pretrained, progress)
  File "E:\Projects\RFB_ESRGAN-PyTorch\rfb_esrgan_pytorch\models\generator.py", line 100, in _gan
    state_dict = load_state_dict_from_url(model_urls[arch], progress=progress, map_location=torch.device("cpu"))
  File "E:\Programs\Anaconda3\envs\yolact\lib\site-packages\torch\hub.py", line 517, in load_state_dict_from_url
    cached_file = os.path.join(model_dir, filename)
  File "E:\Programs\Anaconda3\envs\yolact\lib\ntpath.py", line 115, in join
    genericpath._check_arg_types('join', path, *paths)
  File "E:\Programs\Anaconda3\envs\yolact\lib\genericpath.py", line 155, in _check_arg_types
    raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components

size error

UserWarning: Using a target size (torch.Size([1, 3, 1356, 204
0])) that is different to the input size (torch.Size([1, 3, 1224, 2040])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.

return F.l1_loss(input, target, reduction=self.reduction)

: the generator net can be wrong?????

Grayscale, dtype and normalization

the model currently does not support Grayscale images, he same applies to the loss function.
I could not find how to specify which normalization operation has to be applied to the dataset ([0,1], [-1,1], min max etc...)
Could you please get me some hints on how to proceed with the implementation.

poor results

Why do I get poor results when I use an already trained model for super-resolution, did you train this model?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.