Super Resolution


A deep CNN that uses sub-pixel convolution layers to upscale the input image

Recently, several models based on deep neural networks have achieved great success in terms of both reconstruction accuracy and computational performance for single image super-resolution. In these methods, the low resolution (LR) input image is upscaled to the high resolution (HR) space using a single filter, commonly bicubic interpolation, before reconstruction. This means that the super-resolution (SR) operation is performed in HR space. We demonstrate that this is sub-optimal and adds computational complexity. In this paper, we present the first convolutional neural network (CNN) capable of real-time SR of 1080p videos on a single K2 GPU. To achieve this, we propose a novel CNN architecture where the feature maps are extracted in the LR space. In addition, we introduce an efficient sub-pixel convolution layer which learns an array of upscaling filters to upscale the final LR feature maps into the HR output. By doing so, we effectively replace the handcrafted bicubic filter in the SR pipeline with more complex upscaling filters specifically trained for each feature map, whilst also reducing the computational complexity of the overall SR operation. We evaluate the proposed approach using images and videos from publicly available datasets and show that it performs significantly better (+0.15dB on Images and +0.39dB on Videos) and is an order of magnitude faster than previous CNN-based methods.

How to install

1) download project / library

2) Install library `pip install *.whl` OR `python install`

How to use

  • Python interface
import cv2
from model import Model

image = cv2.imread('../tests/test.png')
model = Model()

ret = model.process_sample(image)
  • Use ONNX model
#### Preprocessing

orig_img = / 'tests/test.png');
img = resizeimage.resize_cover(orig_img, [224, 224], validate=False)
img_ycbcr = img.convert('YCbCr')
img_y_0, img_cb, img_cr = img_ycbcr.split()
img_ndarray = np.asarray(img_y_0)
img_4 = np.expand_dims(np.expand_dims(img_ndarray, axis=0), axis=0)
img_5 = img_4.astype(np.float32) / 255.0

#### Inference

ort_session = onnxruntime.InferenceSession("../super_resolution/assets/model.onnx")
ort_inputs = {ort_session.get_inputs()[0].name: self._preprocess(sample)}
ort_outs =, ort_inputs)
img_out_y = ort_outs[0]

#### Postprocessing

# Result postprocessing
img_out_y = Image.fromarray(np.uint8((img_out_y[0] * 255.0).clip(0, 255)[0]), mode='L')

# get the output image
final_img = Image.merge(
    "YCbCr", [
        img_cb.resize(img_out_y.size, Image.BICUBIC),
        img_cr.resize(img_out_y.size, Image.BICUBIC),


There are no reviews yet.

Write a review

Your email address will not be published. Required fields are marked *