Git Product home page Git Product logo

srcnn's Introduction

Image Super-Resolution Using Deep Convolutional Networks

Tensorflow implementation of SRCNN.

Prerequisites

  • Python 3
  • Tensorflow
  • Numpy
  • Scipy
  • Opencv 3
  • h5py

Usage

To train, uncomment the scripts in the bottom in net.py. Then type python net.py
To test, set proper img_path, save_path and upscaling factor (multiplier) in the use_SRCNN.py. Then type python use_SRCNN.py

Results

The following results are based on 45 hours of training on my i7 CPU.

Bicubic interpolation:
bicubic
SRCNN:
srcnn



Bicubic interpolation:
bicubic
SRCNN:
srcnn



Bicubic interpolation:
bicubic
SRCNN:
srcnn

We can also feed any image to this model to get an upscaled version with interpolated details:
Original image:
lenna
SRCNN:
3xlenna

Reference:

srcnn's People

Contributors

edwardlzy 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

Watchers

 avatar  avatar

srcnn's Issues

Pretrained Model

Dear Zhiyu,

could you please provide the pretrained model for SRCNN with RGB as input channel? The original paper only provides a model with Y as input.

Best regards
Andreas

Gaussian blur not applied to input images

I noticed that you missed the step of bluring the images between down-sampling and up-sampling. From prepare_train.py:

im_temp = scipy.misc.imresize(im_label, 1/scale, interp='bicubic')
im_input = scipy.misc.imresize(im_temp, size, interp='bicubic')

This still created distorted images, but I think it makes the task easier when the blur isn't applied.

img = im2double(img) # Only use the luminance value.

Hi @Edwardlzy , I am replicating the same paper . I am having trouble pre-processing the input image.

This function is normalizing image converted to YCB_CR format .

Where in the code are you extracting the luminance value of YCB_CR format image?
Also, according to the paper, Gaussian blur needs to be added to the input image before rescaling it by factor of 3.

can't train with the tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')

When I try to try the network with the padding = "SAME" in the code:
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='VALID')
“””
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
“””
in flie net.py,
and the it goes wrong:
in the code: l2_loss = tf.reduce_mean(tf.square(labels - model))
ValueError: Dimensions must be equal, but are 21 and 33 for 'sub' (op: 'Sub') with input shapes: [?,21,21,1], [?,33,33,1].
Can you tell me how to solve this problem? Thanks!

About:OSError

Hello! First of all, thank you for sharing your code on github. I had the honor to reproduce your program recently, but encountered a problem, as follows:

Traceback (most recent call last):
File "net.py", line 162, in
train_SRCNN(images)
File "net.py", line 92, in train_SRCNN
train_data, train_label = load_data(train_path)
File "net.py", line 24, in load_data
with h5py.File(path, 'r') as hf:
File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 408, in init
swmr=swmr)
File "/root/anaconda3/lib/python3.7/site-packages/h5py/_hl/files.py", line 173, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 88, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = './checkpoint/train.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Can you help me solve this problem? Thank you for reading during your busy schedule and wish you a happy life!

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.