Search

Search papers and lessons

Super-Resolution

Level 3 · 13 min read

Super-resolution turns a small, blurry image into a larger, sharper one by predicting the detail that was lost. Plain resizing only stretches the pixels it has, so a learned network is needed to invent plausible detail.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Linear algebra
  • Neural network basics
  • Signal processing
  • Architectures
  • ReadReady to readNot yet

TL;DR

Super-resolution takes a small, low-detail image and produces a larger image with finer detail. Simple resizing can make the picture bigger, but it cannot add detail that was never recorded, so the result looks soft. A learned network predicts the missing detail from patterns it saw in many training images.

Builds on: Bilinear Interpolation, Convolutional Neural Network, Transposed Convolution, Mean Squared Error · Leads to: Generative Adversarial Network

Where it's used

Games. Modern graphics cards can render a game at a lower internal resolution and then use a neural network to reconstruct a sharper frame at the display's resolution, which saves rendering time. NVIDIA's DLSS is a well-known product built this way.

Old photos and film. Archives hold scans that are small or soft. Restoration tools upscale them with learned models so that a print or a screen shows more usable detail than a plain enlargement would.

Satellite and aerial imagery. Sensors often record a scene at a coarse ground resolution. Learned upscaling is used to make such images easier for people to read, though the output is an estimate, not a new measurement.

How it works

We follow one tiny case: a single row of two pixels, brightness 0 (black) and 100 (bright), turned into four pixels. The true, sharp version of that row is 0, 0, 100, 100, with the edge in the middle. We only see the two low-resolution pixels, so the question is how to get from 0, 100 to something close to 0, 0, 100, 100.

  1. Start with the low-resolution input. The image has two pixels: 0 and 100. We want four pixels. There is no sharp edge recorded in the input, only a jump between two values.
  2. Enlarge with a fixed rule. Bilinear interpolation fills the two new positions by averaging neighbours. The output is 0, 50, 100, 100. Check: the middle value 50 is halfway between 0 and 100, as the rule says. The size is right, but the edge is now a soft ramp.
  3. Let a network look at the neighbourhood. A Convolution layer slides a small window, its Receptive Field, across the enlarged row. A window that sees a rising step (a 0 next to a 100) gives a strong response. The network has learned that a step like this usually means a sharp edge in the real scene.
  4. Correct the enlarged image. The network outputs a correction for each pixel. Adding the correction to the bilinear result moves the middle value from 50 towards the side it belongs to: the correction is 0, -50, 0, 0, so the output is 0, 0, 100, 100. Check: the four values now match the true row.
  5. Measure the error. Compare the output with the true row using mean squared error. For bilinear output the error is 625 (see the math below). For the corrected output it is 0. Training adjusts the network so that this error becomes small across many image pairs.

The plot shows the two rows from steps 2 and 4. The bilinear row climbs gradually from position 0 to position 2. The true row is flat at 0 up to position 1 and flat at 100 from position 2, so its edge is the steep segment between those two positions. The learned correction moves the value at position 1 down from 50 to 0, which restores that edge.

00.511.522.53020406080100pixel positionbrightness
  • true high-resolution row
  • bilinear enlargement
Bilinear enlargement keeps the size but smears the edge across two positions. The learned correction restores the sharp rise between positions 1 and 2.

The whole pipeline has the same shape for any image:

flowchart LR
  A[Low-resolution image] --> B[Enlarge with bilinear or a learned upsampler]
  B --> C[Convolutional layers read the neighbourhood]
  C --> D[Add the predicted correction]
  D --> E[High-resolution estimate]
  E --> F[Compare with the true image using MSE]
  F -. error sends gradients back .-> C

A common variant replaces the bilinear step with a learned upsampler. Some networks use a Transposed Convolution that grows the grid. Others use pixel shuffle (also called sub-pixel convolution): the network produces several channels per low-resolution location, and those channels are rearranged into a block of high-resolution pixels. Pixel shuffle needs no overlapping kernels, so it avoids some of the uneven patterns a transposed convolution can leave behind.

