Presentation is loading. Please wait.

Presentation is loading. Please wait.

Probabilistic Inference Lecture 2 M. Pawan Kumar Slides available online

Similar presentations


Presentation on theme: "Probabilistic Inference Lecture 2 M. Pawan Kumar Slides available online"— Presentation transcript:

1 Probabilistic Inference Lecture 2 M. Pawan Kumar pawan.kumar@ecp.fr Slides available online http://cvc.centrale-ponts.fr/personnel/pawan/

2 Pose Estimation Courtesy Pedro Felzenszwalb

3 Pose Estimation Courtesy Pedro Felzenszwalb

4 Pose Estimation Variables are body partsLabels are positions

5 Pose Estimation Unary potentials θ a;i proportional to fraction of foreground pixels Variables are body partsLabels are positions

6 Pose Estimation Pairwise potentials θ ab;ik proportional to d 2 Head Torso Joint location according to ‘head’ part Joint location according to ‘torso’ part d

7 Pose Estimation Pairwise potentials θ ab;ik proportional to d 2 Head Torso d Head Torso d >

8 Outline Problem Formulation –Energy Function –Energy Minimization –Computing min-marginals Reparameterization Energy Minimization for Trees Loopy Belief Propagation

9 Energy Function VaVa VbVb VcVc VdVd Label l 0 Label l 1 Random Variables V = {V a, V b, ….} Labels L = {l 0, l 1, ….} Labelling f: {a, b, …. }  {0,1, …}

10 Energy Function VaVa VbVb VcVc VdVd Q(f) = ∑ a  a;f(a) Unary Potential 2 5 4 2 6 3 3 7 Label l 0 Label l 1 Easy to minimize Neighbourhood

11 Energy Function VaVa VbVb VcVc VdVd E : (a,b)  E iff V a and V b are neighbours E = { (a,b), (b,c), (c,d) } 2 5 4 2 6 3 3 7 Label l 0 Label l 1

12 Energy Function VaVa VbVb VcVc VdVd +∑ (a,b)  ab;f(a)f(b) Pairwise Potential 0 1 1 0 0 2 1 1 41 0 3 2 5 4 2 6 3 3 7 Label l 0 Label l 1 Q(f) = ∑ a  a;f(a)

13 Energy Function VaVa VbVb VcVc VdVd 0 1 1 0 0 2 1 1 41 0 3 Parameter 2 5 4 2 6 3 3 7 Label l 0 Label l 1 +∑ (a,b)  ab;f(a)f(b) Q(f;  )= ∑ a  a;f(a)

14 Outline Problem Formulation –Energy Function –Energy Minimization –Computing min-marginals Reparameterization Energy Minimization for Trees Loopy Belief Propagation

15 Energy Minimization VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 0 3 Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) Label l 0 Label l 1

16 Energy Minimization VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 0 3 Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) 2 + 1 + 2 + 1 + 3 + 1 + 3 = 13 Label l 0 Label l 1

17 Energy Minimization VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 0 3 Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) Label l 0 Label l 1

18 Energy Minimization VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 0 3 Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) 5 + 1 + 4 + 0 + 6 + 4 + 7 = 27 Label l 0 Label l 1

19 Energy Minimization VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 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 l 0 Label l 1

20 Energy Minimization f(a)f(b)f(c)f(d) Q(f;  ) 000018 000115 001027 001120 010022 010119 011027 011120 16 possible labellings f(a)f(b)f(c)f(d) Q(f;  ) 100016 100113 101025 101118 1100 110115 111023 111116 f* = {1, 0, 0, 1} q* = 13

21 Outline Problem Formulation –Energy Function –Energy Minimization –Computing min-marginals Reparameterization Energy Minimization for Trees Loopy Belief Propagation

22 Min-Marginals VaVa VbVb VcVc VdVd 2 5 4 2 6 3 3 7 0 1 1 0 0 2 1 1 41 0 3 f* = arg min Q(f;  ) such that f(a) = i Min-marginal q a;i Label l 0 Label l 1

23 Min-Marginals 16 possible labellings q a;0 = 15 f(a)f(b)f(c)f(d) Q(f;  ) 000018 000115 001027 001120 010022 010119 011027 011120 f(a)f(b)f(c)f(d) Q(f;  ) 100016 100113 101025 101118 1100 110115 111023 111116

