Pytorch implementation of Deep Recursive Residual Network for Super Resolution (DRRN)

Overview

DRRN-pytorch

This is an unofficial implementation of "Deep Recursive Residual Network for Super Resolution (DRRN)", CVPR 2017 in Pytorch. [Paper]

You can get the official Caffe implementation here.

Usage

Training

usage: main.py [-h] [--batchSize BATCHSIZE] [--nEpochs NEPOCHS] [--lr LR]
               [--step STEP] [--cuda] [--resume RESUME]
               [--start-epoch START_EPOCH] [--clip CLIP] [--threads THREADS]
               [--momentum MOMENTUM] [--weight-decay WEIGHT_DECAY]
               [--pretrained PRETRAINED]
               
optional arguments:
  -h, --help            Show this help message and exit
  --batchSize           Training batch size
  --nEpochs             Number of epochs to train for
  --lr                  Learning rate. Default=0.1
  --step                Learning rate decay, Default: n=5 epochs
  --cuda                Use cuda?
  --resume              Path to checkpoint
  --clip                Clipping Gradients. Default=0.01
  --threads             Number of threads for data loader to use Default=1
  --momentum            Momentum, Default: 0.9
  --weight-decay        Weight decay, Default: 1e-4
  --pretrained          Path to the pretrained model, used for weight initialization (default: none)

Evaluation

usage: eval.py [-h] [--cuda] [--model MODEL] [--dataset DATASET]
               [--scale SCALE]

PyTorch DRRN Evaluation

optional arguments:
  -h, --help         show this help message and exit
  --cuda             use cuda?
  --model MODEL      model path
  --dataset DATASET  dataset name, Default: Set5

An example of training usage is shown as follows:

python eval.py --cuda

Prepare Training dataset

  • the training data is generated with Matlab Bicubic Interpolation, please refer Code for Data Generation for creating training files.

Performance

  • We provide a rough pre-trained DRRN_B1U25 model trained on 291 images with data augmentation. The model can achieve a better performance with a smart optimization strategy. For the DRRN_B1U9 implementation, you can manually modify the number of recursive blocks here.
  • The same adjustable gradient clipping's implementation as original paper.
  • No bias is used in this implementation.
  • No batch normalization is used in this implementation.
  • Performance in PSNR on Set5
