Giter Club home page Giter Club logo

lapsrn's Introduction

Deep Laplacian Pyramid Networks for Fast and Accurate Super-Resolution (CVPR 2017)

Wei-Sheng Lai, Jia-Bin Huang, Narendra Ahuja, and Ming-Hsuan Yang

IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017

Table of Contents

  1. Introduction
  2. Citation
  3. Requirements and Dependencies
  4. Installation
  5. Test Pre-trained Models
  6. Training LapSRN
  7. Training MS-LapSRN
  8. Third-Party Implementation

Introduction

The Laplacian Pyramid Super-Resolution Network (LapSRN) is a progressive super-resolution model that super-resolves an low-resolution images in a coarse-to-fine Laplacian pyramid framework. Our method is fast and achieves state-of-the-art performance on five benchmark datasets for 4x and 8x SR. For more details and evaluation results, please check out our project webpage and paper.

teaser

Citation

If you find the code and datasets useful in your research, please cite:

@inproceedings{LapSRN,
    author    = {Lai, Wei-Sheng and Huang, Jia-Bin and Ahuja, Narendra and Yang, Ming-Hsuan}, 
    title     = {Deep Laplacian Pyramid Networks for Fast and Accurate Super-Resolution}, 
    booktitle = {IEEE Conferene on Computer Vision and Pattern Recognition},
    year      = {2017}
}

Requirements and Dependencies

  • MATLAB (we test with MATLAB R2017a on Ubuntu 16.04 and Windows 7)
  • Cuda & Cudnn (we test with Cuda 8.0 and Cudnn 5.1)

Installation

Download repository:

$ git clone https://github.com/phoenix104104/LapSRN.git

Run install.m in MATLAB to compile MatConvNet:

# Start MATLAB
$ matlab
>> install

If you install MatConvNet in your own path, you need to change the corresponding path in install.m, train_LapSRN.m and test_LapSRN.m.

Test Pre-trained Models

To test LapSRN / MS-LapSRN on a single-image:

>> demo_LapSRN
>> demo_MSLapSRN

This script will load the pretrained LapSRN / MS-LapSRN model and apply SR on emma.jpg.

To test LapSRN / MS-LapSRN on benchmark datasets, first download the testing datasets:

$ cd datasets
$ wget http://vllab1.ucmerced.edu/~wlai24/LapSRN/results/SR_testing_datasets.zip
$ unzip SR_testing_datasets.zip
$ cd ..

Then choose the evaluated dataset and upsampling scale in evaluate_LapSRN_dataset.m and evaluate_MSLapSRN_dataset.m, and run:

>> evaluate_LapSRN_dataset
>> evaluate_MSLapSRN_dataset

which can reproduce the results in our paper.

Training LapSRN

To train LapSRN from scratch, first download the training datasets:

$ cd datasets
$ wget http://vllab1.ucmerced.edu/~wlai24/LapSRN/results/SR_training_datasets.zip
$ unzip SR_train_datasets.zip
$ cd ..

or use the provided bash script to download all datasets and unzip at once:

$ cd datasets
$ ./download_SR_datasets.sh
$ cd ..

Then, setup training options in init_LapSRN_opts.m, and run train_LapSRN(scale, depth, gpuID). For example, to train LapSRN with depth = 10 for 4x SR using GPU ID = 1:

>> train_LapSRN(4, 10, 1)

Note that we only test our code on single-GPU mode. MatConvNet supports training with multiple GPUs but you may need to modify our script and options (e.g., opts.gpu).

To test your trained LapSRN model, use test_LapSRN(model_name, epoch, dataset, test_scale, gpu). For example, test LapSRN with depth = 10, scale = 4, epoch = 10 on Set5:

>> test_LapSRN('LapSRN_x4_depth10_L1_train_T91_BSDS200_pw128_lr1e-05_step50_drop0.5_min1e-06_bs64', 10, 'Set5', 4, 1)

which will report the PSNR and SSIM.

Training MS-LapSRN

Setup training options in init_MSLapSRN_opts.m, and run train_MSLapSRN(scales, depth, recursive, gpuID), where scales should be a vector, e.g., [2, 4, 8]. For example, to train MS-LapSRN with D = 5, R = 2 for 2x, 4x and 8x SR:

>> train_MSLapSRN([2, 4, 8], 5, 2, 1)

To test your trained MS-LapSRN model, use test_MS-LapSRN(model_name, model_scale, epoch, dataset, test_scale, gpu), where model_scale is used to define the number of pyramid levels. test_scale could be different from model_scale. For example, test MS-LapSRN-D5R2 with two pyramid levels (model_scale = 4), epoch = 10, on Set5 for 3x SR:

>> test_MSLapSRN('MSLapSRN_x248_SS_D5_R2_fn64_L1_train_T91_BSDS200_pw128_lr5e-06_step100_drop0.5_min1e-06_bs64', 4, 10, 'Set5', 3, 1)

which will report the PSNR and SSIM.

Third-Party Implementation

lapsrn's People

Contributors

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

lapsrn's Issues

error in running demo

