lect 6: graph partition by swendsen-wang cuts

17
ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005 Lect 6: Graph Partition by Swendsen-Wang Cuts Topics 1. Graph partition and labeling 2. Clustering with bottom-up edge probabilities 3. Moving in the partition space Reversible and detailed balance 4. Swendsen-Wang Cuts 5. Examples segmentation, stereo, and motion etc. ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005 Graph partition vertices possible values A graph G=<V, E> is partitioned into an unknown number of sub-graphs Each subgraph is often assigned a lable or color, thus the partition problem is augmented into a graph coloring/labeling problem. E.g. image segmentation (label), stereo (disparity), motion (velocity), …

Upload: others

Post on 24-May-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lect 6: Graph Partition by Swendsen-Wang Cuts

1

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Lect 6: Graph Partition by Swendsen-Wang Cuts

Topics

1. Graph partition and labeling2. Clustering with bottom-up edge probabilities3. Moving in the partition space

Reversible and detailed balance4. Swendsen-Wang Cuts5. Examples

segmentation, stereo, and motion etc.

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Graph partition

vertices

possible values

A graph G=<V, E> is partitioned into an unknown number of sub-graphs

Each subgraph is often assigned a lable or color, thus the partition problem is augmented into a graph coloring/labeling problem.

E.g. image segmentation (label), stereo (disparity), motion (velocity), …

Page 2: Lect 6: Graph Partition by Swendsen-Wang Cuts

2

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Traversing the partition spaceLet ΩL be the partition space of all possible L-way partitions of V

The partition space is denoted by

How do we design a Markov chain to traverse the partition space?This is a challenging question facing many tasks,

e.g. how can the split-merge operator be made reversible in image segmentation?

So what? You need to have algorithms that is capable of global optimality independent of initial solutions !!

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

An example of segmentation

input image

over-segmentation with atomic regionsadjacency graph

graph partition (labeling)image segmentation result

For speed, one can group adjacent pixels ofconstant intensity into super-pixels to reduce the graph. (This step has risk, more proper treatment should be using multi-level Swendsen-Wang cut, which can freeze and openthe atomic regions.)

Page 3: Lect 6: Graph Partition by Swendsen-Wang Cuts

3

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

An example of adjacency graph

Each node could be a pixel, atomic region (super-pixel), feature points,…

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Moves in the partition spaceA

C

B

splitmerge spl

itmerge

split + merge

split + merge

Page 4: Lect 6: Graph Partition by Swendsen-Wang Cuts

4

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

The key issues

A

C

B

1. How do we select a subset of nodes Vo to flip?2. How do we maintaining reversibility?3. How do we ensure detailed balance?

What is the probabilities (ratio) for selecting Vo at two reversible states?

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Swendsen-Wang revisited

SW (1987) uses data augmentation and selects Vo by Bernoulli bonds.

Each edge is augmented a bond variable ust ~ Bernoulli(ρ 1(xs=xt)), ρ=1-e-β.

Page 5: Lect 6: Graph Partition by Swendsen-Wang Cuts

5

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Limitations of SW

Although it works well in Ising/Potts models, SW has the following problems that need to be resolved for many vision applications.

1. It is limited to Ising / Potts models.

2. The number of labels L is fixed and known.

3. The forming of clusters is not informed by data, thus itslows down in the presence of an external field (data).

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

From SW to SW-cut

SW cuts (Barbu and Zhu, ICCV 03, CVPR04) extended SW in three aspects.

1. Generalize SW to arbitrary probabilities on graphs with variable L.It can also be made into a generalized Gibbs sampler which flips a CCP at each step

with simple weights on the conditional probabilities.

2. Using discriminative models (data-driven) for the edge probabilitiesThe edge probability approaches the marginal posterior probability for how likelytwo sites s and t belong to the same color (object surface)

3. Hierarchical coloring in a multi-resolution pyramid representation.

Page 6: Lect 6: Graph Partition by Swendsen-Wang Cuts

