Paper commentary
Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials
Dense pixel-level CRFs can be solved quickly using Gaussian filtering
- Problem Fully connected CRFs over all pixels have billions of edges, so traditional inference is impractical. Earlier fully connected models only handled graphs of a few hundred regions at most.
- Method The authors rewrite mean field inference as Gaussian filtering in feature space. Each pixel's message sum runs on a permutohedral lattice, which cuts the cost from quadratic to linear in the number of pixels.
- Results The fully connected CRF reached 86.0 global accuracy on the standard MSRC-21 ground truth. Inference took 0.2 seconds in a single-threaded implementation.
Why pixel-level CRFs stay sparse
Multi-class labeling is usually cast as MAP inference in a CRF over pixels or image patches, where unary terms come from classifiers and pairwise terms encourage neighboring labels to agree. Pixel-level models mostly keep pairwise terms between neighboring pixels, which limits how much long-range structure the model can capture and tends to oversmooth object boundaries.
Region-level models can connect many regions densely, but their output is bounded by how well the regions were segmented in the first place, which makes complex boundaries hard to label accurately. Fully connected CRFs drop the dependence on a preliminary segmentation by linking all pairs of pixels, yet earlier fully connected models were practical only for graphs of a few hundred regions at most.
Inference cost is therefore the bottleneck, and the open question is whether inference on such dense pixel-level graphs can be made cheap enough to use in practice, and whether the extra connectivity improves accuracy.
A dense CRF with Gaussian pairwise terms
The model keeps the usual CRF energy decomposition, with one unary term per pixel and one pairwise term for every pair of pixels, so the graph is complete. The energy is written as a sum over pixels of the unary term plus a sum over pairs i < j of the pairwise term: \[ E(x)=\sum_i \psi_u(x_i)+\sum_{i<j}\psi_p(x_i,x_j) \] Each unary term comes from a per-pixel classifier that sees only that pixel's features, so the labels produced by the unaries alone are noisy and inconsistent across the image.
The pairwise term is a label compatibility function multiplied by a weighted sum of K Gaussian kernels evaluated on feature vectors f_i and f_j: \[ \psi_p(x_i,x_j)=\mu(x_i,x_j)\sum_{m=1}^{K} w^{(m)} k^{(m)}(f_i,f_j) \] Each kernel is \[ k^{(m)}(f_i,f_j)=\exp\!\left(-\tfrac{1}{2}(f_i-f_j)^{T}\Lambda^{(m)}(f_i-f_j)\right) \] where the precision matrix Λ^(m) is symmetric and positive definite and sets the shape of the kernel.
Because the feature space is arbitrary, the same machinery can express different notions of similarity between pixels.
For images the paper uses two kernels defined on pixel positions p and colors I: \[ k(f_i,f_j)=w^{(1)}\exp\!\left(-\frac{|p_i-p_j|^2}{2\theta_\alpha^2}-\frac{|I_i-I_j|^2}{2\theta_\beta^2}\right)+w^{(2)}\exp\!\left(-\frac{|p_i-p_j|^2}{2\theta_\gamma^2}\right) \] The appearance kernel lets pixels that are close in position and similar in color interact, with θα controlling the positional range and θβ the color range.
The smoothness kernel depends on position only, through θγ, and removes small isolated regions.
That ignores relations between labels, so a sky-bird pair pays the same penalty as a sky-cat pair. The model therefore learns a general symmetric compatibility over label pairs from data.
Turning the CRF into iterative message passing
Exact inference on P is out of reach, so mean field replaces the CRF distribution with a product of independent per-pixel marginals: \[ Q(X)=\prod_i Q_i(X_i) \] The marginals are chosen to minimize the KL-divergence D(Q||P) within this family, and the minimization is carried out subject to each Q_i being a valid distribution.
Minimizing the divergence gives an iterative update for each pixel and label: \[ Q_i(x_i=l)=\frac{1}{Z_i}\exp\!\Big(-\psi_u(x_i)-\sum_{l'\in L}\mu(l,l')\sum_{m=1}^{K}w^{(m)}\sum_{j\neq i}k^{(m)}(f_i,f_j)Q_j(l')\Big) \] Inside the exponent, the unary energy is combined with a sum over every other pixel j of the kernel similarity times the current belief Q_j, weighted by w^(m) and transformed by μ.
Z_i is the normalizer that makes Q_i a distribution.
Each iteration has three steps: message passing computes the kernel-weighted sums over other pixels for each kernel and label, a compatibility transform mixes these messages through μ and the weights, and a local update combines the result with the unary term and renormalizes. The compatibility transform and local update are cheap, so the message passing is the bottleneck.
Evaluated naively, each pixel's sum visits all other pixels, which makes the cost quadratic in N.
The authors track convergence with the KL-divergence between Q and P and set the number of iterations to 10 for all later experiments.
Gaussian filtering in feature space
The message sum for pixel i is a Gaussian convolution in feature space, with the self term removed: \[ \tilde Q^{(m)}_i(l)=\sum_{j\in V}k^{(m)}(f_i,f_j)Q_j(l)-Q_i(l)=[G_{\Lambda^{(m)}}\otimes Q(l)](f_i)-Q_i(l) \] The subtraction is needed because the convolution includes j equal to i, while message passing sums only over the other pixels.
The convolution acts as a low-pass filter, so the function is band-limited, and the sampling theorem allows reconstruction from samples spaced in proportion to the filter's standard deviation. The convolution can therefore be computed by downsampling Q onto a sparser set of points, convolving on those samples, and upsampling the result back to the feature points.
The Gaussian is truncated at two standard deviations, so each sample needs only a constant number of neighboring samples, and approximate message passing runs in O(N) time. Generic high-dimensional filters can still scale exponentially in the dimension d, but the permutohedral lattice reduces the convolution cost to O(Nd).
The lattice tiles the feature space with simplices arranged along d+1 axes and exploits the separability of unit-variance Gaussians, so the filter becomes a sequence of one-dimensional convolutions along the lattice axes. To use the lattice, the feature space is whitened with \(\tilde f = U f\), where \(\Lambda^{(m)} = UU^{T}\) is a Cholesky decomposition.
The implementation is fully sequential, with no parallelism or graphics hardware, and the downsampling rate is one standard deviation.
Piecewise learning of unaries, kernels and compatibility
Learning proceeds in pieces. The boosted unary classifiers are trained first with JointBoost on the features described in the implementation. The appearance kernel weight w(1) is fit by a combination of expectation maximization and high-dimensional filtering, while the widths θα and θβ are chosen by grid search on a holdout validation set.
The smoothness parameters are fixed at w(2) = θγ = 1, which the authors found to work well and to give a small visual improvement with little effect on accuracy.
The compatibility μ, which is symmetric, is fit with L-BFGS to maximize the log-likelihood on validation images with ground truth labelings. The exact gradient needs the partition function, so the authors approximate it with the mean field marginals. Each training image contributes two sums over pixel pairs: one built from the ground truth indicators and one built from the marginals Q.
Both sums are evaluated with the same high-dimensional filtering, so the learning cost remains linear in the number of variables N.
Unary features and kernel normalization
The unary potentials are built on TextonBoost, using its 17-dimensional filter bank extended with color, histogram of oriented gradients and pixel location features. On VOC 2010 the responses of bounding box object detectors, one per class, add 20 features. These detector responses raise unary accuracy on VOC 2010 from 13% to 22%, and a logistic regression on the boosted outputs adds a further 5%.
Sampling-based filters underestimate the kernel strength for very similar feature points, and normalization can cancel most of this error. Two normalizations are available: \[ \hat k=\frac{1}{N}\sum_{i,j}k(f_i,f_j)\qquad \hat k_i=\sum_j k(f_i,f_j) \] The global version divides by the average kernel strength over all pairs. The pixelwise version corrects regional errors as well, but it breaks the symmetry of the pairwise term, and the authors found it worked better in practice.
Experiments ran on an Intel i7-930 at 2.80GHz. Eight CPU cores were used for training, and the inference algorithm ran in a single CPU thread.
MSRC-21 results under two ground truths
MSRC-21 contains 591 color images of 320×213 pixels with 21 object classes, and the standard split is 45% training, 10% validation and 45% test. On this dataset the learned label compatibility performed on par with the Potts model.
On the standard ground truth the fully connected CRF reached 86.0 global and 78.3 average accuracy. The Grid CRF reached 84.6 and 77.2, the Robust Pn CRF 84.9 and 77.5, and the unary classifiers alone 84.0 and 76.6. The runtimes listed are 0.2 s for the fully connected model, 1 s for the Grid CRF and 30 s for the Robust Pn CRF, and the 0.2 s figure comes from a single-threaded implementation.
The standard ground truth is imprecise near object boundaries, so the authors hand-labeled 94 representative images, taking 30 minutes per image on average. Accuracy on this set was measured with 5-fold cross validation, with 45 of the 94 images used to train the CRF parameters, while the unary potentials were trained on a separate set that excluded these images.
On the accurate ground truth the fully connected CRF reached 88.2 ± 0.7 global and 84.7 ± 0.7 average, against 86.5 ± 1.0 and 83.1 ± 1.5 for the Robust Pn CRF, 84.8 ± 1.5 and 82.4 ± 1.8 for the Grid CRF, and 83.2 ± 1.5 and 80.6 ± 2.3 for the unary classifiers.
Accuracy near object boundaries
The trimap measure counts the relative number of misclassified pixels inside a narrow band around object boundaries taken from the accurate ground truth, following Kohli et al. The band width is varied, so the comparison checks the boundary region at several widths rather than at one.
The authors report that the fully connected CRF outperforms the compared methods at all trimap widths, and the plotted widths run from 0 to 20 pixels. The compared models are the unary classifiers, the Grid CRF and the Robust Pn CRF. Exact curve values are not stated in the text, so the boundary comparison rests on the ordering the authors report.
PASCAL VOC 2010 results
PASCAL VOC 2010 contains 1928 color images of about 500×400 pixels with 20 object classes and one background class. Because the test labels are not public, all experiments use training and validation data, randomly partitioned into 40% training, 15% validation and 45% test images. Segmentation accuracy uses the standard VOC measure.
Unary potentials trained on the training set reached 27.6% average classification accuracy. The fully connected model with Potts potentials reached 29.1%, and adding the learned label compatibility raised it to 30.2%. The grid CRF reached 28.3% on the same measure, and training took 2.5 hours.
How far the pairwise connections should reach
To test long-range connections, the spatial and color widths θα and θβ of the appearance kernel are varied, with w(1) held fixed and w(2) set to 0. The measured quantity is global accuracy on the 94 accurately labeled MSRC images.
Accuracy rises as longer-range connections are added and peaks at θα = 61 pixels and θβ = 11.
The same long-range edges can carry misleading evidence. Figure 7 shows failure cases in which a bird wing is partly eroded and cat legs are corrupted. The peak comes from a setting with the smoothness kernel weight at 0, so it describes the appearance kernel alone and not the full model.
Limitations
The quantitative comparison covers two benchmarks, MSRC-21 and PASCAL VOC 2010, and the VOC experiments use only training and validation data. The accurate-ground-truth comparison uses 94 images under 5-fold cross validation, and the timings refer to a single-threaded implementation on the stated CPU.
MCMC and graph cut were run only as informal comparisons: MCMC ran for 36 hours and only partially converged on one image, and graph cut did not converge within 72 hours. Neither enters the quantitative tables, which compare against the Grid CRF and the Robust Pn CRF.
The gradient used for the compatibility is an approximation that relies on the mean field marginals, and the kernel widths are chosen by grid search rather than learned. Sampling-based filters underestimate kernel strength for very similar points, and normalization can cancel most of that error, while the pixelwise choice breaks the symmetry of the pairwise term.
On MSRC-21 the learned label compatibility performed on par with the Potts model rather than clearly beating it. Long-range connections can propagate misleading information, as the failure cases show.
Paper info
- Authors
- Philipp Krähenbühl, Vladlen Koltun
- Venue
- arXiv · Preprint
- First published
- 2012-10-20
- Added
- 2026-11-12
- Updated
- 2012-10-20
- Version
- v1
- arXiv
- 1210.5644
- Category
- cs.CV · cs.AI · cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Philipp Krähenbühl, Vladlen Koltun (2012). Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials. arXiv:1210.5644v1. https://arxiv.org/abs/1210.5644v1
BibTeX
@misc{krhenbhl2012efficient,
title = {{Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials}},
author = {Philipp Krähenbühl and Vladlen Koltun},
year = {2012},
eprint = {1210.5644},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1210.5644v1}
}