# Conditional Random Fields for Image Labeling

Authors: Tong Liu; Xiutian Huang; Jianshe Ma
Journal: Mathematical Problems in Engineering
 (2016)

---

## Abstract

With the rapid development and application of CRFs (Conditional Random Fields) in computer vision, many researchers have made some outstanding progress in this domain because CRFs solve the classical version of the label bias problem with respect to MEMMs (maximum entropy Markov models) and HMMs (hidden Markov models). This paper reviews the research development and status of object recognition with CRFs and especially introduces two main discrete optimization methods for image labeling with CRFs: graph cut and mean field approximation. This paper describes graph cut briefly while it introduces mean field approximation more detailedly which has a substantial speed of inference and is researched popularly in recent years.


---

## Body

## 1. Introduction

Recognizing and labeling objects and properties in a given image is an important task in computer vision. The goal of image labeling is to label every pixel or groups of pixels in the image with one of several predetermined semantic object or property categories, for example, “dog,” “building,” and “car.” It is a natural ability for human beings to perform object recognition effortlessly, but it is not straightforward for a computer to do so. Researchers [1–4] are still trying to improve the image labeling technique to reach a better result in terms of speed and accuracy. Figure 1 is an example of label image labeling.Figure 1
An example of image labeling. An image in (a) is a set of pixelsP with observed intensities I
p for each p
∈
P. A labeling L shown in (b) assigns some label L
p
∈
0,1
,
2 to each pixel p
∈
P. Such labels can represent depth (in stereo), object index (in segmentation), original intensity (in image restoration), or other pixel properties. Thick lines in (b) show labeling discontinuities between neighboring pixels [5].
(a)
An image
(b)
A labelingImage labeling usually includes several issues: first we should set up a model and train it; then we will make inference of labeling for a new image. The state-of-the-art of algorithmic solution to image labeling is yet to reach a satisfactory state, especially for the process of inference. Graph cut method [5–8]was popular previously. But the speed of graph cut method is very slow, especially when there are many labels. In [1], Vineet et al. are able to achieve remarkable speed-ups and improvements in accuracy with graph cut base inference techniques comparing with the baseline method in both joint stereo-object labeling and object class segmentation. However, their method [9] has two limitations: the first is the fact that mean field approximation assumes complete factorization over the individual variables; the second limitation relates to the form of the pairwise weights in the formula which are a linear combination of Gaussian kernels. See Section 3.2 for more details of these two limitations.Naturally, human beings understand a scene mainly by using the spatial and visual information assimilated through their eyes. Inversely, given an image or several images, this information, such as boundary or object, is extremely necessary for scene interpretation. What we hope is to capture the full interaction between pixels. Due to the sensor noise and complexity of the real world, researchers realize that the solution of vision problems can be transformed to some equivalent optimization process as exact interpretation is unapproachable for computers.In the early history of computer vision, Markov random field (MRF) was popularly used in both low-level and high-level vision perception after it was first introduced into vision by S. Geman and D. Geman in 1984 [10]. The MRF provides a mathematical framework to find optimal solutions by using the contextual visual information in the images. Recently, the MRF model regained attention in the field of computer vision thanks to the progress in powerful energy minimization algorithms [3] such as graph cut [6], belief propagation [11], dual decomposition [12], fusion move [13], and iterated conditional modes. The MRF has been applied to image problems such as restoration, matting [14], segmentation, optical flow, object classification [15, 16], face recognition [17], and text recognition [18].Object classification can be formulated as a pixel labeling problem; that is, the correct label is to be assigned to each pixel or clique where the label of a pixel represents some property in the real scene, such as the same object or disparity. In [3], Chen et al. introduced the background, basic concepts, and fundamental formulation of image labeling with MRF. They discussed two distinct types of discrete optimization method, that is, belief propagation and graph cut. And they further applied them to the solutions of two classical vison problems: stereo and binary image segmentation using MRF model. Figure 2 shows some examples of labeling problems in computer vision.Figure 2
Some examples of labeling problems in computer vision. For stereo matching, the goal is to find the corresponding pixel in one image given a pixel in another image. Its label set is the differences (disparities) between corresponding pixels. For image segmentation, its goal is to partition an image into multiple disjoint regions with region IDs as its label set. For image restoration, it tries to “compensate for” or “undo” defects which degrade an image, and its label set is restored intensities or color.
(a)
Stereo matching
(b)
Image segmentation
(c)
Image restorationIt was later recognized that the image labeling problem can be naturally described with a Conditional Random Fields (CRFs) model [1]. The CRF model was first proposed by John Lafferty et al. [19] in 2001. In their work they present iterative parameter estimation algorithms for Conditional Random Fields and compare the performance of the resulting models to HMMs and MEMMs on synthetic and natural-language data. The CRF model is brought to image labeling by Shotton et al., Peng and McCallum, and Kristjansson et al. [20–22].The use of CRFs was originally restricted in the area of Information Extraction [22–25], in which, given a dataset, the problem is to extract relevant information that belongs to some predefined types. Since the datasets are mostly linguistic, imposing a chain structure on the texts is both effective in capturing temporal relations and efficient in inference and learning for texts is inherently sequential. Therefore, CRFs have been quickly adopted in a wide range of text processing applications, such as part-of-speech tagging (POS), chunking [26, 27], and semantic role labeling [28]. Later on, the application of CRFs has been expanded to word alignment [29], question answering [30], and document summarization [31].Recently, the research of the CRF model in computer vision has been very popular, as it can be solved by efficient energy minimization algorithms. The efficiency of inference is a critical issue for CRFs in training and predicting the labels on new inputs. After training a CRF model, the marginal distribution over subsets of labels is computed so as to estimate the parameters of the model. As a result, it can be used to predict the labels of a new input such as a new image using the most likely labels. A lot of inference algorithms have been deployed to solve the CRF optimization problems, such as iterated conditional modes [32], Monte Carlo methods [33], graph cut methods [5–8], and message passing methods, in which mean field inference [1, 34] and belief propagation [35] are the two most popular ways, and people also developed many extensions around the methods.Local information is well captured by the standard form of a CRF [6, 36]. Since it is not effective for modeling global information as it often fails to capture global consistency in image recognition, researches on how to capture global information of images in CRF with different forms [5–7, 37] become a hot area. To capture both local and global information of images makes the learning and inference very tough; we should not only focus on the accuracy of the method, but also consider the efficiency which turns out to be very poor with the increasing number of the input, such as the dimensions of the feature captured, or the number of input images. Therefore, many methods [38–41] have been proposed to solve such a problem. Recently, a number of cross bilateral Gaussian filter-based methods have been proposed for problems such as object class segmentation [34], denoising [42], and stereo and optical flow [2]; all of these permit substantially faster inference, which maintains or improves accuracy as well. On the basis of [6], Vineet et al. [1] show how higher-order terms can be formulated such that filter-based inference remains possible and demonstrate their techniques on joint stereo and object labeling problems, as well as object class segmentation. In fact, they show that they are able to speed up inference in these model around 10–30 times with respect to competing graph cut methods.In this paper, we review the progress in the inference of image labeling with CRF models. As mentioned above, a good inference method algorithm is critical in both predicting a new label with a new input and learning the parameters of the model to satisfy the goals of accuracy and efficiency which are two main aspects that we pursue.Section2 gives the model of CRFs and their extensions. In Section 3, we mainly introduce two inference methods: graph cut and mean field approximation which are widely used in recent years. And we conclude this paper in Section 4.


## 2. The Model of CRFs