6

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Step 1. Computing discriminative edge probability

The edge probability is decided by local features.

Histogram Hi

Histogram Hj

is a marginal probability of π(X | I) 1. Konishi et al 01, Ren et al 042. Adaboost, Shapire 00

It approaches the marginal posterior as the number of features increase.

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Clusters (connected components)by flipping the edge probabilities

independently

T=1 T=2 T=4 T=8

Sample 1

Sample 2

Sample 3

Page 7: Lect 6: Graph Partition by Swendsen-Wang Cuts

7

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Step 2. Computing SW-Cuts

V0

V1

V2

x

xx

x

x

x

Definition: A Swendsen-Wang cut is the set of edges between a cluster (CCP) and other sites of the same color.

This is the set of dashed edges marked with crosses.They must be turned off for V0 being a CCP.

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

State A State B

Probability ratio for a pair of SW-cuts

Theorem. The probability ratio for selecting CCP V0 at states A and B is

V0

V1

V2

x

xx

x

x

x

x

V0

V1

V2

x

x

x

xx

xx

xx

x

(Barbu and Zhu, 2003)

Page 8: Lect 6: Graph Partition by Swendsen-Wang Cuts

8

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Outline of the proofWe compute the proposal probability ratio:

All configurations of edges that take state A to B must have all edges of the cut Cut(Vo,V1-Vo) turned off.

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Outline of the proof

Cancellation of the sums occurs because of the symmetry between states A and B:Any CP that takes state A to B is also a CP that takes state B to A

Any configuration of “on” edges in state A appears in state B and vice versa

Any configuration of “off” edges in state A appears in state B

State A State B

V0

V1

V2

x

xx

x

xx

x

x

xx

x

V0

V1

V2

x

xx

x

x

x

Page 9: Lect 6: Graph Partition by Swendsen-Wang Cuts

9

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

State A State B

Step 3. The Metropolis-Hasting Step

Theorem. The acceptance probability for flipping V0 is

results in an ergodic and reversible Markov Chain.

V0

V1

V2

x

xx

x

x

x

x

V0

V1

V2

x

x

x

xx

xx

xx

x

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Same conclusion when multiple paths exist

State A

State C

State B

A

CB

Page 10: Lect 6: Graph Partition by Swendsen-Wang Cuts

10

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

1. Initialize a graph partition 2. Repeat, for current state A= π

State A

The Swendsen-Wang Cuts algorithm

Swendsen-Wang Cuts: SWCInput: Go=<V, Eo>, discriminative probabilities qe, e ∈Eo,

and generative posterior probability p(W|I).Output: Samples X~p(X|I).

7. Select a connected component V0∈CP at random

9. Accept the move with probability α(A→B).

3. Repeat for each subgraph Gl=<Vl, El>, l=1,2,...,n in A4. For e ∈El turn e=“on” with probability qe.5. Partition Gl into nl connected components:

gli=<Vli, Eli>, i=1,...,nl6. Collect all the connected components in

CP=Vli: l=1,...,n, i=1,...,nl.V0

CP

V0

V1

V2

x

xx

x

x

x

The initial graph Go

8. Propose to reassign V0 to a subgraph Gl’, l' follows a probability q(l'|V0,A)

x

V0

V1

V2

x

x

x

xx

xx

xx

x

State B

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Acceptance probability can be made always 1

If we select the label probability as

Remark: zero rejection rate may not necessarily be an optimal design.

Page 11: Lect 6: Graph Partition by Swendsen-Wang Cuts

11

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Another generalized Gibbs sampler

We denote the probabilities on the SW-cuts Cut(V0, Vk) by weights

Flip the label of a CCP according to a condition probability weighted by the SW-weights

0 1 2 n

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

SW comes as a special case

Consider the reversible moves between states A and B by Metroplis-Hastings:the proposal probability ratio is:

