Statistical and Learning Techniques in Computer Vision Lecture 1: Markov Random Fields Jens Rittscher and Chuck Stewart

Similar documents
Algorithms for Markov Random Fields in Computer Vision

intro, applications MRF, labeling... how it can be computed at all? Applications in segmentation: GraphCut, GrabCut, demos

Image Restoration using Markov Random Fields

Undirected Graphical Models. Raul Queiroz Feitosa

Lecture 4: Undirected Graphical Models

Neighbourhood-consensus message passing and its potentials in image processing applications

D-Separation. b) the arrows meet head-to-head at the node, and neither the node, nor any of its descendants, are in the set C.

Regularization and Markov Random Fields (MRF) CS 664 Spring 2008

Comparison of Graph Cuts with Belief Propagation for Stereo, using Identical MRF Parameters

FMA901F: Machine Learning Lecture 6: Graphical Models. Cristian Sminchisescu

Chapter 8 of Bishop's Book: Graphical Models

Computer Vision Group Prof. Daniel Cremers. 4. Probabilistic Graphical Models Directed Models

Markov Random Fields with Efficient Approximations

Probabilistic Graphical Models

Computer vision: models, learning and inference. Chapter 10 Graphical Models

Markov Networks in Computer Vision

Computer Vision Group Prof. Daniel Cremers. 4. Probabilistic Graphical Models Directed Models

Markov Networks in Computer Vision. Sargur Srihari

10708 Graphical Models: Homework 4

Graphical Models. David M. Blei Columbia University. September 17, 2014

Lecture 3: Conditional Independence - Undirected

The Basics of Graphical Models

Exact optimization for Markov random fields with convex priors

Loopy Belief Propagation

Models for grids. Computer vision: models, learning and inference. Multi label Denoising. Binary Denoising. Denoising Goal.

Markov Random Fields and Gibbs Sampling for Image Denoising

3 : Representation of Undirected GMs

MRF-based Algorithms for Segmentation of SAR Images

Bayesian Classification Using Probabilistic Graphical Models

GiRaF: a toolbox for Gibbs Random Fields analysis

Graphical Models. Pradeep Ravikumar Department of Computer Science The University of Texas at Austin

