probabilistic inference lecture 2

Post on 23-Feb-2016

42 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Probabilistic Inference Lecture 2. M. Pawan Kumar pawan.kumar@ecp.fr. Slides available online http:// cvc.centrale-ponts.fr /personnel/ pawan /. Pose Estimation. Courtesy Pedro Felzenszwalb. Pose Estimation. Courtesy Pedro Felzenszwalb. Pose Estimation. Variables are body parts. - PowerPoint PPT Presentation

TRANSCRIPT

Probabilistic InferenceLecture 2

M. Pawan Kumarpawan.kumar@ecp.fr

Slides available online http://cvc.centrale-ponts.fr/personnel/pawan/

Pose Estimation

Courtesy Pedro Felzenszwalb

Pose Estimation

Courtesy Pedro Felzenszwalb

Pose Estimation

Variables are body parts Labels are positions

Pose Estimation

Unary potentials θa;i proportional to fraction of foreground pixels

Variables are body parts Labels are positions

Pose Estimation

Pairwise potentials θab;ik proportional to d2

Head

Torso

Joint location according to ‘head’ part

Joint location according to ‘torso’ partd

Pose Estimation

Pairwise potentials θab;ik proportional to d2

Head

Torso

dHead

Torso

d>

Outline• Problem Formulation

– Energy Function– Energy Minimization– Computing min-marginals

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Energy Function

Va Vb Vc Vd

Label l0

Label l1

Random Variables V = {Va, Vb, ….}

Labels L = {l0, l1, ….}

Labelling f: {a, b, …. } {0,1, …}

Energy Function

Va Vb Vc Vd

Q(f) = ∑a a;f(a)

Unary Potential

2

5

4

2

6

3

3

7Label l0

Label l1

Easy to minimize

Neighbourhood

Energy Function

Va Vb Vc Vd

E : (a,b) E iff Va and Vb are neighbours

E = { (a,b) , (b,c) , (c,d) }

2

5

4

2

6

3

3

7Label l0

Label l1

Energy Function

Va Vb Vc Vd

+∑(a,b) ab;f(a)f(b)

Pairwise Potential

0

1 1

0

0

2

1

1

4 1

0

3

2

5

4

2

6

3

3

7Label l0

Label l1

Q(f) = ∑a a;f(a)

Energy Function

Va Vb Vc Vd

0

1 1

0

0

2

1

1

4 1

0

3

Parameter

2

5

4

2

6

3

3

7Label l0

Label l1

+∑(a,b) ab;f(a)f(b)Q(f; ) = ∑a a;f(a)

Outline• Problem Formulation

– Energy Function– Energy Minimization– Computing min-marginals

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Energy Minimization

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

Label l0

Label l1

Energy Minimization

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

2 + 1 + 2 + 1 + 3 + 1 + 3 = 13

Label l0

Label l1

Energy Minimization

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

Label l0

Label l1

Energy Minimization

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

5 + 1 + 4 + 0 + 6 + 4 + 7 = 27

Label l0

Label l1

Energy Minimization

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

f* = arg min Q(f; )

q* = min Q(f; ) = Q(f*; )

Label l0

Label l1

Energy Minimization

f(a) f(b) f(c) f(d) Q(f; )0 0 0 0 180 0 0 1 150 0 1 0 270 0 1 1 200 1 0 0 220 1 0 1 190 1 1 0 270 1 1 1 20

16 possible labellings

f(a) f(b) f(c) f(d) Q(f; )1 0 0 0 161 0 0 1 131 0 1 0 251 0 1 1 181 1 0 0 181 1 0 1 151 1 1 0 231 1 1 1 16

f* = {1, 0, 0, 1}q* = 13

Outline• Problem Formulation

– Energy Function– Energy Minimization– Computing min-marginals

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Min-Marginals

Va Vb Vc Vd

2

5

4

2

6

3

3

7

0

1 1

0

0

2

1

1

4 1

0

3

f* = arg min Q(f; ) such that f(a) = i

Min-marginal qa;i

Label l0

Label l1

Min-Marginals16 possible labellings qa;0 = 15f(a) f(b) f(c) f(d) Q(f; )0 0 0 0 180 0 0 1 150 0 1 0 270 0 1 1 200 1 0 0 220 1 0 1 190 1 1 0 270 1 1 1 20

f(a) f(b) f(c) f(d) Q(f; )1 0 0 0 161 0 0 1 131 0 1 0 251 0 1 1 181 1 0 0 181 1 0 1 151 1 1 0 231 1 1 1 16

Min-Marginals16 possible labellings qa;1 = 13