A CRF is a discriminative undirected probabilistic graphical model that can represent relationships between different variables [20, 43]. The structure of a CRF model helps to estimate the unobserved ones given the observed ones. The classical CRF model is described as follows [34].Denote byX the input variable and Y
=
(
y
1
,
y
2
,
…
,
y
N
) the joint output variable. The input variable X represents our knowledge about the domain such as color and texture. The output Y can be continuous or discrete, but, in most cases, all the labels we set are discrete.We would like to model the mapping fromX to Y via the conditional distribution P
Y
∣
X. As a result, we are only interested in the output structure conditioned on the input. CRFs approach the modeling of P
Y
∣
X by representing Y as a Markov random field. More precisely, let G
=
(
V
,
E
) be an undirected graph, where V is the set of nodes in the graph and each node corresponds to a variable y
i, and E is the set of edges. Let n
=
V denote the number of nodes in the graph. Define X as the set of input random variables and Y
=
y
v
v
∈
V as the set of output random variables where V
=
X
∪
Y and each y
v
(
v
∈
V
) takes a value from a range of possible discrete labels. In a conditional random field, we assume that each random variable y
v obeys theMarkov property when conditioned on X, such that the conditional probability distribution of y
v given its adjacent nodes is independent of the rest of the nodes in the graph. That is, if G is such a graphical model that (1)
P
y
v
∣
X
,
y
w
,
w
≠
v
=
p
y
v
∣
X
,
y
w
,
w
∈
N
v
,where N
(
v
) is the set of adjacent nodes of v, the Y
,
X is conditional random field (CRF). Let N
=
N
v
∣
∀
v
∈
V represent the neighbor system to indicate the interrelationship between nodes or the order of CRF. The edges are added between one node P
v and its neighbors N
v. Usually, the neighbor system should satisfy the following:(1)
A site does not neighbor with itself:i
∉
N
i.
(2)
The neighboring relationship is mutual:i
∈
N
j
⇔
j
∈
N
i.The definition of the neighbor system is important because it reflects how far the contextual constraint is. For regular data, as in Figure 3, the neighbors of i are defined as the set of sites within a radius of s
q
r
t
(
r
) from i where r is the order of the neighbor system. One has N
i
=
i
,
j
∈
V
∣
[
d
i
s
(
p
i
x
e
l
i
,
p
i
x
e
l
j
)
]
2
≤
r
,
i
≠
j, where d
i
s
(
i
,
j
) measures the Euclidean distance between a and b.Figure 3
An example of 5th-order neighbor system.In object recognition problems, the observationsX are often the image data themselves, or extracted visual features, and Y correspond to the outputs of vision system, for example, possible class labels of the image to be classified, which is shown in Figure 4.Figure 4
The model of CRF in image labeling.y
i represents the label in ith pixel, and x
i is the features of the corresponding pixel such as color and texture. The red lines in this figure only connect neighboring pixels which means each random variable y
i obeys theMarkov property.To make the concept clear, we only consider the case when each variable inV takes a value from a range of possible discrete labels, although they can be either continuous or discrete in a more general case. The paper will describe it in two aspects: probabilistic and energy function.Under probabilistic understanding, it gets the set of all maximal cliquesΛ of G, by using x and y to denote the values assigned to variables X and Y, respectively. The conditional probability distribution of a CRF can be written as (2)
P
y
∣
x
=
1
Z
x
∏
A
∈
Λ
Ψ
A
x
A
,
y
A
,where the so-calledpotential function orcompatibility function
Ψ
A is a nonnegative potential function defined over A which is a maximal clique in G. Z is a normalization factor which is also calledpartition function depending on the observed values of input variable x and is defined as(3)
Z
x
=
∑
y
∏
A
∈
Λ
Ψ
A
x
A
,
y
A
.We also assume that the conditional distribution over graphG is anexponential family [44]; thus we require each potential function Ψ
A to have the form(4)
Ψ
A
=
exp
⁡
∑
k
w
A
k
f
A
k
x
A
,
y
A
,where w
A is a real-valued parameter vector and f
A
k is a set of feature functions defined on the potential Ψ
A.To simplify the solution to the energy function (see (2)), one can take the negative logarithm of the left hand side and right side of (2), and the problem of maximizing the conditional probability becomes an energy minimization problem. In practice, we usually model structures using pairwise constraints, since inference is easier in this case and the model parameters are easy to learn. For example, in computer vision problems, we often see CRFs with maximal cliques of size 2. In this case we can write down the energy as (5)
E
y
∣
x
=
∑
i
D
y
i
∣
x
+
∑
i
,
j
V
y
i
,
y
j
∣
x
,where we call D the unary potential and V the pairwise potential. Occasionally we also use high-order cliques and there are special types of high-order clique potentials that are useful in a few applications.Probabilistic models need to be normalized properly and in many cases require evaluating intractable integrals over the space of all possible variable configurations. While energy functions have no such normalization requirement, thus they provide more flexibility in designing the architecture of the underlying graphical model.The standard form [1, 25] of a CRF is good for modeling local information. We can write down the form of the standard CRF as follows:(6)
P
s
t
d
L
∣
X
=
1
Z
s
t
d
exp
⁡
∑
i
∈
S
f
i
l
i
∣
X
+
α
∑
i
∈
S
∑
j
∈
N
i
f
i
j
l
i
,
l
j
∣
X
,where X is an input image, L
=
l
i
i
∈
S represents labeling, and l
i is a category label at size i. S is a set of sites in the image, N
i is a set of neighbors of i, and α is a coefficient that modulates the effects of the potentials.In fact, the unary potentialf
i represents relations between labels and local image features. It predicts label l
i based on the local features at site i. And the pairwise potential f
i
j represents relationships between labels of neighboring sites. It means if neighboring sites have similar image features, f
i
j favors the same category label for them; if not, they might be assigned different category labels. So the pairwise potential f
i
j works for data-dependent smoothing. What is important is that both potentials represent only local information, as a result, the global information was lost, and some intuitive mistakes can happen; for example, a “dog” might appear in the water [43]. Using the global information, some classification mistakes in image labeling will be avoided which is shown in Figure 5.Figure 5
(a, b) Two small image patches that are difficult to label based on local information. (c, d) Images containing the patches. We will usually make mistakes in such classification problems if we use only the local information because the color and texture features in these two patches are too similar. However, as described in (c, d), the global context makes it clear what the patches are ((a, c) water; (b, d) sky) [43].
(a)
(b)
(c)
(d)Later on, the multiscale CRF [43] (mCRF) was invented to use regional and global label features that encode particular label patterns at local and global scales. The form of mCRF can be presented below by multiplicatively combining component conditional distributions that capture statistical structure at different spatial scale s:(7)
P
L
∣
X
=
1
Z
∏
s
P
s
L
∣
X
.Although the mCRF uses regional and global label features, it has massive variables and parameters to be estimated. And it also involves inefficient stochastic sampling for learning and label inference. So the overwhelmingly large dataset size and number of classes are its limitations in practical application.The boosted random fields [37] model long-range interactions learned by using a boosting algorithm [45]. The hierarchical CRF [23] (hCRF) uses a hierarchical structure of CRFs to model long-range interaction (e.g., relative configurations of objects or regions) and short-range interactions (e.g., pixel-wise label smoothing) in a tractable manner. Its two-layer formulation to exploit different levels of contextual information in images for robust classification is general enough to be applied to different domains ranging from pixel-wise image labeling to contextual object detection. Both of these two methods do not incorporate global information of the image and thus make the labeling highly dependent on local information.The random field model proposed by Toyoda and Hasegawa [46] explicitly models local information and global information in conditional random field. The method extracts global image features as well as local ones and uses them to predict the scene of the input image. The form is(8)
P
L
∣
X
=
1
Z
exp
⁡
∑
i
∈
S
f
i
l
i
∣
X
+
α
∑
i
∈
S
∑
j
∈
N
i
f
i
j
l
i
,
l
j
∣
X
+
β
∑
i
∈
S
g
i
l
i
∣
X
+
λ
∑
i
∈
S
∑
j
∈
N
i
g
i
j
l
i
,
l
j
∣
X
,where g
i and g
i
j are global unary potential and global pairwise potential, respectively, α, β, and λ are coefficients that modulate the effects of the potentials, and Z is the partition function for normalization. The global unary potential g
i represents relationships between labels and global image features. It predicts the spatial configuration of labels according to the scene of the input image. The global pairwise potential g
i
j represents the compatibility of all pairs of labels. This method not only incorporates the local information and global information, but also enables rapid processing by using the global image features. However, it will not do the classification well if there are too many classes (there are only 7 classes in their experiments) because the relationship between classes becomes substantially complex.Some researchers [47–49] move their research point to the higher-order cliques. In fact, most energy minimization methods for solving computer vision problems assume that the energy can be represented in terms of unary pairwise clique potentials. As a result, this assumption severely restricts the representational power of these models making them unable to capture the rich statistics of natural scenes [50], while higher-order clique potentials have the capability to model complex interactions of random variables and thus could overcome this problem. The initial work with high-order potentials [36, 50–52] has been quite promising but their use has been limited due to the unavailability of efficient algorithms for minimizing the resulting energy functions. Kohli et al. [49] extend the class of energy functions for which the optimal α-expansion and α
β-swap moves can be computed in polynomial time. In the paper, they propose the P
n Potts model for which the optimal move can be found by solving a st-mincut problem. They define the P
n Potts model potential for cliques of size n as (9)
ψ
c
x
c
=
γ
k
,
if
x
i
=
l
k
,
∀
i
∈
c
,
γ
m
a
x
o
t
h
e
r
w
i
s
e
,where γ
m
a
x
>
γ
k, ∀
l
k
∈
L. For a pairwise clique this reduces to the P
2 Potts model potential defined as ψ
i
j
a
,
b
=
γ
k if a
=
b
=
l
k and γ
m
a
x otherwise. The Gibbs energy of the CRF with high-order cliques is as follows in this paper:(10)
E
x
=
∑
i
ψ
i
x
i
+
∑
i
∑
j
∈
N
i
ψ
i
j
x
i
,
x
j
+
∑
c
∈
C
ψ
c
x
c
,where c is a clique which represents the path D
c
=
D
i
,
i
∈
c of the frame D and C is the set of all cliques. The example in the paper demonstrates the importance of enforcing label consistency over homogeneous regions for object class segmentation. However, the inference speed is inefficient comparing to mean field inference method.TheP
n Potts model potential is a particular case of the pattern-based potentials [48] which is defined as(11)
ψ
c
p
a
t
x
c
=
γ
x
c
,
if
x
c
∈
P
c
,
γ
m
a
x
o
t
h
e
r
w
i
s
e
,where P
c
⊂
L
c is a set of recognized patterns (i.e., label configurations for clique) each associated with an individual cost γ
x
c, while a common cost γ
m
a
x is applied to all other patterns. If we set P
c to be the L configurations with constant labels, then we will get the P
n Potts model as described.Cooccurrence relations capture global information about which classes tend to appear together in an image and which do not. And to model object class cooccurrence statistics a new termK
x is added to the energy:(12)
E
x
=
∑
ψ
c
x
c
+
K
x
.Torralba et al. [53] proposed the use of additional unary potentials to capture scene based occurrence priors. Their costs took the form:(13)
K
x
=
∑
i
∈
V
ϕ
x
i
.However, the complexity of inference over such potentials scales linearly with the size of the graph; they are prone to overcounting costs and it also requires an initial hard decision of scene type before inference.Rabinovich et al. [54, 55] proposed cooccurrence as a soft constraint that took the form:(14)
K
x
=
∑
i
,
j
∈
V
ϕ
x
i
,
x
j
,where ϕ is some potential which penalizes labels that should not occur together in an image. It can capture the global information, however, because it is on the basis of a fully connected graph; the memory requirements of inference scale badly with the size of a fully connected graph. It grows with complexity O
V
2 rather than O
V with the size of the graph.To improve these methods, Ladicky et al. [40] proposed a new form of K
x:(15)
K
x
=
C
L
x
,where L
(
x
)
=
{
l
∈
L
:
∃
x
i
=
l
} which guarantees invariance to the size of an object and C
(
L
(
x
)
) can be seen as a particular higher-order potential defined over a clique which includes the whole of V, that is, ψ
V
x. And the restriction is placed on C
(
L
(
x
)
) that it should be nondecreasing with respect to the inclusion relation; that is, L
1, L
2
∈
L, and L
1
∈
L
2 imply that C
L
1
≤
C
L
2. By incorporating these potentials, they got a quantitatively better and visually more coherent labelings. But it carries a comparable higher computer cost comparing to mean field inference.Similar to Ladicky et al.’s form ofK
x, Vineet et al. [47] proposed the form of C
(
Λ
(
x
)
):(16)
C
Λ
=
∑
l
∈
L
C
l
·
Λ
l
+
∑
l
1
,
l
2
∈
L
C
l
1
,
l
2
·
Λ
l
1
·
Λ
l
2
,where Λ
l
=
l
∈
Λ, where [
] is 1 for a true condition and 0 otherwise. They used filter-based mean field inference to solve the energy with higher-order terms and showed that they are able to spend up inference in relative models about 10–30 times with respect to competing graph cut methods [43].Joint optimization for object class segmentation is another important area of research in image labeling, such as combining objects and attributes for image segmentation [56], or joint optimization for object class segmentation and dense stereo reconstruction [4]. In [57], Farhadi et al. proposed a method to shift the goal of recognition from naming to description; for example, we not only recognize a basketball as a basketball, but also describe its attributes such as round. Therefore, the method allows them not only to name a familiar object, but also to report unusual aspects of a familiar object and to learn how to recognize new objects with few or no visual examples. The attributes in the paper consist of two aspects: semantic and discriminative. Since the concepts of objects and attributes are both important for describing images precisely, in [57], they formulated the problem of joint visual attribute and object class image segmentation as a dense multilabeling problem, where each pixel in an image should be associated with both an object class and a set of visual attributes labels. In the paper, they proposed a factorial multilabel CRF model which combines the multiclass CRF model and the multilabel model.The multiclass CRF for objects can be defined in terms of an energy function:(17)
E
O
x
=
∑
i
∈
V
ψ
i
O
x
i
+
∑
i
,
j
∈
E
ψ
i
j
O
x
i
,
x
j
,where ψ
i
O and ψ
i
j
O are unary potential and pairwise potential functions, respectively, and E
=
i
,
j
∣
i
,
j
∈
V
,
i
≠
j.The multilabel CRF for attributes is defined as(18)
E
A
y
=
∑
i
∈
V
ψ
i
A
y
i
+
∑
i
,
j
∈
E
ψ
i
j
A
y
i
,
y
j
,where y
=
Y
1
,
Y
2
,
…
,
Y
n are a set of random variables and A
=
a
1
,
a
2
,
…
,
a
m are a set of random attribute labels. Rather than taking values directly in A though, the Y
i’s take values in the power-set operator.They also defined a joint CRF in terms of a pairwise energy over theZ
i (Z
i
=
X
i
,
Y
i):(19)
E
J
z
=
∑
i
∈
V
ψ
i
J
z
i
+
∑
i
,
j
∈
E
ψ
i
j
J
z
i
,
z
j
,where (20)
ψ
i
J
z
i
=
ψ
i
O
x
i
+
ψ
i
A
y
i
+
∑
l
,
a
ψ
i
,
l
,
a
O
A
x
i
,
y
i
,
a
,
ψ
i
j
J
z
i
,
z
j
=
ψ
i
j
O
x
i
,
x
i
+
ψ
i
j
A
y
i
,
y
i
.Using a two-level hierarchical model, where labeling object classes and attributes is done not only at the pixel level but also at a regional level, they gave the following energy:(21)
E
H
z
=
∑
i
∈
V
p
i
x
ψ
i
J
z
i
+
∑
i
,
j
∈
E
ψ
i
j
J
z
i
,
z
j
+
∑
i
∈
V
r
e
g
ψ
i
J
′
z
i
+
∑
i
,
j
∈
E
i
∈
V
p
i
x
,
j
∈
V
r
e
g
ψ
i
j
J
′
z
i
,
z
j
.It was recognized that the problems of dense stereo reconstruction and object class segmentation can both be transformed as one CRF model based labeling problem, in which every pixel in the image is assigned a label corresponding to either its disparity, or an object class. This inspires [4, 46] to provide an energy minimization framework that unifies the two problems. In their paper, the energy function of object class segmentation using a CRF took the form(22)
E
O
x
=
∑
i
∈
V
ψ
i
O
x
i
+
∑
i
∈
V
,
j
∈
N
i
ψ
i
j
O
x
i
,
x
j
+
∑
c
∈
C
ψ
c
O
x
c
.And the problem of dense stereo reconstruction using a CRF can be written as(23)
E
D
x
=
∑
i
∈
V
ψ
i
D
y
i
+
∑
i
∈
V
,
j
∈
N
i
ψ
i
j
D
y
i
,
y
j
.Thus the energy of the CRF for joint estimation can be written as(24)
E
x
=
∑
i
∈
V
ψ
i
J
z
i
+
∑
i
∈
V
,
j
∈
N
i
ψ
i
j
J
z
i
,
z
j
+
∑
c
∈
C
ψ
c
O
x
c
.Using the fact that certain objects occupy a certain range of real world heights, they jointed unary potentials successfully by(25)
ψ
i
C
x
i
,
y
i
=
-
log
⁡
H
h
y
i
,
i
∣
x
i
,where h
y
i
,
i is the corresponding height above the ground plane and H
h
∣
l is a histogram based measure of the naïve probability that a pixel taking label l has height h in the training set. So the combined unary potential can be written as(26)
ψ
i
J
x
i
,
y
i
=
w
O
w
ψ
i
O
x
i
+
w
D
w
ψ
i
D
y
i
+
w
C
u
ψ
i
C
x
i
,
y
i
,where w
O
u, w
D
u, and w
C
u are the corresponding weights.For pairwise interactions, we know that an object classes boundary is more likely to occur if the disparity of two neighboring pixels differs significantly. Taking it into account, they chose tractable pairwise potentials of the form(27)
ψ
i
j
J
x
i
,
y
i
,
x
j
,
y
j
=
w
O
p
ψ
i
j
O
x
i
,
x
i
+
ψ
D
p
ψ
i
j
D
y
i
,
y
i
+
ψ
C
p
ψ
i
j
O
x
i
,
x
i
ψ
i
j
D
y
i
,
y
i
,where w
O
p, ψ
D
p, and ψ
C
p are the weights of the pairwise potential.Although the two models described as above need more parameters to learn which makes the processes of learning and inference more complicated, they achieved a better scene understanding comparing to other models before.


