MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research...

134
MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II

Transcript of MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research...

Page 1: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

MAP Estimation Algorithms in

M. Pawan Kumar, University of Oxford

Pushmeet Kohli, Microsoft Research

Computer Vision - Part II

Page 2: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Example: Image Segmentation

E(x) = ∑ ci xi + ∑ cij xi(1-xj)

E: {0,1}n → R0 → fg 1 → bg

Image (D)

i i,jn = number of pixels

Page 3: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Example: Image Segmentation

E(x) = ∑ ci xi + ∑ cij xi(1-xj)

E: {0,1}n → R0 → fg 1 → bg

i i,j

Unary Cost (ci)

Dark (negative) Bright (positive)

n = number of pixels

Page 4: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Example: Image Segmentation

E(x) = ∑ ci xi + ∑ cij xi(1-xj)

E: {0,1}n → R0 → fg 1 → bg

i i,j

Discontinuity Cost (cij)

n = number of pixels

Page 5: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Example: Image Segmentation

E(x) = ∑ ci xi + ∑ cij xi(1-xj)

E: {0,1}n → R0 → fg 1 → bg

i i,j

Global Minimum (x*)

x* = arg min

E(x) x

How to minimize E(x)?

n = number of pixels

Page 6: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Recent Advances and Open Problems

Connection between st-mincut and energy

minimization?

Page 7: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Connection between st-mincut and energy

minimization?

Recent Advances and Open Problems

Page 8: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

The st-Mincut Problem

Source

Sink

v1 v2

2

5

9

42

1

Graph (V, E, C)Vertices V = {v1, v2 ... vn}

Edges E = {(v1, v2) ....}

Costs C = {c(1, 2) ....}

Page 9: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

The st-Mincut Problem

Source

Sink

v1 v2

2

5

9

42

1

What is a st-cut?

Page 10: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

The st-Mincut Problem

Source

Sink

v1 v2

2

5

9

42

1

What is a st-cut?

An st-cut (S,T) divides the nodes between source and sink.

What is the cost of a st-cut?

Sum of cost of all edges going from S to T

5 + 2 + 9 = 16

Page 11: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

The st-Mincut Problem

What is a st-cut?

An st-cut (S,T) divides the nodes between source and sink.

What is the cost of a st-cut?

Sum of cost of all edges going from S to T

What is the st-mincut?

st-cut with the minimum cost

Source

Sink

v1 v2

2

5

9

42

1

2 + 1 + 4 = 7

Page 12: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

How to compute the st-mincut?

Source

Sink

v1 v2

2

5

9

42

1

Solve the dual maximum flow problem

In every network, the maximum flow equals the cost of the st-

mincut

Min-cut\Max-flow Theorem

Compute the maximum flow between Source and Sink

Constraints

Edges: Flow < Capacity

Nodes: Flow in = Flow out

Page 13: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Source

Sink

v1 v2

2

5

9

42

1

Algorithms assume non-negative capacity

Flow = 0

Page 14: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Source

Sink

v1 v2

2

5

9

42

1

Algorithms assume non-negative capacity

Flow = 0

Page 15: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Source

Sink

v1 v2

2-2

5-2

9

42

1

Algorithms assume non-negative capacity

Flow = 0 + 2

Page 16: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

9

42

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 2

Page 17: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

9

42

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 2

Page 18: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

9

42

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 2

Page 19: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

5

02

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 2 + 4

Page 20: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

5

02

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 6

Page 21: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

3

5

02

1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 6

Page 22: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

2

4

02+1

1-1

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 6 + 1

Page 23: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

2

4

03

0

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 7

Page 24: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow Algorithms

Source

Sink

v1 v2

0

2

4

03

0

Augmenting Path Based Algorithms

1. Find path from source to sink with positive capacity

2. Push maximum possible flow through this path

3. Repeat until no path can be found

Algorithms assume non-negative capacity

Flow = 7

Page 25: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

History of Maxflow Algorithms

[Slide credit: Andrew Goldberg]

Augmenting Path and Push-Relabel

n: #nodes

m: #edges

U: maximum edge weight

Algorithms assume non-negative edge

weights

Page 26: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

History of Maxflow Algorithms

[Slide credit: Andrew Goldberg]

Augmenting Path and Push-Relabel

n: #nodes

m: #edges

U: maximum edge weight

Algorithms assume non-negative edge

weights

Page 27: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Augmenting Path based Algorithms

a1 a2

1000 1

Sink

Source

1000

1000

1000

0

Ford Fulkerson: Choose any augmenting path

Page 28: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

a1 a2

1000 1

Sink

Source

1000

1000

1000

0

Augmenting Path based Algorithms

Bad Augmenting

Paths

Ford Fulkerson: Choose any augmenting path

