Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza...

54
Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    221
  • download

    1

Transcript of Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza...

Page 1: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Normalized Cuts and Image Segmentation

Jianbo Shi and Jitendra Malik,

Presented by: Alireza Tavakkoli

Page 2: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Image Segmentation

Page 3: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Image segmentation

How do you pick the right segmentation?

•Bottom up segmentation: - Tokens belong together because they are locally coherent. •Top down segmentation: - Tokens grouped because they lie on the same object.

•Bottom up segmentation: - Tokens belong together because they are locally coherent. •Top down segmentation: - Tokens grouped because they lie on the same object.

Page 4: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

“Correct” segmentation

There may not be a single correct answer.

Partitioning is inherently hierarchical.One approach we will use in this

presentation: “Use the low-level coherence of brightness,

color, texture or motion attributes to come up with partitions”

Page 5: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1. Introduction

2. Graph terminology and representation.

3. “Min cuts” and “Normalized cuts”.

4. Other segmentation methods using eigenvectors.

5. Conclusions.

Page 6: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1.1. IntroductionIntroduction

2. Graph terminology and representation.

3. “Min cuts” and “Normalized cuts”.

4. Other segmentation methods using eigenvectors.

5. Conclusions.

Page 7: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph-based Image Segmentation

Image (I)

Graph Affinities(W)

IntensityColorEdgesTexture