## 3. Inference Methods

Over the years, a large number of inference algorithms have been developed; although exact inference in such CRFs is intractable, much attention has been paid to developing fast approximation algorithms, including graph cut approaches [6], variants of belief propagation [11, 35, 50], and a number of Gaussian filter-based methods [1, 39]. In this section, we briefly introduce two inference methods for approximating energy minimums; one is the classical method, graph cut, and the other is mean field approximation which has been popular in recent years.


### 3.1. Graph Cut

Greig and Porteous [59] first applied the graph cut in computer vision which describes a large family of MRF inference algorithms based on solving min-cui/max-flow problem. If a type of computer vision problems can be formulated in terms of an energy function, then we can use graph cut to get the minimum energy configuration that corresponds to the MAP theory. Figure 6 is an example of min-cut graph cut.Figure 6
An example of min-cut graph cut. The circles represent the pixels, and the lines including curves represent the edges between nodes includingt-links and n-links. The dotted line indicates a cut of graph partition [3].In this method, we set a directed weighted graphG
=
(
V
,
E
) which consists of a set of nodes V and a set of directed edges E and the edge weight is nonnegative. The nodes correspond to pixels in image labeling problem. There are two additional nodes which are called terminals, that is, the source s and the sink t. In computer vision, terminals correspond to the set of labels that can be assigned to pixels. All edges in the graph are assigned some weight or cost. In fact, it is very important to assign edge weights for many graph-based applications in vision. And there are two types of edges in the graph: n-links and t-links. The former connect pairs of neighboring pixels so they can represent a neighborhood system in an image. The latter connect pixels with terminals; thus a t-link connecting a pixel and a terminal corresponds to a penalty for assigning the corresponding label to the pixel. A cut C
⊂
E is a set of edges such that the terminals are separated in the induced graph G
C
=
(
V
,
E
-
C
). In addition, no other proper subset of C separates the terminals in G
C. And the weight of a cut C is the sum of its edge weights, for example, C. The minimum cut problem is to find the cut with the smallest cost.Boykov et al. [6] proposed the two most graph cut algorithms: α-expansion and α
β-swap. α
β-swap is described as follows: for a pair of labels α, β, it exchanges the labels between an arbitrary set of pixels labeled α and another arbitrary set labeled β. The algorithm generates a labeling such that there is no swap move that decreases the energy. As for α-expansion: for a label α, this move assigns an arbitrary set of pixels to the label α. This algorithm is ended when there is no expansion move that decreases the energy. In their paper they define two concepts: semimetric and metric. Suppose V is the interaction potentials of the energy, for example, V
p
,
q
(
f
p
,
f
q
) with features f
·. V is called a semimetric on the space of labels L if, for any pair of labels α
,
β
∈
L, it satisfies two properties: V
α
,
β
=
V
β
,
α
≥
0 and V
α
,
β
=
0
⇔
α
=
β. If V also satisfies the triangle inequality V
α
,
β
≤
V
α
,
γ
+
V
γ
,
β in L, then V is called a metric. Although α-expansion is more accurate and efficient and can produce a result with lower energy, the interaction potential must be a metric when using α-expansion, while for α
β-swap, it must be semimetric.The main idea of theα-expansion algorithm is to successively segment all α and non-α pixels with graph cuts and the algorithm will change the value of α at each iteration. The algorithm will iterate through each possible label for α until it converges. At each iteration, the α region P
α can only expand. This changes somehow the way to set the graph weights. Also when two neighboring nodes do not currently have the same label, an intermediate node is inserted and links are weighted so they are relative to the distance of the α label.The main idea of theα
β-swap algorithm is to successively segment all α pixels from β pixels with graph cuts and the algorithm will change the α
-
β combination at each iteration. The algorithm will iterate through each possible combination until it converges. Within an iteration the graph is constructed in a normal way so it can segment efficiently between the α region and the β region. Special care must be taken with nodes that are neither in the α nor in the β region. That means, for a pixel, the terminal link weight is the data term plus the sum of all links to neighbors which are neither in the α region nor in the β region.In [6], the energy formula was described as E
y
=
∑
i
∈
V
D
i
(
d
i
,
y
i
)
+
∑
i
,
j
∈
N
V
i
,
j
(
y
i
,
y
j
). The first term is known as the data term. It ensures that the current labeling y is coherent with the observed data d
i. It penalizes a label y
i to pixel i if it is too different from the observed data d
i. The second term is the smooth term. To make it clear for algorithms used in [6], a quick implementation of the α-expansion algorithm for image restoration is shown in Figure 7. Here an image with embedded squares is of intensity values 255, 191, 128, and 64. Noise was added to the original image so intensity is i
′
=
i
±
10. Possible labels are all integers between 0 and 255. The algorithm will perform α
-
α
- segmentations until it converges. Note that α
- means non-α labels. The data term used here is a simple squared difference D
d
i
,
y
i
=
(
d
i
-
y
i
)
2. The smoothing term used here is Potts model V
y
i
,
y
j
=
λ
T
(
y
i
≠
y
j
), where T
(
x
)
=
1 if x is true, or zero otherwise.Figure 7
Restoration using theα-expansion algorithm [6].
(a)
Observed image
(b)
Restored image at convergenceFor more details aboutα
β-swap and α-expansion, one can go to [6]. In addition, Kolmogorov and Rother [60] wrote a survey about graph cut and pointed out that graph cut can be applied to both submodular and nonsubmodular functions. Other more recent developments in graph cut include order-preserving graph cut [61] and combination graph cut [3, 62].


