Giter Club home page Giter Club logo

srgan's Introduction

SRGAN

This is implementation of SRGAN under working.

Currently only generator part is implemented. SRResNet is implemented but not benchmarked yet. SRGAN is hopefully implementation soon. I can't reproduce PSNR of bicubic in the paper, thus haven't measured the PSNR.

The paper is Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network.

These images are generated from LR images into 4x SR with trained with with the code. Check 23K results Reproduce result 2 3

There more experiments going on. For ex, using preactivation ResNet, 4x4 deconvolution layer to remove artifacts.

This repository started from altering Torch7-Network Profiler. Used ResNet but changed a lot from original. Final using model is models/resnet-deconv2.lua. The model trained uses 9x9 conv for first and last Conv layers and 15 residual blocks.

LR Patch is 3x24x24 and SR Patch is 3x96x96. It was vague in the paper that 96x96x is either LR or SR but LR96 was untrainable because of not enough memory (GTX1080).

Trained with ImageNet (50 images from 1000 classes that have 3 channel and bigger than 3x288x288). For first time, just uncomment prepImageNet to have paths to images. Save it as imgBatch.t7 After then, comment these as original code and load it.

Only supports, cuda/cudnn backend.

To profile network,

th profile-model.lua -m models/resnet-deconv2.lua -r 16x3x24x24 -p cuda

To train network,

First, parse ImageNet dataset. Manually set datasetPath variable as your ImageNet path. The path is expected to have 1000 sub category folders.

th prepImageNet.lua

Then, start train with

th train-SRResNet.lua -model_name 9x9-15res-LR24 It will save checkpoints in model_name directory.

To resume training,

th train-SRResNet.lua -model_name 9x9-15res-LR24 -checkpoint_start_from models/9x9-15res-LR24/230000.t7

To run/test model,

th run-SRResNet.lua -checkpoint_path models/9x9-15res-LR24/230000.t7 -dataset BSD100 -result_path results_23K

-dataset can be BSD100|Set5|Set14.

If memory is not big enough, will print 'oom' and move on.

Model weight

For those who need weight, download this weight in your

./checkpoints/9x9-15res-LR24 : 700K iter ./checkpoints/VGGloss-4x4deconv : [24K iter](: https://www.dropbox.com/s/ngru09rhfjzfos0/24000.t7?dl=0)

Currently Doing

  1. I've tried training in preactviation resnet and removing artifacts by deconv. So far, analyzing what are pros and cons.

  2. ContentLoss. Inlcuded VGG/saveVGG19.sh to build VGG loss.

  • luarocks install loadcaffe
  • Download VGG : cd VGG; ./saveVGG19
  • luarocks install https://raw.githubusercontent.com/szym/display/master/display-scm-0.rockspec
  • th -ldisplay.start 8000 0.0.0.0
  • th train-SRResNet-VGGloss.lua -arch models/resnet-4x4deconv-preact.lua -model_name VGGloss-4x4deconv -checkpoint_save_iter 1000
  • localhost:8000 shows training visualization vis
  1. PSNR

srgan's People

Contributors

atcold avatar bmartini avatar codeac29 avatar culurciello avatar jhjin avatar junhocho avatar spk921 avatar syed-ahmed 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

srgan's Issues

image.load loads an image into a torch.Tensor Error!!!

th train-SRResNet.lua -model_name 9x9-15res-LR24
{
iter_end : 10000000
checkpoint_start_from : ""
beta : 0.9
model_name : "9x9-15res-LR24"
arch : ""
checkpoint_save_iter : 10000
lr : 0.001
}
ResNet-34 ImageNet
ImageNet loaded, # of imgs:0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
image.load

loads an image into a torch.Tensor

usage:
image.load(
string -- path to file
[number] -- force destination depth: 1 | 3
[string] -- type: byte | float | double
)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/Users/anthonyyuan/torch/install/bin/luajit: ...s/anthonyyuan/torch/install/share/lua/5.1/dok/inline.lua:738: <image.load> missing file name
stack traceback:
[C]: in function 'error'
...s/anthonyyuan/torch/install/share/lua/5.1/dok/inline.lua:738: in function 'error'
...s/anthonyyuan/torch/install/share/lua/5.1/image/init.lua:345: in function 'load'
./src/util.lua:13: in function 'crop_SR_LR_patches'
./src/util.lua:52: in function 'setBatch'
train-SRResNet.lua:104: in main chunk
[C]: in function 'dofile'
...yuan/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x01092febc0

PSNR of bicubic

I can't reproduce PSNR of bicubic in the paper,

Long time ago, I also has the same problem for reproducing superresolution papers.

This problem caused by MATLAB's rgb2ycbcr for converting grayscale image. MATLAB's rgb2ycbcr returns [16 235], not [0 255]. This causes higher PSNR than correct PSNR. I think many papers has this bug in benchmark code.

When reproducing this bug, PSNR of bicubic was successfully reproduced.
See my bencharmk code: https://github.com/nagadomi/waifu2x/blob/master/tools/benchmark.lua#L105

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.