37
Computer Vision - A Modern Approach Set: Segmentation Slides by D.A. Forsyth Basic ideas of grouping in humans: The Gestalt school Gestalt properties elements in a collection of elements can have properties that result from relationships Gestaltqualitat Wertheimer Wertheimer Koehler Koehler Koffka Koffka A series of factors affect whether elements should be grouped together • Gestalt factors

Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Basic ideas of grouping in humans: The Gestalt school

Gestalt propertieselements in a collection of elements can have properties that result from relationships

• Gestaltqualitat

WertheimerWertheimer

KoehlerKoehler

KoffkaKoffka

A series of factors affect whether elements should be grouped together

• Gestalt factors

Page 2: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 3: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 4: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Segmentation as clustering

• Cluster together (pixels, tokens, etc.) that belong together

• Agglomerative clustering– attach closest to cluster it is

closest to– repeat

• Divisive clustering– split cluster along best

boundary– repeat

• Point-Cluster distance– single-link clustering– complete-link clustering– group-average clustering

• Dendrograms– yield a picture of output as

clustering process continues

Page 5: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Clustering

Page 6: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 7: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

K-Means

• Choose a fixed number of clusters

• Choose cluster centers and point-cluster allocations to minimize error

• can’t do this by search, because there are too many possible allocations.

• Algorithm– fix cluster centers; allocate

points to closest cluster– fix allocation; compute best

cluster centers• x could be any set of features

for which we can compute a distance (careful about scaling)

x j − µ i2

j∈elements of i'th cluster∑

i∈clusters

Page 8: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

K-Means Algorithm

1. Choose k data points to act as cluster centers2. Repeat3. Allocate each data point to cluster whose center is nearest4. Replace the cluster centers with the centroid of the elements in their clusters5. Until the cluster centers are unchanged

NOTE: In step 2), ensure that every cluster has at least one data point. Possible techniques for doing this include supplying empty clusters with a point chosen at random from points far from their cluster centers.

Page 9: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Image Clusters on intensity Clusters on color

K-means clustering using intensity alone and color alone

Page 10: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Graph-theoretic (pairwise) clustering

• Represent tokens using a weighted graph.– affinity matrix

• Cut up this graph to get subgraphs with strong interior links

Page 11: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 12: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 13: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Measuring AffinityIntensity

aff x, y( )= exp − 12σ i

2

I x( )− I y( ) 2( )

Distance

aff x, y( )= exp − 12σ d

2

x − y 2( )

Texture

aff x, y( )= exp − 12σ t

2

c x( )− c y( ) 2( )

Page 14: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Scale affects affinity

Page 15: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Eigenvector-based clustering

• This is an eigenvalue problem -choose the eigenvector of A with largest eigenvalue

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

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

• We could maximize

• But need the constraint aTAa

aTa = 1

Page 16: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Example eigenvector

points

eigenvector

matrix

Page 17: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

More than two segments

• Two options– Recursively split each side to get a tree, continuing till the

eigenvalues are too small– Use the other eigenvectors

Page 18: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Clustering by eigenvectors: Algorithm

1. Construct (or take as input) the affinity matrix A2. Compute the eigenvalues and eigenvectors of A3. Repeat4. Take the eigenvector corresponding to the largest unprocessed eigenvalue5. Zero all components corresponding to elements that have already been clustered6. Threshold the remaining components to determine which elements belong to

this cluster7. If all elements have been accounted for, there are sufficient clusters8. Until there are sufficient clusters

Page 19: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Clustering as graph partitioning

Page 20: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Normalized Cut

Page 21: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Cut vs Association

Page 22: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Normalized cuts

• Current criterion evaluates within cluster similarity, but not across cluster difference

• Instead, we’d like to maximize the within cluster similarity compared to the across cluster difference

• Write graph as V, one cluster as A and the other as B

• Maximize

• i.e. construct A, B such that their within cluster similarity is high compared to their association with the rest of the graph

assoc(A,A)assoc(A,V )

+

assoc(B,B)assoc(B,V )

Page 23: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 24: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 25: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 26: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 27: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 28: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Normalized cuts algorithm

D −W( )y = λDy

Page 29: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 30: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 31: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 32: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 33: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 34: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 35: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Page 36: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

Figure from “Image and video segmentation: the normalised cut framework”, by Shi and Malik, copyright IEEE, 1998

Page 37: Basic ideas of grouping in humans: The Gestalt schoolpelillo/Didattica/Old Stuff/VisioneArtificiale/Slide... · Basic ideas of grouping in humans: The Gestalt school Gestalt properties

Computer Vision - A Modern ApproachSet: Segmentation

Slides by D.A. Forsyth

F igure from “Normalized cuts and image segmentation,” Shi and Malik, copyright IEEE, 2000