24 Min-Marginals 16 possible labellings q a;1 = 13 f(a)f(b)f(c)f(d) Q(f;  ) 100016 100113 101025 101118 1100 110115 111023 111116 f(a)f(b)f(c)f(d) Q(f;  ) 000018 000115 001027 001120 010022 010119 011027 011120

25 Min-Marginals and MAP Minimum min-marginal of any variable = energy of MAP labelling min f Q(f;  ) such that f(a) = i q a;i min i min i ( ) V a has to take one label min f Q(f;  )

26 Summary Energy Minimization f* = arg min Q(f;  ) Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) Min-marginals q a;i = min Q(f;  ) s.t. f(a) = i Energy Function

27 Outline Problem Formulation Reparameterization Energy Minimization for Trees Loopy Belief Propagation

28 Reparameterization VaVa VbVb 2 5 4 2 0 1 1 0 f(a)f(b) Q(f;  ) 007 0110 105 116 2 + - 2 Add a constant to all  a;i Subtract that constant from all  b;k

29 Reparameterization f(a)f(b) Q(f;  ) 007 + 2 - 2 0110 + 2 - 2 105 + 2 - 2 116 + 2 - 2 Add a constant to all  a;i Subtract that constant from all  b;k Q(f;  ’) = Q(f;  ) VaVa VbVb 2 5 4 2 0 0 2 + - 2 1 1

30 Reparameterization VaVa VbVb 2 5 4 2 0 1 1 0 f(a)f(b) Q(f;  ) 007 0110 105 116 - 3 + 3 Add a constant to one  b;k Subtract that constant from  ab;ik for all ‘i’ - 3

31 Reparameterization VaVa VbVb 2 5 4 2 0 1 1 0 f(a)f(b) Q(f;  ) 007 0110 - 3 + 3 105 116 - 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’

32 Reparameterization VaVa VbVb 2 5 4 2 31 0 1 2 VaVa VbVb 2 5 4 2 31 1 0 1 - 2 + 2 + 1 - 1 VaVa VbVb 2 5 4 2 31 2 1 0 - 4+ 4 - 4  ’ a;i =  a;i  ’ b;k =  b;k  ’ ab;ik =  ab;ik + M ab;k - M ab;k + M ba;i - M ba;i Q(f;  ’) = Q(f;  )

33 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 + M ab;k - M ab;k + M ba;i - M ba;i Equivalently Kolmogorov, PAMI, 2006 VaVa VbVb 2 5 4 2 0 0 2 + - 2 11

34 Recap Energy Minimization f* = arg min Q(f;  ) Q(f;  ) = ∑ a  a;f(a) + ∑ (a,b)  ab;f(a)f(b) Min-marginals q a;i = min Q(f;  ) s.t. f(a) = i Q(f;  ’) = Q(f;  ), for all f  ’   Reparameterization

35 Outline Problem Formulation Reparameterization Energy Minimization for Trees Loopy Belief Propagation Pearl, 1988

36 Belief Propagation Belief Propagation is exact for chains Some problems are easy Exact MAP for trees Clever Reparameterization

37 Two Variables VaVa VbVb 2 5 2 1 0 VaVa VbVb 2 5 40 1 Choose the right constant  ’ b;k = q b;k Add a constant to one  b;k Subtract that constant from  ab;ik for all ‘i’

38 VaVa VbVb 2 5 2 1 0 VaVa VbVb 2 5 40 1 Choose the right constant  ’ b;k = q b;k  a;0 +  ab;00 = 5 + 0  a;1 +  ab;10 = 2 + 1 min M ab;0 = Two Variables

39 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 40 1 Choose the right constant  ’ b;k = q b;k Two Variables

40 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 40 1 Choose the right constant  ’ b;k = q b;k f(a) = 1  ’ b;0 = q b;0 Two Variables Potentials along the red path add up to 0

41 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 40 1 Choose the right constant  ’ b;k = q b;k  a;0 +  ab;01 = 5 + 1  a;1 +  ab;11 = 2 + 0 min M ab;1 = Two Variables

42 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 6-2 Choose the right constant  ’ b;k = q b;k f(a) = 1  ’ b;0 = q b;0 f(a) = 1  ’ b;1 = q b;1 Minimum of min-marginals = MAP estimate Two Variables