Slide from Timothee Cour (http://www.seas.upenn.edu/~timothee)

Page 8: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph-based Image Segmentation

Image (I)

)(

1

)(

1),(),(

BvolAvolBAcutBANcut

Slide from Timothee Cour (http://www.seas.upenn.edu/~timothee)

Graph Affinities(W)

IntensityColorEdgesTexture

Page 9: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph-based Image Segmentation

Image (I)

)(

1

)(

1),(),(

BvolAvolBAcutBANcut

Eigenvector X(W)

Aiif

AiifiX

DXXWD

A 0

1)(

)(

Slide from Timothee Cour (http://www.seas.upenn.edu/~timothee)

Graph Affinities(W)

IntensityColorEdgesTexture

Page 10: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph-based Image Segmentation

Image (I)

)(

1

)(

1),(),(

BvolAvolBAcutBANcut

Eigenvector X(W)

Discretization

Slide from Timothee Cour (http://www.seas.upenn.edu/~timothee)

Aiif

AiifiX

DXXWD

A 0

1)(

)(

Graph Affinities(W)

IntensityColorEdgesTexture

Page 11: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1. Introduction

2.2. Graph terminology and representation.Graph terminology and representation.

3. “Min cuts” and “Normalized cuts”.

4. Other segmentation methods using eigenvectors.

5. Conclusions.

Page 12: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph-based Image Segmentation

V: graph nodesE: edges connection nodes

G = {V,E}

PixelsPixel similarity

Slides from Jianbo Shi

Page 13: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph terminology

Similarity matrix:

Slides from Jianbo Shi

2

2

2)()(

,X

ji XX

ji ew

jiwW ,

Page 14: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Affinity matrix

Similarity of image pixels to selected pixelBrighter means more similar

Reshape

N*M pixels

N*M pixels

M pixels

N pixels

WarningWarningthe size of W is quadratic

with the numberof parameters!

WarningWarningthe size of W is quadratic

with the numberof parameters!

Page 15: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph terminology

Degree of node:

Slides from Jianbo Shi

j

jii wd ,

……

Page 16: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph terminology

Volume of set:

Slides from Jianbo Shi

Ai

i VAdAvol ,)(

Page 17: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph terminology

AjAi

jiwAAcut,

,),(

Slides from Jianbo Shi

Cuts in a graph:

Page 18: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Representation

Partition matrix Partition matrix XX::

Pair-wise similarity matrix Pair-wise similarity matrix WW::

Degree matrix Degree matrix DD::

Laplacian matrix Laplacian matrix LL::

KXXX ,...,1

j jiwiiD ,),(

WDL

segments

pix

els

),(),( jiaffjiW

Page 19: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Pixel similarity functions

Intensity

Texture

Distance

2

2

2)()(

),( I

ji II

ejiW

2

2

2)()(

),( X

ji XX

ejiW

2

2

2)()(

),( c

ji cc

ejiW

Page 20: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Pixel similarity functions

Intensity

Texture

Distance

2

2

2)()(

),( I

ji II

ejiW

2

2

2)()(

),( X

ji XX

ejiW

2

2

2)()(

),( c

ji cc

ejiW

here c(x) is a vector of filter outputs. A natural thing to do is to square the outputs

of a range of different filters at different scales and orientations,

smooth the result, and rack these into a vector.

Page 21: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Definitions

Methods that use the spectrum of the affinity matrix to cluster are known as spectral clusteringspectral clustering.

Normalized cuts, Average cuts, Average association make use of the eigenvectors of the affinity matrix.

Why these methods work?

Page 22: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Spectral Clustering

Data Similarities

* Slides from Dan Klein, Sep Kamvar, Chris Manning, Natural Language Group Stanford University

Page 23: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Eigenvectors and blocks

Block matrices have block eigenvectors:

Near-block matrices have near-block eigenvectors:

1 1 0 0

1 1 0 0

0 0 1 1

0 0 1 1

eigensolver

.71

.71

0

0

0

0

.71

.71

1= 2 2= 2 3= 0

4= 0

1 1 .2 0

1 1 0 -.2

.2 0 1 1

0 -.2 1 1

eigensolver

.71

.69

.14

0

0

-.14

.69

.71

1= 2.02 2= 2.02 3= -0.02

4= -0.02

* Slides from Dan Klein, Sep Kamvar, Chris Manning, Natural Language Group Stanford University

Page 24: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Spectral Space

Can put items into blocks by eigenvectors:

Clusters clear regardless of row ordering:

1 1 .2 0

1 1 0 -.2

.2 0 1 1

0 -.2 1 1

.71

.69

.14

0

0

-.14

.69

.71

e1

e2

e1 e2

1 .2 1 0

.2 1 0 1

1 0 1 -.2

0 1 -.2 1

.71

.14

.69

0

0

.69

-.14

.71

e1

e2

e1 e2

* Slides from Dan Klein, Sep Kamvar, Chris Manning, Natural Language Group Stanford University

Page 25: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1. Introduction

2. Graph terminology and representation.

3.3. ““Min cuts” and “Normalized cuts”.Min cuts” and “Normalized cuts”.

4. Other segmentation methods using eigenvectors.

5. Conclusions.

Page 26: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

How do we extract a good cluster?

Simplest ideaSimplest idea: we want a vector xx giving the association between each element and a cluster

We want elements within this cluster to, on the whole, have strong affinity with one anotherstrong affinity with one another

We could maximizemaximize But need the constraintconstraint This is an eigenvalue problemeigenvalue problem - choose the

eigenvector of W with largest eigenvalue.

WxxT

1xxT

Page 27: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Criterion for partition:

Minimum cut

BvAu

BAvuwBAcut

,,

),(min),(min

First proposed by Wu and Leahy

A

B

Ideal Cut

Cuts with lesser weightthan the ideal cut

Problem! Problem! Weight of cut is directly proportional to the number of edges in the cut.

Problem! Problem! Weight of cut is directly proportional to the number of edges in the cut.

Page 28: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Normalized Cut

)(

1

)(

1),(),(

BvolAvolBAcutBANcut

Normalized cut or balanced cut:

Finds better cut

Page 29: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Normalized Cut

Volume of set (or association):

VtAutuwVAassocAvol

,),(),()(

A

B

Page 30: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Normalized Cut

Volume of set (or association):

Define normalized cut: “a fraction of the total edge connections to all the nodes in the graph”:

),(

),(

),(

),(),(

VBassoc

BAcut

VAassoc

BAcutBANcut

VtAutuwVAassocAvol

,),(),()(

),(

),(

),(

),(),(

VBassoc

BBassoc

VAassoc

AAassocBANassoc

A

B

A

B

Define normalized association: “how tightly on average nodes within the cluster are connected to each other”

A

B

Page 31: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

01 DyTSubject to:

Observations(I)

Maximizing Nassoc is the same as minimizing Ncut, since they are related:

How to minimize Ncut? Transform Ncut equation to a matricial form. After simplifying:

),(2),( BANassocBANcut

Dyy

yWDyxNcut

T

T

yx

)(min)(min

Rayleigh quotient

j

jiWiiD ),(),( j

jiWiiD ),(),(

NP-Hard!NP-Hard!yy’s values are ’s values are

quantizedquantized

Page 32: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Instead, relax into the continuous domain by solving generalized eigenvalue system:

Which gives: Note that so, the first eigenvector is

y0=1 with eigenvalue 0.

The second smallest eigenvector is the real valued solution to this problem!!

Observations(II)

DyyWD )(

01)( WD

maxy yT D W y subject to yT Dy 1 min

Page 33: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Algorithm

1. Define a similarity function between 2 nodes. i.e.:

2. Compute affinity matrix (W) and degree matrix (D).3. Solve4. Use the eigenvector with the second smallest

eigenvalue to bipartition the graph.5. Decide if re-partition current partitions.

Note: since precision requirements are low, W is very sparse and only few eigenvectors are required, the eigenvectors can be extracted very fast using Lanczos algorithm.

DyyWD )(

2

2

2)()(

2

2

2)()(

,X

ji

I

ji XXFF

ji ew

Page 34: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Discretization

Sometimes there is not a clear threshold to binarize since eigenvectors take on continuous values.

How to choose the splitting point? a) Pick a constant value (0, or 0.5).

b) Pick the median value as splitting point.

c) Look for the splitting point that has the minimum Ncut value:1. Choose n possible splitting points.

2. Compute Ncut value.

3. Pick minimum.

Page 35: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Use k-eigenvectors

Recursive 2-way NcutNcut is slow. We can use more eigenvectors to re-partition the graph, however:

Not all eigenvectors are useful for partition (degree of smoothnessdegree of smoothness). Procedure: compute k-means k-means with a high kk. Then follow one of these

procedures:a) Merge segments that minimize kk-way NcutNcut criterion.

