A Probabilistic U-Net for Segmentation of Ambiguous Images

Simon A. A. Kohl, Bernardino Romera-Paredes, Clemens Meyer, Jeffrey De Fauw, Joseph R. Ledsam, Klaus H. Maier-Hein, S. M. Ali Eslami, Danilo Jimenez Rezende, Olaf Ronneberger · NeurIPS · 2018

In one paragraph

When an image is ambiguous, a group of experts draws several different but plausible masks. This paper trains a U-Net together with a conditional VAE so that one small random vector z selects which plausible mask the network draws. Sampling a different z gives a different, internally consistent segmentation, at the cost of re-running only the last few layers.

What the model gives that others do not

Approach What it outputs Why it falls short here
Plain U-Net one mask hides the ambiguity
Dropout U-Net per-pixel probabilities each sample mixes variants pixel by pixel, so no single sample is a coherent hypothesis
Ensemble several masks members are trained independently and each learns the most likely variant; the count is fixed
M-heads several masks the count is fixed in advance and the frequencies of variants are not learned
Probabilistic U-Net unlimited coherent masks, with learned frequencies

The key phrase is joint over pixels. A per-pixel probability of “50% cat, 50% dog” cannot say that the fur is either all cat or all dog; one draw of z commits to a single consistent reading.

The architecture

There are three networks and one latent space \mathbb R^N (the paper found N=6 best on Cityscapes; 3 to 5 dimensions did similarly well).

Sampling.

  1. Run the U-Net and the prior net once.
  2. Draw z_i\sim P(\cdot\mid X) and broadcast it to an N-channel map the size of the mask.
  3. Concatenate it to the last activation map of the U-Net.
  4. Three 1\times1 convolutions (f_{comb}, weights \psi) turn that into class scores: S_i=f_{comb}(f_{U\text{-}Net}(X;\theta),z_i;\psi).

For m samples only step 4 is repeated, which is why sampling is cheap. Injecting late is the deliberate choice. The Image2Image VAE baseline injects into the encoder instead, which forces the latent information to travel through the whole U-Net.

Training

Standard conditional-VAE training. The loss is

\mathcal L(Y,X)=\mathbb E_{z\sim Q(\cdot\mid Y,X)}\big[-\log P_c(Y\mid S(X,z))\big]+\beta\,D_{KL}\big(Q(z\mid Y,X)\,\|\,P(z\mid X)\big)

Why it learns the spread: for the same image the posterior lands in different places for different experts’ masks, and the KL asks the one prior to cover all those places. On average over the data, the prior spreads its mass over the variants and in proportion to how often they occur. At test time only the prior is used.

How it is judged

The generalised energy distance (GED) with d=1-\mathrm{IoU}:

D^2_{GED}(P_{gt},P_{out})=2\,\mathbb E[d(S,Y)]-\mathbb E[d(S,S')]-\mathbb E[d(Y,Y')]

Y,Y' are independent expert masks and S,S' independent model samples. The first term rewards samples near experts’ masks. The other two subtract each set’s own spread, so a model cannot win by being only accurate (all samples identical) or only diverse. It is also a proper metric, and it penalises missing variants and variants produced at the wrong frequency. Lower is better.

Experiments

Results

Mean \hat D^2_{GED} for the Probabilistic U-Net (their Tables 2 and 3):

Samples drawn 1 4 8 16
LIDC 0.811 0.388 0.321 0.287
Cityscapes 0.874 0.337 0.248 0.206

It beat every baseline at 4, 8 and 16 samples (Wilcoxon signed-rank test at 16 samples, p of order 10^{-13} on LIDC and 10^{-77} on Cityscapes). On Cityscapes it is the only model whose frequency of predicting each of the 32 modes lies close to the true probabilities (their Fig. 5), down to the rare ones. The Image2Image VAE finds all the modes but with the wrong frequencies. Ablations (fixed prior; fixed prior with no image context in the posterior; injecting at the start of the U-Net) each did worse.

The latent space can be inspected. In a 2D slice for one lung example, one axis roughly encodes lesion size (including a transition to “no lesion”) and the other shape variation, and the three experts who saw a lesion lie within one standard deviation of the prior while the expert who saw none lies near its edge.

Questions and doubts

Takeaways