The math

Step 1 in symbols: the problem and the training pairs

Let x\mathbf{x} be a low-resolution image and y\mathbf{y} the high-resolution image it came from, with scale factor ss (for example s=2s = 2). The network fθf_\theta with weights θ\theta tries to produce

y^=fθ(x),y^≈y.\hat{\mathbf{y}} = f_\theta(\mathbf{x}), \qquad \hat{\mathbf{y}} \approx \mathbf{y}.

Training pairs are made by taking high-resolution photographs y\mathbf{y} and degrading them: blur them, then shrink them to x=D(y)\mathbf{x} = D(\mathbf{y}). The network never sees the original detail, only the degraded version and the true answer.

Step 2 in symbols: bilinear enlargement

In one dimension, the value at a fractional position tt between two neighbours aa and bb is

u(t)=(1−t) a+t b,0≤t≤1.u(t) = (1 - t)\,a + t\,b, \qquad 0 \le t \le 1.

At the midpoint t=0.5t = 0.5 this is (a+b)/2(a + b)/2. For a=0a = 0 and b=100b = 100 it gives 5050, which matches step 2.

Step 3 in symbols: reading the neighbourhood

A convolution with weights w=(w1,w2)\mathbf{w} = (w_1, w_2) on a row u\mathbf{u} gives

vi=w1ui+w2ui+1.v_i = w_1 u_i + w_2 u_{i+1}.

With w=(−1,1)\mathbf{w} = (-1, 1) this is the difference between a pixel and its right neighbour. The enlarged row (0,50,100,100)(0, 50, 100, 100) gives (50,50,0)(50, 50, 0): a large positive response wherever the brightness rises. A trained network learns many such windows, and their responses feed the correction.

Step 4 in symbols: the residual form

Most super-resolution networks predict the correction rather than the whole image, the same residual idea used in deep networks:

y^=u(x)+rθ(x).\hat{\mathbf{y}} = u(\mathbf{x}) + r_\theta(\mathbf{x}).

Here u(x)u(\mathbf{x}) is the bilinear enlargement and rθr_\theta is the learned residual. The network only has to learn what bilinear interpolation gets wrong, which is easier than learning the whole image from scratch. In the example, rθ(x)=(0,−50,0,0)r_\theta(\mathbf{x}) = (0, -50, 0, 0).

Step 5 in symbols: the loss

Over NN pixels, mean squared error is

L(θ)=1N∑k=1N(y^k−yk)2.\mathcal{L}(\theta) = \frac{1}{N} \sum_{k=1}^{N} \left(\hat{y}_k - y_k\right)^2.

For the bilinear row, the differences from (0,0,100,100)(0, 0, 100, 100) are (0,50,0,0)(0, 50, 0, 0), so the squared errors sum to 25002500 and the mean is 2500/4=6252500 / 4 = 625. For the corrected row the error is 00. Training uses gradient descent (see Gradient Descent and Backpropagation) to lower L\mathcal{L} over millions of pairs.

A common quality measure is peak signal-to-noise ratio, PSNR=10log⁡10(MAX2/MSE)\mathrm{PSNR} = 10 \log_{10}\left(\mathrm{MAX}^2 / \mathrm{MSE}\right), where MAX\mathrm{MAX} is the largest possible pixel value (255 for 8-bit images). For the bilinear row this gives about 20.220.2 dB.

Worked examples

Example
A single edge, by hand

