graph cut algorithm - university at buffalosrihari/cse674/chap13/13.3-graph cut.pdf ·...

11
Probabilistic AI Srihari 1 Graph Cut Algorithm Sargur Srihari [email protected]

Upload: others

Post on 16-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

1

Graph Cut Algorithm

Sargur [email protected]

Page 2: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Topics

2

• Overview of MAP as a graph cut problem• Graphcuts• Min-cut problem• Reducing MAP to min-cut problem• A simple example

Page 3: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Overview of Graph Cuts• Graph Cut algorithm provides a MAP solution

for metric and semi-metric MRFs– It is important in computer vision applications– Close to optimal for densely connected networks

• Graph Cuts is an efficient exact MAP inference algorithm for certain Potts models

• Over binary-valued variables Xi∈{0,1}– The algorithm is tractable even when the model has

large tree-width

3

Page 4: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Graph Cut• We first define the min-cut problem for a graph

and show how the MAP problem can be reduced to it

• The min-cut problem is defined by a set ofvertices Z plus two distinguished nodesgenerally known as s and t– We have a set of directed edges ε over Z ∪ {s,t}

– Where each edge (z1,z2) ∈ ε is associated with a non-negative cost cost(z1,z2)

• A graph cut is a disjoint partition of Z into Zs ∪Zt such that s ∈ Zs and t ∈ Zt

Page 5: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Cost of a Graph Cut• A graph cut of an undirected graph G=(V, ε) is

a partition of V into 2 disjoint sets Vs ∪ Vt• When each edge (v1,v2)∈ ε is associated with a

nonnegative cost cost(v1,v2)– the cost of a graph cut is the sum of the costs of

the edges that cross between the two partitions:

5

Page 6: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Min Cut Problem

• The min-cut problem is to find the partition Vs,Vt that minimizes the cost of the graph cut

6

Page 7: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Reducing MAP to Computing Cuts• We need to design our graph so that a cut

corresponds to an assignment to χ and its cost to the value of the assignment

• The construction follows from this intuition– Vertices, other than s and t represent variables in

our MRF– We use s to represent the label 0 and t to represent

the label 1– Thus we map a cut C=(Zs,Zt) to the following

assignment !":– %&'=0 iff zi ∈ Zs 7

Page 8: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Construction for Ising model• Generalized Ising model has the form

• For every node i either εi(1)=0 or εi(0)=0• We now construct the graph as follows:

– If εi(1)=0 we introduce an edge ziàt with cost εi(0)– If εi(0)=0 we introduce an edge sàzi with cost εi(1)– For each pair of variables Xi,Xj that are connected

by an edge in the MRF we introduce both an edge(zi,zj) and an edge (zj,zi), both with cost λi,j=0

Page 9: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Cost of Cut• Consider the cost of a cut (Zs,Zt)

– If zi ∈ Zs, then Xi is assigned a value of 0• Here zi and t are on opposite sides of the cut and so we

will get a contribution of εi(0) to the cost of the cut• This is precisely the Xi node energy of the assignmentXi=0 as we would want

– Similar argument applies when zi ∈ Zt• We now consider the edge potential

• Cost of cut is precisely the same as the energyof the corresponding assignment– Thus min-cut algorithm is guaranteed to find

assignment to X that minimizes energy, i.e., "#$%

Page 10: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

A simple example

• We have an undirected graph of four variables X1,X2,X3,X4

– Connected in a loop withedgesX1-X2, X2-X3, X3-X4, X1-X4

• Assume the following energies

ε1(0)=7, ε2(0)=2, ε3(0)=1, ε4(0)=6

λ1,2=6, λ2,3=6, λ3,4=2, λ1,4=1

Page 11: Graph Cut Algorithm - University at Buffalosrihari/CSE674/Chap13/13.3-Graph Cut.pdf · Probabilistic AI Srihari Overview of Graph Cuts •Graph Cut algorithm provides a MAP solution

Probabilistic AI Srihari

Example of a minimum cut

11

Numbers on the edgesrepresent their weight λi,j

The cut is represented by the set of nodes in Zt

Dashed edges are ones that participate in the cut

In the MAP assignment X1,X2, and X3are assigned label 1X4 is assigned label 0