How does Super-Resolution work?

Authors
How does Super-Resolution work?

Super-Resolution turns a small, blurry image into a large, sharp one, using a model trained to add real detail instead of just stretching the pixels.

In this blog, we will learn about how Super-Resolution works. We will also see why we need it, why the simple approach of just stretching an image fails, how a Super-Resolution model is trained to add real detail, and where it is used in the real world.

We will cover the following:

  • What is Super-Resolution?
  • Why do we need Super-Resolution?
  • The naive approach and why it fails
  • How does Super-Resolution actually work?
  • Training a Super-Resolution model
  • A simple worked example
  • The loss function and what it teaches the model
  • A small code example
  • Real-world use cases of Super-Resolution

I am Amit Shekhar, Founder @ Outcome School, I have taught and mentored many developers, and their efforts landed them high-paying tech jobs, helped many tech companies in solving their unique problems, and created many open-source libraries being used by top companies. I am passionate about sharing knowledge through open-source, blogs, and videos.

I teach AI and Machine Learning at Outcome School.

Let's get started.

What is Super-Resolution?

Super-Resolution is the process of taking a small, blurry, low-quality image and turning it into a large, sharp, high-quality image.

Let's understand the term Resolution.

Resolution means the number of tiny dots in an image. These tiny dots are called pixels. A pixel is a single dot of color.

More pixels means more detail, and more detail means a sharper image.

So, Super-Resolution means "adding extra resolution", which means adding extra pixels to make the image larger and clearer.

Why do we need Super-Resolution?

Let's say we have an old photo of our grandparents. It is small and blurry. We want to print it big and hang it on the wall. But when we make it big, it looks even more blurry and ugly.

Consider another case. We are watching an old video on a big modern TV. The video was made for small screens long ago. On the big screen, it looks soft and unclear.

In both cases, we have a low-quality image, and we want a high-quality one. This is exactly the problem Super-Resolution solves.

The naive approach and why it fails

Before jumping into how Super-Resolution works, we must understand the simple old approach first.

Suppose we have a small image, and we want to make it twice as big. The most obvious idea is to simply stretch it. When we stretch an image, the computer has to create new pixels to fill the empty space.

The traditional method to do this is called interpolation.

Interpolation means guessing the color of a new pixel by looking at the colors of the pixels around it and taking an average.

Let's understand with an example. Assume that we have two pixels next to each other. One is black, and one is white. We want to add a new pixel between them. Interpolation will simply make the new pixel grey, because grey is the average of black and white.

This is easy and fast.

Interpolation only averages the colors we already have. It cannot invent any new detail. So, when we enlarge a face, the eyes, the skin texture, and the hair do not become sharp. They just become bigger and blurrier.

The issue with this approach is that it cannot create real detail. Let's see how the next approach solves this issue.

How does Super-Resolution actually work?

So, here comes the deep learning approach to the rescue.

Super-Resolution using deep learning means we train a model to look at a low-quality image and predict the missing details, instead of just averaging the existing pixels.

Interpolation only averages. The model predicts what the missing detail should look like.

Let me give an analogy. Suppose a skilled artist sees a blurry photo of a cat. The artist has drawn thousands of cats before. So, the artist knows that a cat has sharp whiskers, fur texture, and clear eyes. The artist can redraw the blurry photo into a sharp one, because the artist has learned how cats look.

The Super-Resolution model is exactly like this artist. It has seen millions of sharp images during training. So, it knows how sharp details usually look. It uses this knowledge to fill in the missing detail.

We have a detailed blog on Generative Adversarial Networks (GANs) that explains how a model learns to generate realistic images.

This is how Super-Resolution turns a blurry image into a sharp one.

Planning your move into AI?

No matter which tech domain you work in today, with your effort, you can transition to these roles:

  • AI Engineer
  • Forward Deployed Engineer
  • AI Agent Engineer
  • Harness Engineer
  • Voice AI Engineer
  • AI Architect
  • LLM Engineer
  • LLM Inference Engineer
  • Gen AI Engineer
  • MLOps Engineer
  • ML Engineer
  • Deep Learning Engineer