### 3.2. The Mean Field Approximation

Recently, a number of mean field approximations in computer vision have been proposed, such as object class segmentation [8, 9, 11, 34]. The mean field algorithm finds the distribution Q, which is closest to P which is the exact distribution by minimizing the KL-divergence D
Q
∣
P within the class of distributions representable as a product of independent marginal, Q
X
=
∏
i
Q
i
X
i [63]. Although the approximation of P as a fully factored distribution is likely to lose a lot of information in the distribution, this approximation is computationally attractive. The mean field approximation can be formulated as follows:(28)
F
i
n
d
Q
i
X
i
m
a
x
i
m
i
z
e
F
subject  to
Q
X
=
∏
i
Q
i
X
i
∑
x
i
Q
i
x
i
=
1
,
∀
i
,where F is the energy functional. See [63] for more details.The approach of [34] of provides a filter-based method for performing fast approximate maximum posterior marginal (MPM) inference; for example, the solution satisfies x
i
M
P
M
∈
a
r
g
m
a
x
i
∑
x
∣
x
i
=
l
P
x
∣
I, in multilabel CRF models with fully connected pairwise terms, where the pairwise terms have the form of a weighted mixture of Gaussian kernels. We can express the fully connected pairwise CRF as(29)
P
X
∣
I
=
1
Z
I
e
x
p
-
E
X
∣
I
E
X
∣
I
=
∑
i
∈
N
ψ
u
x
i
+
∑
i
<
j
∈
N
ψ
p
x
i
,
x
j
,where E
X
∣
I is the energy associated with a configuration X conditioned on I and ψ
u and ψ
p are unary and pairwise potential functions, respectively. And, in [34], the pairwise potentials take the form of a weighted mixture of Gaussian kernels:(30)
ψ
p
x
i
,
x
j
=
u
x
i
,
x
j
∑
m
=
1
M
w
m
k
m
f
i
→
,
f
j
→
,where u is a label compatibility function, k
m
·
,
·, m
=
1
⋯
M are Gaussian kernels, and w
m
·
,
·, m
=
1
⋯
M are the corresponding weight of the kernels. We briefly deduce the whole process of the iterative update equation:(31)
Q
i
x
=
l
=
1
Z
exp
⁡
-
ψ
u
x
i
-
∑
l
′
∈
L
u
l
,
l
′
∑
m
=
1
M
w
m
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
′
.First, we can write the KL-divergenceD
(
Q
∥
P
):(32)
D
Q
∥
P
=
∑
x
Q
x
log
⁡
Q
x
P
x
=
-
∑
x
Q
x
log
⁡
P
x
+
∑
x
Q
x
log
⁡
Q
x
=
-
E
U
~
Q
log
⁡
P
U
+
E
U
~
Q
log
⁡
Q
U
=
-
E
U
~
Q
log
⁡
P
~
U
+
E
U
~
Q
log
⁡
Z
+
∑
i
E
U
i
~
Q
log
⁡
Q
U
i
=
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
,where E
U
~
Q refers to the expected value under the distribution Q. Since Q
X
=
∏
i
Q
i
X
i and linearity of expectation E
U
~
Q
log
⁡
Q
(
U
)
=
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
(
U
i
), one has(33)
E
U
~
Q
E
U
=
E
U
~
Q
∑
i
ψ
u
U
i
+
∑
i
<
j
ψ
p
U
i
,
U
j
=
∑
i
E
U
i
~
Q
i
ψ
u
U
i
+
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
,where(34)
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
=
1
2
∑
i
E
U
i
~
Q
i
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
U
i
,
U
j
=
1
2
∑
m
=
1
M
w
m
∑
i
E
U
i
~
Q
i
∑
j
≠
i
k
m
f
i
→
,
f
j
→
E
U
j
~
Q
j
u
U
i
,
U
j
.The marginalQ
i
x
i which we need is found by minimizing a Lagrangian that consists of all terms in D
Q
∣
P plus Lagrange multipliers assuring that the marginal Q
i
X
i are probability distributions. The detailed derivations will be presented below:(35)
L
i
Q
=
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
Q
i
x
i
-
1
.So we can get(36)
∂
L
i
Q
Q
i
x
i
=
∂
Q
i
x
i
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
Q
i
x
i
-
1
=
∂
Q
i
x
i
∑
i
E
U
i
~
Q
i
ψ
u
U
i
+
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
x
i
-
1
=
ψ
u
x
i
+
∂
Q
i
x
i
1
2
∑
i
E
U
i
~
Q
i
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
U
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
=
ψ
u
x
i
+
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
.Setting the derivative to 0,(37)
ψ
u
x
i
+
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
=
0and rearranging terms, we get that(38)
log
⁡
Q
i
x
i
=
-
ψ
u
x
i
-
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
-
1
-
λ
⟹
Q
i
x
i
=
exp
⁡
-
ψ
u
x
i
-
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
-
1
-
λ
⟹
Q
i
x
i
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
,where Z
i is the corresponding partition function.Substituting the definition of the pairwise potential above into the mean field update in (38) yields the following formulation of the update equation:(39)
Q
i
x
i
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
m
=
1
M
w
m
∑
j
≠
i
E
U
j
~
Q
j
u
l
,
U
j
k
m
f
i
→
,
f
j
→
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
m
=
1
M
w
m
∑
j
≠
i
∑
l
′
∈
L
Q
j
l
′
u
l
,
l
′
k
m
f
i
→
,
f
j
→
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
l
′
∈
L
u
l
,
l
′
∑
m
=
1
M
w
m
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
′
.In fact, the general form of the mean field update equations (see [52]) is(40)
Q
i
v
i
=
v
=
1
Z
i
exp
⁡
-
∑
c
∈
C
∑
v
c
∣
v
i
=
v
Q
c
-
i
v
c
-
i
·
ψ
c
v
c
,where v is a value in the domain of random variable v
i, v
c denote an assignment of all variables in clique c, and v
c
-
i is an assignment of all variables in c apart from V
i, and Q
c
-
i denotes the marginal distribution of all variables in c apart from V
i derived from the joint distribution Q. Thus ∑
v
c
∣
v
i
=
v
Q
c
-
i
v
c
-
i
·
ψ
c
v
c evaluates the expected value of ψ
c over Q given the condition that V
i takes the value v. When we set v
i
=
x
1
⋯
N and v
=
1
⋯
L by evaluating (40) across the unary and pairwise potentials defined in [34], we will directly get (39).In [34], it is shown that parallel updates for (39) can be evaluated by convolution with a high dimensional Gaussian kernel using any efficient bilateral filter, for example, the permutohedral lattice method of [39]. It is achieved by the following transformation:(41)
Q
~
i
m
=
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
=
G
m
⊗
Q
l
f
i
→
-
Q
i
l
,where G
m is a Gaussian kernel corresponding to the mth component of (30), and ⊗ is the convolution operator. The following algorithms are the algorithms used in [34].Algorithm  1 (mean field in fully connected CRFs).
while not converged do(42)
Q
~
i
m
l
⟵
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
∀
m
Q
^
i
x
i
⟵
∑
l
∈
L
u
m
x
i
,
l
∑
m
w
m
Q
~
i
m
l
Q
i
x
i
⟵
e
x
p
-
ψ
u
x
i
-
Q
^
i
x
i
end  whileIn [34], the permutohedral lattice [39] was used for the filter-based inference; the recently proposed domain transform filtering approach [58] has certain advantages over the permutohedral lattice. Since domain transform filtering approach does not subsample the original signal, its complexity is independent of the filter size, while the complexity and filter size are inversely related using the permutohedral lattice. In [47], it was demonstrated that the domain transform approach achieves even faster inference times than using the permutohedral lattice for accurate object/stereo labeling. On the basis of [34, 47] the mean field approximation to the inference of models with higher-order terms was further applied.In [47] the pattern-based potentials ψ
c
p
a
t
x
c were added, which is described in Section 2, to the energy function; the required expectation for the mean field updates (39) can be calculated:(43)
∑
x
c
∣
x
i
=
l
Q
c
-
i
x
c
-
i
·
ψ
c
p
a
t
x
c
=
∑
p
∈
P
c
∣
i
=
l
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
p
j
γ
p
+
1
-
∑
p
∈
P
c
∣
i
=
l
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
p
j
γ
m
a
x
,where P
c
∣
i
=
l is the subset of patterns in P
c for which x
i
=
l.A particular case of the pattern-based potential is theP
n-Potts model, (44)
ψ
c
p
o
t
t
s
x
c
=
r
l
if
∀
i
∈
c
,
x
i
=
l
r
m
a
x
o
t
h
e
r
w
i
s
e
,and the required expectations can be expressed as (45)
∑
x
c
∣
x
i
=
l
Q
c
-
i
x
c
-
i
·
ψ
c
p
o
t
t
s
x
c
=
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
l
r
l
+
1
-
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
l
γ
m
a
x
.The paper [1] also added coconcurrence potentials (see [47] for more details) which is over the entire image clique with a defined form and tested their approach on object class segmentation. As a result, they showed substantial improvements in inference speed with respect to graph cut based methods, particularly by using recent domain transform filtering techniques, while also observing similar or better accuracies. Figures 8 and 9 are the results of [1] in both stereo and image labeling. All the experiments in [1] are based on an Inter® Xeon® 3.33 GHz processor, and they fixed the number of full mean field update iterations to 5 for all models.Figure 8
Results of [1] on Leuven dataset. From (a–e): input image, ground truth, object labeling for [4] (using graph cut + range-moves for inference), object labeling, and stereo outputs from dense CRF with higher-order terms and extended cost-volume filtering [1].
(a)
(b)
(c)
(d)
(e)Figure 9
Results of [1] on PascalVOC-10 dataset. From (a–e): input image, ground truth, output from [40] (AHCRF + cooccurrence), output from [34] (dense CRF), and output from dense CRF with Potts and cooccurrence terms [1].
(a)
(b)
(c)
(d)
(e)In Figure8, [1] applied their model to the Leuven dataset, consisting of stereo images of street scenes, with ground truth labeling for 7 object classes, and manually annotated ground truth stereo labeling quantized into 100 disparity labels. In their model they used JointBoost classifier responses to form the object unary potentials. A truncated l
2-norm of the intensity differences is used to form the disparity potentials. For the densely connected pairwise terms, identical kernels and weightings and Ising model for the label compatibility function were used. For the P
n-Potts potentials, γ
l
=
0 for all l
=
1
,
…
,
L was set and γ
m
a
x was set by cross-validation. Figure 9 is the results of [1] on PascalVOC-10 dataset.From Figure8 and Table 1, we note that the densely connected CRF with higher-order terms (Dense + HO) achieves comparable accuracies to [4], and that the use of domain transform filtering methods [58] permits an extra speed-up, with inference being almost 12 times faster than the least accurate setting of [4] and over 35 times faster than the most accurate. The Dense + HO + CostVol approach achieves the best overall stereo accuracies. Although the improved stereo performance appears to generate a small decrease in the object labeling accuracy in [1]’s full model, the former remains at an almost saturated level.Table 1
Quantitative comparison on Leuven dataset of [1]. The table compares the average time per image and performance (object and stereo labeling accuracy) of joint object and stereo algorithms, using graph cut + range-move (GC + Range (x)), an extension of cost-volume filtering, and [1]’s dense CRF with higher-order terms and filter-based inference (with and without cost-volume filtered unary, and using different approaches). HO means higher-order terms of [1] in the table.
Algorithm
Time (s)
Object (% correct)
Stereo (% correct)
GC + Range (1) [4]
24.6
95.94
76.97
GC + Range (2) [4]
49.9
95.94
77.31
GC + Range (3) [4]
74.4
95.94
77.46
Extended CostVol ([39] filter)
4.2
95.20
77.18
Dense + HO ([39] filter)
3.1
95.24
78.89
Dense_HO ([58] filter)
2.1
95.06
78.21
Dense + HO + CostVol ([58] filter)
6.3
94.98
79.00Figure9 and Table 2 compare timing and performance of [1]’s approach (final 2 lines) against two baseline. The importance of higher-order information is confirmed by the better performance of all algorithms compared to the basic dense CRF of [34]. Further, the filter-based inference is able to improve substantially on the inference time and class-average performance of the AHCRF [40], with P
n-Potts and cooccurrence potentials each giving notable gains.Table 2
Quantitative results of [1] on PascalVOC-10 dataset.
Algorithm
Time (s)
Overall (% correct)
AHCRF + Cooc [40]
36
81.43
Dense CRF [34]
0.67
71.63
Dense + Potts
4.35
79.87
Dense + Potts + Cooc
4.4
80.44Although the mean field algorithm is an easy approximation method, it still has several limitations. As mentioned in [9], the first limitation is related to the fact that the mean field approximation assumes complete factorization over the individual variable. As a result, the mean field inference methods are usually sensitive to initialization although the simplified model leads to efficient and tractable models for learning and inference. Another limitation relates to the form of the pairwise weights in (30) which are a linear combination of Gaussian kernels. In fact, they allow each Gaussian component to take only zero mean and use the same combination of Gaussian kernels for each label pair. Although these are improved in [9], they are still lead to unsatisfactory results. Therefore, in the future, we hope to find some other methods which have not only substantial speed of inference but also considerable accuracies.


