Markov random fields (MRFs) are probabilistic models that can model images using neighborhoods of pixels that satisfy the Markov property. MRFs allow modeling textures and segmenting images into objects. Inference in MRFs can be done using Markov chain Monte Carlo methods like the Gibbs sampler or Metropolis algorithm to sample from the distributions. MRFs have been used for image segmentation by modeling pixel labels as an MRF and maximizing the joint probability of labels and image pixels.
1. Probabilistic Models for Images
Markov Random Fields
Applications in Image Segmentation and Texture Modeling
Ying Nian Wu
UCLA Department of Statistics
IPAM July 22, 2013
2. Outline
•Basic concepts, properties, examples
•Markov chain Monte Carlo sampling
•Modeling textures and objects
•Application in image segmentation
3. Markov Chains
Pr(future|present, past) = Pr(future|present)
future past | present
Markov property: conditional independence
limited dependence
Makes modeling and learning possible
5. Markov Random Fields
all the other pixels
Nearest neighborhood, first order neighborhood
Markov Property
From Slides by S. Seitz - University of Washington
7. Markov Random Fields
Can be generalized to any undirected graphs (nodes, edges)
Neighborhood system: each node is connected to its neighbors
neighbors are reciprocal
Markov property: each node only depends on its neighbors
Note: the black lines on the left graph are illustrating the 2D grid for the image pixels
they are not edges in the graph as the blue lines on the right
9. Cliques for this neighborhood
Hammersley-Clifford Theorem
normalizing constant, partition function
potential functions of cliques
From Slides by S. Seitz - University of Washington
10. Cliques for this neighborhood
Hammersley-Clifford Theorem
a clique: a set of pixels, each member is the neighbor of any other member
From Slides by S. Seitz - University of Washington
Gibbs distribution
11. Cliques for this neighborhood
Hammersley-Clifford Theorem
a clique: a set of pixels, each member is the neighbor of any other member
……etc, note: the black lines are for illustrating 2D grids, they are not edges in the graph
Gibbs distribution
12. Cliques for this neighborhood
Ising model
From Slides by S. Seitz - University of Washington
15. Sampling from MRF Models
Markov Chain Monte Carlo (MCMC)
• Gibbs sampler (Geman & Geman 84)
• Metropolis algorithm (Metropolis et al. 53)
• Swedeson & Wang (87)
• Hybrid (Hamiltonian) Monte Carlo
20. Metropolis for Ising model
Challenge: sample from Ising model
Ising model: proposal --- randomly pick a pixel and flip it
21. Modeling Images by MRF
Ising model
Exponential family model, log-linear model
maximum entropy model
unknown parameters
features (may also need to be learned)
reference distribution
Hidden variables, layers, RBM
22. Modeling Images by MRF
Given
How to estimate
• Maximum likelihood
• Pseudo-likelihood (Besag 1973)
• Contrastive divergence (Hinton)
38. Modeling image pixel labels as MRF (Ising)
( , )
i i
x y
( , )
i j
x x
1
real image
label image
Slides by R. Huang – Rutgers University
MRF for Image Segmentation
Bayesian posterior
40. *
1
( , ) ( , )
2
2
2
2 2
arg max ( | )
1
arg max ( , ) ( | ) ( , ) / ( ) ( , )
1
arg max ( , ) ( , ) ( , ) ( , ) ( , )
( , ) ( ; , )
( , ) exp( ( ) / )
[ , , ]
i i
i i
i i i j i i i j
i i j i i j
i i i x x
i j i j
x x
P
P P P P P
Z
x y x x P x y x x
Z
x y G y
x x x x
x
x
x
x x y
x y x y x y y x y
x y
( , )
i i
x y
( , )
i j
x x
Slides by R. Huang – Rutgers University
MRF for Image Segmentation
41. Inference in MRFs
– Classical
• Gibbs sampling, simulated annealing
• Iterated conditional modes
– State of the Art
• Graph cuts
• Belief propagation
• Linear Programming
• Tree-reweighted message passing
Slides by R. Huang – Rutgers University