All Projects → kweisamx → Tensorflow Espcn

kweisamx / Tensorflow Espcn

Licence: apache-2.0
TensorFlow implementation of the Efficient Sub-Pixel Convolutional Neural Network

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tensorflow Espcn

Wdsr ntire2018
Code of our winning entry to NTIRE super-resolution challenge, CVPR 2018
Stars: ✭ 570 (+1063.27%)
Mutual labels:  super-resolution
Pytorch Implemented Deep Sr Itm
A Pytorch implemented Deep SR-ITM (ICCV2019)
Stars: ✭ 23 (-53.06%)
Mutual labels:  super-resolution
Tensorflow Srgan
Tensorflow implementation of "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network" (Ledig et al. 2017)
Stars: ✭ 33 (-32.65%)
Mutual labels:  super-resolution
Srgan
A PyTorch implementation of SRGAN based on CVPR 2017 paper "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"
Stars: ✭ 644 (+1214.29%)
Mutual labels:  super-resolution
Srgan Tensorflow
Tensorflow implementation of the SRGAN algorithm for single image super-resolution
Stars: ✭ 754 (+1438.78%)
Mutual labels:  super-resolution
Training extensions
Trainable models and NN optimization tools
Stars: ✭ 857 (+1648.98%)
Mutual labels:  super-resolution
Ntire2017
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"
Stars: ✭ 554 (+1030.61%)
Mutual labels:  super-resolution
Rcan Tensorflow
Image Super-Resolution Using Very Deep Residual Channel Attention Networks Implementation in Tensorflow
Stars: ✭ 43 (-12.24%)
Mutual labels:  super-resolution
Neuralsuperresolution
Real-time video quality improvement for applications such as video-chat using Perceptual Losses
Stars: ✭ 18 (-63.27%)
Mutual labels:  super-resolution
Super Resolution
Tensorflow 2.x based implementation of EDSR, WDSR and SRGAN for single image super-resolution
Stars: ✭ 952 (+1842.86%)
Mutual labels:  super-resolution
Kair
Image Restoration Toolbox (PyTorch). Training and testing codes for USRNet, DnCNN, FFDNet, SRMD, DPSR, ESRGAN
Stars: ✭ 677 (+1281.63%)
Mutual labels:  super-resolution
Super Resolution.benckmark
Benchmark and resources for single super-resolution algorithms
Stars: ✭ 745 (+1420.41%)
Mutual labels:  super-resolution
Dncnn
Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising (TIP, 2017)
Stars: ✭ 912 (+1761.22%)
Mutual labels:  super-resolution
Dcscn Super Resolution
A tensorflow implementation of "Fast and Accurate Image Super Resolution by Deep CNN with Skip Connection and Network in Network", a deep learning based Single-Image Super-Resolution (SISR) model.
Stars: ✭ 611 (+1146.94%)
Mutual labels:  super-resolution
Hyperspectral Image Spatial Super Resolution Via 3d Full Convolutional Neural Network
Hyperspectral Image Spatial Super-Resolution via 3D-Full-Convolutional-Neural-Network
Stars: ✭ 41 (-16.33%)
Mutual labels:  super-resolution
Zooming Slow Mo Cvpr 2020
Fast and Accurate One-Stage Space-Time Video Super-Resolution (accepted in CVPR 2020)
Stars: ✭ 555 (+1032.65%)
Mutual labels:  super-resolution
Scn
Scale-wise Convolution for Image Restoration
Stars: ✭ 26 (-46.94%)
Mutual labels:  super-resolution
Srrescgan
Code repo for "Deep Generative Adversarial Residual Convolutional Networks for Real-World Super-Resolution" (CVPRW NTIRE2020).
Stars: ✭ 44 (-10.2%)
Mutual labels:  super-resolution
Jsi Gan
Official repository of JSI-GAN (Accepted at AAAI 2020).
Stars: ✭ 42 (-14.29%)
Mutual labels:  super-resolution
Super Resolution cnn
Implementation of 'Image Super-Resolution using Deep Convolutional Network'
Stars: ✭ 27 (-44.9%)
Mutual labels:  super-resolution

Implement ESCPN with Tensorflow

Imgur

Dependency

pip

  • Tensorflow
  • Opencv
  • h5py

How to train

python main.py

if you want to see all flag

python main.py -h

How to test

If you don't input a Test image, it will be default image

python main.py --is_train False

then result will put in the result directory

If you want to Test your own iamge

use test_img flag

python main.py --is_train False --test_img Train/t20.bmp

then result image also put in the result directory

Subpixel CNN layer

source

In numpy, we can write this as

def PS(I, r):
  assert len(I.shape) == 3
  assert r>0
  r = int(r)
  O = np.zeros((I.shape[0]*r, I.shape[1]*r, I.shape[2]/(r*2)))
  for x in range(O.shape[0]):
    for y in range(O.shape[1]):
      for c in range(O.shape[2]):
        c += 1
        a = np.floor(x/r).astype("int")
        b = np.floor(y/r).astype("int")
        d = c*r*(y%r) + c*(x%r)
        print a, b, d
        O[x, y, c-1] = I[a, b, d]
  return O

To implement this in Tensorflow we would have to create a custom operator and its equivalent gradient. But after staring for a few minutes in the image depiction of the resulting operation we noticed how to write that using just regular reshape, split and concatenate operations. To understand that note that phase shift simply goes through different channels of the output convolutional map and builds up neighborhoods of r x r pixels. And we can do the same with a few lines of Tensorflow code as:

   def _phase_shift(self, I, r):
       # Helper function with main phase shift operation
       bsize, a, b, c = I.get_shape().as_list()
       X = tf.reshape(I, (self.batch_size, a, b, r, r))
       X = tf.split(X, a, 1)  # a, [bsize, b, r, r]
       X = tf.concat([tf.squeeze(x) for x in X], 2)  # bsize, b, a*r, r
       X = tf.split(X, b, 1)  # b, [bsize, a*r, r]
       X = tf.concat([tf.squeeze(x) for x in X], 2)  # bsize, a*r, b*r
       return tf.reshape(X, (self.batch_size, a*r, b*r, 1))

   def PS(self, X, r):
       # Main OP that you can arbitrarily use in you tensorflow code
       Xc = tf.split(X, 3, 3)
       if self.is_train:
           X = tf.concat([self._phase_shift(x, r) for x in Xc], 3) # Do the concat RGB
       else:
           X = tf.concat([self._phase_shift_test(x, r) for x in Xc], 3) # Do the concat RGB
       return X

Result

  • origin 255 x 255 x 3

Imgur

  • upscaling 3 times, 765 x 765 x 3

Imgur

References

problem

If you meet the problem with opencv when run the program

libSM.so.6: cannot open shared object file: No such file or directory

please install dependency package

sudo apt-get install libsm6
sudo apt-get install libxrender1
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].