Low-resolution input: (40,80)(40, 80). Target: the true row (40,40,80,80)(40, 40, 80, 80).

  1. Bilinear enlargement: the midpoint between 40 and 80 is 60, so the output is (40,60,80,80)(40, 60, 80, 80).
  2. Compare position by position: (40−40, 60−40, 80−80, 80−80)=(0,20,0,0)(40-40,\ 60-40,\ 80-80,\ 80-80) = (0, 20, 0, 0).
  3. Square each difference: (0,400,0,0)(0, 400, 0, 0). The sum is 400.
  4. Mean over four pixels: 400/4=100400 / 4 = 100. This is the MSE of plain bilinear enlargement for this row.
  5. Interpretation: one pixel is wrong by 20 brightness levels, and that single miss dominates the loss. A correction of (0,−20,0,0)(0, -20, 0, 0) would bring the MSE to 0.
Example
Why scale factor decides how much is invented

Take a colour image of 64×6464 \times 64 pixels with 3 channels, and a scale factor s=4s = 4.

  1. Input values: 64×64×3=12,28864 \times 64 \times 3 = 12{,}288.
  2. Output size: 256×256256 \times 256 pixels, so 256×256×3=196,608256 \times 256 \times 3 = 196{,}608 values.
  3. Ratio of output to input: 196,608/12,288=16=s2196{,}608 / 12{,}288 = 16 = s^2.
  4. Each input value is copied to at most one output location; the other 15 out of every 16 output values have to be predicted.
  5. Cost of one layer: a 3×33 \times 3 convolution from 64 to 64 channels has 3⋅3⋅64⋅64+64=36,9283 \cdot 3 \cdot 64 \cdot 64 + 64 = 36{,}928 weights, and a network with several such layers runs this per output position, so the computation is large.
  6. Interpretation: the larger the scale factor, the less of the output comes from the input. This is why 4×4\times results are visibly more inventive than 2×2\times results.
Example
Upscaling a 1080p frame to 4K

A video frame is 1920×10801920 \times 1080 and the display is 3840×21603840 \times 2160. The scale factor is 22 in each direction.

  1. Input pixels: 1920×1080=2,073,6001920 \times 1080 = 2{,}073{,}600.
  2. Output pixels: 3840×2160=8,294,4003840 \times 2160 = 8{,}294{,}400.
  3. Ratio: 8,294,400/2,073,600=48{,}294{,}400 / 2{,}073{,}600 = 4, which is s2s^2 with s=2s = 2.
  4. Each input pixel corresponds to one output position directly, and the other three output positions for it must be predicted.
  5. At 60 frames per second, the output needs 8,294,400×60=497,664,0008{,}294{,}400 \times 60 = 497{,}664{,}000 pixel values per second. The upscaler has only part of a 16.7 millisecond frame budget, so it must be fast as well as accurate.
  6. Interpretation: most 4K pixels in an upscaled video are estimates. This is acceptable for smooth regions and is where errors show up, such as on fine text.

Try it: a 960×540960 \times 540 frame is upscaled to 1920×10801920 \times 1080. How many output pixels are predicted for every input pixel that is copied? Answer: the output has 1920×1080=2,073,6001920 \times 1080 = 2{,}073{,}600 pixels and the input has 960×540=518,400960 \times 540 = 518{,}400, a ratio of 4, so 3 out of every 4 output pixels are predicted.

Common mistakes and tradeoffs

It is tempting to think a super-resolved image recovers the true detail. In fact the network predicts the most likely detail given its training data, because the true detail was lost when the image was made small. This is why a model trained on one kind of camera or blur can invent wrong shapes on another. A licence plate or a line of small text is the clearest case where the output can look sharp and be wrong.

It is tempting to think that a bigger network gives sharper pictures. In fact, training with mean squared error rewards the average of all plausible answers, which is smooth. Two different sharp edges that could both explain a blurry input average to a soft edge, and MSE prefers that average. Sharpness needs a different loss. Adversarial training, used in GAN-based super-resolution, adds a critic that rejects smooth-looking output, at the cost of some pixel accuracy.