Our AI and Machine Learning Program at Outcome School takes you there.

Training a Super-Resolution model

Now, the next big question is: how does the model learn?

The answer is by practice, using a lot of examples.

To train the model, we need pairs of images. Each pair has a low-quality version and a high-quality version of the same picture.

Now, the next question is: where do we get these pairs?

We take a large set of sharp, high-quality images. Then, for each sharp image, we shrink it down to make a small, low-quality copy. Now we have both versions of the same image.

So, we prepare the data as below:

  • We start with a sharp, high-quality image. This becomes the correct answer.
  • We shrink it to make a small, blurry image. This becomes the input.
  • We pair them together.

Now the training begins.

First, we feed the small, blurry image to the model. Then, the model tries to produce a sharp image. After that, we compare the model's output with the real sharp image, which is the correct answer. Finally, we tell the model how wrong it was, and the parameters of the model get updated to do better next time.

Let's see this training loop in a diagram like below:

Sharp high-quality image (the correct answer)
                      ↓
                  shrink it
                      ↓
       Small blurry image (the input)
                      ↓
           +-------------------+
           |     The model     |
           | (predicts detail) |
           +-------------------+
                      ↓
            Model's sharp output
                      ↓
       Compare with the correct answer
                      ↓
    How wrong was it? (this is the loss)
                      ↓
           Update the parameters
                      ↓
          Repeat with the next pair

Here, we can see that we start from one sharp image, shrink it to create the blurry input, pass that input through the model, and then compare the model's output with the original sharp image. The difference tells us how wrong the model was, and the parameters of the model get updated before moving to the next pair.

We repeat this millions of times with millions of image pairs. Slowly, the model gets better and better at turning blurry images into sharp ones.

This is how the model learns.

To learn Supervised Learning, Loss Functions, and Gradient Descent from the ground up, check out our AI and Machine Learning Program at Outcome School.

A simple worked example

The best way to learn this is by taking an example.

Let's take a tiny part of an image. Just for the sake of understanding, assume we have a small row of 2 pixels, and we want to make it a row of 4 pixels.

Our low-quality input is two pixels with these brightness values:

Input (low-quality):  [ 100,  200 ]

Here, the numbers are brightness values. A value of 0 means fully dark, and a value of 255 means fully bright. So, 100 is a dark grey, and 200 is a light grey.

Now, let's see what the old interpolation approach does. It fills the new pixels with evenly spaced in-between values as below:

Interpolation output: [ 100,  133,  167,  200 ]

Here, we can see that interpolation only created smooth, in-between values. There is no sharpness. The change from dark to light is slow and gradual, which looks blurry.

Now, let's see what a trained Super-Resolution model does. The model has learned that real images often have sharp edges. So, it predicts something like the below:

Super-Resolution output: [ 95,  105,  205,  215 ]

Here, we can notice that the model kept the dark pixels dark and the bright pixels bright, and it created a sharp jump in the middle. This sharp jump is an edge. Edges are what make an image look crisp and clear.

A quick note for you

No matter which tech domain you work in, get familiar with these topics:

  • LLM
  • RAG
  • MCP
  • Agent
  • Fine-tuning
  • Quantization

We put it all together in one video:

AI Engineering Explained: LLM, RAG, MCP, Agent, Fine-Tuning, and Quantization

No need to stop reading - bookmark it and watch later when you get time. Future you will thank you.

Now, let's get back to the topic.

The loss function and what it teaches the model

Now, let's understand one important piece that makes the training work. It is called the loss function.

A loss function is a way to measure how wrong the model is.

It is a score that tells us the difference between the model's output and the correct answer. A high loss means the model is very wrong. A low loss means the model is very close to correct.

Let's understand with our example. The correct sharp answer was:

Correct answer: [ 90,  110,  210,  220 ]

And the model produced:

Model output:   [ 95,  105,  205,  215 ]

