Quiz: the random walker
Before this unit: Day 27: Graph cuts; Day 15: Watershed.
See also: Quadratic smoothing and total variation (day 28); Day 28: Ising model and Markov random fields; Day 35: Gaussian mixtures.
Short questions to test your understanding. Try each on paper first, then open the answer. Weights are affinities: w_{pq} large means “similar” (a strong link), as in the graph-cut unit.
Q1. A random walker starts at pixel p. What number does the random walker segmentation assign to p, and how is the label chosen from it?
Two kinds of seeds; which one does the walk reach first?
The probability that a walk from p, stepping to neighbours in proportion to the edge weights, reaches an object seed before a background seed. With two labels, p is object if this probability exceeds 0.5; with K labels it takes the label with the largest probability.
Q2. Why do we never simulate random walks to compute the segmentation?
Where does the walker go in its first step?
The probability at a pixel equals the weighted average of its neighbours’ probabilities (condition on the first step), with 1 and 0 fixed at the seeds. That is a sparse linear system, one equation per unlabelled pixel, solved exactly. Simulation would need thousands of walks per pixel for two correct decimals.
Q3. A chain: object seed, then edges with weights 1 and 1/3, then a background seed. What is the probability at the middle node?
Resistances 1/w; the voltage drops in proportion to resistance.
Resistances 1 and 3, total 4. The voltage drops by 1/4 across the first resistor: the middle node is at 3/4 = 0.75. Check: (1 \cdot 1 + \tfrac13 \cdot 0)/(1 + \tfrac13) = 0.75.
Q4. Can the random walker produce an object region that contains no object seed? Can a graph cut with a data term?
Can a weighted average exceed all of its neighbours?
The plain random walker cannot: a free pixel is an average of its neighbours, so a region above 0.5 must reach up to a node fixed at 1, an object seed (the maximum principle). A graph cut with a data term can: a bright blob far from all seeds may be cheaper as object than as background. (The random walker with priors can too.)
Q5. With three seed labels you need only two linear systems. Why?
What do the three probabilities at a pixel add up to?
At every pixel the three probabilities sum to 1 (every walk ends at some seed). Solve for two labels; the third is 1 minus their sum.
Q6. Seeds are a single click in the object and a single click in the background, both near the left edge of a large image without strong edges. Where will the boundary be, and how confident?
What decides the probability where there are no weak links?
Without edges, the walker is decided by geometry: roughly halfway between the seeds in resistance, wherever the image’s true boundary is. Far from both seeds the probabilities are close to 0.5: the decision is weak, and the uncertainty map shows it. More (or longer) seed strokes help.
Q7. Two regions of grey level 80 and 170 meet in a smooth ramp over 40 pixels. The walker puts the boundary in the wrong place. Why, and what fixes it?
What does the walker know about the grey levels inside regions?
The walker sees only edge weights. A smooth ramp has no weak link, so the boundary is set by the seed positions. Priors fix it: an intensity model from the seeds pulls each pixel towards the class its grey level suggests (an extra diagonal term λ in the same linear system).
Q8. The graph cut and the random walker use the same weights w_{pq} and the same seeds. In one sentence each: what does each minimise?
Hard labels vs real values.
The graph cut minimises the sum of the weights of the cut edges over 0/1 labellings; the random walker minimises the sum of w_{pq}(x_p - x_q)^2 over real values with the seeds fixed. The first favours short boundaries (shrinking bias), the second spreads the change over weak links in proportion to resistance.
Q9. (math) Write the random walker as a minimisation problem and derive the linear system for the unlabelled nodes.
Split the Laplacian into marked and unmarked blocks.
Minimise \mathbf x^\top L\mathbf x with \mathbf x_M fixed. With L = \begin{pmatrix} L_M & B \\ B^\top & L_U\end{pmatrix} the energy is \mathbf x_M^\top L_M\mathbf x_M + 2\mathbf x_U^\top B^\top\mathbf x_M + \mathbf x_U^\top L_U\mathbf x_U; the gradient with respect to \mathbf x_U is zero for L_U\mathbf x_U = -B^\top\mathbf x_M.