Page 29: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

a1 a2

1000 1

Sink

Source

1000

1000

1000

0

Augmenting Path based Algorithms

Bad Augmenting

Path

Ford Fulkerson: Choose any augmenting path

Page 30: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

a1 a2

9990

Sink

Source

1000

1000

9991

Augmenting Path based Algorithms

Ford Fulkerson: Choose any augmenting path

Page 31: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

a1 a2

9990

Sink

Source

1000

1000

9991

Ford Fulkerson: Choose any augmenting path

n: #nodes

m: #edges

We will have to perform 2000 augmentations!

Worst case complexity: O (m x Total_Flow)

(Pseudo-polynomial bound: depends on flow)

Augmenting Path based Algorithms

Page 32: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Dinic: Choose shortest augmenting path

n: #nodes

m: #edges

Worst case Complexity: O (m n2)

Augmenting Path based Algorithms

a1 a2

1000 1

Sink

Source

1000

1000

1000

0

Page 33: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow in Computer Vision

• Specialized algorithms for vision problems– Grid graphs – Low connectivity (m ~ O(n))

• Dual search tree augmenting path algorithm[Boykov and Kolmogorov PAMI 2004]• Finds approximate shortest

augmenting paths efficiently• High worst-case time complexity• Empirically outperforms other

algorithms on vision problems

Page 34: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Maxflow in Computer Vision

• Specialized algorithms for vision problems– Grid graphs – Low connectivity (m ~ O(n))

• Dual search tree augmenting path algorithm[Boykov and Kolmogorov PAMI 2004]• Finds approximate shortest

augmenting paths efficiently• High worst-case time complexity• Empirically outperforms other

algorithms on vision problems• Efficient code available on the

webhttp://www.adastral.ucl.ac.uk/~vladkolm/software.html

Page 35: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Connection between st-mincut and energy

minimization?

Recent Advances and Open Problems

Page 36: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

St-mincut and Energy Minimization

T

S st-mincut

E: {0,1}n → R

Minimizing a Qudratic

Pseudoboolean function E(x)

Functions of boolean variables

Pseudoboolean?

Polynomial time st-mincut algorithms require non-negative

edge weights

E(x) = ∑ ci xi + ∑ cij xi(1-xj) cij≥0i,ji

Page 37: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

So how does this work?

Construct a graph such that:

1.Any st-cut corresponds to an assignment of x

2.The cost of the cut is equal to the energy of x : E(x)

SolutionT

S st-mincut

E(x)

Page 38: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

Sink (1)

Source (0)

a1 a2

E(a1,a2)

Page 39: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

Sink (1)

Source (0)

a1 a2

E(a1,a2) = 2a1

2

Page 40: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

Sink (1)

Source (0)

Page 41: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

Sink (1)

Source (0)

Page 42: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

2

Sink (1)

Source (0)

Page 43: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

2

1

Sink (1)

Source (0)

Page 44: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

2

1

Sink (1)

Source (0)

Page 45: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

2

1a1 = 1 a2 = 1

E (1,1) = 11

Cost of cut = 11

Sink (1)

Source (0)

Page 46: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph Construction

a1 a2

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

2

5

9

4

2

1

Sink (1)

Source (0)

a1 = 1 a2 = 0

E (1,0) = 8

st-mincut cost = 8

Page 47: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Energy Function Reparameterization

Two functions E1 and E2 are reparameterizations if

E1 (x) = E2 (x) for all x

For instance:

E1 (a1) = 1+ 2a1 + 3ā1

E2 (a1) = 3 + ā1

a1 ā1 1+ 2a1 + 3ā1

3 + ā1

0 1 4 4

1 0 3 3

Page 48: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Flow and Reparametrization

a1 a2

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

2

5

9

4

2

1

Sink (1)

Source (0)

Page 49: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Flow and Reparametrization

a1 a2

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

2

5

9

4

2

1

Sink (1)

Source (0)

2a1 + 5ā1

= 2(a1+ā1) + 3ā1

= 2 + 3ā1

Page 50: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Flow and Reparametrization

Sink (1)

Source (0)

a1 a2

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

0

3

9

4

2

12a1 + 5ā1

= 2(a1+ā1) + 3ā1

= 2 + 3ā1

Page 51: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

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

0

3

9

4

2

1

Flow and Reparametrization

9a2 + 4ā2

= 4(a2+ā2) + 5ā2

= 4 + 5ā2

Page 52: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

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

0

3

5

0

2

19a2 + 4ā2

= 4(a2+ā2) + 5ā2

= 4 + 5ā2

Flow and Reparametrization

Page 53: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

E(a1,a2) = 6 + 3ā1+ 5a2 + 2a1ā2 + ā1a2