f(a) f(b) f(c) f(d) Q(f; )1 0 0 0 161 0 0 1 131 0 1 0 251 0 1 1 181 1 0 0 181 1 0 1 151 1 1 0 231 1 1 1 16

f(a) f(b) f(c) f(d) Q(f; )0 0 0 0 180 0 0 1 150 0 1 0 270 0 1 1 200 1 0 0 220 1 0 1 190 1 1 0 270 1 1 1 20

Min-Marginals and MAP• Minimum min-marginal of any variable = energy of MAP labelling

minf Q(f; ) such that f(a) = i

qa;i mini

mini ( )

Va has to take one label

minf Q(f; )

Summary

Energy Minimization

f* = arg min Q(f; )

Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

Min-marginals

qa;i = min Q(f; ) s.t. f(a) = i

Energy Function

Outline• Problem Formulation

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Reparameterization

Va Vb

2

5

4

2

0

1 1

0

f(a) f(b) Q(f; )

0 0 7

0 1 10

1 0 5

1 1 6

2 +

2 +

- 2

- 2

Add a constant to all a;i

Subtract that constant from all b;k

Reparameterization

f(a) f(b) Q(f; )

0 0 7 + 2 - 20 1 10 + 2 - 21 0 5 + 2 - 21 1 6 + 2 - 2

Add a constant to all a;i

Subtract that constant from all b;k

Q(f; ’) = Q(f; )

Va Vb

2

5

4

2

0

0

2 +

2 +

- 2

- 2

1 1

Reparameterization

Va Vb

2

5

4

2

0

1 1

0

f(a) f(b) Q(f; )

0 0 7

0 1 10

1 0 5

1 1 6

- 3 + 3

Add a constant to one b;k

Subtract that constant from ab;ik for all ‘i’

- 3

Reparameterization

Va Vb

2

5

4

2

0

1 1

0

f(a) f(b) Q(f; )

0 0 7

0 1 10 - 3 + 31 0 5

1 1 6 - 3 + 3

- 3 + 3

- 3

Q(f; ’) = Q(f; )

Add a constant to one b;k

Subtract that constant from ab;ik for all ‘i’

Reparameterization

Va Vb

2

5

4

2

3 1

0

1

2

Va Vb

2

5

4

2

3 1

10

1- 2- 2

- 2 + 2+ 1

+ 1

+ 1- 1

Va Vb

2

5

4

2

3 1

2

1

0 - 4 + 4

- 4

- 4

’a;i = a;i ’b;k = b;k

’ab;ik = ab;ik

+ Mab;k

- Mab;k

+ Mba;i

- Mba;i Q(f; ’) = Q(f; )

Reparameterization

Q(f; ’) = Q(f; ), for all f

’ is a reparameterization of , iff

’b;k = b;k

’a;i = a;i

’ab;ik = ab;ik

+ Mab;k

- Mab;k

+ Mba;i

- Mba;i

Equivalently Kolmogorov, PAMI, 2006

Va Vb

2

5

4

2

0

0

2 +

2 +

- 2

- 2

1 1

RecapEnergy Minimization

f* = arg min Q(f; )Q(f; ) = ∑a a;f(a) + ∑(a,b) ab;f(a)f(b)

Min-marginals

qa;i = min Q(f; ) s.t. f(a) = i

Q(f; ’) = Q(f; ), for all f ’ Reparameterization

Outline• Problem Formulation

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Pearl, 1988

Belief Propagation

• Belief Propagation is exact for chains

• Some problems are easy

• Exact MAP for trees

• Clever Reparameterization

Two Variables

Va Vb

2

5 2

1

0Va Vb

2

5

40

1

Choose the right constant ’b;k = qb;k

Add a constant to one b;k

Subtract that constant from ab;ik for all ‘i’

Va Vb

2

5 2

1

0Va Vb

2

5

40

1

Choose the right constant ’b;k = qb;k

a;0 + ab;00 = 5 + 0

a;1 + ab;10 = 2 + 1minMab;0 =

Two Variables

Va Vb

2

5 5

-2

-3Va Vb

2

5

40

1

Choose the right constant ’b;k = qb;k

Two Variables

Va Vb

2

5 5

-2

-3Va Vb

2

5

40

1

Choose the right constant ’b;k = qb;k

f(a) = 1

’b;0 = qb;0

Two Variables

Potentials along the red path add up to 0

Va Vb

2

5 5

-2

-3Va Vb

2

5

40

1

Choose the right constant ’b;k = qb;k

a;0 + ab;01 = 5 + 1

a;1 + ab;11 = 2 + 0minMab;1 =

Two Variables

Va Vb

2

5 5

-2

