Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Making up detail that looks right
Blow up a small photo and it looks soft, because the fine detail was never recorded. A network trained to be right on average paints that missing detail grey: it averages over all the possibilities. A GAN-trained network instead paints in detail that looks real, such as grass blades, fabric and brick, but it is invented and need not match the true scene. Sharper pictures can therefore be less accurate. The demo shows a texture the low-resolution input cannot see, and compares the error of predicting the average with the error of guessing.
Super-resolution is used on satellite and drone imagery, but invented detail is dangerous for measurement: a GAN can draw a convincing car or crack that is not there. For analysis, prefer distortion-oriented models and report which kind was used.
- 1. An MSE-trained SR network outputs…
- 2. A GAN-trained SR network…
- 3. Sharper outputs can be…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Problem. y = (x ∗ k)↓s + n: blur, downsample by s, add noise; the inverse is ill-posed. Classic baselines: bicubic interpolation; SRCNN (Dong et al. 2014); ESPCN’s sub-pixel convolution or pixel shuffle (Shi et al. 2016), which predicts s² channels and rearranges them; residual networks such as SRResNet and EDSR (Lim et al. 2017).
- SRGAN (Ledig et al., CVPR 2017). SRResNet generator (16 residual blocks, two pixel-shuffle ×2 stages); loss = VGG feature (content) loss + 10⁻³ × adversarial loss. Lower PSNR than SRResNet, but much better mean opinion scores.
- ESRGAN (Wang et al., ECCV workshops 2018). Residual-in-residual dense blocks (RRDB) without batch norm, with residual scaling; relativistic average discriminator, which predicts whether a real image is more realistic than the average fake; perceptual loss on VGG features before activation; pretraining with L1, then GAN fine-tuning; network interpolation between the PSNR and GAN weights to trade sharpness against artifacts. It won PIRM 2018.
- Real-ESRGAN (Wang et al. 2021). Trained with a synthetic high-order degradation pipeline (blur, resize, noise, JPEG, repeated) and a U-Net discriminator with spectral norm; widely used for real photos and video. Diffusion upscalers (SR3, 2021; StableSR) now compete on quality; GANs stay popular for speed.
- Perception–distortion trade-off (Blau and Michaeli, CVPR 2018). No method can be both minimum-distortion (MSE) and perfectly realistic (output distribution equal to the data); the best achievable pairs form a convex frontier.
- Metrics. PSNR and SSIM (distortion); LPIPS (Zhang et al. 2018) and no-reference scores (NIQE, the PIRM perceptual index); human mean opinion scores.
- 1. ESRGAN's discriminator is…
- 2. Pixel shuffle rearranges…
- 3. Real-ESRGAN is trained with…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Training and evaluating SR models
Exercise 1.
- PSNR.
- Pixel shuffle (sub-pixel convolution rearrangement).
- The relativistic average discriminator.
- Network interpolation.
Practice.
- Pretrain with L1 or MSE, then fine-tune with GAN and perceptual losses: the PSNR model is a stable starting point (ESRGAN).
- Match degradations: a model trained on bicubic downsampling fails on real sensor blur and compression; use Real-ESRGAN-style degradation pipelines or the real sensor model.
- Report both kinds of metric: PSNR/SSIM for fidelity and LPIPS or a user study for realism. Never claim more accuracy from a sharper image.
- Use interpolation (or a tunable loss weight) to pick a point on the perception–distortion curve per application.
- Earth observation: keep a distortion-oriented model for measurement tasks; use GAN SR only for visual interpretation, and say so.
# Real-ESRGAN inference (pip install realesrgan basicsr)
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer
import cv2
net = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
up = RealESRGANer(scale=4, model_path="RealESRGAN_x4plus.pth", model=net, half=False)
img = cv2.imread("drone_frame.png")
sr, _ = up.enhance(img, outscale=4) # 4× larger; detail is synthesised, not measured
cv2.imwrite("drone_frame_x4.png", sr)- 1. ESRGAN fine-tunes from…
- 2. A model trained on bicubic downsampling…
- 3. For measurement tasks prefer…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Why MSE blurs. The MSE-optimal prediction is the conditional mean E[x | y]. If a detail is equally likely to be +A or −A given the low-res input, the mean is 0. The output is smooth, and its expected squared error on that detail is A², the minimum possible.
Why a realistic guess costs twice as much. A generator that outputs a sample from p(x | y), independent of the truth, has expected error E‖x̂ − x‖² = 2 Var(x | y). For the ±A texture that is 2A², double the MSE optimum. This is the perception–distortion trade-off in its simplest form. Blau and Michaeli proved that perfect realism costs at most twice the minimum MSE: D(P = 0) ≤ 2 D_min.
Relativistic discriminator. A standard D estimates P(real | x). The relativistic average D estimates P(x_r more realistic than the average fake). Its generator loss involves real images too, so G gets gradients from both real and fake terms.
Network interpolation. Interpolating the weights of a PSNR model and its GAN fine-tuned version (which share an initialisation) gives a smooth path along the trade-off. It works because the fine-tuned model stays in the same basin.
- 1. The MSE-optimal output is…
- 2. Sampling from p(x | y) has expected error…
- 3. Perfect realism costs at most…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Does adversarial training restore missing texture, and what does it cost in pixel error?
History.
- C. Dong et al., SRCNN (2014); W. Shi et al., ESPCN and the pixel shuffle (2016).
- C. Ledig et al., “Photo-realistic single image super-resolution using a generative adversarial network” (2017).
- X. Wang et al., ESRGAN (2018) and Real-ESRGAN (2021); Y. Blau and T. Michaeli, “The perception-distortion tradeoff” (2018).
Exercise 2. A setup where theory predicts the answer.
- Signals: high-res signals of length 16: a smooth wave plus texture of amplitude 0.3 that alternates every sample, with a random sign. 4× average-pool to length 4 removes the texture completely.
- Network: upsample(x_lr) + MLP(x_lr) (4 → 32 → 32 → 16).
- Training: MSE only (SRResNet-style, 800 steps); then fine-tuned for 500 steps with MSE + 0.05 × adversarial loss, with either a standard D (SRGAN) or a relativistic average D (ESRGAN). Weight interpolation between the MSE and relativistic models.
- Metrics: MSE, PSNR (peak 2), texture energy relative to the truth, and the sign agreement of the texture.
| model (seed 0) | MSE | PSNR (dB) | texture energy | texture sign right |
|---|---|---|---|---|
| repeat upsampling | 0.1415 | 14.51 | 0 | – |
| MSE only | 0.0908 | 16.44 | 0.002 | – |
| SRGAN (MSE + adv) | 0.1796 | 13.48 | 0.921 | 0.482 |
| relativistic D | 0.1885 | 13.27 | 0.949 | 0.49 |
| interpolation α 0.5 | 0.1126 | 15.51 | 0.153 | 0.486 |
| interpolation α 0.8 | 0.1457 | 14.39 | 0.501 | 0.489 |
- MSE hit the theoretical floor: 0.0908 against the predicted A² = 0.09, with no texture.
- The GANs restored texture, at double the error: 0.1796 against the predicted 2A² = 0.18. The texture’s sign was a coin flip (0.482), as it must be.
- Interpolation traced the trade-off: α 0.5 kept most of the PSNR and little texture; α 0.8 gave half the texture energy.
- Seeds 1 and 2: SRGAN texture 0.945 and 0.728 (MSE 0.1826, 0.1656); relativistic D 1.008 and 0.522. On seed 2 the relativistic D restored less texture than the standard D, so its advantage was not consistent here.
- Caveat: 1D signals with a texture chosen to be completely invisible. Real images are partly predictable, and VGG perceptual losses, not modelled here, matter.
Adversarial SR in AI, robotics and aerospace
- Satellite imagery: SR of Sentinel-2 bands from 20 m to 10 m, or of commercial imagery, helps visual interpretation. GAN-made detail must not be used for counting or measuring objects.
- Video and onboard processing: real-time GAN SR, such as Real-ESRGAN variants, can upscale drone video for operators on limited bandwidth links.
- Simulation: SR turns cheap low-resolution renders or simulations into realistic training images; check that downstream models are not fooled by artifacts.
References
- C. Ledig et al. (2017). “Photo-realistic single image super-resolution using a generative adversarial network.” CVPR.
- X. Wang et al. (2018). “ESRGAN: enhanced super-resolution generative adversarial networks.” ECCV Workshops.
- X. Wang, L. Xie, C. Dong and Y. Shan (2021). “Real-ESRGAN: training real-world blind super-resolution with pure synthetic data.” ICCV Workshops.
- Y. Blau and T. Michaeli (2018). “The perception-distortion tradeoff.” CVPR.
- W. Shi et al. (2016). “Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network.” CVPR.