0

3

5

0

2

1

Flow and Reparametrization

Page 54: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

E(a1,a2) = 6 + 3ā1+ 5a2 + 2a1ā2 + ā1a2

0

3

5

0

2

1

Flow and Reparametrization

Page 55: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

E(a1,a2) = 6 + 3ā1+ 5a2 + 2a1ā2 + ā1a2

0

3

5

0

2

1

Flow and Reparametrization

3ā1+ 5a2 + 2a1ā2

= 2(ā1+a2+a1ā2) +ā1+3a2= 2(1+ā1a2) +ā1+3a2

a1 a2 F1 F2

0 0 1 1

0 1 2 2

1 0 1 1

1 1 1 1

F1 = ā1+a2+a1ā2

F2 = 1+ā1a2

Page 56: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2

0

1

3

0

0

3

Flow and Reparametrization

3ā1+ 5a2 + 2a1ā2

= 2(ā1+a2+a1ā2) +ā1+3a2= 2(1+ā1a2) +ā1+3a2

a1 a2 F1 F2

0 0 1 1

0 1 2 2

1 0 1 1

1 1 1 1

F1 = ā1+a2+a1ā2

F2 = 1+ā1a2

Page 57: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

0

1

3

0

0

3

Flow and Reparametrization

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2

No more augmenting paths

possible

Page 58: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

0

1

3

0

0

3

Flow and Reparametrization

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2

Total Flow

Residual Graph(positive

coefficients)

bound on the optimal solution

Inference of the optimal solution becomes trivial because the bound is

tight

Page 59: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Sink (0)

Source (1)

a1 a2

0

1

3

0

0

3

Flow and Reparametrization

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2

a1 = 1 a2 = 0

E (1,0) = 8

st-mincut cost = 8Total Flow

bound on the optimal solution

Inference of the optimal solution becomes trivial because the bound is

tight

Residual Graph(positive

coefficients)

Page 60: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Example: Image Segmentation

E(x) = ∑ ci xi + ∑ cij xi(1-xj)

E: {0,1}n → R0 → fg 1 → bg

i i,j

Global Minimum (x*)

x* = arg min

E(x) x

How to minimize E(x)?

Page 61: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

How does the code look like?

Sink (1)

Source (0)

Graph *g;

For all pixels p

/* Add a node to the graph */nodeID(p) = g->add_node();

/* Set cost of terminal edges */set_weights(nodeID(p), fgCost(p), bgCost(p));

end

for all adjacent pixels p,qadd_weights(nodeID(p), nodeID(q), cost);

end

g->compute_maxflow();

label_p = g->is_connected_to_source(nodeID(p));

// is the label of pixel p (0 or 1)

Page 62: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

How does the code look like?

Graph *g;

For all pixels p

/* Add a node to the graph */nodeID(p) = g->add_node();

/* Set cost of terminal edges */set_weights(nodeID(p), fgCost(p), bgCost(p));

end

for all adjacent pixels p,qadd_weights(nodeID(p), nodeID(q), cost);

end

g->compute_maxflow();

label_p = g->is_connected_to_source(nodeID(p));

// is the label of pixel p (0 or 1)

a1 a2

fgCost(a1)

Sink (1)

Source (0)

fgCost(a2)

bgCost(a1) bgCost(a2)

Page 63: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph *g;

For all pixels p

/* Add a node to the graph */nodeID(p) = g->add_node();

/* Set cost of terminal edges */set_weights(nodeID(p), fgCost(p), bgCost(p));

end

for all adjacent pixels p,qadd_weights(nodeID(p), nodeID(q), cost(p,q));

end

g->compute_maxflow();

label_p = g->is_connected_to_source(nodeID(p));

// is the label of pixel p (0 or 1)

How does the code look like?

a1 a2

fgCost(a1)

Sink (1)

Source (0)

fgCost(a2)

bgCost(a1) bgCost(a2)

cost(p,q)

Page 64: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Graph *g;

For all pixels p

/* Add a node to the graph */nodeID(p) = g->add_node();

/* Set cost of terminal edges */set_weights(nodeID(p), fgCost(p), bgCost(p));

end

for all adjacent pixels p,qadd_weights(nodeID(p), nodeID(q), cost(p,q));

end

g->compute_maxflow();

label_p = g->is_connected_to_source(nodeID(p));

// is the label of pixel p (0 or 1)

How does the code look like?

a1 a2

fgCost(a1)

Sink (1)

Source (0)

fgCost(a2)

bgCost(a1) bgCost(a2)

cost(p,q)

a1 = bg a2 = fg

Page 65: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Image Segmentation in Video

Image Flow Global Optimum

pqw

n-links st-cuts

t

= 0

= 1

E(x) x*