-3Va Vb

2

5

6-2

-1

Choose the right constant ’b;k = qb;k

f(a) = 1

’b;0 = qb;0

f(a) = 1

’b;1 = qb;1

Minimum of min-marginals = MAP estimate

Two Variables

Va Vb

2

5 5

-2

-3Va Vb

2

5

6-2

-1

Choose the right constant ’b;k = qb;k

f(a) = 1

’b;0 = qb;0

f(a) = 1

’b;1 = qb;1

f*(b) = 0 f*(a) = 1

Two Variables

Va Vb

2

5 5

-2

-3Va Vb

2

5

6-2

-1

Choose the right constant ’b;k = qb;k

f(a) = 1

’b;0 = qb;0

f(a) = 1

’b;1 = qb;1

We get all the min-marginals of Vb

Two Variables

RecapWe only need to know two sets of equations

General form of Reparameterization

’a;i = a;i

’ab;ik = ab;ik

+ Mab;k

- Mab;k

+ Mba;i

- Mba;i

’b;k = b;k

Reparameterization of (a,b) in Belief Propagation

Mab;k = mini { a;i + ab;ik } Mba;i = 0

Three Variables

Va Vb

2

5 2

1

0Vc

4 60

1

0

1

3

2 3

Reparameterize the edge (a,b) as before

l0

l1

Va Vb

2

5 5-3Vc

6 60

1

-2

3

Reparameterize the edge (a,b) as before

f(a) = 1

f(a) = 1

-2 -1 2 3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 60

1

-2

3

Reparameterize the edge (a,b) as before

f(a) = 1

f(a) = 1

Potentials along the red path add up to 0

-2 -1 2 3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 60

1

-2

3

Reparameterize the edge (b,c) as before

f(a) = 1

f(a) = 1

Potentials along the red path add up to 0

-2 -1 2 3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 12-6

-5

-2

9

Reparameterize the edge (b,c) as before

f(a) = 1

f(a) = 1

Potentials along the red path add up to 0

f(b) = 1

f(b) = 0

-2 -1 -4 -3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 12-6

-5

-2

9

Reparameterize the edge (b,c) as before

f(a) = 1

f(a) = 1

Potentials along the red path add up to 0

f(b) = 1

f(b) = 0

qc;0

qc;1-2 -1 -4 -3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 12-6

-5

-2

9

f(a) = 1

f(a) = 1

f(b) = 1

f(b) = 0

qc;0

qc;1

f*(c) = 0 f*(b) = 0 f*(a) = 1Generalizes to any length chain

-2 -1 -4 -3

Three Variables

l0

l1

Va Vb

2

5 5-3Vc

6 12-6

-5

-2

9

f(a) = 1

f(a) = 1

f(b) = 1

f(b) = 0

qc;0

qc;1

f*(c) = 0 f*(b) = 0 f*(a) = 1Dynamic Programming

-2 -1 -4 -3

Three Variables

l0

l1

Dynamic Programming3 variables 2 variables + book-keeping

n variables (n-1) variables + book-keeping

Start from left, go to right

Reparameterize current edge (a,b)Mab;k = mini { a;i + ab;ik }

’ab;ik = ab;ik+ Mab;k - Mab;k’b;k = b;k

Repeat

Dynamic Programming

Start from left, go to right

Reparameterize current edge (a,b)Mab;k = mini { a;i + ab;ik }

Repeat

Messages Message Passing

Why stop at dynamic programming?

’ab;ik = ab;ik+ Mab;k - Mab;k’b;k = b;k

Va Vb

2

5 5-3Vc

6 12-6

-5

-2

9

Reparameterize the edge (c,b) as before

-2 -1 -4 -3

Three Variables

l0

l1

Va Vb

2

5 9-3Vc

11 12-11

-9

-2

9

Reparameterize the edge (c,b) as before

-2 -1 -9 -7

’b;i = qb;i

Three Variables

l0

l1

Va Vb

2

5 9-3Vc

11 12-11

-9

-2

9

Reparameterize the edge (b,a) as before

-2 -1 -9 -7

Three Variables

l0

l1

Va Vb

9

11 9-9Vc

11 12-11

-9

-9

9

Reparameterize the edge (b,a) as before

-9 -7 -9 -7

’a;i = qa;i

Three Variables

l0

l1

Va Vb

9

11 9-9Vc

11 12-11

-9

-9

9

Forward Pass Backward Pass

-9 -7 -9 -7

All min-marginals are computed

Three Variables

l0

l1

Belief Propagation on Chains

Start from left, go to right

Reparameterize current edge (a,b)Mab;k = mini { a;i + ab;ik }