## 3.1. Graph Cut

Greig and Porteous [59] first applied the graph cut in computer vision which describes a large family of MRF inference algorithms based on solving min-cui/max-flow problem. If a type of computer vision problems can be formulated in terms of an energy function, then we can use graph cut to get the minimum energy configuration that corresponds to the MAP theory. Figure 6 is an example of min-cut graph cut.Figure 6
An example of min-cut graph cut. The circles represent the pixels, and the lines including curves represent the edges between nodes includingt-links and n-links. The dotted line indicates a cut of graph partition [3].In this method, we set a directed weighted graphG
=
(
V
,
E
) which consists of a set of nodes V and a set of directed edges E and the edge weight is nonnegative. The nodes correspond to pixels in image labeling problem. There are two additional nodes which are called terminals, that is, the source s and the sink t. In computer vision, terminals correspond to the set of labels that can be assigned to pixels. All edges in the graph are assigned some weight or cost. In fact, it is very important to assign edge weights for many graph-based applications in vision. And there are two types of edges in the graph: n-links and t-links. The former connect pairs of neighboring pixels so they can represent a neighborhood system in an image. The latter connect pixels with terminals; thus a t-link connecting a pixel and a terminal corresponds to a penalty for assigning the corresponding label to the pixel. A cut C
⊂
E is a set of edges such that the terminals are separated in the induced graph G
C
=
(
V
,
E
-
C
). In addition, no other proper subset of C separates the terminals in G
C. And the weight of a cut C is the sum of its edge weights, for example, C. The minimum cut problem is to find the cut with the smallest cost.Boykov et al. [6] proposed the two most graph cut algorithms: α-expansion and α
β-swap. α
β-swap is described as follows: for a pair of labels α, β, it exchanges the labels between an arbitrary set of pixels labeled α and another arbitrary set labeled β. The algorithm generates a labeling such that there is no swap move that decreases the energy. As for α-expansion: for a label α, this move assigns an arbitrary set of pixels to the label α. This algorithm is ended when there is no expansion move that decreases the energy. In their paper they define two concepts: semimetric and metric. Suppose V is the interaction potentials of the energy, for example, V
p
,
q
(
f
p
,
f
q
) with features f
·. V is called a semimetric on the space of labels L if, for any pair of labels α
,
β
∈
L, it satisfies two properties: V
α
,
β
=
V
β
,
α
≥
0 and V
α
,
β
=
0
⇔
α
=
β. If V also satisfies the triangle inequality V
α
,
β
≤
V
α
,
γ
+
V
γ
,
β in L, then V is called a metric. Although α-expansion is more accurate and efficient and can produce a result with lower energy, the interaction potential must be a metric when using α-expansion, while for α
β-swap, it must be semimetric.The main idea of theα-expansion algorithm is to successively segment all α and non-α pixels with graph cuts and the algorithm will change the value of α at each iteration. The algorithm will iterate through each possible label for α until it converges. At each iteration, the α region P
α can only expand. This changes somehow the way to set the graph weights. Also when two neighboring nodes do not currently have the same label, an intermediate node is inserted and links are weighted so they are relative to the distance of the α label.The main idea of theα
β-swap algorithm is to successively segment all α pixels from β pixels with graph cuts and the algorithm will change the α
-
β combination at each iteration. The algorithm will iterate through each possible combination until it converges. Within an iteration the graph is constructed in a normal way so it can segment efficiently between the α region and the β region. Special care must be taken with nodes that are neither in the α nor in the β region. That means, for a pixel, the terminal link weight is the data term plus the sum of all links to neighbors which are neither in the α region nor in the β region.In [6], the energy formula was described as E
y
=
∑
i
∈
V
D
i
(
d
i
,
y
i
)
+
∑
i
,
j
∈
N
V
i
,
j
(
y
i
,
y
j
). The first term is known as the data term. It ensures that the current labeling y is coherent with the observed data d
i. It penalizes a label y
i to pixel i if it is too different from the observed data d
i. The second term is the smooth term. To make it clear for algorithms used in [6], a quick implementation of the α-expansion algorithm for image restoration is shown in Figure 7. Here an image with embedded squares is of intensity values 255, 191, 128, and 64. Noise was added to the original image so intensity is i
′
=
i
±
10. Possible labels are all integers between 0 and 255. The algorithm will perform α
-
α
- segmentations until it converges. Note that α
- means non-α labels. The data term used here is a simple squared difference D
d
i
,
y
i
=
(
d
i
-
y
i
)
2. The smoothing term used here is Potts model V
y
i
,
y
j
=
λ
T
(
y
i
≠
y
j
), where T
(
x
)
=
1 if x is true, or zero otherwise.Figure 7
Restoration using theα-expansion algorithm [6].
(a)
Observed image
(b)
Restored image at convergenceFor more details aboutα
β-swap and α-expansion, one can go to [6]. In addition, Kolmogorov and Rother [60] wrote a survey about graph cut and pointed out that graph cut can be applied to both submodular and nonsubmodular functions. Other more recent developments in graph cut include order-preserving graph cut [61] and combination graph cut [3, 62].


