Professional Documents
Culture Documents
Lecture 02 Artificial Vision Lecture2
Lecture 02 Artificial Vision Lecture2
in Artificial Vision
Lecture 2
Reparameterization and dynamic programming
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Undirected Graph
Graph G
Vertices
V
V1
V2
V3
V4
V5
V6
V7
V8
V9
Edges
E
V1
V2
V3
V4
V5
V6
V7
V8
V9
X1
X2
X3
X4
X5
X6
X7
X8
X9
Unobserved
Random
Variables
X1
X2
X3
X4
X5
X6
X7
X8
X9
Neighbors
Edges define a neighborhood over random variables
MRF
X1
X2
X3
X4
X5
X6
X7
X8
X9
MRF
X1
X2
X3
X4
X5
X6
X7
X8
X9
MRF
X1
X2
X3
X4
X5
X6
X7
X8
X9
MRF
X1
X2
X3
X4
X5
X6
X7
X8
X9
MRF
Potential
12(x1,x2)
X1
X2
X3
X4
X5
X6
X7
X8
X9
Potential
56(x5,x6)
MRF
Potential
12(x1,x2)
X1
X2
X3
X4
X5
X6
X7
X8
X9
Potential
56(x5,x6)
Outline
Models
Incorporating Data
Conditional Random Fields
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
MRF
Potential
1(x1,d1)
d1
X1
d2
X2
d4
X4
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
Observed
Data
MRF
d1
X1
d2
X2
d4
X4
Probability P(x,d) =
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
MRF
d1
X1
d2
X2
d4
X4
High-order
Potential
4578(x4,x5,x7,x8)
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
Pairwise MRF
Unary
Potential
1(x1,d1)
d1
X1
d2
X2
d4
X4
Probability P(x,d) =
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
Pairwise
Potential
56(x5,x6)
d9
X9
Outline
Models
Incorporating Data
Conditional Random Fields
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
d2
X2
d4
X4
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
CRF
d1
X1
d2
X2
d4
X4
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
CRF
d1
X1
d2
X2
d4
X4
Probability P(x|d) =
X3
d5
X5
d7
X7
d3
d6
X6
d8
X8
d9
X9
Probability P(x) =
X1
X2
X3
X4
X5
X6
X7
X8
X9
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Exponential Family
Probability P(x) =
Probability P(x) =
Exponential Family
Probability P(x) =
Probability P(x) =
Exponential Family
Probability P(x) =
Probability P(x) =
Exponential Family
Probability P(x) =
Probability P(x) =
Exponential Family
exp(-E(x))
Probability P(x) =
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Energy Function
Label l1
Label l0
Xp
Random Variables X
Labels L = {l0, l1, .}
Labelling x
Xq
Xr
Xs
Energy Function
Label l1
2
Xq
3
Xr
7
Xs
Label l0
Xp
E(x) = p p(xp)
Unary Potential
Easy to minimize
Neighbourhood
Energy Function
Label l1
2
Xq
3
Xr
7
Xs
Label l0
Xp
Energy Function
Label l1
2
Xq
3
Xr
7
Xs
Label l0
Xp
Pairwise Potential
Energy Function
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
Pairwise Potential
Energy Function
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
Outline
Models
Exponential Family
Problem Formulation
Energy Minimization
Computing Min-Marginals
Reparameterization
Dynamic Programming
Energy Minimization
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
Energy Minimization
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
2 + 1 + 2 + 1 + 3 + 1 + 3 = 13
Energy Minimization
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
Energy Minimization
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
5 + 1 + 4 + 0 + 6 + 4 + 7 = 27
Energy Minimization
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
x* = argmin E(x; )
Energy Minimization
x* = {1, 0, 0, 1}
e* = 13
16 possible labellings
xp
0
0
0
0
0
0
0
0
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
18
15
27
20
22
19
27
20
xp
1
1
1
1
1
1
1
1
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
16
13
25
18
18
15
23
16
Outline
Models
Exponential Family
Problem Formulation
Energy Minimization
Computing Min-Marginals
Reparameterization
Dynamic Programming
Min-Marginals
Label l1
0
1
4
1
Label l0
5
Xp
2
Xq
6
3
1
4
3
Xr
3
1
0
7
Xs
Min-Marginals
ep(0) = 15
16 possible labellings
xp
0
0
0
0
0
0
0
0
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
18
15
27
20
22
19
27
20
xp
1
1
1
1
1
1
1
1
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
16
13
25
18
18
15
23
16
Min-Marginals
ep(1) = 13
16 possible labellings
xp
0
0
0
0
0
0
0
0
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
18
15
27
20
22
19
27
20
xp
1
1
1
1
1
1
1
1
xq
0
0
0
0
1
1
1
1
xr
0
0
1
1
0
0
1
1
xs
0
1
0
1
0
1
0
1
16
13
25
18
18
15
23
16
mini ep(i)
mini ( minx E(x; ) such that xp = i )
minx E(x; )
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Reparameterization
2 +
2
2 +
5
Xp
4
- 2
2
- 2
Xq
xp
xq
E(x; )
10
Reparameterization
2 +
2
2 +
5
Xp
4
- 2
2
- 2
Xq
xp
xq
E(x; )
7 +2-2
10 + 2 - 2
5 +2-2
6 +2-2
Reparameterization
0
- 3
1
- 3
1
5
Xp
4
+ 3
2
Xq
xp
xq
E(x; )
10
Reparameterization
0
- 3
1
- 3
1
5
Xp
4
+ 3
2
Xq
xp
xq
E(x; )
10 - 3 + 3
6-3+3
Reparameterization
3
2
2
- 2
1
- 2
5
0
- 2
Xp
1
+ 1
4
- 1
2
0
+ 1
1
+ 1
2
+ 2
5
2
Xq
Xq
Xp
0
- 4
1
+ 4
1
- 4
4
2
- 4
5
Xp
2
Xq
E(x; )
= E(x; )
Reparameterization
is a reparameterization of , iff
2 +
5
Xp
1
0
2
- 2
Xq
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Dynamic Programming
Some problems are easy
Dynamic programming is exact for chains
Exact for trees
Clever Reparameterization
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Two Variables
Three Variables
Chains and Trees
Two Variables
2
0
1
1
5
Xp
2
Xq
5
Xp
Xq
q(k) = eq(k)
Two Variables
2
Xp
4
1
1
5
2
Xq
Mpq(0) = min
5
Xp
Xq
p(0) + pq(0,0) = 5 + 0
q(1) + pq(1,0) = 2 + 1
q(k) = eq(k)
Two Variables
2
0
1
-2
5
Xp
-3
5
Xq
5
Xp
Xq
q(k) = eq(k)
Two Variables
2
xp = 1
0
1
-2
5
Xp
-3
5
Xq
5
Xp
q(0) = eq(0)
Potentials along the red path add up to 0
Xq
Two Variables
2
Xp
4
1
-2
5
-3
5
Xq
Mpq(1) = min
5
Xp
p(0) + pq(0,1) = 5 + 1
p(1) + pq(1,1) = 2 + 0
Xq
Two Variables
2
xp = 1
Xp
-2
6
-1
-2
5
xp = 1
-3
5
Xq
q(0) = eq(0)
5
Xp
Xq
q(1) = eq(1)
Two Variables
xp = 1
-3
Xp
5
Xq
q(0) = eq(0)
xq = 0
-2
6
-1
-2
5
xp = 1
5
Xp
Xq
q(1) = eq(1)
xp = 1
Two Variables
2
xp = 1
Xp
-2
6
-1
-2
5
xp = 1
-3
5
Xq
q(0) = eq(0)
5
Xp
Xq
q(1) = eq(1)
Computational Complexity
Number of reparameterization constants = h
Complexity for each constant = O(h)
Total complexity = O(h2)
Same complexity as brute-force !!
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Two Variables
Three Variables
Chains and Trees
Three Variables
l1
2
1
4
1
6
3
l0
5
Xp
2
Xq
3
Xr
Three Variables
xp = 1
l1
-2
2
-2
6
-1
6
3
l0
5
Xp
-3
5
Xq
3
Xr
xp = 1
Reparameterize the edge (p,q) as before
Three Variables
xp = 1
l1
-2
2
-2
6
-1
6
3
l0
5
Xp
-3
5
Xq
3
Xr
xp = 1
Reparameterize the edge (p,q) as before
Potentials along the red path add up to 0
Three Variables
xp = 1
l1
-2
2
-2
6
-1
6
3
l0
5
Xp
-3
5
Xq
3
Xr
xp = 1
Reparameterize the edge (q,r) as before
Potentials along the red path add up to 0
Three Variables
xp = 1
l1
-2
2
-2
6
-1
xq = 1
-6
12
-3
-4
l0
5
Xp
-3
5
Xq
xp = 1
-5
9
Xr
xq = 0
Three Variables
xp = 1
l1
-2
2
-2
6
-1
xq = 1
-6
12
-3
-4
l0
5
Xp
-3
5
Xq
xp = 1
-5
9
Xr
er(1)
er(0)
xq = 0
Three Variables
xp = 1
l1
-2
2
-2
6
-1
xq = 1
-6
12
-3
-4
l0
-3
Xp
5
Xq
xp = 1
xr = 0
xq = 0
-5
9
Xr
xq = 0
xp = 1
er(1)
er(0)
Computational Complexity
Number of reparameterization constants = 2h
Complexity for each constant = O(h)
Total complexity = O(2h2) = O(h2)
Better than brute-force O(h3)
Outline
Models
Exponential Family
Problem Formulation
Reparameterization
Dynamic Programming
Two Variables
Three Variables
Chains and Trees
Chains
X1
X2
X3
..
Xn
Chains
X1
X2
X3
..
Xn
Chains
X1
X2
X3
..
Xn
Chains
X1
X2
X3
..
Xn
Chains
X1
X2
X3
..
Xn
Chains
X1
X2
X3
..
Xn
Computational Complexity
Number of reparameterization constants = (n-1)h
Complexity for each constant = O(h)
Total complexity = O(nh2)
Better than brute-force O(hn)
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Trees
X1
X2
X4
X3
X5
X6
X7
Computational Complexity
Number of reparameterization constants = (n-1)h
Complexity for each constant = O(h)
Total complexity = O(nh2)
Better than brute-force O(hn)