the probability ratio of the two states is:

)|,(|)|,(|)|,(|

)|,(|2010

20

10

)1()1()1(

)()( VVCutVVCut

oVVCuto

VVCuto qqq

ABqBAq −−=

−−

=→→

)|),(|)|,((|)|,(|

)|,(|2010

10

20

expexpexp)( VVCutVVCut

VVCut

VVCut

ΒA −⋅

⋅−

⋅−

==)π(

π ββ

β

)|,(|)|,(| 21)1

())()(

)()(,1min()( VVCutVVCut

o

oo

qe

AB

BAqABqBA −

−=

ππ⋅

→→

=→β

α

If we choose β−−= eqo 1

Then the acceptance probability is always 1.

Page 12: Lect 6: Graph Partition by Swendsen-Wang Cuts

12

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Comparison with Gibbs sampler in CPU time

Convergence comparison of SWC-1 and the Gibbs sampler on the cheetah image, starting from a random state or from the state where all nodes have label 0. Right – zoom in view of the first 20 seconds.

0 2 4 6 8 10 12 14 16 18 203.2

3.3

3.4

3.5

3.6

3.7

3.8

3.9

4

4.1

4.2x 10

5

ener

gy

time(s)

Gibbs, uniform initialization

SWC-1, uniform initialization

Gibbs, random initialization

SWC-1, random initialization

0 200 400 600 800 1000 12003.2

3.3

3.4

3.5

3.6

3.7

3.8

3.9

4

4.1

4.2x 10

5

ener

gy

time(s)

Gibbs, uniform initialization

SWC-1

Gibbs, random initialization

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Convergence comparison: in seconds

7000 seconds zoom-in view of the first 200 seconds

Another example

Page 13: Lect 6: Graph Partition by Swendsen-Wang Cuts

13

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Comparison

0 20 40 60 80 100 120 140 160 180 2003.75

3.8

3.85

3.9

3.95

4

4.05x 10

5

time(s)

ener

gy

Generalized Gibbs samplerSWC-1

starting from a random state.

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Examples of segmentation

a. input image b. over-segmentationwith atomic regions

c. segmentation result

Page 14: Lect 6: Graph Partition by Swendsen-Wang Cuts

14

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Examples of segmentation

a. input image b. over-segmentationwith atomic regions

c. segmentation

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Examples on Stereo Reconstruction

left image

Ground truthLeft image Segmentation result

Page 15: Lect 6: Graph Partition by Swendsen-Wang Cuts

15

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Performance comparison with Graph Cuts and Belief propagation on a special (simplified) energy

0 200 400 600 800 1000 1200 1400 1600

5

5.5

6

6.5

7

7.5

8x 10

5

Sync. BP

Accel. BP

Graph Cuts

SW Cuts slow annealing

time(s)

ener

gy

SW Cuts fast annealing

Ground truth energy

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Hierarchical partition and segmentation

– Level 0: Pixels are grouped into atomic regionsrijk of relatively constant motion and intensity

– motion parameters (uijk,vijk) – intensity histogram hijk

– Level 1: Atomic regions are grouped into intensity regions Rij of coherent motionwith intensity models Hij

– Level 2: Intensity regions are grouped into moving objects Oi with motion parameters θi

X0

X1

X2

Page 16: Lect 6: Graph Partition by Swendsen-Wang Cuts

16

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Motion segmentation examples

Image Segmentation Motion SegmentationInput sequence

Image Segmentation Motion SegmentationInput sequence

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Motion segmentation examples

Image Segmentation Motion SegmentationInput sequence

Image Segmentation Motion SegmentationInput sequence

Page 17: Lect 6: Graph Partition by Swendsen-Wang Cuts

17

ICCV05 Tutorial: MCMC for Vision. Zhu / Dellaert / Tu October 2005

Summary

– Generally applicable – allows usage of complex models beyond the scope of the specialized algorithms

– Computationally efficient – performance comparable with the specialized algorithms

– Reversible and ergodic – theoretically guaranteed to eventually find the global optimum