Giter Site home page Giter Site logo

rdn's Introduction

Residual Dense Network for Image Super-Resolution

This repository is for RDN introduced in the following paper

Yulun Zhang, Yapeng Tian, Yu Kong, Bineng Zhong, and Yun Fu, "Residual Dense Network for Image Super-Resolution", CVPR 2018 (spotlight), [arXiv]

Yulun Zhang, Yapeng Tian, Yu Kong, Bineng Zhong, and Yun Fu, "Residual Dense Network for Image Restoration", arXiv 2018, [arXiv]

Visual Results

[Visual Results@BaiduDrive], [Visual Results@GoodleDrive]

The code is built on EDSR (Torch) and tested on Ubuntu 14.04 environment (Torch7, CUDA8.0, cuDNN5.1) with Titan X/1080Ti/Xp GPUs.

Other implementations: PyTorch_version has been implemented by Nguyễn Trần Toàn ([email protected]) and merged into EDSR_PyTorch. TensorFlow_version by hengchuan.

Contents

  1. Introduction
  2. Train
  3. Test
  4. Results
  5. Citation
  6. Acknowledgements

Introduction

A very deep convolutional neural network (CNN) has recently achieved great success for image super-resolution (SR) and offered hierarchical features as well. However, most deep CNN based SR models do not make full use of the hierarchical features from the original low-resolution (LR) images, thereby achieving relatively-low performance. In this paper, we propose a novel residual dense network (RDN) to address this problem in image SR. We fully exploit the hierarchical features from all the convolutional layers. Specifically, we propose residual dense block (RDB) to extract abundant local features via dense connected convolutional layers. RDB further allows direct connections from the state of preceding RDB to all the layers of current RDB, leading to a contiguous memory (CM) mechanism. Local feature fusion in RDB is then used to adaptively learn more effective features from preceding and current local features and stabilizes the training of wider network. After fully obtaining dense local features, we use global feature fusion to jointly and adaptively learn global hierarchical features in a holistic way. Experiments on benchmark datasets with different degradation models show that our RDN achieves favorable performance against state-of-the-art methods.

RDB Figure 1. Residual dense block (RDB) architecture. RDN Figure 2. The architecture of our proposed residual dense network (RDN).

Train

Prepare training data

  1. Download DIV2K training data (800 training + 100 validtion images) from DIV2K dataset or SNU_CVLab.

  2. Place all the HR images in 'Prepare_TrainData/DIV2K/DIV2K_HR'.

  3. Run 'Prepare_TrainData_HR_LR_BI/BD/DN.m' in matlab to generate LR images for BI, BD, and DN models respectively.

  4. Run 'th png_to_t7.lua' to convert each .png image to .t7 file in new folder 'DIV2K_decoded'.

  5. Specify the path of 'DIV2K_decoded' to '-datadir' in 'RDN_TrainCode/code/opts.lua'.

For more informaiton, please refer to EDSR(Torch).

Begin to train

  1. (optional) Download models for our paper and place them in '/RDN_TrainCode/experiment/model'.

    All the models can be downloaded from Dropbox or Baidu.

  2. Cd to 'RDN_TrainCode/code', run the following scripts to train models.

    You can use scripts in file 'TrainRDN_scripts' to train models for our paper.

    # BI, scale 2, 3, 4
    # BIX2F64D18C6G64P48, input=48x48, output=96x96
    th main.lua -scale 2 -netType RDN -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 96 -dataset div2k -datatype t7  -DownKernel BI -splitBatch 4 -trainOnly true
    
    # BIX3F64D18C6G64P32, input=32x32, output=96x96, fine-tune on RDN_BIX2.t7
    th main.lua -scale 3 -netType resnet_cu -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 96 -dataset div2k -datatype t7  -DownKernel BI -splitBatch 4 -trainOnly true  -preTrained ../experiment/model/RDN_BIX2.t7
    
    # BIX4F64D18C6G64P32, input=32x32, output=128x128, fine-tune on RDN_BIX2.t7
    th main.lua -scale 4 -nGPU 1 -netType resnet_cu -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 128 -dataset div2k -datatype t7  -DownKernel BI -splitBatch 4 -trainOnly true -nEpochs 1000 -preTrained ../experiment/model/RDN_BIX2.t7 
    
    # BD, scale 3
    # BDX3F64D18C6G64P32, input=32x32, output=96x96, fine-tune on RDN_BIX3.t7
    th main.lua -scale 3 -nGPU 1 -netType resnet_cu -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 96 -dataset div2k -datatype t7  -DownKernel BD -splitBatch 4 -trainOnly true -nEpochs 200 -preTrained ../experiment/model/RDN_BIX3.t7
    
    # DN, scale 3
    # DNX3F64D18C6G64P32, input=32x32, output=96x96, fine-tune on RDN_BIX3.t7
    th main.lua -scale 3 -nGPU 1 -netType resnet_cu -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 96 -dataset div2k -datatype t7  -DownKernel DN -splitBatch 4 -trainOnly true  -nEpochs 200 -preTrained ../experiment/model/RDN_BIX3.t7

    Only RDN_BIX2.t7 was trained using 48x48 input patches. All other models were trained using 32x32 input patches in order to save training time. However, smaller input patch size in training would lower the performance to some degree. We also set '-trainOnly true' to save GPU memory.

