An Attempt at Super Resolution: Part I

Photo by Mike Austin on Unsplash

Haven’t you been amused at watching TV series when the detective zooms into the image of a crime scene and he finds a clue that leads to the culprit? Sounds so sci-fi! Well this is my attempt to code that out. While Super Resolution has been there for quite some time now , being used for various tasks. One of them being delivering high resolution content such as 1080 resolution movies through streaming while consuming lesser bandwidth. Surprising!? I know!.

What is Super Resolution?

Lets code that out and see for ourselves:

lr_img = cv2.imread('Data/0797_lr.png')
print(lr_img.shape)
plt.imshow(lr_img)

Now lets resize the image to 2X. Below is the code and the output of the image. If you observe , you can see the image getting blurred. This is because just doubling images just can’t create and fill in the missing information.

hr_img = cv2.resize(lr_img,(lr_img.shape[1]*2,lr_img.shape[0]*2),interpolation = cv2.INTER_NEAREST)
print(hr_img.shape)
plt.imshow(hr_img)

Interpolation above does the trick here in filling in the missing values.
A quick highlight what each of it means:

The above ones are used for zooming purposes.

Source: https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121

Why do we need super resolution at all?

If data can’t be created, is Super Resolution achievable?

With the progress of research in the field of Deep Learning , multiple researchers have been able to propose and build architectures that are able to achieve such feats. This is possible due the reason that Neural networks can fill in the gaps when they are trained over pairs of low resolution and their corresponding higher resolution images.

While there are multiple such architectures and designs that work on similar lines, we will try to build one super resolution pipeline using Resnet-18 based model. Lets build it together in the following below sections.

Before we head out to code, a couple of papers to inspire us:

Icon Credits: Icons made by Smashicons from www.flaticon.com
Image source
: https://data.vision.ee.ethz.ch/cvl/DIV2K/
Originally published at https://github.com.

Anurag is a Data Scientist by profession. Loves to tinker with gadgets. Codes and plays during free time.

Anurag is a Data Scientist by profession. Loves to tinker with gadgets. Codes and plays during free time.