YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Pushmeet Kohli Philip H.S. Torr

Department of Computing

Oxford Brookes University

Page 2: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Overview

Recycling Solutions

Page 3: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Overview

PB SB

cheaperoperation

computationally

expensive operation

Simplerproblem

PB*

differencesbetweenA and B

A and Bsimilar

PA SA

solve

Page 4: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

differencesbetweenA and B

Overview

PA

PB SB

SA

PB*

Page 5: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Contributions

• A dynamic algorithm for the st-mincut problem.

- Exact

- Handle arbitrary changes

- Minimize dynamic energy functions.

• Efficient image segmentation in videos

Page 6: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Outline of the Talk

• Markov Random Fields

• Energy minimization using graph cuts

• Minimizing dynamic energy functions

• Experimental Results

Page 7: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Outline of the Talk

• Markov Random Fields

• Energy minimization using graph cuts

• Minimizing dynamic energy functions

• Experimental Results

Page 8: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Markov Random Fields

• Set of random variables (x) taking values from a label set e.g.

- stereo (disparity)- image segmentation (‘fg’ or ‘bg’)

• Energy of a configuration• E(x) = - log Pr(x|D) + constant

• Less energy = More Probability

Page 9: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

MRF for Image Segmentation

EnergyMRF

Pair-wise Terms MAP SolutionUnary likelihoodData (D)

Unary likelihood Contrast Term Uniform Prior(Potts Model)

Boykov and Jolly [ICCV 2001], Blake et al. [ECCV 2004]

Maximum-a-posteriori (MAP) solution x* = arg min E(x)x

=

Page 10: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Solving MRFs using Graph cuts

• Obtain the exact MAP solution

Labelling problem MAP solution

t

s

Graph Cut

• Construct graph to represent the MRF energy - binary labels (Kolmogorov and Zabih [ECCV 2002])

- multiple labels (Ishikawa [PAMI 2003])

• Compute st-mincut by finding the max-flow

st-mincut

MRF

Page 11: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Outline of the Talk

• Markov Random Fields

• Energy minimization using graph cuts

• Minimizing dynamic energy functions

• Experimental Results

Page 12: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2)

Sink (1)

Source (0)

a1 a2

Graph Construction for Binary Random Variables

Page 13: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

Sink (1)

Source (0)

a1 a2

EMRF(a1,a2) = 2a1

2t-edges

(unary terms)

Page 14: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1

Sink (1)

Source (0)

a1 a2

2

5

Page 15: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2

Sink (1)

Source (0)

a1 a2

2

5

9

4

Page 16: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2

Sink (1)

Source (0)

a1 a2

2

5

9

4

2

n-edges(pair-wise term)

Page 17: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2 + ā1a2

Sink (1)

Source (0)

a1 a2

2

5

9

4

2

1

Page 18: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2 + ā1a2

Sink (1)

Source (0)

a1 a2

2

5

9

4

2

1

Page 19: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2 + ā1a2

Sink (1)

Source (0)

a1 a2

2

5

9

4

2

1

a1 = 1 a2 = 1

EMRF(1,1) = 11

Cost of st-cut = 11

Page 20: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