b) Use the k segments and find the partitions there using exhaustive search.

Compute Q (next slides).

1 1 .2 0

1 1 0 -.2

.2 0 1 1

0 -.2 1 1

.71

.69

.14

0

0

-.14

.69

.71

e1

e2

e1 e2

Page 36: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Example

EigenvectorsEigenvectors

SegmentsSegments

Page 37: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Experiments

Define similarity: for point sets. for brightness images. for HSV

images. in case of

texture.

2

2

2)()(

2

2

2)()(

,X

ji

I

ji XXFF

ji ew

1iF

iIiF

)]cos(..),sin(..,[ hsvhsvviF |]*|,|,*[| 1 nfIfIiF

Page 38: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Experiments (I)

Point set segmentation:

(a) Pointset generated by Poisson process. (b) Segmentation results.

Page 39: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Experiments (II)

Synthetic images:

Page 40: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Experiments (III)

Weather radar:

Page 41: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Experiments (IV)

Motion segmentation

Page 42: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1. Introduction

2. Graph terminology and representation.

3.3. ““Min cuts” and “Normalized cuts”.Min cuts” and “Normalized cuts”.

4.4. Other segmentation methods using Other segmentation methods using eigenvectors.eigenvectors.

5. Conclusions.

Page 43: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

Average associationUse the eigenvector of W associated to the

biggest eigenvalue for partitioning.Tries to maximize:

Has a bias to find tight clusters. Useful for Gaussian distributions.

B

BBassoc

A

AAassoc ),(),(

A

B

Page 44: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

Average cutTries to minimize:

Very similar to normalized cuts.We cannot ensure that partitions will have a

a tight within-group similarity since this equation does not have the nice properties of the equation of normalized cuts.

B

BAcut

A

BAcut ),(),(

Page 45: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

Page 46: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

20 points are randomly distributed from 0.0 to 0.512 points are randomly distributed from 0.65 to 1.0

Normalized cutNormalized cut

Average cutAverage cut

Average associationAverage association

Page 47: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

20 points are randomly distributed from 0.0 to 0.512 points are randomly distributed from 0.65 to 1.0

Normalized cutNormalized cut

Average cutAverage cut

Average associationAverage association

Page 48: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Other methods

20 points are randomly distributed from 0.0 to 0.512 points are randomly distributed from 0.65 to 1.0

Normalized cutNormalized cut

Average cutAverage cut

Average associationAverage association

Page 49: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Outline

1. Introduction

2. Graph terminology and representation.

3. “Min cuts” and “Normalized cuts”.

4. Other segmentation methods using eigenvectors.

5.5. Conclusions.Conclusions.

Page 50: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Conclusions

Good news: Simple and powerful methods to segment images. Flexible and easy to apply to other clustering

problems.

Bad news: High memory requirements (use sparse matrices). Very dependant on the scale factor for a specific

problem.2

2

2)()(

),( X

ji XX

ejiW

Page 51: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Thank you!Thank you!

The End!

Page 52: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Examples

2

2

2)()(

,X

ji XX

ji ew

Spectral Clutering

Images from Matthew Brand (TR-2002-42)

Page 53: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Spectral clustering

Makes use of the spectrum of the similarity matrix of the data to cluster the points.

Solve clustering for

affinity matrix

Solve clustering for

affinity matrix

w(i,j) distance node i to node j

Page 54: Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.

Graph terminology

Similarity matrix: Degree of node: j

jii wd , jiwW ,

Volume of set: Graph cuts: