Region Segmentation Readings: Chapter 10: 10.1 Additional Materials Provided
Region Segmentation Readings: Chapter 10: 10.1 Additional Materials Provided
1
Image Segmentation
Image segmentation is the operation of partitioning an
image into a collection of connected sets of pixels.
3
Main Methods of Region
Segmentation
1. Region Growing
3. Clustering
4
Clustering
7
K-Means Example 2
8
K-Means Example 3
9
K-means Variants
• Different ways to initialize the means
• Different stopping criteria
• Dynamic methods for determining the right
number of clusters (K) for a given image
10
K-Means
• Boot Step:
– Initialize K clusters: C1, …, CK
Each cluster is represented by its mean mj
• Iteration Step:
– Estimate the cluster for each data point
xi C(xi)
– Re-estimate the cluster parameters
11
K-Means Example
12
K-Means Example
13
K-means vs. EM
K-means EM
15
N(, ) is a multivariate Gaussian distribution with
mean and covariance matrix .
R G B
R R2 RG RB variance(X): X2 = (xi - )2 (1/N)N)
G GR G2 GB
B BR BG B2
cov(X,Y) = (xi - x)(yi - y) (1/N)N)
16
1. Suppose we have a set of clusters: C1, C2, ... , CK
over a set of data points X = {x1, x2, ... , xN}.
17
EM: Expectation-Maximization
• Boot Step:
– Initialize K clusters: C1, …, CK
(j, j) and and and P(Cj) for and each and cluster and j.
• Iteration Step:
– Estimate the cluster of each data point
p(C j | xi ) Expectation
– Re-estimate the cluster parameters
( j , j ), p (C j ) Maximization
For and each and cluster and j
18
1-D EM with Gaussian Distributions
• Each cluster Cj is represented by a
Gaussian distribution N(j , j).
• Initialization: For each cluster Cj initialize
its mean j , variance j2, and weight j.
19
Expectation
• For each point xi and each cluster Cj
compute P(Cj | xi).
21
Maximization
• Having computed p(C | x ) x
j i i
i
j
P(Cj | xi) for each p(C | x ) j i
22
Multi-Dimensional Expectation Step
for Color Image Segmentation
Input (Known) Input (Estimation) Output
p( xi | C j ) p(C j ) p( xi | C j ) p(C j )
p(C j | xi )
p( xi ) p( x | C ) p(C )
i j j
j
23
Multi-dimensional Maximization Step
for Color Image Segmentation
Input (Known) Input (Estimation) Output
24
Full EM Algorithm
Multi-Dimensional
• Boot Step:
– Initialize K clusters: C1, …, CK
(j, j) and and and P(Cj) for and each and cluster and j.
• Iteration Step:
– Expectation Step
p ( xi | C j ) p(C j ) p( xi | C j ) p(C j )
p(C j | xi )
p ( xi ) p( xi | C j ) p(C j )
j
– Maximization Step
p(C | x ) x
j i i p (C j | xi ) ( xi j ) ( xi j )T p(C j | xi )
i i i
j j p (C j )
p(C | x ) j i p(C j | xi ) N
i i 25
Visualizing EM Clusters
mean
26
EM Demo
• Demo
http:/N)/N)www.neurosci.aist.go.jp/N)~akaho/N)MixtureEM.html
• Example
http:/N)/N)www-2.cs.cmu.edu/N)~awm/N)tutorials/N)gmm13.pdf
27
EM Applications
• Blobworld: and Image and segmentation and using and
Expectation-Maximization and and and its and application and
to and image and querying
28
Blobworld: Sample Results
29
Jianbo Shi’s Graph-Partitioning
• An image is represented by a graph whose nodes
are pixels or small groups of pixels.
30
Minimal Cuts
31
Cut(A,B)
cut(A,B) = w(u,v)
uA, vB
B
A
w1
w2
32
Normalized Cut
Minimal cut favors cutting off small node groups,
so Shi proposed the normalized cut.
cut(A, B) cut(A,B)
normalized
Ncut(A,B) = ------------- + -------------
cut
asso(A,V) asso(B,V)
33
Example Normalized Cut
A B
2 2 2
2
2 2 2 2
1 4 3 1 2
2 2 3
3 3
Ncut(A,B) = ------- + ------
21 16
34
Shi turned graph cuts into an
eigenvector/N)eigenvalue problem.
• Set up a weighted graph G=(V,E)
– V is the set of (N) pixels
36
How Shi used the procedure
38
Problems with Graph Cuts
• Need to know when to stop
• Very Slooooow
Problems with EM
• Local minima
• Need to know number of segments
• Need to choose generative model
39
Mean-Shift Clustering
• Simple, like K-means
• But you don’t have to select K
• Statistical method
• Guaranteed to converge to a fixed number
of clusters.
40
Finding Modes in a Histogram
42
Numeric Example
Must Use Normalized Histogram!
window W centered at 12
mean shift
x 10 11 12 13 14
H(x) 5 4 3 2 1
N(x) 5/N)15 4/N)15 3/N)15 2/N)15 1/N)15
x N(x) = 10(5/N)15)+11(4/N)15)+12(3/N)15)+13(2/N)15)+14(1/N)15)
= 11.33
43
Mean Shift Approach
– Initialize a window around each point
– See where it shifts—this determines which segment
it’s in
– Multiple points will shift to the same segment
44
Segmentation Algorithm
45
Mean-shift for image segmentation
• Useful to take into account spatial information
– instead of (R, G, B), run in (R, G, B, x, y) space
46
References
– Shi and Malik, “Normalized Cuts and Image
Segmentation,” Proc. CVPR 1997.
47