Page 66: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Image Segmentation in Video

Image

FlowGlobal Optimu

m

Page 67: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Dynamic Energy Minimization

EB SBcomputationally

expensive operation

EA SA

minimize

Recycling

Solutions

Can we do better?

Boykov & Jolly ICCV’01, Kohli & Torr (ICCV05, PAMI07)

Page 68: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Dynamic Energy Minimization

EB SBcomputationally

expensive operation

EA SA

minimize

cheaperoperation

Simplerenergy

EB*

differencesbetweenA and B

A and Bsimilar

Kohli & Torr (ICCV05, PAMI07)

3 – 100000 time

speedup!

Reparametrization

Reuse flow

Boykov & Jolly ICCV’01, Kohli & Torr (ICCV05, PAMI07)

Page 69: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Reparametrized Energy

Dynamic Energy Minimization

Kohli & Torr (ICCV05, PAMI07)

Boykov & Jolly ICCV’01, Kohli & Torr (ICCV05, PAMI07)

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

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2

Original Energy

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

E(a1,a2) = 8 + ā1+ 3a2 + 3ā1a2 + 5a1ā2

New Energy

New Reparametrized Energy

Page 70: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Connection between st-mincut and energy

minimization?

Recent Advances and Open Problems

Page 71: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Minimizing Energy Functions

Space of Function Minimization

Problems

Submodular

Functions

NP-Hard

• General Energy Functions– NP-hard to minimize– Only approximate

minimization possible

• Easy energy functions – Solvable in polynomial time– Submodular ~ O(n6)

MAXCUT

Functions defined on trees

Page 72: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Submodular Set Functions

Set function f 2|E| ℝ

2|E| = #subsets of E

Let E= {a1,a2, .... an} be a set

Page 73: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Submodular Set Functions

Set function f 2|E| ℝ is submodular if

E

A B

f(A) + f(B) f(AB) + f(AB) for all A,B E

2|E| = #subsets of E

Let E= {a1,a2, .... an} be a set

Important Property

Sum of two submodular functions is submodular

Page 74: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Minimizing Submodular Functions

• Minimizing general submodular functions– O(n5 Q + n6) where Q is function evaluation time

[Orlin, IPCO 2007]

• Symmetric submodular functions– E (x) = E (1 - x)– O(n3) [Queyranne 1998]

• Quadratic pseudoboolean– Can be transformed to st-mincut– One node per variable [ O(n3) complexity]– Very low empirical running time

Page 75: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Submodular Pseudoboolean Functions

• All functions for one boolean variable (f: {0,1} -> R) are submodular

• A function of two boolean variables (f: {0,1}2 -> R) is submodular if

f(0,1) + f(1,0) f(0,0) + f(1,1)

• A general pseudoboolean function f 2n ℝ is submodular if all its projections fp are submodular i.e.fp(0,1) + fp (1,0) fp (0,0) + fp

(1,1)

Function defined over boolean vectors x = {x1,x2, .... xn}

Definition:

Page 76: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

E(x) = ∑ θi (xi) + ∑ θij (xi,xj)i,ji

Quadratic Submodular Pseudoboolean Functions

θij(0,1) + θij (1,0) θij

(0,0) + θij

(1,1)For all ij

Page 77: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

E(x) = ∑ θi (xi) + ∑ θij (xi,xj)i,ji

Quadratic Submodular Pseudoboolean Functions

θij(0,1) + θij (1,0) θij

(0,0) + θij

(1,1)For all ij

E(x) = ∑ ci xi + ∑ cij xi(1-xj) cij≥0i,ji

Equivalent (transformable)

i.e. All submodular QPBFs are st-mincut solvable

Page 78: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

A B

C D

0 1

0

1

xi

xj

= A +0 0

C-A C-A

0 1

0

1

0 D-C

0 D-C

0 1

0

1

0B+C-A-D

0 0

0 1

0

1

+ +

if x1=1 add

C-A

if x2 = 1 add

D-C

B+C-A-D 0 is true from the submodularity of θij

How are they equivalent?

A = θij (0,0) B = θij(0,1) C = θij

(1,0) D = θij

(1,1)

θij (xi,xj) = θij(0,0)

+ (θij(1,0)-θij(0,0)) xi + (θij(1,0)-θij(0,0)) xj

+ (θij(1,0) + θij(0,1) - θij(0,0) - θij(1,1)) (1-xi) xj

Page 79: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

A B

C D

0 1

0

1

xi

xj

= A +0 0

C-A C-A

0 1

0

1

0 D-C

0 D-C

0 1

0

1

0B+C-A-D

0 0

0 1

0

1

+ +

if x1=1 add

C-A

if x2 = 1 add

D-C

B+C-A-D 0 is true from the submodularity of θij

