cs 558 c omputer v ision lecture vi: segmentation and grouping slides adapted from s. lazebnik

64
CS 558 COMPUTER VISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebn

Upload: thomasine-holmes

Post on 30-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

CS 558 COMPUTER VISIONLecture VI: Segmentation and Grouping

Slides adapted from S. Lazebnik

Page 2: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 3: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 4: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

THE GOALS OF SEGMENTATION

• Group together similar-looking pixels for efficiency of further processing “Bottom-up” process Unsupervised

X. Ren and J. Malik. Learning a classification model for segmentation. ICCV 2003.

“superpixels”

Page 5: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

THE GOALS OF SEGMENTATION

• Separate image into coherent “objects” “Bottom-up” or “top-down” process? Supervised or unsupervised?

Berkeley segmentation database:http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/segbench/

image human segmentation

Page 6: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 7: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

INSPIRATION FROM PSYCHOLOGY• The Gestalt school: Grouping is key to visual

perception

The Muller-Lyer illusion

http://en.wikipedia.org/wiki/Gestalt_psychology

Page 8: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

THE GESTALT SCHOOL• Elements in a collection can have properties

that result from relationships “The whole is greater than the sum of its parts”

subjective contours occlusion

familiar configuration

http://en.wikipedia.org/wiki/Gestalt_psychology

Page 9: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

EMERGENCE

http://en.wikipedia.org/wiki/Gestalt_psychology

Page 10: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

A TEST

How do you describe this image?

Page 11: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

A TEST

How do you describe this image?

Page 12: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

GESTALT FACTORS

Page 13: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

GROUPING PHENOMENA IN REAL LIFE

Forsyth & Ponce, Figure 14.7

Page 14: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

GROUPING PHENOMENA IN REAL LIFE

Forsyth & Ponce, Figure 14.7

Page 15: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

GESTALT FACTORS

• These factors make intuitive sense, but are very difficult to translate into algorithms!

Page 16: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 17: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

SEGMENTATION AS CLUSTERING

Source: K. Grauman

Page 18: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Image Intensity-based clusters Color-based clusters

SEGMENTATION AS CLUSTERING• K-means clustering based on intensity or

color is essentially vector quantization of the image attributes Clusters don’t have to be spatially coherent

Page 19: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

SEGMENTATION AS CLUSTERING

Source: K. Grauman

Page 20: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

SEGMENTATION AS CLUSTERING• Clustering based on (r,g,b,x,y) values enforces

more spatial coherence

Page 21: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

K-MEANS FOR SEGMENTATION

• Pros Very simple method Converges to a local minimum of the error

function• Cons

Memory-intensive Need to pick K Sensitive to initialization Sensitive to outliers Only finds “spherical”

clusters

Page 22: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html

MEAN SHIFT CLUSTERING AND SEGMENTATION

• An advanced and versatile technique for clustering-based segmentation

D. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature Space Analysis, PAMI 2002.

Page 23: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MEAN SHIFT ALGORITHM

• The mean shift algorithm seeks modes or local maxima of density in the feature space

imageFeature space

(L*u*v* color values)

Page 24: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 25: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 26: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 27: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 28: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 29: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Mean Shiftvector

Slide by Y. Ukrainitz & B. Sarel

Page 30: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

Searchwindow

Center ofmass

Slide by Y. Ukrainitz & B. Sarel

Page 31: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MEAN SHIFT CLUSTERING

• Cluster: all data points in the attraction basin of a mode

• Attraction basin: the region for which all trajectories lead to the same mode

Slide by Y. Ukrainitz & B. Sarel

Page 32: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

• Find features (color, gradients, texture, etc)• Initialize windows at individual feature points• Perform mean shift for each window until

convergence• Merge windows that end up near the same “peak”

or mode

MEAN SHIFT CLUSTERING/SEGMENTATION

Page 33: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html

MEAN SHIFT SEGMENTATION RESULTS

