CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct 15 2009.

15
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct 15 2009

Transcript of CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct 15 2009.

CS774. Markov Random Field : Theory and Application

Lecture 13

Kyomin JungKAIST

Oct 15 2009

The Labeling Problem in Vision

Common idea behind many Computer Vision problems

In the presence of uncertainties, find the best Labeling !

Computing MAP of a corresponding MRF (it is called an Energy minimization problem in the vision community)

(Stereo, 3D Reconstruction, Segmentation, Image Restoration)

Image Segmentation and Graph Cuts

An image segmentation problem can be interpreted as partitioning the image ele-ments (pixels) into different cate-gories.

A Cut of a graph is a partition of the ver-tices in the graph into two disjoint subsets.

By constructing a graph with an image, we can solve the segmentation problem using techniques for graph cuts in graph theory.

Energy minimization via Graph cut

Simple Example : 2-label case

Eij(0,0) + Eij(1,1) ≤ Eij(0,1) + Eij(1,0)

If an pairwise Energy ftn is submodular, i.e. for all edge potentials,

can compute Minimum energy and a corresponding labeling via Min Cut.

Min Cut problem

2–label minimization can be computed by solving max-flow (s-t cut) exactly in poly-nomial time.

Multi-way cut is NP-Hard for ≥ 3 labels. approximation algorithm for multi-label minimization.

Graph Cuts

Partition the graph into two parts separating red and blue nodes

s-t graph cut

A graph with two terminals S and T

“source”

S T

“sink”

• Cut cost is a sum of edge weights connecting two colors

Flow Network

A flow network is defined as a directed graph G where an edge has a nonnegative capacity.

A flow in G is a real-valued (often integer) function that satisfies the following three properties: Capacity Constraint:

For all Skew Symmetry

For all Flow Conservation

For allwhere s is the source, t is

the sink node.

),(),(,, vucvufVvu

),(),(,, uvfvufVvu

Vv

vuftsVu 0),(}),,{\(

Graph Cuts & Network Flow

The Max-flow Min-Cut Theorem

If f is a maximum flow, | f | = c (S,T ) for some cut (S,T ) of G

The cost of the minimum s-t cut = the maximum

flow.

Thus, we will find minimum s-t cuts in graphs by

solving for max-flow.

Graph Cut based Segmentation

n-links

s

t a cuthard constraint

hard constraint

User Guided Segmentation:

Ford-Fulkerson Algorithm

Main OperationStarting from zero flow, increase the flow gradually by finding a path from s to t along which more flow can be sent, until a max-flow is achieved.The path for flow to be pushed through is called an augmenting path.

Ford-Fulkerson Algorithm

The Ford-Fulkerson algorithm uses a residual net-work of flow in order to find the solution.

The residual network is defined as the network of edges containing flow that remains after a fixed flow.

For example, in the graph shown below, there is an initial path from the source to the sink, and the middle edge has a total capacity of 3, and a residual capacity of 3-1=2.

0/1

0/2

1/2

0/2

1/3

0/21/2

s t

Algorithm Framework

The basic Ford-Fulkerson algorithm for each edge Evu ),(do

0),( vuf0),( uvf

while there exists a path P from s to t

in the residual network Gf

do cf (P) ← min{cf (u, v ): (u, v) is on

P}for each edge (u, v) in Pdo

)(),(),( Pcvufvuf f),(),( vufuvf

Algorithm Execution Example

1

2

2

2

3

22

s t

1

2

11

3

22

s t

1

2

2

1

2

21

s t

1/1

1/2

2/2

1/2

1/3

1/22/2

s t

f = 0

f = 1

f = 2

f = 3

1

1

1

1

1

1

1

2

1

2

12

s t

f = 3

1

1

1

1

0/1

0/2

0/2

0/2

0/3

0/20/2

s t

f = 0

(a)

(b)

(c) (f)

(e)

(d)

Finding the Min-Cut

After the max-flow is found, the mini-mum cut is determined byS = {all vertices reachable from s in the resid-ual network}

T = V-S

1

1

2

1

2

12

s t1

1

1

1

Ford-Fulkerson Algorithm Analysis

The running time of the algorithm depends on how the augmenting path is determined.

If the searching for augmenting path is realized by a breadth-first search, the algorithm runs in O ( E |fmax| ).

Under some extreme cases the efficiency of the algorithm can be reduced drastically. One exam-ple is shown in the figure below, applying Ford-Fulkerson algorithm needs 400 iterations to get the max flow of 400. v1

v2

s t

200 200

200 200

1