Here, the model is very close. The differences are small, which means the loss is low. So, the model learns that this kind of prediction is good.

During training, the parameters of the model, also called weights, keep getting updated to make the loss as low as possible. The lower the loss, the better the model matches the real sharp image. We have a detailed blog on Gradient Descent that explains step by step how the weights are updated to lower the loss.

This is how the loss function guides the model toward producing sharp, correct images.

A small code example

Let's see a small code example to make this concrete. We will use simple Python-style code, just for the sake of understanding.

# Step 1: take a low-quality, blurry image as input
low_quality_image = load_image("old_photo_small.jpg")

# Step 2: pass it to the trained Super-Resolution model
sharp_image = super_resolution_model.predict(low_quality_image)

# Step 3: save the new high-quality image
save_image(sharp_image, "old_photo_sharp.jpg")

Here, we have done three things.

  • First, we loaded the small, blurry image into the variable low_quality_image.
  • Then, we passed it to the model using super_resolution_model.predict, and the model returned a sharp version into sharp_image.
  • Finally, we saved the sharp image to a file.

All the hard work of predicting the missing detail happens inside the predict step. The model has already learned everything during training. So, using it is very simple.

Now, let's see a tiny piece of how the loss is calculated during training:

# model_output is what the model predicted
# correct_answer is the real sharp image

difference = correct_answer - model_output
loss = average(difference * difference)

Here, we can see that we first find the difference between the correct answer and the model's output. Then, we square the difference so that all values become positive, and we take the average. This single number is the loss.

The model uses this loss to update its weights and do better in the next round.

This is how the model keeps improving during training.

Stay updated: Subscribe to our newsletter to get our latest AI and Machine Learning blogs straight to your inbox.

Real-world use cases of Super-Resolution

Now that we have learned how Super-Resolution works, it is time to learn where we use it.

Here are a few common use cases:

  • Restoring old photos: We can take old, blurry family photos and make them sharp and clear.
  • Streaming video: Many TVs and streaming apps use Super-Resolution to make low-quality videos look better on big screens.
  • Medical imaging: Doctors can get clearer scans, which helps them see small details more easily.
  • Satellite images: Blurry images from space can be sharpened to study land, weather, and oceans.
  • Smartphone cameras: Phones use Super-Resolution to improve zoomed-in photos that would otherwise look blurry.
  • Security cameras: Low-quality footage can be enhanced to see important details more clearly.

The model predicts the missing detail based on what it has learned. So, it produces a very believable image, but it is a guess, not a perfect record of reality. This is good enough for most everyday use cases, but in sensitive cases like medical or legal work, we must always keep this in mind.

Frequently Asked Questions

Is Super-Resolution the same as resizing an image?

No. Resizing an image with interpolation only averages the colors of the pixels we already have, so it cannot invent any new detail. The image just becomes bigger and blurrier. Super-Resolution uses a trained model that predicts what the missing detail should look like, based on the millions of sharp images it has seen during training.

Why does a Super-Resolution image look sharper than an interpolated one?

Because the model creates edges. Interpolation fills new pixels with smooth, in-between values, so the change from dark to light is slow and gradual, which looks blurry. A trained Super-Resolution model keeps the dark pixels dark and the bright pixels bright, and creates a sharp jump in the middle. Edges are what make an image look crisp and clear.

Does Super-Resolution recover the real details of the original image?

No. The model predicts the missing detail based on what it has learned, so the result is a very believable image, but it is a guess, not a perfect record of reality. This is good enough for most everyday use cases, but in sensitive cases like medical or legal work, we must always keep this in mind.

Do we need to train a Super-Resolution model every time we use it?

No. The model learns everything during training, which is done ahead of time with millions of image pairs. After that, using it is very simple: we pass a low-quality image to the trained model, and it returns a sharp version. All the hard work of predicting the missing detail happens inside that single predict step.

That's it for now.

Thanks

Amit Shekhar
Founder @ Outcome School

You can connect with me on:

Follow Outcome School on:

Read all of our high-quality blogs here.