How are they equivalent?

A = θij (0,0) B = θij(0,1) C = θij

(1,0) D = θij

(1,1)

θij (xi,xj) = θij(0,0)

+ (θij(1,0)-θij(0,0)) xi + (θij(1,0)-θij(0,0)) xj

+ (θij(1,0) + θij(0,1) - θij(0,0) - θij(1,1)) (1-xi) xj

Page 80: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

A B

C D

0 1

0

1

xi

xj

= A +0 0

C-A C-A

0 1

0

1

0 D-C

0 D-C

0 1

0

1

0B+C-A-D

0 0

0 1

0

1

+ +

if x1=1 add

C-A

if x2 = 1 add

D-C

B+C-A-D 0 is true from the submodularity of θij

How are they equivalent?

A = θij (0,0) B = θij(0,1) C = θij

(1,0) D = θij

(1,1)

θij (xi,xj) = θij(0,0)

+ (θij(1,0)-θij(0,0)) xi + (θij(1,0)-θij(0,0)) xj

+ (θij(1,0) + θij(0,1) - θij(0,0) - θij(1,1)) (1-xi) xj

Page 81: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

A B

C D

0 1

0

1

xi

xj

= A +0 0

C-A C-A

0 1

0

1

0 D-C

0 D-C

0 1

0

1

0B+C-A-D

0 0

0 1

0

1

+ +

if x1=1 add

C-A

if x2 = 1 add

D-C

B+C-A-D 0 is true from the submodularity of θij

How are they equivalent?

A = θij (0,0) B = θij(0,1) C = θij

(1,0) D = θij

(1,1)

θij (xi,xj) = θij(0,0)

+ (θij(1,0)-θij(0,0)) xi + (θij(1,0)-θij(0,0)) xj

+ (θij(1,0) + θij(0,1) - θij(0,0) - θij(1,1)) (1-xi) xj

Page 82: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

A B

C D

0 1

0

1

xi

xj

= A +0 0

C-A C-A

0 1

0

1

0 D-C

0 D-C

0 1

0

1

0B+C-A-D

0 0

0 1

0

1

+ +

if x1=1 add

C-A

if x2 = 1 add

D-C

B+C-A-D 0 is true from the submodularity of θij

How are they equivalent?

A = θij (0,0) B = θij(0,1) C = θij

(1,0) D = θij

(1,1)

θij (xi,xj) = θij(0,0)

+ (θij(1,0)-θij(0,0)) xi + (θij(1,0)-θij(0,0)) xj

+ (θij(1,0) + θij(0,1) - θij(0,0) - θij(1,1)) (1-xi) xj

Page 83: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

E(x) = ∑ θi (xi) + ∑ θij (xi,xj)i,ji

Quadratic Submodular Pseudoboolean Functions

θij(0,1) + θij (1,0) θij

(0,0) + θij

(1,1)For all ij

Equivalent (transformable)

T

Sst-mincut

x in {0,1}n

Page 84: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Minimizing Non-Submodular Functions

• Minimizing general non-submodular functions is NP-hard.

• Commonly used method is to solve a relaxation of the problem

E(x) = ∑ θi (xi) + ∑ θij (xi,xj)i,ji

θij(0,1) + θij (1,0) ≤ θij

(0,0) + θij (1,1) for some ij

[Slide credit: Carsten Rother]

Page 85: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

pairwise nonsubmodular

unary

pairwise submodular