## 3.2. The Mean Field Approximation

Recently, a number of mean field approximations in computer vision have been proposed, such as object class segmentation [8, 9, 11, 34]. The mean field algorithm finds the distribution Q, which is closest to P which is the exact distribution by minimizing the KL-divergence D
Q
∣
P within the class of distributions representable as a product of independent marginal, Q
X
=
∏
i
Q
i
X
i [63]. Although the approximation of P as a fully factored distribution is likely to lose a lot of information in the distribution, this approximation is computationally attractive. The mean field approximation can be formulated as follows:(28)
F
i
n
d
Q
i
X
i
m
a
x
i
m
i
z
e
F
subject  to
Q
X
=
∏
i
Q
i
X
i
∑
x
i
Q
i
x
i
=
1
,
∀
i
,where F is the energy functional. See [63] for more details.The approach of [34] of provides a filter-based method for performing fast approximate maximum posterior marginal (MPM) inference; for example, the solution satisfies x
i
M
P
M
∈
a
r
g
m
a
x
i
∑
x
∣
x
i
=
l
P
x
∣
I, in multilabel CRF models with fully connected pairwise terms, where the pairwise terms have the form of a weighted mixture of Gaussian kernels. We can express the fully connected pairwise CRF as(29)
P
X
∣
I
=
1
Z
I
e
x
p
-
E
X
∣
I
E
X
∣
I
=
∑
i
∈
N
ψ
u
x
i
+
∑
i
<
j
∈
N
ψ
p
x
i
,
x
j
,where E
X
∣
I is the energy associated with a configuration X conditioned on I and ψ
u and ψ
p are unary and pairwise potential functions, respectively. And, in [34], the pairwise potentials take the form of a weighted mixture of Gaussian kernels:(30)
ψ
p
x
i
,
x
j
=
u
x
i
,
x
j
∑
m
=
1
M
w
m
k
m
f
i
→
,
f
j
→
,where u is a label compatibility function, k
m
·
,
·, m
=
1
⋯
M are Gaussian kernels, and w
m
·
,
·, m
=
1
⋯
M are the corresponding weight of the kernels. We briefly deduce the whole process of the iterative update equation:(31)
Q
i
x
=
l
=
1
Z
exp
⁡
-
ψ
u
x
i
-
∑
l
′
∈
L
u
l
,
l
′
∑
m
=
1
M
w
m
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
′
.First, we can write the KL-divergenceD
(
Q
∥
P
):(32)
D
Q
∥
P
=
∑
x
Q
x
log
⁡
Q
x
P
x
=
-
∑
x
Q
x
log
⁡
P
x
+
∑
x
Q
x
log
⁡
Q
x
=
-
E
U
~
Q
log
⁡
P
U
+
E
U
~
Q
log
⁡
Q
U
=
-
E
U
~
Q
log
⁡
P
~
U
+
E
U
~
Q
log
⁡
Z
+
∑
i
E
U
i
~
Q
log
⁡
Q
U
i
=
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
,where E
U
~
Q refers to the expected value under the distribution Q. Since Q
X
=
∏
i
Q
i
X
i and linearity of expectation E
U
~
Q
log
⁡
Q
(
U
)
=
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
(
U
i
), one has(33)
E
U
~
Q
E
U
=
E
U
~
Q
∑
i
ψ
u
U
i
+
∑
i
<
j
ψ
p
U
i
,
U
j
=
∑
i
E
U
i
~
Q
i
ψ
u
U
i
+
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
,where(34)
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
=
1
2
∑
i
E
U
i
~
Q
i
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
U
i
,
U
j
=
1
2
∑
m
=
1
M
w
m
∑
i
E
U
i
~
Q
i
∑
j
≠
i
k
m
f
i
→
,
f
j
→
E
U
j
~
Q
j
u
U
i
,
U
j
.The marginalQ
i
x
i which we need is found by minimizing a Lagrangian that consists of all terms in D
Q
∣
P plus Lagrange multipliers assuring that the marginal Q
i
X
i are probability distributions. The detailed derivations will be presented below:(35)
L
i
Q
=
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
Q
i
x
i
-
1
.So we can get(36)
∂
L
i
Q
Q
i
x
i
=
∂
Q
i
x
i
E
U
~
Q
E
U
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
Q
i
x
i
-
1
=
∂
Q
i
x
i
∑
i
E
U
i
~
Q
i
ψ
u
U
i
+
∑
i
<
j
E
U
i
~
Q
i
,
U
j
~
Q
j
ψ
p
U
i
,
U
j
+
∑
i
E
U
i
~
Q
i
log
⁡
Q
i
U
i
+
log
⁡
Z
+
λ
∑
x
i
x
i
-
1
=
ψ
u
x
i
+
∂
Q
i
x
i
1
2
∑
i
E
U
i
~
Q
i
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
U
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
=
ψ
u
x
i
+
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
.Setting the derivative to 0,(37)
ψ
u
x
i
+
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
+
log
⁡
Q
i
x
i
+
1
+
λ
=
0and rearranging terms, we get that(38)
log
⁡
Q
i
x
i
=
-
ψ
u
x
i
-
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
-
1
-
λ
⟹
Q
i
x
i
=
exp
⁡
-
ψ
u
x
i
-
1
2
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
-
1
-
λ
⟹
Q
i
x
i
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
,where Z
i is the corresponding partition function.Substituting the definition of the pairwise potential above into the mean field update in (38) yields the following formulation of the update equation:(39)
Q
i
x
i
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
j
≠
i
E
U
j
~
Q
j
ψ
p
x
i
,
U
j
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
m
=
1
M
w
m
∑
j
≠
i
E
U
j
~
Q
j
u
l
,
U
j
k
m
f
i
→
,
f
j
→
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
m
=
1
M
w
m
∑
j
≠
i
∑
l
′
∈
L
Q
j
l
′
u
l
,
l
′
k
m
f
i
→
,
f
j
→
=
1
Z
i
exp
⁡
-
ψ
u
x
i
-
∑
l
′
∈
L
u
l
,
l
′
∑
m
=
1
M
w
m
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
′
.In fact, the general form of the mean field update equations (see [52]) is(40)
Q
i
v
i
=
v
=
1
Z
i
exp
⁡
-
∑
c
∈
C
∑
v
c
∣
v
i
=
v
Q
c
-
i
v
c
-
i
·
ψ
c
v
c
,where v is a value in the domain of random variable v
i, v
c denote an assignment of all variables in clique c, and v
c
-
i is an assignment of all variables in c apart from V
i, and Q
c
-
i denotes the marginal distribution of all variables in c apart from V
i derived from the joint distribution Q. Thus ∑
v
c
∣
v
i
=
v
Q
c
-
i
v
c
-
i
·
ψ
c
v
c evaluates the expected value of ψ
c over Q given the condition that V
i takes the value v. When we set v
i
=
x
1
⋯
N and v
=
1
⋯
L by evaluating (40) across the unary and pairwise potentials defined in [34], we will directly get (39).In [34], it is shown that parallel updates for (39) can be evaluated by convolution with a high dimensional Gaussian kernel using any efficient bilateral filter, for example, the permutohedral lattice method of [39]. It is achieved by the following transformation:(41)
Q
~
i
m
=
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
=
G
m
⊗
Q
l
f
i
→
-
Q
i
l
,where G
m is a Gaussian kernel corresponding to the mth component of (30), and ⊗ is the convolution operator. The following algorithms are the algorithms used in [34].Algorithm  1 (mean field in fully connected CRFs).
while not converged do(42)
Q
~
i
m
l
⟵
∑
j
≠
i
k
m
f
i
→
,
f
j
→
Q
j
l
∀
m
Q
^
i
x
i
⟵
∑
l
∈
L
u
m
x
i
,
l
∑
m
w
m
Q
~
i
m
l
Q
i
x
i
⟵
e
x
p
-
ψ
u
x
i
-
Q
^
i
x
i
end  whileIn [34], the permutohedral lattice [39] was used for the filter-based inference; the recently proposed domain transform filtering approach [58] has certain advantages over the permutohedral lattice. Since domain transform filtering approach does not subsample the original signal, its complexity is independent of the filter size, while the complexity and filter size are inversely related using the permutohedral lattice. In [47], it was demonstrated that the domain transform approach achieves even faster inference times than using the permutohedral lattice for accurate object/stereo labeling. On the basis of [34, 47] the mean field approximation to the inference of models with higher-order terms was further applied.In [47] the pattern-based potentials ψ
c
p
a
t
x
c were added, which is described in Section 2, to the energy function; the required expectation for the mean field updates (39) can be calculated:(43)
∑
x
c
∣
x
i
=
l
Q
c
-
i
x
c
-
i
·
ψ
c
p
a
t
x
c
=
∑
p
∈
P
c
∣
i
=
l
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
p
j
γ
p
+
1
-
∑
p
∈
P
c
∣
i
=
l
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
p
j
γ
m
a
x
,where P
c
∣
i
=
l is the subset of patterns in P
c for which x
i
=
l.A particular case of the pattern-based potential is theP
n-Potts model, (44)
ψ
c
p
o
t
t
s
x
c
=
r
l
if
∀
i
∈
c
,
x
i
=
l
r
m
a
x
o
t
h
e
r
w
i
s
e
,and the required expectations can be expressed as (45)
∑
x
c
∣
x
i
=
l
Q
c
-
i
x
c
-
i
·
ψ
c
p
o
t
t
s
x
c
=
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
l
r
l
+
1
-
∏
j
∈
c
,
j
≠
i
Q
j
x
j
=
l
γ
m
a
x
.The paper [1] also added coconcurrence potentials (see [47] for more details) which is over the entire image clique with a defined form and tested their approach on object class segmentation. As a result, they showed substantial improvements in inference speed with respect to graph cut based methods, particularly by using recent domain transform filtering techniques, while also observing similar or better accuracies. Figures 8 and 9 are the results of [1] in both stereo and image labeling. All the experiments in [1] are based on an Inter® Xeon® 3.33 GHz processor, and they fixed the number of full mean field update iterations to 5 for all models.Figure 8
Results of [1] on Leuven dataset. From (a–e): input image, ground truth, object labeling for [4] (using graph cut + range-moves for inference), object labeling, and stereo outputs from dense CRF with higher-order terms and extended cost-volume filtering [1].
(a)
(b)
(c)
(d)
(e)Figure 9
Results of [1] on PascalVOC-10 dataset. From (a–e): input image, ground truth, output from [40] (AHCRF + cooccurrence), output from [34] (dense CRF), and output from dense CRF with Potts and cooccurrence terms [1].
(a)
(b)
(c)
(d)
(e)In Figure8, [1] applied their model to the Leuven dataset, consisting of stereo images of street scenes, with ground truth labeling for 7 object classes, and manually annotated ground truth stereo labeling quantized into 100 disparity labels. In their model they used JointBoost classifier responses to form the object unary potentials. A truncated l
2-norm of the intensity differences is used to form the disparity potentials. For the densely connected pairwise terms, identical kernels and weightings and Ising model for the label compatibility function were used. For the P
n-Potts potentials, γ
l
=
0 for all l
=
1
,
…
,
L was set and γ
m
a
x was set by cross-validation. Figure 9 is the results of [1] on PascalVOC-10 dataset.From Figure8 and Table 1, we note that the densely connected CRF with higher-order terms (Dense + HO) achieves comparable accuracies to [4], and that the use of domain transform filtering methods [58] permits an extra speed-up, with inference being almost 12 times faster than the least accurate setting of [4] and over 35 times faster than the most accurate. The Dense + HO + CostVol approach achieves the best overall stereo accuracies. Although the improved stereo performance appears to generate a small decrease in the object labeling accuracy in [1]’s full model, the former remains at an almost saturated level.Table 1
Quantitative comparison on Leuven dataset of [1]. The table compares the average time per image and performance (object and stereo labeling accuracy) of joint object and stereo algorithms, using graph cut + range-move (GC + Range (x)), an extension of cost-volume filtering, and [1]’s dense CRF with higher-order terms and filter-based inference (with and without cost-volume filtered unary, and using different approaches). HO means higher-order terms of [1] in the table.
Algorithm
Time (s)
Object (% correct)
Stereo (% correct)
GC + Range (1) [4]
24.6
95.94
76.97
GC + Range (2) [4]
49.9
95.94
77.31
GC + Range (3) [4]
74.4
95.94
77.46
Extended CostVol ([39] filter)
4.2
95.20
77.18
Dense + HO ([39] filter)
3.1
95.24
78.89
Dense_HO ([58] filter)
2.1
95.06
78.21
Dense + HO + CostVol ([58] filter)
6.3
94.98
79.00Figure9 and Table 2 compare timing and performance of [1]’s approach (final 2 lines) against two baseline. The importance of higher-order information is confirmed by the better performance of all algorithms compared to the basic dense CRF of [34]. Further, the filter-based inference is able to improve substantially on the inference time and class-average performance of the AHCRF [40], with P
n-Potts and cooccurrence potentials each giving notable gains.Table 2
Quantitative results of [1] on PascalVOC-10 dataset.
Algorithm
Time (s)
Overall (% correct)
AHCRF + Cooc [40]
36
81.43
Dense CRF [34]
0.67
71.63
Dense + Potts
4.35
79.87
Dense + Potts + Cooc
4.4
80.44Although the mean field algorithm is an easy approximation method, it still has several limitations. As mentioned in [9], the first limitation is related to the fact that the mean field approximation assumes complete factorization over the individual variable. As a result, the mean field inference methods are usually sensitive to initialization although the simplified model leads to efficient and tractable models for learning and inference. Another limitation relates to the form of the pairwise weights in (30) which are a linear combination of Gaussian kernels. In fact, they allow each Gaussian component to take only zero mean and use the same combination of Gaussian kernels for each label pair. Although these are improved in [9], they are still lead to unsatisfactory results. Therefore, in the future, we hope to find some other methods which have not only substantial speed of inference but also considerable accuracies.