Scale DRRN_B1U25 Paper DRRN_B1U25 PyTorch
x2 37.74 37.69
x3 34.03 34.02
x4 31.68 31.70
Issues
  • how does your implementation share the weight?

    how does your implementation share the weight?

    Hi, there, I don't find the any code to evident that the parameter is shared. Maybe becanse I don't I understand how to use the "weight shared function" of pytorch? Can u help me? thanks.

    class DRRN(nn.Module):
    	def __init__(self):
    		super(DRRN, self).__init__()
    		self.input = nn.Conv2d(in_channels=1, out_channels=128, kernel_size=3, stride=1, padding=1, bias=False)
    		self.conv1 = nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, stride=1, padding=1, bias=False)
    		self.conv2 = nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, stride=1, padding=1, bias=False)
    		self.output = nn.Conv2d(in_channels=128, out_channels=1, kernel_size=3, stride=1, padding=1, bias=False)
    		self.relu = nn.ReLU(inplace=True)
    
    		# weights initialization
    		for m in self.modules():
    			if isinstance(m, nn.Conv2d):
    				n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
    				m.weight.data.normal_(0, sqrt(2. / n))
    
    	def forward(self, x):
    		residual = x
    		inputs = self.input(self.relu(x))
    		out = inputs
    		for _ in range(25):
    			out = self.conv2(self.relu(self.conv1(self.relu(out))))
    			out = torch.add(out, inputs)
    
    		out = self.output(self.relu(out))
    		out = torch.add(out, residual)
    return out
    
    opened by pzz2011 1
  • No such file or directory: 'model/model_epoch_1.pth'

    No such file or directory: 'model/model_epoch_1.pth'

    python eval.py --model model/model_epoch_28.pth or python eval.py --model model_epoch_28.pth Where am I doing this wrong?

    opened by blackhumor22 0
  • why did you use BN layer?

    why did you use BN layer?

    I used it, got bad result. PSNR only 29
    QAQ Does BN layer is harmful for modle?

    opened by HelloBigLuo 0
  • 如何用自己数据集测试(How to test with my own dataset.)

    如何用自己数据集测试(How to test with my own dataset.)

    I want to be able to test with my own dataset. First, I need to convert the image to. Mat, such as a_ x2.mat ,a_ x4.mat In the project, for example, How is the file baby_ GT_ x2.mat generated?

    我希望能用自己的数据集测试,首先需要将图片转换为.mat,如a_x2.mat ,a_x4.mat 请问项目中例如baby_GT_x2.mat的文件是如何生成的?

    opened by clttyou 0
  • h5py objects cannot be pickled

    h5py objects cannot be pickled

    Hello, after I finished the H5 file on MATLAB, I ran main.py for training, and the TypeError: h5py objects cannot be pickled error appeared. What could be the reason?

    opened by qiqiing 0
  • how to do testing?

    how to do testing?

    It doesn't have test.py

    opened by tan-zixuan 0
  • 不能得到和论文一样的结果

    不能得到和论文一样的结果

    感谢大佬开源,我按照你的代码,没有改任何代码,跑50 epoch,发现在第50 epoch得到结果如下: Processing Set5_mat/head_GT_x2.mat Processing Set5_mat/butterfly_GT_x2.mat Processing Set5_mat/baby_GT_x2.mat Processing Set5_mat/woman_GT_x2.mat Scale= 2 Dataset= Set5 PSNR_predicted= 35.98152927120101 PSNR_bicubic= 33.69039381292539 It takes average 5.726621294021607s for processing Processing Set5_mat/woman_GT_x3.mat Processing Set5_mat/bird_GT_x3.mat Processing Set5_mat/baby_GT_x3.mat Processing Set5_mat/head_GT_x3.mat Processing Set5_mat/butterfly_GT_x3.mat Scale= 3 Dataset= Set5 PSNR_predicted= 32.590871083509164 PSNR_bicubic= 30.407692343235453 It takes average 5.687644147872925s for processing Processing Set5_mat/bird_GT_x4.mat Processing Set5_mat/woman_GT_x4.mat Processing Set5_mat/butterfly_GT_x4.mat Processing Set5_mat/head_GT_x4.mat Processing Set5_mat/baby_GT_x4.mat Scale= 4 Dataset= Set5 PSNR_predicted= 30.483599758580993 PSNR_bicubic= 28.41454827257395 It takes average 5.374003458023071s for processing

    相反的是我在第20 epoch得到了更好的结果,emmm,如果大佬有时间可以麻烦解答下么: Processing Set5_mat/head_GT_x2.mat Processing Set5_mat/butterfly_GT_x2.mat Processing Set5_mat/baby_GT_x2.mat Processing Set5_mat/woman_GT_x2.mat Scale= 2 Dataset= Set5 PSNR_predicted= 36.17091792433612 PSNR_bicubic= 33.69039381292539 It takes average 5.751824855804443s for processing Processing Set5_mat/woman_GT_x3.mat Processing Set5_mat/bird_GT_x3.mat Processing Set5_mat/baby_GT_x3.mat Processing Set5_mat/head_GT_x3.mat Processing Set5_mat/butterfly_GT_x3.mat Scale= 3 Dataset= Set5 PSNR_predicted= 32.7447910082183 PSNR_bicubic= 30.407692343235453 It takes average 5.653450155258179s for processing Processing Set5_mat/bird_GT_x4.mat Processing Set5_mat/woman_GT_x4.mat Processing Set5_mat/butterfly_GT_x4.mat Processing Set5_mat/head_GT_x4.mat Processing Set5_mat/baby_GT_x4.mat Scale= 4 Dataset= Set5 PSNR_predicted= 30.44373425939143 PSNR_bicubic= 28.41454827257395 It takes average 5.370740699768066s for processing

    opened by chaoyueziji 2
  • Debugging problem

    Debugging problem

    Can you teach me how to debug? ? This is my graduation design. After a long time of debugging, there are still many bugs. Thank you

    opened by hao891886881 0
  • training problem

    training problem

    Thank you for your wonderful work! I want to train a model with my own dataset, but there are something wrong in the process. The error is described as below:

    ===> Loading datasets ===> Building model /home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/nn/_reduction.py:49: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead. warnings.warn(warning.format(ret)) ===> Setting GPU ===> load model model/model_epoch_28.pth /home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) /home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) /home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/serialization.py:435: SourceChangeWarning: source code of class 'torch.nn.modules.activation.ReLU' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes. warnings.warn(msg, SourceChangeWarning) Traceback (most recent call last): File "main.py", line 128, in main() File "main.py", line 69, in main model.load_state_dict(weights['model'].state_dict()) File "/home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for DRRN: Missing key(s) in state_dict: "input.weight", "conv1.weight", "conv2.weight", "output.weight". Unexpected key(s) in state_dict: "module.input.weight", "module.conv1.weight", "module.conv2.weight", "module.output.weight".

    It seems that the parameters in model are miss? I can't understand the error, hoping you can give me some suggestions. Sincerely appreciate for your reply.

    opened by meroluo 1
  • how can i Generate the test_dataset?

    how can i Generate the test_dataset?

    hi sir, i want to generate other test_dataset,so how can i Generate the test_dataset? look forward your reply.

    opened by chenyuyi94 0
  • Why set_5.mat use double as ground truth

    Why set_5.mat use double as ground truth

    Hi I wonder how you generate the Set_5.mat. It shows that the ground truth are using double type and are not round to integer, if I try to round to integer, it gives a different psnr. However I found if I directly using rgb2ycrcb it gives an integer value in matlab.

    opened by HarukiYqM 0
  • How much loss value you get when in no.8 epoach?

    How much loss value you get when in no.8 epoach?

    hello sir,i wan to ask you ,how much loss value you get when in no.8 epoach? i always get approximately 180 loss value in no.3 epoach, is it normal?

    opened by chenyuyi94 0
