12 Vision Problems as Inverse Problems
Vision Meets Generation
The previous chapters developed the theory of generative models, including GANs, Wasserstein distances, and min-max optimisation. In this chapter, we show that many classical computer vision problems are inverse problems that can be solved by learned generative priors. This provides the mathematical bridge between the theory of Parts IβIII and the applications in the next chapter.
Key Idea.
If you can generate realistic images, you can also restore them. A generative model that has learned the distribution of natural images encodes a powerful prior over the image space. Combining this prior with a physical forward model turns every inverse problem (denoising, super-resolution, inpainting, style transfer) into a posterior inference problem.
The chapter is organised as follows. We first introduce the general framework of inverse problems in imaging (Section Inverse Problems in Imaging). We then study five fundamental vision tasks, namely denoising (Section Image Denoising), super-resolution (Section Super-Resolution), inpainting (Section Image Inpainting), style transfer (Section Style Transfer and Texture Synthesis), and image-to-image translation (Section Image-to-Image Translation), formulating each as an inverse problem and tracing the path from classical solutions to generative approaches. We close with a unifying perspective on the generative prior (Section The Generative Prior).
Inverse Problems in Imaging
Definition 1 (Forward Model).
An imaging forward model describes the physical process that produces an observation from a clean image : (Forward) where is a (possibly nonlinear) degradation operator and is observation noise.
Example 1 (Forward Models for Common Tasks).
1.4
Task Operator Observation Denoising Identity: Super-resolution Downsample: Inpainting Mask: Deblurring Convolution: Compressed sensing Random projection:
Ill-Posedness
Definition 2 (Well-Posed Problem (Hadamard, 1902)).
A problem is well-posed in the sense of Hadamard if:
A solution exists.
The solution is unique.
The solution depends continuously on the data.
A problem that violates any of these conditions is ill-posed.
Remark 1 (Most Vision Problems Are Ill-Posed).
Super-resolution: The downsampling operator maps many high-resolution images to the same low-resolution observation, so the solution is not unique.
Inpainting: The missing pixels can be filled in infinitely many ways, so again not unique.
Denoising: The inverse of the identity is the identity (trivially well-posed), but the noise makes the problem discontinuous: small changes in can produce large changes in without regularisation.
Bayesian Formulation
The Bayesian approach resolves ill-posedness by introducing a prior over images:
Definition 3 (MAP Estimation).
The maximum a posteriori (MAP) estimate is (MAP) where is the likelihood (determined by the forward model and noise distribution) and is the prior.
Example 2 (MAP for Gaussian Denoising).
For with : The MAP estimate becomes: (Gaussian) The first term pulls towards the observation; the second term pulls it towards βnatural-lookingβ images. The balance between the two is controlled by the noise level .
Insight.
Every choice of prior yields a different restoration algorithm:
total-variation denoising
wavelet shrinkage
from a GAN/VAE/diffusion model generative prior
The evolution from hand-crafted priors to learned generative priors is the central story of modern computational imaging.
Image Denoising
Denoising is the simplest inverse problem: the forward model is the identity, and the task is to undo the effect of additive noise.
Definition 4 (Image Denoising Problem).
Given a noisy observation (Denoise) estimate the clean image .
Classical Methods
Remark 2 (A Hierarchy of Denoising Methods).
Gaussian filter. Replace each pixel by a weighted average of its neighbours: . Simple but blurs edges.
Bilateral filter. Weight neighbours by both spatial distance and intensity similarity, preserving edges while smoothing flat regions.
Non-local means (NLM). Average pixels whose patches (not just individual pixels) are similar, exploiting the self-similarity of natural images [1].
BM3D. Group similar patches into 3D stacks, apply a 3D transform (e.g. wavelet), threshold, and invert. State-of-the-art among non-learned methods [2].
Deep denoisers. Train a neural network to minimise over a dataset of (noisy, clean) pairs. The DnCNN architecture [3] and its successors consistently outperform BM3D.
Historical Note.
The connection between denoising and generative modelling runs deep. Vincent et al. (2008, 2010) showed that training an autoencoder to denoise is equivalent to learning the score function of the data distribution, the very quantity that score-based diffusion models (Part VI of this book) use to generate images. In this sense, denoising is not just an application of generative models; it is their foundation.
The MMSE Estimator
Theorem 1 (Optimal Denoiser).
The estimator that minimises the mean squared error is the posterior mean: (MMSE)
Proof.
For any estimator : since the cross-term vanishes by the tower property. The first term is minimised (to zero) when .
Caution.
The MMSE estimator averages over all plausible clean images, which produces blurry results when the posterior is multimodal. For example, if a noisy image could be either a cat or a dog, the MMSE estimate is a blurry blend of the two. This is why perceptual quality metrics (LPIPS, FID) and MAP/sampling-based approaches are often preferred in practice.
Super-Resolution
Definition 5 (Single-Image Super-Resolution).
Given a low-resolution observation (SR) where with is a downsampling operator (e.g. bicubic downsampling by factor ), estimate the high-resolution image .
Remark 3 (Ill-Posedness of Super-Resolution).
For -fold super-resolution, each low-resolution pixel corresponds to high-resolution pixels. The system is massively underdetermined: there are times more unknowns than equations. Without a prior, there are infinitely many valid high-resolution images consistent with the observation.
Example 3 (The PSNRβPerceptual Quality Trade-Off).
Consider super-resolution of a face image:
Bicubic interpolation: Smooth, blurry output. High PSNR but low perceptual quality.
MSE-trained CNN: Sharper than bicubic, but still blurry on fine details (hair, skin texture). Maximises PSNR.
GAN-based (SRGAN): Generates sharp, realistic textures. Lower PSNR than the CNN, but much higher perceptual quality.
This paradox arises because PSNR measures pixel-wise accuracy, while perceptual quality depends on whether the image βlooks real.β The MMSE solution maximises PSNR but averages over the posterior, producing blur. A GAN samples from the posterior, producing sharp but potentially inaccurate details.
Insight.
The PSNRβperceptual quality trade-off is a distortionβperception trade-off, and it is worth being precise about which quantity does the work, because the intuitive reading is backwards. Conditioned on , both candidate estimators are unbiased: , and a posterior sample also has conditional mean . They differ in variance, and it is the posterior mean that has none: given it is a single deterministic image, and that absence of variability is exactly what blur is. Averaging away the variation across plausible images is what makes the result look unreal.
Writing for the posterior variance, the two estimators cost since an independent sample contributes its own on top of the target's. A posterior sample therefore pays exactly twice the squared error of the posterior mean, while carrying the full posterior variance that makes it look like a real image. Realism is bought with distortion, and any pixel-wise metric such as PSNR will prefer the blur every time.
Classical to Learned Super-Resolution
Remark 4 (Evolution of Super-Resolution).
Interpolation (nearest, bilinear, bicubic): Simple, fast, but does not add any new information.
Sparse coding [4]: Learn a dictionary of high-resolution patches and reconstruct using sparse coefficients.
SRCNN [5]: First deep learning approach, a 3-layer CNN that maps low-resolution to high-resolution. Set a new state of the art in 2014.
SRGAN [6]: Added a GAN loss and a perceptual loss (VGG features) to produce photorealistic super-resolution. We study this in detail in the next chapter.
Image Inpainting
Definition 6 (Image Inpainting Problem).
Given an image and a binary mask (where indicates a missing pixel), the observation is (Inpaint) where denotes element-wise multiplication. The task is to estimate the original image from the observed pixels and the mask .
Remark 5 (Degrees of Freedom in Inpainting).
If pixels are missing (i.e. ), then the problem has free parameters and constraints. For a small scratch (), the problem is mildly underdetermined; for a large hole (), it is severely underdetermined and requires strong priors.
Classical Approaches
Example 4 (Three Classical Inpainting Strategies).
Diffusion-based [7]: Propagate information from known pixels into the missing region using a PDE that mimics heat diffusion: in the missing region, with Dirichlet boundary conditions from the known pixels. Good for thin scratches, poor for large holes.
Patch-based [9]: Search the known region for patches similar to the boundary of the hole, and copy them in. The βimage quiltingβ approach of Efros and Freeman [8] is a related technique. Good for textured regions, poor for structured content.
Generative: Use a generative model (GAN, VAE, diffusion) to sample plausible completions conditioned on the known pixels. Can hallucinate coherent structure (faces, objects) in large missing regions.
Key Idea.
Inpainting is perhaps the clearest demonstration of why generative models matter for vision: filling a large hole in an image requires imagining what could be there, which is exactly what a generative model is trained to do.
Style Transfer and Texture Synthesis
Style transfer and texture synthesis ask a different kind of question: not βwhat was the original image?β but βwhat would this image look like in a different style?β
Texture Synthesis
Definition 7 (Texture Synthesis Problem).
Given a small texture exemplar , generate a larger image () that is perceptually indistinguishable from the exemplar; it should appear to be a different sample from the same texture distribution.
Remark 6 (Texture Synthesis Methods).
Pixel-based [10]: Synthesise one pixel at a time by matching local neighbourhoods. Slow but handles stochastic textures well.
Patch-based (Image Quilting) [8]: Stitch overlapping patches together with minimum-error boundary cuts. Fast and effective for many textures.
Parametric (Gram matrix) [11]: Match the Gram matrices of CNN feature maps between the exemplar and the synthesised image. This is the foundation of neural style transfer.
Neural Style Transfer
The breakthrough of Gatys et al. [13] was to show that the βstyleβ of an image can be captured by the correlations between features in a pretrained CNN.
Definition 8 (Gram Matrix).
Let be the feature map of layer of a pretrained CNN (e.g. VGG-19), where is the number of channels and is the spatial size. The Gram matrix is (GRAM) Entry measures the correlation between feature channels and at layer .
Definition 9 (Neural Style Transfer Loss).
Given a content image and a style image , generate an output that minimises (NST) where control the balance between content fidelity and style fidelity.
Historical Note.
The idea of βimage analogiesβ ( is to as is to ) was introduced by Hertzmann et al. [12] in 2001. It used patch-based nearest-neighbour search to transfer the transformation between an exemplar pair to a new input . Fifteen years later, Gatys et al. [13] showed that a pretrained CNN provides a far more powerful feature space for style representation. This opened the door to real-time style transfer using feed-forward networks [14], and eventually to GAN-based methods like pix2pix (Chapter 13).
Example 5 (Reading the Style Transfer Loss).
Content loss matches spatial feature maps: it preserves the βwhatβ and βwhereβ of the content image (objects, edges, layout).
Style loss matches feature correlations: it captures the βhowβ of the style image (brushstrokes, colour palette, textures), stripped of spatial arrangement.
Increasing makes the output more βstylisedβ (more like ); decreasing it makes it more βphotographicβ (more like ).
Image-to-Image Translation
Many vision tasks can be viewed as translating an image from one domain to another: edges photos, day night, labels facades, horses zebras.
Definition 10 (Image-to-Image Translation).
Given paired training data from two domains and , learn a mapping such that is indistinguishable from real samples in domain .
Remark 7 (Paired vs. Unpaired Translation).
Paired: Each input has a corresponding output (e.g. satellite image map). The loss can include a pixel-wise term. Example: pix2pix [15].
Unpaired: We have images from domain and images from domain , but no correspondences. The loss relies on a cycle-consistency constraint. Example: CycleGAN [16].
Both approaches are studied in detail in the next chapter.
Example 6 (Image-to-Image Tasks as Translation).
1.3
Task Domain Domain Semantic segmentation Photo Label map Colourisation Grayscale Colour Edge-to-photo Edge map Photo Day-to-night Daytime photo Nighttime photo Style transfer Photo Painting Super-resolution Low-res High-res Inpainting Masked image Complete image
Key Idea.
Image-to-image translation is the Swiss army knife of generative vision. By casting each task as a translation between two domains, a single framework (conditional GAN + perceptual loss) can handle denoising, super-resolution, colourisation, segmentation, style transfer, and more. The next chapter develops this idea in detail.
The Generative Prior
We can now see the common thread running through all the problems in this chapter: each one is an inverse problem that requires a prior over natural images.
Definition 11 (Generative Prior).
A generative prior is a prior over images that is implicitly or explicitly defined by a generative model (GAN, VAE, normalising flow, or diffusion model). Given an inverse problem , the generative prior enables:
MAP estimation: where .
Posterior sampling: via MCMC or diffusion-based methods.
Projection: where projects the observation onto the range of the generator.
Remark 8 (From Hand-Crafted to Learned Priors).
1.3
Era Prior Examples 1990s Smoothness (Tikhonov) 2000s Sparsity (compressed sensing) 2010s Patch-based (BM3D, NLM) Self-similarity 2014+ Deep generative (GAN, VAE) from data 2020+ Diffusion models
Example 7 (GAN Projection for Inpainting).
Suppose we have a pretrained GAN generator . To inpaint a masked image :
Optimise over the latent space: .
The reconstruction is .
Because can only produce images in the learned manifold of natural images, the missing pixels are automatically filled with plausible content. This technique requires no task-specific training, only a pretrained generator.
Insight.
The generative prior provides a universal regulariser: the same GAN or diffusion model can be applied to denoising, super-resolution, inpainting, colourisation, and compressed sensing, simply by changing the forward model while keeping fixed. This βplug-and-playβ approach is one of the most powerful ideas in modern computational imaging.
Exercises
Exercise 1 (MAP for Gaussian Denoising).
Consider with and a Gaussian prior .
- (a)
Show that the MAP estimate is .
- (b)
Verify that as , (no denoising needed).
- (c)
Verify that as , (rely entirely on the prior).
- (d)
Compute the MMSE estimator and show it coincides with the MAP for this Gaussian case.
Exercise 2 (Total-Variation Denoising).
The total-variation (TV) prior on a 1D signal is .
- (a)
Write the TV-regularised denoising problem as a minimisation.
- (b)
Show that the TV prior encourages piecewise-constant signals.
- (c)
Explain why TV denoising preserves edges but produces βstaircaseβ artefacts in smooth regions.
- (d)
Propose a modification to handle smooth regions better.
Exercise 3 (Super-Resolution as a Linear Inverse Problem).
For super-resolution of a image to :
- (a)
Write the downsampling operator as a matrix.
- (b)
What is the rank of ? How many dimensions of are unobservable?
- (c)
Show that without a prior, the least-squares solution is equivalent to nearest-neighbour upsampling.
- (d)
Explain how a prior changes this solution.
Exercise 4 (Inpainting with a Known Image Model).
Suppose and we observe (noise-free, masked). Partition into observed components and missing components .
- (a)
Show that is Gaussian and compute its mean and covariance using the Schur complement.
- (b)
What happens when the prior covariance is diagonal? Why is this a poor model for natural images?
- (c)
Explain qualitatively how a GAN prior improves upon the Gaussian prior for this task.
Exercise 5 (Gram Matrix Properties).
- (a)
Show that the Gram matrix is symmetric and positive semidefinite.
- (b)
Show that where is the -th row of (the activation of channel across all spatial locations).
- (c)
Explain why matching Gram matrices captures βstyleβ (correlations between features) rather than βcontentβ (spatial arrangement).
- (d)
If the feature map has channels and spatial size , what is the dimensionality of the Gram matrix? Is this efficient for large feature maps?
Exercise 6 (Content vs. Style Loss).
Consider a neural style transfer setup with a single content layer and a single style layer .
- (a)
If we set , what does the output look like? What about ?
- (b)
Explain why using deeper layers for the content loss preserves semantic structure but not fine details.
- (c)
Explain why using earlier layers for the style loss captures low-level textures while later layers capture higher-level style elements.
Exercise 7 (Perceptual Loss vs. Pixel Loss).
Consider training a super-resolution network with two possible losses: where extracts features from a pretrained VGG network.
- (a)
Explain why minimising leads to blurry outputs.
- (b)
Why does produce sharper results?
- (c)
Design a combined loss for super-resolution that includes pixel, perceptual, and adversarial components. Explain the role of each term.
Exercise 8 (GAN Projection).
A pretrained GAN maps to images .
- (a)
For denoising via GAN projection, , explain why the output is guaranteed to be a βnatural-lookingβ image.
- (b)
What are the limitations of this approach? (Hint: consider the expressiveness of the generator.)
- (c)
How would you modify the approach to handle super-resolution? Inpainting?
Exercise 9 (Paired vs. Unpaired Translation).
- (a)
Explain why an reconstruction loss can be used for paired but not unpaired translation.
- (b)
For unpaired translation, the CycleGAN loss includes where is a reverse mapping. Explain the intuition behind this cycle-consistency loss.
- (c)
Give an example of a translation task where paired data is easy to obtain and one where it is impossible.
Exercise 10 (Designing a Loss Function for Colourisation).
Image colourisation maps a grayscale image to a colour image .
- (a)
Formulate colourisation as an inverse problem: what is ?
- (b)
Why is loss problematic for colourisation? (Hint: consider a blue car vs. a red car.)
- (c)
Design a loss function that combines , perceptual, and adversarial components. Explain each term.
Exercise 11 (Ill-Posedness and the Number of Solutions).
For each of the following tasks, determine whether the inverse problem is (i) well-posed, (ii) underdetermined, or (iii) overdetermined. Justify your answer.
- (a)
Denoising with known noise level.
- (b)
super-resolution.
- (c)
Inpainting a single missing pixel.
- (d)
Inpainting 90% of the image.
- (e)
Compressed sensing with measurements.
- (f)
Deblurring with a known blur kernel.
References
-
A Non-Local Algorithm for Image Denoising
BibTeX
@inproceedings{buades2005nonlocal, title={A Non-Local Algorithm for Image Denoising}, author={Buades, Antoni and Coll, Bartomeu and Morel, Jean-Michel}, booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}, pages={60--65}, year={2005} }Conference paper
-
Image Denoising by Sparse 3-D Transform-Domain Collaborative Filtering
BibTeX
@article{dabov2007bm3d, title = {Image Denoising by Sparse 3-{D} Transform-Domain Collaborative Filtering}, author = {Dabov, Kostadin and Foi, Alessandro and Katkovnik, Vladimir and Egiazarian, Karen}, journal = {IEEE Transactions on Image Processing}, volume = {16}, number = {8}, pages = {2080--2095}, year = {2007} }Journal article
-
Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising
BibTeX
@article{zhang2017beyond, title = {Beyond a {G}aussian Denoiser: Residual Learning of Deep {CNN} for Image Denoising}, author = {Zhang, Kai and Zuo, Wangmeng and Chen, Yunjin and Meng, Deyu and Zhang, Lei}, journal = {IEEE Transactions on Image Processing}, volume = {26}, number = {7}, pages = {3142--3155}, year = {2017} }Journal article
-
Image Super-Resolution via Sparse Representation
BibTeX
@article{yang2010image, title = {Image Super-Resolution via Sparse Representation}, author = {Yang, Jianchao and Wright, John and Huang, Thomas S. and Ma, Yi}, journal = {IEEE Transactions on Image Processing}, volume = {19}, number = {11}, pages = {2861--2873}, year = {2010} }Journal article
-
Learning a Deep Convolutional Network for Image Super-Resolution
BibTeX
@inproceedings{dong2014learning, title = {Learning a Deep Convolutional Network for Image Super-Resolution}, author = {Dong, Chao and Loy, Chen Change and He, Kaiming and Tang, Xiaoou}, booktitle = {European Conference on Computer Vision}, pages = {184--199}, year = {2014} }Conference paper
-
Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
BibTeX
@inproceedings{ledig2017photo, title = {Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network}, author = {Ledig, Christian and Theis, Lucas and Husz{\'a}r, Ferenc and Caballero, Jose and Cunningham, Andrew and Acosta, Alejandro and Aitken, Andrew and Tejani, Alykhan and Totz, Johannes and Wang, Zehan and Shi, Wenzhe}, booktitle = {IEEE Conference on Computer Vision and Pattern Recognition}, pages = {4681--4690}, year = {2017} }Conference paper
-
Image Inpainting
BibTeX
@inproceedings{bertalmio2000image, title={Image Inpainting}, author={Bertalmio, Marcelo and Sapiro, Guillermo and Caselles, Vincent and Ballester, Coloma}, booktitle={Proceedings of the 27th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH)}, pages={417--424}, year={2000} }Conference paper
-
Image Quilting for Texture Synthesis and Transfer
BibTeX
@inproceedings{Efros2001, title={Image Quilting for Texture Synthesis and Transfer}, author={Efros, Alexei A. and Freeman, William T.}, booktitle={Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH)}, pages={341--346}, year={2001}, publisher={ACM}, doi={10.1145/383259.383296} }Conference paper
-
Region Filling and Object Removal by Exemplar-Based Image Inpainting
BibTeX
@article{criminisi2004region, title = {Region Filling and Object Removal by Exemplar-Based Image Inpainting}, author = {Criminisi, Antonio and P{\'e}rez, Patrick and Toyama, Kentaro}, journal = {IEEE Transactions on Image Processing}, volume = {13}, number = {9}, pages = {1200--1212}, year = {2004} }Journal article
-
Texture synthesis by non-parametric sampling
BibTeX
@INPROCEEDINGS{efros1999, author={Efros, A.A. and Leung, T.K.}, booktitle={Proceedings of the Seventh IEEE International Conference on Computer Vision}, title={Texture synthesis by non-parametric sampling}, year={1999}, volume={2}, number={}, pages={1033-1038 vol.2}, keywords={Sampling methods;Image sampling;Pixel;Filters;Histograms;Computer science;Integrated circuit synthesis;Computer vision;Image texture analysis;Application software}, doi={10.1109/ICCV.1999.790383} }Conference paper
-
Texture Synthesis Using Convolutional Neural Networks
BibTeX
@inproceedings{gatys2015texture, title = {Texture Synthesis Using Convolutional Neural Networks}, author = {Gatys, Leon A. and Ecker, Alexander S. and Bethge, Matthias}, booktitle = {Advances in Neural Information Processing Systems}, year = {2015} }Conference paper
-
Image analogies
BibTeX
@inproceedings{Hertzmann2001, author = {Hertzmann, Aaron and Jacobs, Charles E. and Oliver, Nuria and Curless, Brian and Salesin, David H.}, title = {Image analogies}, year = {2001}, isbn = {158113374X}, publisher = {Association for Computing Machinery}, address = {New York, NY, USA}, url = {https://doi.org/10.1145/383259.383295}, doi = {10.1145/383259.383295}, booktitle = {Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques}, pages = {327β340}, numpages = {14}, keywords = {Markov random fields, autoregression, example-based rendering, non-photorealistic rendering, texture synthesis, texture transfer, texture-by-numbers}, series = {SIGGRAPH '01} }Conference paper
-
Image Style Transfer Using Convolutional Neural Networks
BibTeX
@inproceedings{gatys2016image, title={Image Style Transfer Using Convolutional Neural Networks}, author={Gatys, Leon A and Ecker, Alexander S and Bethge, Matthias}, booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, pages={2414--2423}, year={2016} }Conference paper
-
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
BibTeX
@inproceedings{johnson2016perceptual, title = {Perceptual Losses for Real-Time Style Transfer and Super-Resolution}, author = {Johnson, Justin and Alahi, Alexandre and Fei-Fei, Li}, booktitle = {European Conference on Computer Vision}, pages = {694--711}, year = {2016} }Conference paper
-
Image-to-image translation with conditional adversarial networks
BibTeX
@inproceedings{isola2017image, title={Image-to-image translation with conditional adversarial networks}, author={Isola, Phillip and Zhu, Jun-Yan and Zhou, Tinghui and Efros, Alexei A}, booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition}, pages={1125--1134}, year={2017} }Conference paper
-
Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks
BibTeX
@inproceedings{zhu2017unpaired, title = {Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks}, author = {Zhu, Jun-Yan and Park, Taesung and Isola, Phillip and Efros, Alexei A.}, booktitle = {IEEE International Conference on Computer Vision}, pages = {2223--2232}, year = {2017} }Conference paper