## 4. Conclusion

Recently, CRF is accepted as one of the popular approaches for solving the image labeling problem in computer vision and image analysis. An important issue in CRF models is to develop an efficient inference algorithm to find the most appropriate labels especially when considering the global information of an image.In this paper we review the research development and status of object recognition with CRFs, especially the two main discrete optimization methods for image labeling with CRFs: graph cut and mean field approximation. We describe graph cut briefly while we introduce mean field approximation more detailedly which has a substantial speed of inference and is popular in recent years. Compared to the graph cut method, the mean field inference improves speed substantially for its simplified model.In the application of image labeling problem in computer vision, one typical problem is that there are too many nodes. For example, for an image with the size ofi
×
j, supposing each node takes L possible labels, the computation space is L
i
×
j. Thus the computation space expands exponentially with the growth of image’s size. It is very clear that the inference algorithm plays a very important role in these problems. Another key issue is to construct reasonable CRF models as Section 2 introduces. Learning the parameters of a CRF model efficiently from images instead of being manually or empirically chosen is also an important issue, though it is not the focus of this paper.Nowadays, many tasks in computer vision and image analysis can be formulated as a labeling problem where the correct label has to be assigned to each pixel or clique. However, computational expense of training is still a computational burden for the need to perform inference repeatedly during training process. In the future, we hope to improve the accuracy of mean field inference for image labeling while maintaining its efficiency. Solving these problems will greatly influence some technology such as driverless car. On the other hand, with the development of the skills for capturing image depth information such as Kinect, depth information of an image is easily obtained like color features. So it is considerable to combine these properties with CRF models and efficient inference approaches for image labeling and stereo reconstruction in 3-dimensional space. Moreover, using these theories for facial action labeling research may be another strategy.



---

*Source: 3846125-2016-04-24.xml*