Test

Quick start

  1. Download models for our paper and place them in '/RDN_TestCode/model'.

    All the models can be downloaded from Dropbox or Baidu.

  2. Run 'TestRDN.lua'

    You can use scripts in file 'TestRDN_scripts' to produce results for our paper.

    # No self-ensemble: RDN
    # BI degradation model, X2, X3, X4
    th TestRDN.lua -model RDN_BIX2 -degradation BI -scale 2 -selfEnsemble false -dataset Set5
    th TestRDN.lua -model RDN_BIX3 -degradation BI -scale 3 -selfEnsemble false -dataset Set5
    th TestRDN.lua -model RDN_BIX4 -degradation BI -scale 4 -selfEnsemble false -dataset Set5
    # BD degradation model, X3
    th TestRDN.lua -model RDN_BDX3 -degradation BD -scale 3 -selfEnsemble false -dataset Set5
    # DN degradation model, X3
    th TestRDN.lua -model RDN_DNX3 -degradation DN -scale 3 -selfEnsemble false -dataset Set5
    
    
    # With self-ensemble: RDN+
    # BI degradation model, X2, X3, X4
    th TestRDN.lua -model RDN_BIX2 -degradation BI -scale 2 -selfEnsemble true -dataset Set5
    th TestRDN.lua -model RDN_BIX3 -degradation BI -scale 3 -selfEnsemble true -dataset Set5
    th TestRDN.lua -model RDN_BIX4 -degradation BI -scale 4 -selfEnsemble true -dataset Set5
    # BD degradation model, X3
    th TestRDN.lua -model RDN_BDX3 -degradation BD -scale 3 -selfEnsemble true -dataset Set5
    # DN degradation model, X3
    th TestRDN.lua -model RDN_DNX3 -degradation DN -scale 3 -selfEnsemble true -dataset Set5

The whole test pipeline

  1. Prepare test data.

    Place the original test sets (e.g., Set5, other test sets are available from GoogleDrive or Baidu) in 'OriginalTestData'.

    Run 'Prepare_TestData_HR_LR.m' in Matlab to generate HR/LR images with different degradation models.

  2. Conduct image SR.

    See Quick start

  3. Evaluate the results.

    Run 'Evaluate_PSNR_SSIM.m' to obtain PSNR/SSIM values for paper.

Results

Visual Results

[Visual Results@BaiduDrive], [Visual Results@GoodleDrive] PSNR_SSIM_BI Table 1. Benchmark results with BI degradation model. Average PSNR/SSIM values for scaling factor ×2, ×3, and ×4.

PSNR_SSIM_BD_DN Table 2. Benchmark results with BD and DN degradation models. Average PSNR/SSIM values for scaling factor ×3.

Citation

If you find the code helpful in your resarch or work, please cite the following papers.

@InProceedings{Lim_2017_CVPR_Workshops,
  author = {Lim, Bee and Son, Sanghyun and Kim, Heewon and Nah, Seungjun and Lee, Kyoung Mu},
  title = {Enhanced Deep Residual Networks for Single Image Super-Resolution},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
  month = {July},
  year = {2017}
}

@inproceedings{zhang2018residual,
    title={Residual Dense Network for Image Super-Resolution},
    author={Zhang, Yulun and Tian, Yapeng and Kong, Yu and Zhong, Bineng and Fu, Yun},
    booktitle={CVPR},
    year={2018}
}

@article{zhang2020rdnir,
    title={Residual Dense Network for Image Restoration},
    author={Zhang, Yulun and Tian, Yapeng and Kong, Yu and Zhong, Bineng and Fu, Yun},
    journal={TPAMI},
    year={2020}
}

Acknowledgements

This code is built on EDSR (Torch). We thank the authors for sharing their codes of EDSR Torch version and PyTorch version.

rdn's People

Contributors

yulunzhang 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdn's Issues

RDN for image restoration/denoise

Hi, is image restoration already included in this repository? If so, it will be very kind of you if you could offer some guides on training and testing a model by myself. Thanks!

About the validation result when I train just 1 epoch

Hello. I have a question.

I want to train the network by using SR291 dataset.
I tried to change the parameters and code.
However, when I train with 1 epoch, the validation result is too good (e.g. 37.0581).
It seems to be used some other model which I didn't train.
So, when I want to make new model with other dataset, where should I change?

Denoising model - pytorch version

Hi,

Thanks for your amazing work,

After checking the repo of EDST - pytorch, it seems that they didn't put denoising model in their code.

Therefore, I was wondering if anyone could provide it in PyTorch version.

Thanks in advance.

super-resolution results for each dataset