Page 34: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MORE RESULTS

Page 35: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MORE RESULTS

Page 36: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MEAN SHIFT PROS AND CONS

• Pros Does not assume spherical clusters Just a single parameter (window size) Finds variable number of modes Robust to outliers

• Cons Output depends on window size Computationally expensive Does not scale well with dimensions of feature

spaces

Page 37: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 38: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

IMAGES AS GRAPHS

• Node for every pixel• Edge between every pair of pixels (or every pair

of “sufficiently close” pixels)• Each edge is weighted by the affinity or similarity

of the two nodes

wij

i

j

Source: S. Seitz

Page 39: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

SEGMENTATION BY GRAPH PARTITIONING

• Break Graph into Segments Delete links that cross between segments Easiest to break links that have low affinity

similar pixels should be in the same segments dissimilar pixels should be in different segments

A B C

Source: S. Seitz

wij

i

j

Page 40: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MEASURING AFFINITY

• Suppose we represent each pixel by a feature vector x, and define a distance function appropriate for this feature representation

• Then we can convert the distance between two feature vectors into an affinity with the help of a generalized Gaussian kernel:

2

2),(dist

2

1exp ji xx

Page 41: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

SCALE AFFECTS AFFINITY

• Small σ: group only nearby points• Large σ: group far-away points

Page 42: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

GRAPH CUT

• Set of edges whose removal makes a graph disconnected

• Cost of a cut: sum of weights of cut edges• A graph cut gives us a segmentation

What is a “good” graph cut and how do we find one?

A B

Source: S. Seitz

Page 43: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MINIMUM CUT

• We can do segmentation by finding the minimum cut in a graph Efficient algorithms exist for doing this

Minimum cut example

Page 44: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

MINIMUM CUT

• We can do segmentation by finding the minimum cut in a graph Efficient algorithms exist for doing this

Minimum cut example

Page 45: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

NORMALIZED CUT

• Drawback: minimum cut tends to cut off very small, isolated components

Ideal Cut

Cuts with lesser weightthan the ideal cut

* Slide from Khurram Hassan-Shafique CAP5415 Computer Vision 2003

Page 46: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

• Drawback: minimum cut tends to cut off very small, isolated components

• This can be fixed by normalizing the cut by the weight of all the edges incident to the segment

• The normalized cut cost is:

NORMALIZED CUT

),(

),(

),(

),(

VBw

BAw

VAw

BAw

w(A, B) = sum of weights of all edges between A and B

J. Shi and J. Malik. Normalized cuts and image segmentation. PAMI 2000

Page 47: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

NORMALIZED CUT

• Let W be the adjacency matrix of the graph• Let D be the diagonal matrix with diagonal

entries D(i, i) = Σj W(i, j) • Then the normalized cut cost can be written as

• where y is an indicator vector whose value should be 1 in the ith position if the ith feature point belongs to A and a negative constant otherwise

J. Shi and J. Malik. Normalized cuts and image segmentation. PAMI 2000

Dyy

yWDyT

T )(

Page 48: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

• Finding the exact minimum of the normalized cut cost is NP-complete, but if we relax y to take on arbitrary values, then we can minimize the relaxed cost by solving the generalized eigenvalue problem (D − W)y = λDy .

• The solution y is given by the generalized eigenvector corresponding to the second smallest eigenvalue (the first smallest eigenvalue is 0, and the first eigenvector is all constant and hence useless to partitioning).

• Intutitively, the ith entry of y can be viewed as a “soft” indication of the component membership of the ith pointCan use 0 or median value of all entries as the

splitting point (threshold), or find the threshold that minimizes the Ncut cost.

NORMALIZED CUT

Page 49: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

NORMALIZED CUT ALGORITHM

1. Represent the input image as a weighted graph G = (V,E), compute the weight of each edge, and summarize the information in D and W .

2. Solve (D − W)y = λDy for the eigenvector with the second smallest eigenvalue.

3. Use the entries of this eigenvector to bipartition the graph.

To find more than two clusters:• recursively bipartition the graph;• run K-means clustering on the values of

multiple (e.g., K) eigenvectors.

Page 50: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

EXAMPLE RESULT

Page 51: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

CHALLENGE

• How to segment images that are a “mosaic of textures”?

Page 52: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

USING TEXTURE FEATURES FOR SEGMENTATION

• Convolve images with a bank of filters

J. Malik, S. Belongie, T. Leung and J. Shi. "Contour and Texture Analysis for Image Segmentation". IJCV 43(1),7-27,2001.

Page 53: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

USING TEXTURE FEATURES FOR SEGMENTATION• Convolve the image with a bank of filters• Find textons by clustering vectors of filter-bank

outputs

J. Malik, S. Belongie, T. Leung and J. Shi. "Contour and Texture Analysis for Image Segmentation". IJCV 43(1),7-27,2001.

Texton mapImage

Page 54: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

USING TEXTURE FEATURES FOR SEGMENTATION• Convolve the image with a bank of filters• Find textons by clustering vectors of filter-bank

outputs• The final texture feature is a texton histogram

computed over image windows at some “local scale”

J. Malik, S. Belongie, T. Leung and J. Shi. "Contour and Texture Analysis for Image Segmentation". IJCV 43(1),7-27,2001.

Page 55: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

PITFALL OF TEXTURE FEATURES

• Possible solution: check for “intervening contours” when computing connection weights

J. Malik, S. Belongie, T. Leung and J. Shi. "Contour and Texture Analysis for Image Segmentation". IJCV 43(1),7-27,2001.

Page 56: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

EXAMPLE RESULTS

Page 57: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

RESULTS: BERKELEY SEGMENTATION ENGINE

http://www.cs.berkeley.edu/~fowlkes/BSE/

Page 58: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

• Pros Generic framework, can be used with many

different features and affinity formulations• Cons

High storage requirement and time complexity Bias towards partitioning into equal segments

NORMALIZED CUTS: PRO AND CON

Page 59: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

OUTLINE

Goals of segmentation Why should we care about segmentation? Segmentation as clustering Segmentation as graph partitioning Active contour, level-set and others

Page 60: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

ACTIVE CONTOUR AND LEVEL SET

Active contour method A level-set function

Page 61: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

AUTOMATIC OBJECT OF INTEREST EXTRACTION

Gang Hua, Zicheng Liu, Zhengyou Zhang and Ying Wu, "Iterative local-global energy mini-mization for automatic extraction of object of interest", IEEE Trans. on Pattern Recognition and Machine Intelligence (PAMI), Vol.28, No.10, pp.1701-1706, October, 2006.

Page 62: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

A BUSINESS CARD SCANNING SYSTEM Automatic object of interests (OOI) extraction

It is a general formulation for OOI extraction Business card scanning (Live demo)

Input

Segmentation CurveSimplification

Quadranglefitting

Rectanglerectification

Imageenhancement

Output 2 Output 1

Gang Hua, Zicheng Liu, Zhengyou Zhang and Ying Wu, "Automatic Business Card Scanning with a Camera", in Proc. IEEE conf. on Image Processing (ICIP'2006), pp.373-376, Atlanta, GA, Octobor, 2006.

Page 63: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

TOP-DOWN SEGMENTATION

E. Borenstein and S. Ullman, “Class-specific, top-down segmentation,” ECCV 2002

A. Levin and Y. Weiss, “Learning to Combine Bottom-Up and Top-Down Segmentation,” ECCV 2006.

Page 64: CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik

TOP-DOWN SEGMENTATION

E. Borenstein and S. Ullman, “Class-specific, top-down segmentation,” ECCV 2002

A. Levin and Y. Weiss, “Learning to Combine Bottom-Up and Top-Down Segmentation,” ECCV 2006.

Normalized cuts

Top-down segmentation