Owner
yun_yang
yun_yang
PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

About PyTorch 1.2.0 Now the master branch supports PyTorch 1.2.0 by default. Due to the serious version problem (especially torch.utils.data.dataloade

Sanghyun Son 1.8k Jan 16, 2022
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"

NTIRE2017 Super-resolution Challenge: SNU_CVLab Introduction This is our project repository for CVPR 2017 Workshop (2nd NTIRE). We, Team SNU_CVLab, (B

Bee Lim 592 Dec 3, 2021
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 8 Dec 23, 2021
Pytorch implementation of “Recursive Non-Autoregressive Graph-to-Graph Transformer for Dependency Parsing with Iterative Refinement”

Graph-to-Graph Transformers Self-attention models, such as Transformer, have been hugely successful in a wide range of natural language processing (NL

Idiap Research Institute 34 Nov 25, 2021
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 403 Jan 5, 2022
PyTorch implementation of 1712.06087 "Zero-Shot" Super-Resolution using Deep Internal Learning

Unofficial PyTorch implementation of "Zero-Shot" Super-Resolution using Deep Internal Learning Unofficial Implementation of 1712.06087 "Zero-Shot" Sup

Jacob Gildenblat 183 Sep 25, 2021
The official pytorch implemention of the CVPR paper "Temporal Modulation Network for Controllable Space-Time Video Super-Resolution".

This is the official PyTorch implementation of TMNet in the CVPR 2021 paper "Temporal Modulation Network for Controllable Space-Time VideoSuper-Resolu

Gang Xu 74 Dec 31, 2021
PyTorch code for our paper "Attention in Attention Network for Image Super-Resolution"

Under construction... Attention in Attention Network for Image Super-Resolution (A2N) This repository is an PyTorch implementation of the paper "Atten

Haoyu Chen 51 Jan 4, 2022
PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network"

HAN PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network" This repository is for HAN introduced in the

五维空间 114 Jan 14, 2022
Official PyTorch code for Mutual Affine Network for Spatially Variant Kernel Estimation in Blind Image Super-Resolution (MANet, ICCV2021)

Mutual Affine Network for Spatially Variant Kernel Estimation in Blind Image Super-Resolution (MANet, ICCV2021) This repository is the official PyTorc

Jingyun Liang 84 Jan 12, 2022
PyTorch implementation of the Pose Residual Network (PRN)

Pose Residual Network This repository contains a PyTorch implementation of the Pose Residual Network (PRN) presented in our ECCV 2018 paper: Muhammed

Salih Karagoz 284 Nov 26, 2021
The official code for paper "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Modeling".

R2D2 This is the official code for paper titled "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Mode

Alipay 32 Jan 13, 2022
MaRS - a recursive filtering framework that allows for truly modular multi-sensor integration

The Modular and Robust State-Estimation Framework, or short, MaRS, is a recursive filtering framework that allows for truly modular multi-sensor integration

Control of Networked Systems - University of Klagenfurt 102 Jan 7, 2022
Official implementation of Deep Burst Super-Resolution

Deep-Burst-SR Official implementation of Deep Burst Super-Resolution Publication: Deep Burst Super-Resolution. Goutam Bhat, Martin Danelljan, Luc Van

Goutam Bhat 57 Jan 11, 2022
A PyTorch implementation for PyramidNets (Deep Pyramidal Residual Networks)

A PyTorch implementation for PyramidNets (Deep Pyramidal Residual Networks) This repository contains a PyTorch implementation for the paper: Deep Pyra

Greg Dongyoon Han 246 Jan 12, 2022
PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021.

GCResNet PyTorch implementation of Graph Convolutional Networks in Feature Space for Image Deblurring and Super-resolution, IJCNN 2021. The code will

null 8 Jan 13, 2022
PyTorch implementation of EGVSR: Efficcient & Generic Video Super-Resolution (VSR)

This is a PyTorch implementation of EGVSR: Efficcient & Generic Video Super-Resolution (VSR), using subpixel convolution to optimize the inference speed of TecoGAN VSR model. Please refer to the official implementation ESPCN and TecoGAN for more information.

null 662 Jan 14, 2022
Implementation of paper: "Image Super-Resolution Using Dense Skip Connections" in PyTorch

SRDenseNet-pytorch Implementation of paper: "Image Super-Resolution Using Dense Skip Connections" in PyTorch (http://openaccess.thecvf.com/content_ICC

wxy 113 Nov 11, 2021
Unoffical implementation about Image Super-Resolution via Iterative Refinement by Pytorch

Image Super-Resolution via Iterative Refinement Paper | Project Brief This is a unoffical implementation about Image Super-Resolution via Iterative Re

LiangWei Jiang 1.6k Jan 13, 2022