Hi,
System configuration:

  • Windows 10
  • Matlab 2017a
  • Visual Studio 2013

>> demo_LapSRN
Warning: Name is nonexistent or not a directory:
D:\Users\user\sr\LapSNR\LapSRN-master\LapSRN-master\matconvnet\matlab
> In path (line 109)
In addpath (line 88)
In demo_LapSRN (line 25)
Load pretrained_models\LapSRN_x4.mat
Undefined function or variable 'dagnn.vllab_dag_loss'.

Error in dagnn.DagNN.loadobj (line 26)
block = constr() ;

Error in demo_LapSRN (line 33)
net = dagnn.DagNN.loadobj(net.net);

Any help please?
Thanks.

train problem and times about cpu

hello, can I train this code in CPU not GPU?
if I train it in CPU,which part of code do I need to modify?
And how many days do I need to train?

Error when installing MatConvNet as shown on the page.

Error using vl_compilenn>search_cuda_devkit (line 658)
Could not find a valid NVCC executable\n

Error in vl_compilenn (line 270)
if isempty(opts.cudaRoot), opts.cudaRoot = search_cuda_devkit(opts) ; end

Error in install (line 17)
vl_compilenn('enableGPu', true, 'enableCudnn', true);

PSNR

Thank you for your code. I have a question that how to calculate PSNR of Set5 and Set14? Could you help me?

Some questions about bilinear_kernel.m

Some thing wrong when I use 3 channel bilinear kernel. Following is the 2 upsampling results and original images.
qq 20180131192344
qq 20180131192709
My init code is followings:

function net = add_USN_noise(net, layername, varname, parname, filter_size, scale)
% --------------------------------------------------------------------
crop_default = 1;
stride_default = scale;
net.addLayer(layername, ...
dagnn.ConvTranspose('upsample', stride_default,'crop', crop_default,'hasBias',false), ...
varname{1}, varname{2}, parname);

f = net.getParamIndex(parname) ;
filters = single(bilinear_kernel(4,3,3));
net.params(f).value = filters ;
net.params(f).learningRate = 1;
net.params(f).weightDecay  = 1;
net.params(f).trainMethod = 'adam';

end

Do you have any idea of this problem? Thank you.

Train Loss

Excuse me, thank you very much for your code. I would like to ask how to calculate the training loss? How did the HR picture come from?
Looking forward to your busy reply, thank you!

Error occurs when runnig demo_LapSRN.m

It is successful to run install.m in matlab, but error occurs as follow:
**_>> demo_LapSRN
Load pretrained_models\LapSRN_x4.mat
error dagnn.Layer/load (line 200)
No property ignoreAverage for a layer of type dagnn.vllab_dag_loss.
error dagnn.DagNN.loadobj (line 28)
block.load(struct(s.layers(l).block)) ;

error demo_LapSRN (line 33)
net = dagnn.DagNN.loadobj(net.net);_**

waiting your answer...

The number of epoch

How many epoch can be trained to achieve the effect of the paper?
Thank you for your answer.

ERRORS in code

I followed your instructions but I get this error.
The error is "Undefined function or variable 'dagnn.vllab_dag_loss'".

Thank you for your help . @phoenix104104

what is the version of MatConvNet used in this code?

Thanks for code publicly!
I encountered a version problem that as follows:
"No property ignoreAverage for a layer of type dagnn.vllab_dag_loss."
After searched in the internet, maybe caused by the different version of MatConvNet. So could u tell me what is the version of MatConvNet used in this code?

The Set5 (x4) result reported reproduce

Thanks for your code, I can't reproduce the result with my own model when training the T91 BSDS200 and General100 images. The PSNR of Set5(x4) only 29.7. but the papers PSNR of Set5(x4) is 31.54. Can you provide some details about the training parameters ?

SR video

Thank you for your code. I have read your thesis, saying that you can perform real-time super-resolution on the video. How do you implement this part?

Error occurs when loading pre-trained_models

When I try to load the pre-trained_models, a error always occurs and I don't know how to fix it. I have checked that this is not caused by path but it seemed there are some problems in these .mat files or in the code.
error

Datasets URL was not found

image

The url of the data set seems to be invalid. Can you provide usable data set url? Or is there an alternative?

image

Python source code

Hi

Thanks for sharing. Unfortunately I don't have MATLAB. Wondering if it is possible to have Python version ? Thanks

About the training dataset

thanks for your code.As you mentioned in the paper,the training dataset is t91 and bsd 200.However,the dataset is t91+bsd200+g100... So ,what is the result for your paper? Is is consist of General 100?

T91 and BSD200 are HR or LR images?

Firstly. thank you for your code and paper.
As a beginner, I don't know 291 images in the paper are input LR images or the ground truth HR images. But whatever they are, they need the corresponding HR/LR images when being trained. I downloaded the Training Datasets (86.2 MB) in the link(http://vllab.ucmerced.edu/wlai24/LapSRN/). In the folder, there are 291 images in T91 and BSD200 not 291*2 images.
Looking forward to the recovery of you or others. Thanks.

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.