Minimization using Roof-dual Relaxation

)0,1()1,0()1,1()0,0( pqpqpqpq

)0,1(~

)1,0(~

)1,1(~

)0,0(~

pqpqpqpq

),(~

),(

)(})({

qppq

qppq

ppp

xx

xx

xxE

[Slide credit: Carsten Rother]

Page 86: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

2

),1(~

)1,(~

2

)1,1(),(

2

)1()(}){},({'

qppqqppq

qppqqppq

pppppp

xxxx

xxxx

xxxxE

Double number of variables:

),(~

),(

)(})({

qppq

qppq

ppp

xx

xx

xxE

ppp xxx ,

Minimization using Roof-dual Relaxation

)1( pp xx

[Slide credit: Carsten Rother]

Page 87: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

2

),1(~

)1,(~

2

)1,1(),(

2

)1()(}){},({'

qppqqppq

qppqqppq

pppppp

xxxx

xxxx

xxxxE

Double number of variables:

),(~

),(

)(})({

qppq

qppq

ppp

xx

xx

xxE

ppp xxx ,

Minimization using Roof-dual Relaxation

)1,(~

),( qppqqppq xxxxf

)0,1(~

)1,0(~

)1,1(~

)0,0(~

pqpqpqpq )1,1()0,0()0,1()1,0( pqpqpqpq ffff

Non- submodular Submodular

)1( pp xx

Page 88: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

2

),1(~

)1,(~

2

)1,1(),(

2

)1()(}){},({'

qppqqppq

qppqqppq

pppppp

xxxx

xxxx

xxxxE

Double number of variables:

),(~

),(

)(})({

qppq

qppq

ppp

xx

xx

xxE

ppp xxx ,

Minimization using Roof-dual Relaxation

)1( pp xx

• is submodular ! Ignore (solvable using st-mincut)

Property of the problem:

pp xx 1

Page 89: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

pp xx 1 is the optimal labelpx

Property of the solution:

2

),1(~

)1,(~

2

)1,1(),(

2

)1()(}){},({'

qppqqppq

qppqqppq

pppppp

xxxx

xxxx

xxxxE

Double number of variables:

),(~

),(

)(})({

qppq

qppq

ppp

xx

xx

xxE

ppp xxx , )1( pp xx

Minimization using Roof-dual Relaxation

Page 90: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Recap

• Exact minimization of Submodular QBFs using graph cuts.

• Obtaining partially optimal solutions of non-submodular QBFs using graph cuts.

Page 91: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

But ...

• Need higher order energy functions to model image structure – Field of experts [Roth and Black]

• Many problems in computer vision involve multiple labels

E(x) = ∑ θi (xi) + ∑ θij (xi,xj) + ∑ θc (xc)i,ji c

x ϵ Labels L = {l1, l2, … , lk} Clique c V

Page 92: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Transforming problems in QBFs

Multi-label Functions

Pseudoboolean Functions

Higher order Pseudoboolean

Functions

Quadratic Pseudoboolean

Functions

Page 93: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Transforming problems in QBFs

Multi-label Functions

Pseudoboolean Functions

Higher order Pseudoboolean

Functions

Quadratic Pseudoboolean

Functions

Page 94: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Higher order to Quadratic

• Simple Example using Auxiliary variables

{0 if all xi = 0C1 otherwise

f(x) =

min f(x) min C1a + C1 ∑ ā xi

x ϵ L = {0,1}n

x =x,a ϵ {0,1}

Higher Order Submodular

Function

Quadratic Submodular Function

∑xi = 0 a=0 (ā=1) f(x) = 0

∑xi ≥ 1 a=1 (ā=0) f(x) = C1

Page 95: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Higher order to Quadratic

min f(x) min C1a + C1 ∑ ā xix=

x,a ϵ {0,1}

Higher Order Submodular

Function

Quadratic Submodular Function

∑xi

1 2 3

C1

C1∑xi

Page 96: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Higher order to Quadratic

min f(x) min C1a + C1 ∑ ā xix=

x,a ϵ {0,1}

Higher Order Submodular

Function

Quadratic Submodular Function

∑xi

1 2 3

C1

C1∑xi

a=1a=0Lower

envelop of concave

functions is concave

Page 97: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Higher order to Quadratic

min f(x) min f1 (x)a + f2(x)āx

=x,a ϵ {0,1}

Higher Order Submodular

Function

Quadratic Submodular Function

∑xi

1 2 3

a=1

Lower envelop of concave

functions is concave

f2(x)

f1(x)

Page 98: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Higher order to Quadratic

min f(x) min f1 (x)a + f2(x)āx

=x,a ϵ {0,1}

Higher Order Submodular

Function

Quadratic Submodular Function

∑xi

1 2 3

a=1a=0Lower

envelop of concave

functions is concave

f2(x)

f1(x)

Page 99: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Transforming problems in QBFs

Multi-label Functions

Pseudoboolean Functions

Higher order Pseudoboolean

Functions

Quadratic Pseudoboolean

Functions

Page 100: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Multi-label to Pseudo-boolean

So what is the problem?

Eb (x1,x2, ..., xm)Em (y1,y2, ..., yn)

Multi-label Problem

Binary label Problem

yi ϵ L = {l1, l2, … , lk} xi ϵ L = {0,1}

such that:Let Y and X be the set of feasible solutions, then

1.For each binary solution x ϵ X with finite energy there exists exactly one multi-label solution y ϵ Y

-> One-One encoding function T:X->Y

2. arg min Em(y) = T(arg min Eb(x))

Page 101: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Multi-label to Pseudo-boolean

• Popular encoding scheme [Roy and Cox ’98, Ishikawa ’03, Schlesinger & Flach ’06]

Page 102: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Multi-label to Pseudo-boolean

• Popular encoding scheme [Roy and Cox ’98, Ishikawa ’03, Schlesinger & Flach ’06]

Ishikawa’s result:

E(y) = ∑ θi (yi) + ∑ θij (yi,yj)i,ji

y ϵ Labels L = {l1, l2, … , lk}

θij (yi,yj) = g(|yi-yj|)Convex Functio

n

g(|yi-yj|)

|yi-yj|

Page 103: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Multi-label to Pseudo-boolean

• Popular encoding scheme [Roy and Cox ’98, Ishikawa ’03, Schlesinger & Flach ’06]

Schlesinger & Flach ’06:E(y) = ∑ θi (yi) + ∑ θij (yi,yj)

i,ji

y ϵ Labels L = {l1, l2, … , lk}

θij(li+1,lj) + θij (li,lj+1) θij

(li,lj) + θij

(li+1,lj+1)

Covers all Submodular multi-label functions

More general than Ishikawa

Page 104: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Multi-label to Pseudo-boolean

• Applicability– Only solves restricted class of energy functions– Cannot handle Potts model potentials

• Computational Cost– Very high computational cost– Problem size = |Variables| x |Labels|– Gray level image denoising (1 Mpixel image)

(~2.5 x 108 graph nodes)

Problems

Page 105: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Connection between st-mincut and energy

minimization?

Recent Advances and Open Problems

Page 106: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

St-mincut based Move algorithms

• Commonly used for solving non-submodular multi-label problems

• Extremely efficient and produce good solutions

• Not Exact: Produce local optima

E(x) = ∑ θi (xi) + ∑ θij (xi,xj)i,ji

x ϵ Labels L = {l1, l2, … , lk}

Page 107: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Move Making Algorithms

Solution Space

En

erg

y

Page 108: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Move Making Algorithms

Search Neighbourhood

Current Solution

Optimal Move

Solution Space

En

erg

y

Page 109: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Computing the Optimal Move

Search Neighbourhood

Current Solution

Optimal Move

xc

(t) Key Property

Move Space

Bigger move space

Solution Space

En

erg

y

• Better solutions

• Finding the optimal move hard

Page 110: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Moves using Graph Cuts

Expansion and Swap move algorithms

[Boykov Veksler and Zabih, PAMI 2001]

• Makes a series of changes to the solution (moves)

• Each move results in a solution with smaller energy

Space of Solutions (x) : LN

Move Space (t) : 2N

Search Neighbourhood

Current Solution

N Number of Variables

L Number of Labels

Page 111: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Moves using Graph Cuts

Expansion and Swap move algorithms

[Boykov Veksler and Zabih, PAMI 2001]

• Makes a series of changes to the solution (moves)

• Each move results in a solution with smaller energy Current SolutionCurrent Solution

Construct a move function

Construct a move function

Minimize move function to get optimal move

Minimize move function to get optimal move

Move to new

solution

Move to new

solution

How to minimize

move functions?

Page 112: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

General Binary Moves

Minimize over move variables t to get the optimal move

x = t x1 + (1- t) x2

New solution

Current Solution

Second solution

Em(t) = E(t x1 + (1- t) x2)

Boykov, Veksler and Zabih, PAMI 2001

Move energy is a submodular QPBF (Exact Minimization

Possible)

Page 113: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Swap Move• Variables labeled α, β can swap their

labels

[Boykov, Veksler, Zabih]

Page 114: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Swap Move

Sky

House

Tree

GroundSwap Sky, House

[Boykov, Veksler, Zabih]

• Variables labeled α, β can swap their labels

Page 115: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Swap Move• Variables labeled α, β can swap their

labels

• Move energy is submodular if:– Unary Potentials: Arbitrary– Pairwise potentials: Semimetric

[Boykov, Veksler, Zabih]

θij (la,lb) ≥ 0

θij (la,lb) = 0 a = b

Examples: Potts model, Truncated Convex

Page 116: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Expansion Move

[Boykov, Veksler, Zabih][Boykov, Veksler, Zabih]

• Variables take label or retain current label

Page 117: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Expansion Move

Sky

House

Tree

Ground

Initialize with TreeStatus: Expand GroundExpand HouseExpand Sky

[Boykov, Veksler, Zabih][Boykov, Veksler, Zabih]

• Variables take label or retain current label

Page 118: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Expansion Move

• Move energy is submodular if:– Unary Potentials: Arbitrary

– Pairwise potentials: Metric

[Boykov, Veksler, Zabih][Boykov, Veksler, Zabih]

θij (la,lb) + θij (lb,lc) ≥ θij (la,lc)

Semi metric+

Triangle Inequality

• Variables take label or retain current label

Examples: Potts model, Truncated linear

Cannot solve truncated quadratic

Page 119: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

General Binary Moves

Move Type First Solution

Second Solution

Guarantee

Expansion Old solution All alpha Metric

Fusion Any solution Any solution

Minimize over move variables t

x = t x1 + (1-t) x2

New solution

First solution

Second solution

Move functions can be non-submodular!!

Page 120: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Solving Continuous Problems using Fusion Move

x = t x1 + (1-t) x2

(Lempitsky et al. CVPR08, Woodford et al. CVPR08)

x1, x2 can be continuous

Fx1

x2

x

Optical Flow Example

Final Solutio

n

Solution from

Method 1

Solution from

Method 2

Page 121: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Range Moves • Move variables can be multi-label

• Optimal move found out by using the Ishikawa

• Useful for minimizing energies with truncated convex pairwise potentials

O. Veksler, CVPR 2007

θij (yi,yj) = min(|yi-yj|,T)

|yi-yj|θij (yi,yj)

T

x = (t ==1) x1 + (t==2) x2 +… +(t==k) xk

Page 122: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Move Algorithms for Solving Higher Order Energies

• Higher order functions give rise to higher order move energies

• Move energies for certain classes of higher order energies can be transformed to QPBFs.

E(x) = ∑ θi (xi) + ∑ θij (xi,xj) + ∑ θc (xc)i,ji c

x ϵ Labels L = {l1, l2, … , lk} Clique c V

[Kohli, Kumar and Torr, CVPR07] [Kohli, Ladicky and Torr, CVPR08]

Page 123: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Outline of the Tutorial

The st-mincut problem

What problems can we solve using st-mincut?

st-mincut based Move algorithms

Connection between st-mincut and energy

minimization?

Recent Advances and Open Problems

Page 124: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Solving Mixed Programming Problems

x – binary image segmentation (xi ∊ {0,1})

ω – non-local parameter (lives in some large set Ω)

constant unary potentia

ls

pairwise

potentials

E(x,ω) = C(ω) + ∑ θi (ω, xi) + ∑ θij (ω,xi,xj)i,ji

≥ 0

Rough Shape Prior

Stickman Model

ωPose

θi (ω, xi) Shape Prior

Page 125: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Open Problems

Submodular

Functions

st-mincut

Equivalent

Characterization of Problems Solvable using st-mincut

• What functions can be transformed to submodular QBFs?

Page 126: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Minimizing General Higher Order Functions

• We saw how simple higher order potentials can be solved

• How more sophisticated higher order potentials can be solved?

Page 127: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Exact Transformation

(global optimum)

Or Relaxed transformation

(partially optimal)

Summary

T

Sst-mincut

Labelling

Problem

Submodular Quadratic Pseudoboolean

Function

Move making algorithms

Sub-problem

Page 128: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Thanks. Questions?

Page 129: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Use of Higher order Potentials

Stereo - Woodford et al. CVPR 2008

P1 P2 P3

5

6

7

8

Pixels

Disparity Labels

E(x1,x2,x3) = θ12 (x1,x2) + θ23 (x2,x3)

θij (xi,xj) =0 if xi=xj

C otherwise{

E(6,6,6) = 0 + 0 = 0

Page 130: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Use of Higher order Potentials

Stereo - Woodford et al. CVPR 2008

P1 P2 P3

5

6

7

8

Pixels

Disparity Labels

E(x1,x2,x3) = θ12 (x1,x2) + θ23 (x2,x3)

θij (xi,xj) =0 if xi=xj

C otherwise{

E(6,6,6) = 0 + 0 = 0

E(6,7,7) = 1 + 0 = 1

Page 131: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Use of Higher order Potentials

Stereo - Woodford et al. CVPR 2008

P1 P2 P3

5

6

7

8

Pixels

Disparity Labels

Pairwise potential penalize slanted planar surfaces

E(x1,x2,x3) = θ12 (x1,x2) + θ23 (x2,x3)

θij (xi,xj) =0 if xi=xj

C otherwise{

E(6,6,6) = 0 + 0 = 0

E(6,7,7) = 1 + 0 = 1

E(6,7,8) = 1 + 1 = 2

Page 132: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Computing the Optimal Move

Search Neighbourhood

Current Solution

Optimal Move

x

E(x)

xcTransformation function

T(t)

T(xc, t) = xn = xc + t

Page 133: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Computing the Optimal Move

Search Neighbourhood

Current Solution

Optimal Move

E(x)

xcTransformation function

T

Em Move Energy

(t)

x

Em(t) = E(T(xc, t))

T(xc, t) = xn = xc + t

Page 134: MAP Estimation Algorithms in M. Pawan Kumar, University of Oxford Pushmeet Kohli, Microsoft Research Computer Vision - Part II.

Computing the Optimal Move

Search Neighbourhood

Current Solution

Optimal Move

E(x)

xc

Em(t) = E(T(xc, t))

Transformation function

T

Em Move Energy

T(xc, t) = xn = xc + t minimize

t*Optimal Move

(t)

x