’ab;ik = ab;ik+ Mab;k - Mab;k’b;k = b;k

Repeat till the end of the chain

Start from right, go to left

Repeat till the end of the chain

Belief Propagation on Chains

• A way of computing reparam constants

• Generalizes to chains of any length

• Forward Pass - Start to End• MAP estimate• Min-marginals of final variable

• Backward Pass - End to start• All other min-marginals

Computational Complexity• Each constant takes O(|L|)

• Number of constants - O(|E||L|)

O(|E||L|2)• Memory required ?

O(|E||L|)

Belief Propagation on Trees

Vb

Va

Forward Pass: Leaf Root

All min-marginals are computed

Backward Pass: Root Leaf

Vc

Vd Ve Vg Vh

Outline• Problem Formulation

• Reparameterization

• Energy Minimization for Trees

• Loopy Belief Propagation

Pearl, 1988; Murphy et al., 1999

Belief Propagation on Cycles

Va Vb

Vd Vc

Where do we start? Arbitrarily

a;0

a;1

b;0

b;1

d;0

d;1

c;0

c;1

Reparameterize (a,b)

Belief Propagation on Cycles

Va Vb

Vd Vc

a;0

a;1

’b;0

’b;1

d;0

d;1

c;0

c;1

Potentials along the red path add up to 0

Belief Propagation on Cycles

Va Vb

Vd Vc

a;0

a;1

’b;0

’b;1

d;0

d;1

’c;0

’c;1

Potentials along the red path add up to 0

Belief Propagation on Cycles

Va Vb

Vd Vc

a;0

a;1

’b;0

’b;1

’d;0

’d;1

’c;0

’c;1

Potentials along the red path add up to 0

Belief Propagation on Cycles

Va Vb

Vd Vc

’a;0

’a;1

’b;0

’b;1

’d;0

’d;1

’c;0

’c;1

Potentials along the red path add up to 0

Belief Propagation on Cycles

Va Vb

Vd Vc

’a;0

’a;1

’b;0

’b;1

’d;0

’d;1

’c;0

’c;1

Potentials along the red path add up to 0

- a;0

- a;1

Belief Propagation on Cycles

Va Vb

Vd Vc

a;0

a;1

b;0

b;1

d;0

d;1

c;0

c;1

Any suggestions? Fix Va to label l0

Belief Propagation on Cycles

Va Vb

Vd Vc

Any suggestions? Fix Va to label l0

a;0 b;0

b;1

d;0

d;1

c;0

c;1

Equivalent to a tree-structured problem

Belief Propagation on Cycles

Va Vb

Vd Vc

a;1

b;0

b;1

d;0

d;1

c;0

c;1

Any suggestions? Fix Va to label l1Equivalent to a tree-structured problem

Belief Propagation on Cycles

Choose the minimum energy solution

Va Vb

Vd Vc

a;0

a;1

b;0

b;1

d;0

d;1

c;0

c;1

This approach quickly becomes infeasible

Loopy Belief Propagation

V1 V2 V3

V4 V5 V6

V7 V8 V9

Keep reparameterizing edges in some order

Hope for convergence and a good solution

Belief Propagation• Generalizes to any arbitrary random field

• Complexity per iteration ?

O(|E||L|2)• Memory required ?

O(|E||L|)

Theoretical Properties of BPExact for Trees Pearl, 1988

What about any general random field?

Run BP. Assume it converges.

Theoretical Properties of BPExact for Trees Pearl, 1988

What about any general random field?

Choose variables in a tree. Change their labels.Value of energy does not decrease

Theoretical Properties of BPExact for Trees Pearl, 1988

What about any general random field?

Choose variables in a cycle. Change their labels.Value of energy does not decrease

Theoretical Properties of BPExact for Trees Pearl, 1988

What about any general random field?

For cycles, if BP converges then exact MAPWeiss and Freeman, 2001

Speed-Ups for Special Cases

ab;ik = 0, if i = k

= C, otherwise.

Mab;k = mini { a;i + ab;ik }

Felzenszwalb and Huttenlocher, 2004

Speed-Ups for Special Cases

ab;ik = wab|i-k|

Mab;k = mini { a;i + ab;ik }

Felzenszwalb and Huttenlocher, 2004

Speed-Ups for Special Cases

ab;ik = min{wab|i-k|, C}

Mab;k = mini { a;i + ab;ik }

Felzenszwalb and Huttenlocher, 2004

Speed-Ups for Special Cases

ab;ik = min{wab(i-k)2, C}

Mab;k = mini { a;i + ab;ik }

Felzenszwalb and Huttenlocher, 2004

top related