Integrating Intensity and Texture in Markov Random Fields Segmentation. Amer Dawoud and Anton Netchaev. {amer.dawoud*,

CS 5540 Spring 2013 Assignment 3, v1.0 Due: Apr. 24th 11:59PM

ECE 6504: Advanced Topics in Machine Learning Probabilistic Graphical Models and Large-Scale Learning

AN ANALYSIS ON MARKOV RANDOM FIELDS (MRFs) USING CYCLE GRAPHS

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014

Collective classification in network data

Markov/Conditional Random Fields, Graph Cut, and applications in Computer Vision

Multiple Constraint Satisfaction by Belief Propagation: An Example Using Sudoku

Mesh segmentation. Florent Lafarge Inria Sophia Antipolis - Mediterranee

Texture Modeling using MRF and Parameters Estimation

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms for Inference Fall 2014

Fundamentals of Stereo Vision Michael Bleyer LVA Stereo Vision

ECE521 W17 Tutorial 10

Probabilistic Graphical Models

A Tutorial Introduction to Belief Propagation

Detection of Man-made Structures in Natural Images

COMP 558 lecture 22 Dec. 1, 2010

Lecture 14: Basic Multi-View Geometry

Machine Learning. Sourangshu Bhattacharya

Digital Image Processing Laboratory: MAP Image Restoration

Expectation Propagation

STA 4273H: Statistical Machine Learning

Super Resolution Using Graph-cut

Stereo Matching.

What have we leaned so far?

Bayesian Methods in Vision: MAP Estimation, MRFs, Optimization

COS 513: Foundations of Probabilistic Modeling. Lecture 5

Computer Vision I - Filtering and Feature detection

Fast Approximate Energy Minimization via Graph Cuts

Application of MRF s to Segmentation

Parallel Gibbs Sampling From Colored Fields to Thin Junction Trees

PATTERN RECOGNITION AND MACHINE LEARNING CHAPTER 8: GRAPHICAL MODELS

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Information theory tools to rank MCMC algorithms on probabilistic graphical models

Introduction à la vision artificielle X

Labeling Irregular Graphs with Belief Propagation

Computer Vision : Exercise 4 Labelling Problems

4 Factor graphs and Comparing Graphical Model Types

Mine Boundary Detection Using Markov Random Field Models

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

Digital Image Processing Laboratory: Markov Random Fields and MAP Image Segmentation

Parallel constraint optimization algorithms for higher-order discrete graphical models: applications in hyperspectral imaging

Topic: Orientation, Surfaces, and Euler characteristic

2. Graphical Models. Undirected graphical models. Factor graphs. Bayesian networks. Conversion between graphical models. Graphical Models 2-1

Belief propagation and MRF s

CPSC 536N: Randomized Algorithms Term 2. Lecture 10

Conditional Random Fields and beyond D A N I E L K H A S H A B I C S U I U C,

Graphical Models for Computer Vision

Stereo Matching. Stereo Matching. Face modeling. Z-keying: mix live and synthetic

Scene Grammars, Factor Graphs, and Belief Propagation

Max-Product Particle Belief Propagation

Computer Vision I - Basics of Image Processing Part 1

Graphical models and message-passing algorithms: Some introductory lectures

Image Segmentation Using Iterated Graph Cuts Based on Multi-scale Smoothing

Workshop report 1. Daniels report is on website 2. Don t expect to write it based on listening to one project (we had 6 only 2 was sufficient

Finding Non-overlapping Clusters for Generalized Inference Over Graphical Models

Module 7. Independent sets, coverings. and matchings. Contents

12.1 Formulation of General Perfect Matching

The Rendering Equation and Path Tracing

Final Review CMSC 733 Fall 2014

Cheng Soon Ong & Christian Walder. Canberra February June 2018

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Dense 3D Reconstruction. Christiano Gava

Public Library, Stereoscopic Looking Room, Chicago, by Phillips, 1923

Combining Local and Global Features for Image Segmentation Using Iterative Classification and Region Merging

On the Relationships between Zero Forcing Numbers and Certain Graph Coverings

Higher-order models in Computer Vision

Probabilistic Graphical Models

9 About Intersection Graphs

Transcription:

Statistical and Learning Techniques in Computer Vision Lecture 1: Markov Random Fields Jens Rittscher and Chuck Stewart 1 Motivation Up to now we have considered distributions of a single random variable x. Recall that we wish to be in the position to treat each image as being an outcome of a stochastic process. Even in case the size of the image is small, say 256 256, we would need to model a distribution with 65536 random variables. Now consider Figure 1: Correlation of neighbouring pixels. Using the statistic g(δ) (1) we computed a value of g(δ = 1) = 25.65 while E[I(x) 2 ] = 255.8. These values indicate that the distributions of neighbouring pixels are strongly correlated. the statistic that was computed as part of exercise 3 on homework 1. In a first step you determined a set S(δ) = {(x, y) x y = δ}. Subsequently you computed the expectation of the difference in intensity values as a function of the distance between pixels. Let us rewrite this expression as g(δ) = E[(I(x) I(y)) 2 ] = E[I(x) 2 2(I(x)I(y)) + I(y) 2 ] = 2 (E[I(x) 2 ] E[I(x)I(y)]), (1) which holds under the assumption that E[I(x) 2 ] = E[I(y) 2 ]. Notice, as a result you computed as estimate of the correlation of the intensity values of pixel locations for which x y = δ. Based on the results we conclude that this correlation cannot be ignored in case δ is small. 1

2 Cleaning Dirty Pictures x p Figure 2: Local image properties. Given the image of an apple on the left we magnify a very small portion of the image which is indicated by the white square. We now see what effect the statistics in equation (1) has. Small image regions appear as mostly constant patches. The pixel grid is shown on the right. Motivated by the image statistics we computed using equation (1) and the illustration in figure 2 we realize that we can make a statement about the statistics of the image intensity at the pixel x p given that we have some information about its four neighbours (indicated by circles in the figure). 2.1 A simple prior Let us use this information to construct a prior probability for clean images. Given the fact that we have an image which contains little or no noise the image intensities of the pixel x p and its four neighbours, which we will denote by x 1, x 2, x 3, and x 4, should be similar. Hence the the following expression should be small I(x 1 ) I(x p ) 2 + I(x 2 ) I(x p ) 2 + I(x 3 ) I(x p ) 2 + I(x 4 ) I(x p ) 2. Using the exponential function we can turn this expression into a probability by writing ( p(i 1, i 2, i 3, i 4, i p ) = 1 Z exp α ) i s i p 2, s where we denote the image intensities using the random variable i p, i.e. i p = I(x p ). The constant Z insures that the sum of all the probabilities sums up to one. The parameter β is a model parameter and determines the scaling of the function. We can now write this arguably relatively simple prior for an entire image as ( p(i) = 1 Z exp α ) i s i p 2, <s,p> 2

where the expression <s, p> denotes all neighbouring pairs of pixels in the image. Using this prior we have effectively implemented a smoothness constraint. 2.2 The evidence Now we have of course a noisy image I 0 we wish to restore. We don t known what the original image I looks like but we do assume that it is nice and smooth and it is somewhat similar to the noisy image I 0 we have. Hence we expect that for any decent image I i p i 0 p 2 will be small for most of the pixels locations p. As before we can formulate this in form of a probability by writing ( p(i 0 I) = 1 β ) i p i 0 Z p 2. s 2.3 The posterior probability Being confident that all our modeling steps above make sense, we can now formulate the posterior probability of an image I given our noisy image I 0 using Bayes s rule: p(i I 0 ) = p(i 0 I) p(i) The maximum a posteriori estimate I is the restored image, i.e. I = maxp(i I 0 ). I Finding this maximum is of course not easy. In the following lectures we will review techniques to determine the MAP estimator for a given problem. Note that the model we just developed is quite simple. The image restoration models developed Geman and Geman [GG84] and Besag [Bes86] follow very similar design principles. 3 Stereopsis The second problem we would like to look at is stereopsis. The fundamental problem of stereo vision is the fusion of features observed in two (or more) images or camera views. Potentially tens of thousands of image features such as edge elements need to be matched. Some method must be devised to establish the correct correspondences and avoid erroneous depth measurements. Recall that the epipolar constraint plays a fundamental role in this process and it restricts the search for image correspondences to matching epipolar lines. In case of rectified images (see figure 3) the epipoles correspond to the scan lines of the image. In the following the variable x s will be used to denote pixel location s in the left image. Pixel locations in the right image will be denoted 3

Figure 3: Stereo Pair. The top row shows is the original stereo pair. The epipoles are displayed as white lines on the right. After rectification the epipoles correspond to the scan lines of the image as shown in the bottom row. Images courtesy of A. Fusiello. by y s. The disparity is defined as the difference d s = x s y s. The disparity field for a given image will be denoted by D = {d s } s. Given a rectified stereo pair of images the task is to find the disparity of each pixel in the reference image. 3.1 A probabilistic approach The true disparity at each pixel is a random variable, denoted by d p for the variable at pixel location x p. Each variable can take one of N discrete states. In this case the discrete states are the disparity values. The image pair is denoted by I L and I R, for the left and the right image. In the following left image will also be referred to as the reference image. 3.2 A prior model The intensities of pixels can significantly bias our assessment of disparities without even considering the second image. Two neighbouring pixels, x s and x p, are more likely to have the same disparity in case I L (x s ) I L (x p ). 4

We now use this information to formulate a prior for a disparity field D. As before < s, p > denote pairs of neighbouring pixels. We treat the left image I L as a parameter of the distribution. ( ) p(d; I L ) exp ρ(p, q)(1 δ(d p, d q ) <p,q> where δ( ) represents the unit impulse function, such that { 0, d p = d q δ(d p, d q ) = (2) 1, d p d q The penalty function ρ( ) is defined as { P s if I L (x p ) I L (x q ) < T ρ(p, q) = s otherwise (3) P > 1 is a constant penalty term that increases the penalty if the image gradient has small magnitude. Hence this prior models the fact that in case there is a discontinuity in the image we expect a discontinuity in the corresponding disparity field. The expression 1 δ(d p, d q ) effectively counts discontinuities in the disparity field D. Note that the function ρ( ) cannot be set constant. In case it would be the prior would favour implausible disparity maps. This prior depends on the given image I L. It could be viewed as a parameter of the distribution. 3.3 The evidence For each possible disparity value, there is a cost associated with matching the pixel to the corresponding pixel in the other stereo image. Hence we use the right image I R to formulate the evidence. Typically, this is based on intensity differences between the two pixels x p and y p. Similar to the previous example we can formulate the evidence as ( p(i R D ; I L ) exp β ) I L (x p ) I R (x p + d p ) 2, p where β is again used as a scaling parameter as above. This model is also referred as the Potts model. Typically only pairwise relations are used for stereo problems because considering more neighbours quickly makes inference on the field computationally intractable. Formally this context information can be viewed as a prior on the distribution of d before the information in the second image is disclosed. The posterior probability for the model can now be written as p(d I R ; I L ) p(i R d p ; I L ) p(d s, d p ; I L ), (4) p <s,p> 5

The disparity optimization step requires choosing an estimator for d 1,..., d N. In case we take the logarithm of equation (4) we obtain log p(d 1,..., d N I L, I R ) ( β I L (x p ) I R (x p + d p ) )+ p (ρ(p, q)(1 δ(d p, d q )). p,q (5) This representation is often referred to a potential representation for the model. Remark 3.1 This model is a simplified version of that discussed in the recent literature. In particular we referred to [TF03] and [BVZ98]. We will make repeated use of this model. We proceed by introducing some notation and formal definitions. 4 Neighbours and cliques The concept of conditional independence is of central importance. Definition 4.1 Given three random variables x, y, and z we say that x and y are conditionally independent given z in case p(x y, z) = p(x z). (6) We will use the notation I(x, y, z) p or simply I(x, y, z) to denote the conditional independence of x, y given z So in case the random variables x and y are conditionally independent given z we have p(x, y z) = p(x y, z) p(y z) = p(x z) p(y z). In the examples above we used the relationship of adjacent pixels to define neighbourhood relations. The relationship of our random variables was implicitly defined by the pixel grid. We will now generalize this idea. Definition 4.2 A collection δ = {δ(x) X} of subsets of X is called a neighbourhood system, if x / δ(x) and x δ(y) if and only if y δ(x), the pixel locations or sites x δ(y) are called neighbours of y. A subset C of X is called a clique if two different elements of C are always neighbours. The set of cliques will be denoted by C. 6

5 Graphical Representations In order to aid our intuition, the set of random variables will be represented in form of a graph. The nodes or vertices in the graph represent the individual random variables. Statistical dependence of two random variables is indicated by an edge connecting the vertices representing them. For now we will restrict ourselves to undirected graphs. D I R Figure 4: MRF for Stereo. This is a graphical model for the stereo correspondence problem developed in section 3. On the left you see the disparity at each pixel, d p. On the right you see the right image. Compare the model to equation 4. Let us introduce some formal notation to compare graphical and numerical representations of the model. The aim is find a graphical representation, G = (V, E) that reflects the dependence of random variables in the numerical models such as the ones introduced above. The nodes in the graph V correspond to the random variables of the model, i.e. the node s V corresponds to the random variable x s. In case the edge between nodes s and t exists in the graph, (s, t) E, the random variables x s and x t are dependent. Consider three disjoint subsets of points S, P, and Q, i.e. S V, P V, and Q V. The fact that a subset S of nodes in a graph G intercepts all paths between the nodes of the subset X and those of Y we will occasionally be written as: < S, P, Q > G. (7) Definition 5.1 An undirected graph G is a dependency map (or d-map) of the dependency model M if there is a one-to-one correspondence between the random variables of M and the nodes V of G. For all disjoint subsets S, P, Q V 7

and random variables x s, x p, and x q with s S, p P and q Q we have I(x s, x p, x q ) M = < S, P, Q > G. Similarly, G is an independency map (or i-map) of M if I(x s, x p, x q ) M = < S, P, Q > G. G is said to be a perfect map of M if it is both a d-map and an i-map. We are now in the position to give a formal definition for a Markov random field. Definition 5.2 A Markov random field is a model of the joint probability distribution of a set X = {x p } p of random variables. It consists of an undirected graph G = (V, E) where each vertex s V represents a random variable x s and each edge (s, t) E represents a dependency between the random variables x s and x t. a set of potential functions ψ C one for each clique C. Each ψ C is a mapping from possible joint assignments to non-negative real numbers. 6 Properties of Markov Random Fields Any Markov random field has the following properties: global: For any disjoint subsets S, P, and Q such that Q separates X and Y (all paths from S to P contain a member of Q). We have that S and P are conditionally independent given Q. local: The conditional distribution p(s S \ {s}) depends only on δ(s), i.e. p(s S \ {s}) = p(s δ(s)) pairwise: The random variables s and t are conditionally independent given all the other random variables if s and t are not neighbours. Hammersley-Clifford theorem [Rip96, page 250] relates the local Markov property to the global property and to the potential representation. Theorem 6.1 Suppose we have a collection of discrete random variables defined on the vertices of a graph. (a) Suppose the joint distribution is strictly positive. Then the pairwise Markov property implied that there are positive functions φ C, symmetric in their arguments, such that p(x) C the product being over cliques of the graph. φ C (x C ) (8) 8

(b) A potential representation (8) implies the global Markov property for any distribution. The proof of the first statement is rather technical and we will skip it here. The construction of the proof uses induction, details can be found in [Rip96] on page 250. We now prove the second statement. The proof is structured into two steps. Firstly we show that p(x A x A C ) = p(x A x δa ). This result will then be used to show that the potential representation implies the global Markov property for p(x). Suppose a potential representation (8) is given. Then p(x A x A C ) = p(x V ) = φ C (x C ) / p(x A C ) C C x A = C C φ C (x C ) / x A C A C C C A φ C (x C ) C C φ C (x C ), where we cancel terms for cliques C disjoint from A. The second equation holds because p(x A C ) = p(x A, x A C ) A and the assumption that we have a potential representation for p(x). A clique with C A is contained in A δa, so the right-hand side is a function of x A δa and p(x A x A C ) = p(x A x δa ). Some of the potentials φ C may take zero values, but these calculations still hold if we take 0/0 = 0. The task is to prove the global Markov property. Hence we assume that A and B are separated by C. Let B be the set of vertices which can be reached by a path from B which does not meet C and let D = (B C) C ; by construction D, B and C are disjoint and C separates D and B, so no neighbour of D is in B. The construction of these sets is illustrated in figure 5. By using the first step of the prove we get p(x D x B, x C )) = p(x D x D C ) = p(x D x δd ) does not depend on x B. The random variables x D and x B are conditionally independent given x C and hence x A and x B are conditionally independent given x C since A C, B B. This concludes the proof. 7 Further Reading Geman and Geman presented with [GG84] certainly one of the most influential papers on the topic. Besag s work on the statistical analysis of dirty pictures is also one of the important original references. 9

A D A C C B' B B Figure 5: Illustration of the set construction. As part of the proof of the Hammersley-Clifford theorem two specific sets are being constructed. The above figure serves as an illustration. Given are three sets A, B, and C. The sets A and B are separated by C as shown in the left figure. By construction D, B, and C are also separated. The book written by Winkler [Win95] gives excellent although very mathematical introduction to the topic. Judea Pearl [Pea88] is a classical reference for reasoning using probabilistic models. The book is very detailed and presents a number of techniques to work with graphical models. You might just want to have a look at some of the examples in the earlier chapters. Chris Bishop introduces Markov random fields in the context of graphical model [Bis06, page 383]. The problem of image de-noising is discussed in a specific example. References [Bes86] [Bis06] J. Besag. On the statistical analysis of dirty pictures. Journal of the Royal Statistical Society. Series B, 48(3):259 302, 1986. Christopher M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006. [BVZ98] Y. Boykov, O. Veksler, and R. Zabih. Markov random fields with efficient approximations. In IEEE Computer Vision and Pattern Recognition Conference, volume r, pages 648 655, 1998. 10

[GG84] [Pea88] [Rip96] [TF03] S. Geman and D. Geman. Stochastic relaxation, gibbs distribtutions, and the bayesian restauration of images. IEEE. Trans. Pattern Anal, 6(6):721 741, November 1984. J. Pearl. Probabilistic Reasoning in Intelligent Systems. Morgen Kaufmann Publishers, Inc, 1988. B. R. Ripley. Pattern Recognition and Neural Networks. Cambridge University Press, 1996. M. F. Tappen and W. T. Freeman. Comparison of graph cuts with belief propagation for stereo, using identical mrf parameters. In 9th Int. Conf. on Computer Vision, volume 2, pages 900 906, 2003. [Win95] G. Winkler. Image analysis, random fields and dynamics Monte Carlo methods: a mathematical introduction. Spinger, 1995. 11