The pytorch version of the code reproduces results that are different from those in your paper, and lua is rarely used nowadays. Can you please provide the super-resolved results of each dataset?

Regarding intuition compareed to MemNet

Hi, Really loved reading the paper!

I just had one small confusion. What is MemNet lacking that you are trying to resolve?

Your point from the paper:
MemNet interpolates the original LR image to the desired size to form the input. This preprocessing step not only increases computation complexity quadratically but also loses some details of the original LR image.

I have read MenNet they also do have the same feature extraction initial network as yours followed by memblocks and reconnet.

So what does this above point mean?

Thank you!

RDN best psnr x4 in set5

Hi, Thank you very much for sharing.
I hava some questions in training.
How much time do you spending?
How many epoch you have been trained?

MSE LOSS

Hi,
How much loss(MSE) did u obtained after your training got completed, I've trained my model for about 100 epochs and its ~100 ?
Moreover, I'm using RandomCrop of patches of LR and HR for training ...how will it effect my training?

Thank you

how many Iterations do we need,when we train this mode?

th main.lua -scale 3 -netType resnet_cu -nFeat 64 -nFeaSDB 64 -nDenseBlock 16 -nDenseConv 8 -growthRate 64 -patchSize 96 -dataset div2k -datatype t7 -DownKernel BI -splitBatch 4 -trainOnly true
我跑这个代码,但是160000次迭代也没有停下来,该怎么设置?我们需要多少迭代次数

Training Setting

Hi, your work was excellent and I'm tring to reimplement it as I can understand it deeperly.

I have one question that you said in your paper "Learning rate decreases half for every 200 epochs", and you trian RDN "takes 1 day with a Titan Xp GPU for 200 epochs", did that mean you didn't half down learning rate in whole training? Cause as far as I understand you just train your net for 200 epochs.

Btw, do you think DATA AUGMENTATION is necessary for SR tasks? if input always a patch, 800 images of DIV2K can produce enough patches for 200 iterations of 1000 steps per iteration

Looking forward your reply!

Training

Hi
Thank you very mutch for your code. I have review the model. While, I am not familiar with torch and I get the result of 36.2648. When I read all the issues, I had found that you have skipped some batches when training. Could you tell me where the code or the regular. Waiting for you request.Thank you!

.lua file

When I am working on '.lua' code to convert from png to t7 format it is showing error. the error is

Error -> [string "png_to_t7.lua"]:1: module 'image' not found:
no field package.preload['image']
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm\lua\image.lua'
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm\lua\image\init.lua'
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm\image.lua'
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm\image\init.lua'
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm..\share\lua\5.3\image.lua'
no file 'C:\Program Files\WindowsApps\61954lingguang.LuaScriptTest_2.0.0.0_x64__5b5h4n7n89bzm..\share\lua\5.3\image\init.lua'
no file '.\image.lua'
no file '.\image\init.lua'

I changed the path of DIV2K folder. still same error appears can any one suggest me what mistake i made.#

the code file attached below for your reference.

Thank you in advance.

中文注释版本

您好。打扰了。我记得您之前提供过中文注释版本的code,请问可以再上传一次嘛?多谢多谢!!

epochs in trainning

Hi, thanks for you great work. I find nEpochs is set as 10000 in the opts.lua, does it mean that we need 10000 epochs to get the results in the paper ?

denseblock有没有用Bottleneck layers设计

您好,本人没有学过lua语言,尽力去看懂您的代码,但还是不能理解。最初densenet在33之前加了一层11(减少输入特征图的数量,从而提高计算效率),看您论文当中并没有类似的操作,不知道您的代码或者实现中,是不是没有Bottleneck layers设计?非常抱歉用中文向您提问,感谢

model

Hi, yulun,
Thanks for your excellent work.

I am wondering how to build the model you use? There are many files in "./models", like "RDN", "baseline". If I would like to construct the basic network you use as "Residual Dense Network", how should I follow each steps?

Thank you. :)

DND dataset

Do you have any results on DND (Darmstadt Noise Dataset), say sRGB ?

Testing on "wild SR" = track 4 NTIRE2018

Hi,
I am interested in the NTIRE2018 track4 challenge (wild SR)
This may be a basic question but to which of your degradation methods does this challenge refer? (BI\BD\etc.)
To the best of your knowledge\assumption - would your network perform good SR on any random image (e.g. taken from a phone) or are there degradation limitations?

Thank you

您好!请教有关模型的参数量。

请问PTAMI模型的参数量是多少?您的CVPR论文的参数量好像与TPAMI的论文不同。PAMI中您好像只提及了x2的是22M,我想问一下x3和x4的

model does not converge

hi,sorry to bother you,but I have a problem that model does not converge,what should I do?can you give me some suggestions?thank you so much.the loss function i used is l1 loss

default

Do you have RDN models on the pytorch framework?

Hi,
I cannot install Torch7 because it is too old to install corresponding software package.
So do you have RDN models on the pytorch framework?
Or could you share some SR results produced by RDN?
I just want to compare visual quality.
Looking forward to your reply

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.