Quiz: graph-cut segmentation
Before this unit: Graphs, cuts and maximum flow (previous unit); Day 12: Thresholding.
See also: Day 13: Morphology; Day 15: Watershed.
Short questions to test your understanding. Try each on paper first, then open the answer. The graph has one node per pixel, s = object, t = background; t-links s \to p with capacity D_p(0) and p \to t with D_p(1); n-links \lambda w_{pq} in both directions.
Q1. A pixel ends up on the source side of the cut. Which of its t-links is cut, and what does that cost correspond to?
Only edges from S to T count.
p \in S means L_p = 1 (object). The edge p \to t goes from S to T and is cut, at cost D_p(1): the data cost of labelling p object. The edge s \to p lies inside S and costs nothing.
Q2. Why is each n-link added in both directions?
Which pixel of a disagreeing pair is on the source side?
The boundary cost \lambda w_{pq} must be paid whether p is object and q background, or the other way round. With p \in S, q \in T the edge p \to q is cut; with q \in S, p \in T the edge q \to p is. Exactly one of the two counts, so the cut pays \lambda w_{pq} once.
Q3. Two neighbours have grey levels 100 and 160, and \sigma = 20. What is w_{pq}? What if they were 100 and 105?
w_{pq} = \exp(-(I_p - I_q)^2/2\sigma^2).
60^2/(2 \cdot 400) = 4.5, so w = e^{-4.5} = 0.011: a boundary there is almost free. For 100 and 105: 25/800 = 0.031, w = e^{-0.031} = 0.97: almost the full cost.
Q4. How does an object seed force a pixel to be object? Why not simply set its label after the cut?
A seed also affects its neighbours.
Its t-link s \to p gets a capacity larger than any cut could cost (and p \to t capacity 0), so no minimum cut puts it on the background side. Setting the label afterwards would not do the same: the seed must take part in the optimisation, so that its neighbours, through the n-links, are pulled towards the object label too.
Q5. Why does a graph cut with a large \lambda tend to remove thin structures, but keep large blobs with the same intensity?
Compare how data gain and boundary cost grow with size.
The data gain of keeping a structure grows with its area, the boundary cost with its perimeter. A thin line of length \ell has area \ell and perimeter about 2\ell: its gain per unit boundary is small. A disk of radius r has area \pi r^2 and perimeter 2\pi r: the gain per unit boundary grows with r. This preference for short boundaries is the shrinking bias.
Q6. Segmented with a 4-neighbourhood, a round cell comes out with flat sides and diagonal corners cut off. Why, and what helps?
How much does a diagonal boundary cost per unit length with 4 neighbours?
With 4 neighbours the boundary cost is the city-block length: a diagonal boundary costs \sqrt2 \approx 1.41 times as much per unit of true length as a horizontal or vertical one. The cut therefore prefers axis-aligned boundaries (metrication). An 8-neighbourhood with suitable weights (here \tfrac12 for sides and \tfrac{1}{2\sqrt2} for diagonals) makes the cost nearly the same in every direction.
Q7. Object seeds are placed on a nucleus and background seeds only on the white space around the cell. The result includes the cytoplasm. Why, and how do you fix it?
What does the intensity model learn from these seeds?
The model only knows “nucleus grey” (object) and “white” (background). The cytoplasm is grey too, so its data term says object, and nothing in the energy says otherwise. Add background seeds on the cytoplasm: the background model then includes its grey levels, and where nucleus and cytoplasm overlap in intensity, the seeds and the contrast weights at the nuclear envelope decide.
Q8. Can a graph cut minimise an energy that rewards boundaries, V(L_p, L_q) = -[L_p \ne L_q]?
Check the submodularity condition V(0,1) + V(1,0) \ge V(0,0) + V(1,1).
No: V(0,1) + V(1,0) = -2 < 0 = V(0,0) + V(1,1), so it is not submodular. The n-links would need negative capacity, and adding a constant does not help because it does not depend on whether the labels differ. Such energies are NP-hard in general (maximum cut).