43 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 6-2 Choose the right constant  ’ b;k = q b;k f(a) = 1  ’ b;0 = q b;0 f(a) = 1  ’ b;1 = q b;1 f*(b) = 0f*(a) = 1 Two Variables

44 VaVa VbVb 2 5 5 -2 -3 VaVa VbVb 2 5 6-2 Choose the right constant  ’ b;k = q b;k f(a) = 1  ’ b;0 = q b;0 f(a) = 1  ’ b;1 = q b;1 We get all the min-marginals of V b Two Variables

45 Recap We only need to know two sets of equations General form of Reparameterization  ’ a;i =  a;i  ’ ab;ik =  ab;ik + M ab;k - M ab;k + M ba;i - M ba;i  ’ b;k =  b;k Reparameterization of (a,b) in Belief Propagation M ab;k = min i {  a;i +  ab;ik } M ba;i = 0

46 Three Variables VaVa VbVb 2 5 2 1 0 VcVc 460 1 0 1 3 2 3 Reparameterize the edge (a,b) as before l0l0 l1l1

47 VaVa VbVb 2 5 5 -3 VcVc 660 1 -2 3 Reparameterize the edge (a,b) as before f(a) = 1 -22 3 Three Variables l0l0 l1l1

48 VaVa VbVb 2 5 5 -3 VcVc 660 1 -2 3 Reparameterize the edge (a,b) as before f(a) = 1 Potentials along the red path add up to 0 -22 3 Three Variables l0l0 l1l1

49 VaVa VbVb 2 5 5 -3 VcVc 660 1 -2 3 Reparameterize the edge (b,c) as before f(a) = 1 Potentials along the red path add up to 0 -22 3 Three Variables l0l0 l1l1

50 VaVa VbVb 2 5 5 -3 VcVc 612-6 -5 -2 9 Reparameterize the edge (b,c) as before f(a) = 1 Potentials along the red path add up to 0 f(b) = 1 f(b) = 0 -2-4 -3 Three Variables l0l0 l1l1

51 VaVa VbVb 2 5 5 -3 VcVc 612-6 -5 -2 9 Reparameterize the edge (b,c) as before f(a) = 1 Potentials along the red path add up to 0 f(b) = 1 f(b) = 0 q c;0 q c;1 -2-4 -3 Three Variables l0l0 l1l1

52 VaVa VbVb 2 5 5 -3 VcVc 612-6 -5 -2 9 f(a) = 1 f(b) = 1 f(b) = 0 q c;0 q c;1 f*(c) = 0 f*(b) = 0f*(a) = 1 Generalizes to any length chain -2-4 -3 Three Variables l0l0 l1l1

53 VaVa VbVb 2 5 5 -3 VcVc 612-6 -5 -2 9 f(a) = 1 f(b) = 1 f(b) = 0 q c;0 q c;1 f*(c) = 0 f*(b) = 0f*(a) = 1 Dynamic Programming -2-4 -3 Three Variables l0l0 l1l1

54 Dynamic Programming 3 variables  2 variables + book-keeping n variables  (n-1) variables + book-keeping Start from left, go to right Reparameterize current edge (a,b) M ab;k = min i {  a;i +  ab;ik }  ’ ab;ik =  ab;ik + M ab;k - M ab;k  ’ b;k =  b;k Repeat

55 Dynamic Programming Start from left, go to right Reparameterize current edge (a,b) M ab;k = min i {  a;i +  ab;ik } Repeat MessagesMessage Passing Why stop at dynamic programming?  ’ ab;ik =  ab;ik + M ab;k - M ab;k  ’ b;k =  b;k

56 VaVa VbVb 2 5 5 -3 VcVc 612-6 -5 -2 9 Reparameterize the edge (c,b) as before -2-4 -3 Three Variables l0l0 l1l1

57 VaVa VbVb 2 5 9 -3 VcVc 1112-11 -9 -2 9 Reparameterize the edge (c,b) as before -2-9 -7  ’ b;i = q b;i Three Variables l0l0 l1l1

58 VaVa VbVb 2 5 9 -3 VcVc 1112-11 -9 -2 9 Reparameterize the edge (b,a) as before -2-9 -7 Three Variables l0l0 l1l1