It is tempting to think that transposed convolution is the inverse of downsampling. In fact it is only a learned way to grow a grid. When the kernel size is not divisible by the stride, some output positions receive more contributions than others and the result shows a regular checkerboard pattern. Pixel shuffle, or a resize followed by an ordinary convolution, avoids this pattern.

When to use a learned upscaler: when detail matters, the input is close to the training distribution, and you can afford the compute. When not to: when the output must match a measured truth, such as diagnostic or forensic images, where invented detail is a hazard. Plain bilinear or bicubic resizing is cheap, deterministic and adds no invented detail, so it is the right choice when accuracy matters more than appearance.

ApproachAdds detail?CostRisk
Bilinear or bicubicNo, only smoothVery lowSoft edges
Learned, MSE-trainedSome, averagedModerateBlur, but few invented features
Learned, adversarialYes, sharpHigherPlausible but wrong detail

History

Before learning, image enlargement relied on fixed interpolation filters such as bicubic and Lanczos. They were fast and predictable but could not restore detail, so resized images looked soft. Researchers had long known that patches of natural images are repetitive, and they used this to build dictionaries of example patches in the 2000s.

In 2014, Dong and colleagues published SRCNN, a small convolutional network trained end to end to map a bicubically enlarged image to a sharper one. It beat the earlier methods on standard benchmarks and showed that a plain convolutional network could learn super-resolution from pairs of images.

In 2016, Shi and colleagues introduced the efficient sub-pixel convolution layer (pixel shuffle). Working at low resolution for most of the network and rearranging channels at the end made real-time video upscaling practical.

Also in 2016, Ledig and colleagues proposed SRGAN, which added an adversarial loss and a perceptual loss to get sharper textures. It was presented at CVPR in 2017. It showed that the choice of loss, not only the architecture, decides how a super-resolved image looks, and it set up the trade-off between pixel accuracy and realism that the field still works with.

Recap

  • Enlarging with a fixed rule adds size but no information, so edges stay soft.
  • A convolutional network reads the enlarged image and predicts a correction, which turns the soft edge into a sharper one.
  • The correction is learned with mean squared error, which measures the pixel gap to the true high-resolution image.
  • The scale factor sets how much of the output must be predicted, and MSE prefers averaged, smooth answers.
  • Adversarial training trades some pixel accuracy for sharper, more realistic detail.

Read next: Generative Adversarial Network for the adversarial losses, then U-Net and Image Segmentation for the encoder-decoder designs that use the same upsampling ideas.

Check yourself

QuestionWhy can bilinear enlargement never produce a sharp edge that was not in the input?Show answer

Bilinear interpolation only blends values that are already present. Every new value is a weighted average of two neighbours, so a jump between two pixels can only become a ramp. Recovering a sharp edge needs information about the scene that the fixed rule does not have, which is why a learned correction is used.

QuestionA low-resolution row is (10,90)(10, 90) and the true high-resolution row is (10,10,90,90)(10, 10, 90, 90). Bilinear enlargement gives (10,50,90,90)(10, 50, 90, 90). What is its mean squared error?Show answer

The differences are (0,40,0,0)(0, 40, 0, 0). Squared: (0,1600,0,0)(0, 1600, 0, 0). Sum: 1600. Mean over four pixels: 1600/4=4001600 / 4 = 400.

QuestionWhy does a network trained with mean squared error tend to produce soft images, even when the training images are sharp?Show answer

Several sharp images can produce the same blurry input, so the network cannot know which sharp edge is right. MSE penalises the squared distance to the true value, so the lowest-error answer is the average over the possibilities, which is a smooth edge. The loss rewards the average, not the sharpest guess.

QuestionA phone app upscales a photo of a street sign by 4 times in each direction, and the sign's letters become clearer. Why should you not rely on the letters for a legal or safety decision?Show answer

At 4×4\times most output pixels are predicted, not measured, so the letters are the network's best guess given its training data. A guess can look sharp and still have the wrong letter. The original photo is the measured evidence; the upscaled version is an estimate.

Sources