EMRF(a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2 + ā1a2

Sink (1)

Source (0)

a1 a2

2

5

9

4

2

1

a1 = 1 a2 = 0

EMRF(1,0) = 8

Cost of st-cut = 8

Page 21: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Energy Minimization using Graph cuts

• Most probable (MAP) configuration ≡ minimum cost st-cut.

• st-mincut is in general a NP-hard problem - negative edge weights

• Solvable in polynomial time- non-negative edge weights- corresponds to sub-modular (regular) energy functions

Page 22: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

• The Max-flow Problem- Edge capacity and flow balance constraints

Computing the st-mincut from Max-flow algorithms

• Notation- Residual capacity (edge capacity – current flow)- Augmenting path

• Simple Augmenting Path based Algorithms- Repeatedly find augmenting paths and push flow.- Saturated edges constitute the st-mincut. [Ford-Fulkerson Theorem]

Sink (1)

Source (0)

a1 a2

2

5

9

42

1

Page 23: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

9 + α

4 + α

Adding a constant to both thet-edges of a node does not change the edges constituting the st-mincut.

Key Observation

Sink (1)

Source (0)

a1 a2

2

5

2

1

E (a1,a2) = 2a1 + 5ā1+ 9a2 + 4ā2 + 2a1ā2 + ā1a2

E*(a1,a2 ) = E(a1,a2) + α(a2+ā2)

= E(a1,a2) + α [a2+ā2 =1]

Computing the st-mincut

Page 24: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Outline of the Talk

• Markov Random Fields

• Energy minimization using graph cuts

• Minimizing dynamic energy functions

• Experimental Results

Page 25: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Minimizing dynamic energy functions

Partial Solution

• Boykov and Jolly, Interactive Image Segmentation [ICCV01]

- limited to unary energy terms (t-edge capacities)

Our Contribution

• Arbitrary changes in the energy (graph)

Problem

Given a solution of [min Ea], compute [min Eb]

Page 26: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Minimizing dynamic energy functions

Solution

• Use the flows in Ga to compute the st-mincut on Gb

• Some flows may be more than new edge capacity!

- Edge capacity constraints violated.

Problem

Given a solution of [min Ea], compute [min Eb]

- Compute max-flow in Gb given the solution of Ga

Page 27: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Satisfying Constraints

• Possible Solution

- Push excess flow back through the augmenting paths

- Extremely computationally expensive

- O(m) time for finding such path

• Our Solution

- Re-parameterize the problem to satisfy constraints

- Constant time per update operation [O(1)]

[ m = number of edges ]

Page 28: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Dynamic Image Segmentation

Image

Flows in n-edges Segmentation Obtained

Page 29: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

First segmentation problem MAP solution

Ga

Our Algorithm

Gb

second segmentation problem

Maximum flow

residual graph (Gr)

G`

differencebetween

Ga and Gbupdated residual

graph

Page 30: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

s

Gt

original graph

0/9

0/7

0/5

0/2 0/4

0/1

xi xj

flow/residual capacity

Graph Re-parameterization

Page 31: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

s

Gt

original graph

0/9

0/7

0/5

0/2 0/4

0/1

xi xj

flow/residual capacity

Graph Re-parameterization

t residual graph

xi xj0/12

5/2

3/2

1/0

2/0 4/0st-mincut

ComputeMaxflow

Gr

Edges cut

Page 32: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update t-edge Capacities

s

Gr

t residual graph

xi xj0/12

5/2

3/2

1/0

2/0 4/0

Page 33: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update t-edge Capacities

s

Gr

t residual graph

xi xj0/12

5/2

3/2

1/0

2/0 4/0

capacitychanges from

7 to 4

Page 34: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update t-edge Capacities

s

G`t

updated residual graph

xi xj0/12

5/-1

3/2

1/0

2/0 4/0

capacitychanges from

7 to 4

edge capacityconstraint violated!(flow > capacity)

= 5 – 4 = 1

excess flow (e) = flow – new capacity

Page 35: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

add e to both t-edges connected to node i

Update t-edge Capacities

s

G`t

updated residual graph

xi xj0/12

3/2

1/0

2/0 4/0

capacitychanges from

7 to 4

edge capacityconstraint violated!(flow > capacity)

= 5 – 4 = 1

excess flow (e) = flow – new capacity

5/-1

Page 36: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update t-edge Capacities

s

G`t

updated residual graph

xi xj0/12

3/2

1/0

4/0

capacitychanges from

7 to 4

excess flow (e) = flow – new capacity

add e to both t-edges connected to node i

= 5 – 4 = 1

5/0

2/1

edge capacityconstraint violated!(flow > capacity)

Page 37: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

s

Gr

t

residual graph

xi xj0/12

5/2

3/2

1/0

2/0 4/0

• Capacity changes from 5 to 2

Page 38: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

s

t

Updated residual graph

xi xj0/12

5/2

3/-1

1/0

2/0 4/0

G`

• Capacity changes from 5 to 2- edge capacity constraint violated!

Page 39: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

s

t

Updated residual graph

xi xj0/12

5/2

3/-1

1/0

2/0 4/0

G`

• Capacity changes from 5 to 2- edge capacity constraint violated!

• Reduce flow to satisfy constraint

Page 40: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

s

t

Updated residual graph

xi xj0/11

5/2

2/0

1/0

2/0 4/0

excess

deficiency

G`

• Capacity changes from 5 to 2- edge capacity constraint violated!

• Reduce flow to satisfy constraint- causes flow imbalance!

Page 41: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

s

t

Updated residual graph

xi xj0/11

5/2

2/0

1/0

2/0 4/0

deficiency

excess

G`

• Capacity changes from 5 to 2- edge capacity constraint violated!

• Reduce flow to satisfy constraint- causes flow imbalance!

• Push excess flow to/from the terminals

• Create capacity by adding α = excess to both t-edges.

Page 42: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

Updated residual graph

• Capacity changes from 5 to 2- edge capacity constraint violated!

• Reduce flow to satisfy constraint- causes flow imbalance!

• Push excess flow to the terminals

• Create capacity by adding α = excess to both t-edges.

G`

xi xj0/11

5/3

2/0

2/0

3/0 4/1

s

t

Page 43: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Update n-edge Capacities

Updated residual graph

• Capacity changes from 5 to 2- edge capacity constraint violated!

• Reduce flow to satisfy constraint- causes flow imbalance!

• Push excess flow to the terminals

• Create capacity by adding α = excess to both t-edges.

G`

xi xj0/11

5/3

2/0

2/0

3/0 4/1

s

t

Page 44: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Complexity analysis of MRF Update Operations

MRF Energy Operation

Graph Operation Complexity

modifying a unary term

modifying a pair-wise term

adding a latent variable

delete a latent variable

Updating a t-edge capacity

Updating a n-edge capacity

adding a node

set the capacities of all edges of a node zero

O(1)

O(1)

O(1)

O(k)*

*requires k edge update operations where k is degree of the node

Page 45: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

• Finding augmenting paths is time consuming.• Dual-tree maxflow algorithm [Boykov & Kolmogorov PAMI

2004]

- Reuses search trees after each augmentation.

- Empirically shown to be substantially faster.

• Our Idea

• Reuse search trees from previous graph cut computation

• Saves us search tree creation tree time [O(#edges)]

• Search trees have to be modified to make them consistent with new graphs

• Constrain the search of augmenting paths

– New paths must contain at least one updated edge

Improving the Algorithm

Page 46: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Reusing Search Trees

c’ = measure of change in the energy

• Running time– Dynamic algorithm (c’ + re-create search tree )– Improved dynamic algorithm (c’)– Video Segmentation Example

- Duplicate image frames (No time is needed)

Page 47: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Outline of the Talk

• Markov Random Fields

• Energy minimization using graph cuts

• Minimizing dynamic energy functions

• Experimental Results

Page 48: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

• Compared results with the best static algorithm.- Dual-tree algorithm [Boykov & Kolmogorov PAMI 2004]

• Applications- Interactive Image Segmentation- Image Segmentation in Videos

Experimental Analysis

Page 49: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Experimental Analysis

additional segmentation

cues

user segmentation cuesstatic: 175 msecdynamic : 80 msecdynamic (optimized): 15 msec

static : 175 msec

Interactive Image segmentation (update unary terms)

EnergyMRF =

Page 50: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Experimental Analysis

Image resolution: 720x576 static: 220 msec dynamic (optimized): 50 msec

Image segmentation in videos (unary & pairwise terms)

Graph CutsDynamic Graph Cuts

EnergyMRF =

Page 51: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Experimental Analysis

Image resolution: 720x576 static: 190 msec dynamic (optimized): 60 msec

Image segmentation in videos (unary & pairwise terms)

Graph CutsDynamic Graph Cuts

EnergyMRF =

Page 52: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Experimental Analysis

MRF consisting of 2x105 latent variables connected in a 4-neighborhood.

Running time of the dynamic algorithm

Page 53: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Conclusions

• An exact dynamic algorithm for computing st-mincut- handles arbitrary changes in the graph

• Rapidly solves dynamic sub-modular energy functions

• Running time roughly proportional to the number of changes in the energy terms.

Page 54: Efficiently Solving Dynamic Markov Random Fields using Graph Cuts

Thank You


Related Documents