59 VaVa VbVb 9 11 9 -9 VcVc 1112-11 -9 9 Reparameterize the edge (b,a) as before -9-7-9 -7  ’ a;i = q a;i Three Variables l0l0 l1l1

60 VaVa VbVb 9 11 9 -9 VcVc 1112-11 -9 9 Forward Pass   Backward Pass -9-7-9 -7 All min-marginals are computed Three Variables l0l0 l1l1

61 Belief Propagation on Chains Start from left, go to right Reparameterize current edge (a,b) M ab;k = min i {  a;i +  ab;ik }  ’ ab;ik =  ab;ik + M ab;k - M ab;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

62 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

63 Computational Complexity Each constant takes O(|L|) Number of constants - O(|E||L|) O(|E||L| 2 ) Memory required ? O(|E||L|)

64 Belief Propagation on Trees VbVb VaVa Forward Pass: Leaf  Root All min-marginals are computed Backward Pass: Root  Leaf VcVc VdVd VeVe VgVg VhVh

65 Outline Problem Formulation Reparameterization Energy Minimization for Trees Loopy Belief Propagation Pearl, 1988; Murphy et al., 1999

66 Belief Propagation on Cycles VaVa VbVb VdVd VcVc Where do we start? Arbitrarily  a;0  a;1  b;0  b;1  d;0  d;1  c;0  c;1 Reparameterize (a,b)

67 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  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

68 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  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

69 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  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

70 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  ’ 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

71 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  ’ 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

72 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  a;0  a;1  b;0  b;1  d;0  d;1  c;0  c;1 Any suggestions?Fix V a to label l 0

73 Belief Propagation on Cycles VaVa VbVb VdVd VcVc Any suggestions?Fix V a to label l 0  a;0  b;0  b;1  d;0  d;1  c;0  c;1 Equivalent to a tree-structured problem

74 Belief Propagation on Cycles VaVa VbVb VdVd VcVc  a;1  b;0  b;1  d;0  d;1  c;0  c;1 Any suggestions?Fix V a to label l 1 Equivalent to a tree-structured problem

75 Belief Propagation on Cycles Choose the minimum energy solution VaVa VbVb VdVd VcVc  a;0  a;1  b;0  b;1  d;0  d;1  c;0  c;1 This approach quickly becomes infeasible

76 Loopy Belief Propagation V1V1 V2V2 V3V3 V4V4 V5V5 V6V6 V7V7 V8V8 V9V9 Keep reparameterizing edges in some order Hope for convergence and a good solution

77 Belief Propagation Generalizes to any arbitrary random field Complexity per iteration ? O(|E||L| 2 ) Memory required ? O(|E||L|)

78 Theoretical Properties of BP Exact for Trees Pearl, 1988 What about any general random field? Run BP. Assume it converges.

79 Theoretical Properties of BP Exact for Trees Pearl, 1988 What about any general random field? Choose variables in a tree. Change their labels. Value of energy does not decrease

80 Theoretical Properties of BP Exact for Trees Pearl, 1988 What about any general random field? Choose variables in a cycle. Change their labels. Value of energy does not decrease

81 Theoretical Properties of BP Exact for Trees Pearl, 1988 What about any general random field? For cycles, if BP converges then exact MAP Weiss and Freeman, 2001

82 Speed-Ups for Special Cases  ab;ik = 0, if i = k = C, otherwise. M ab;k = min i {  a;i +  ab;ik } Felzenszwalb and Huttenlocher, 2004

83 Speed-Ups for Special Cases  ab;ik = w ab |i-k| M ab;k = min i {  a;i +  ab;ik } Felzenszwalb and Huttenlocher, 2004

84 Speed-Ups for Special Cases  ab;ik = min{w ab |i-k|, C} M ab;k = min i {  a;i +  ab;ik } Felzenszwalb and Huttenlocher, 2004

85 Speed-Ups for Special Cases  ab;ik = min{w ab (i-k) 2, C} M ab;k = min i {  a;i +  ab;ik } Felzenszwalb and Huttenlocher, 2004


Download ppt "Probabilistic Inference Lecture 2 M. Pawan Kumar Slides available online"

Similar presentations


Ads by Google