Quiz: quadratic smoothing and total variation
Before this unit: Bayesian denoising with an Ising prior (previous unit); Day 27: Graph cuts.
See also: Day 3: Bit depth and noise.
Short questions to test your understanding. Try each on paper first, then open the answer. Energy E(\mathbf x) = \tfrac12\sum_p(x_p - y_p)^2 + \lambda\sum_{(p,q)}\rho(x_p - x_q) with \rho(d) = d^2/2 (quadratic) or \lvert d\rvert (TV).
Q1. Why is quadratic smoothing “just a linear system”, while TV is not?
Differentiate the energy.
With \rho(d) = d^2/2 every derivative of E is linear in \mathbf x: setting the gradient to zero gives (I + \lambda L)\mathbf x = \mathbf y. With \lvert d\rvert the derivative is \pm1 (and undefined at 0), so the optimality conditions are not linear; TV needs a special algorithm (in 1D an exact one).
Q2. A noisy image has a sharp edge of height 100. Why does quadratic smoothing blur it, while TV keeps it sharp?
Compare the prior cost of one jump with many small steps.
A quadratic prior charges d^2: one jump of 100 costs \tfrac12 \cdot 10^4, the same rise in 10 steps of 10 costs \tfrac12 \cdot 1000: ten times less. So it spreads the edge into a ramp. TV charges the total height (100) however it is spread, so nothing is gained by blurring and the data, which say “sharp”, win.
Q3. In what sense is quadratic smoothing a low-pass filter?
What does the solution do to a wave +1, -1, +1, \dots, and to a constant?
On a long signal it multiplies each frequency \omega by 1/(1 + \lambda(2 - 2\cos\omega)): 1 for a constant, 1/(1 + 4\lambda) for the fastest oscillation. High frequencies (noise, but also the sharp part of edges) are damped, low ones pass.
Q4. What are staircasing and contrast loss in TV denoising?
What shapes do TV solutions consist of?
TV solutions are made of flat runs. A smooth ramp in noisy data is therefore turned into a series of flat steps (staircasing). Each run is pulled towards its neighbours by about \lambda/\text{width}, so small or narrow features (a thin bright line, a small spot) lose contrast and eventually vanish.
Q5. When would you prefer the Huber penalty over TV?
Huber is quadratic for small differences.
When the image has both smooth gradients and sharp edges. Huber treats small differences quadratically, so ramps stay smooth (no staircases), and large differences linearly, so edges are not blurred.
Q6. Samples from the TV prior look like rough random walks, not like flat plateaus. Why then are TV estimates piecewise constant?
Which single image does the estimate pick from the posterior?
The estimate is the minimum of the energy (the MAP), not a typical sample. The kink of \lvert d\rvert at 0 makes “exactly equal neighbours” a common place for the minimum to sit, although typical samples almost never have equal neighbours. The look of the estimate is a property of the optimisation, not of what the prior believes images look like.
Q7. How does the noise level enter the quadratic smoothing system?
Start from the posterior with noise standard deviation \sigma_n.
The posterior energy is \frac1{2\sigma_n^2}\sum(x_p - y_p)^2 + \frac{\lambda'}2\sum(x_p - x_q)^2; multiplying by \sigma_n^2 gives our form with \lambda = \lambda'\sigma_n^2. More noise means a larger effective \lambda: the data are trusted less and the image is smoothed more.
Q8. (math) Why does (I + \lambda L)\mathbf x = \mathbf y always have exactly one solution?
\mathbf x^\top(I + \lambda L)\mathbf x = \|\mathbf x\|^2 + \lambda\sum_{(p,q)}(x_p - x_q)^2 > 0 for every \mathbf x \ne 0 (with \lambda \ge 0): the matrix is positive definite, hence invertible. Equivalently the energy is strictly convex.