Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Computer Vision – Lecture 7 Segmentation and Grouping 19.11.2009 Bastian Leibe RWTH.

Slides:



Advertisements
Similar presentations
CSE 473/573 Computer Vision and Image Processing (CVIP)
Advertisements

Human-Computer Interaction Human-Computer Interaction Segmentation Hanyang University Jong-Il Park.
Grouping and Segmentation Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/01/10.
Lecture 6 Image Segmentation
Image segmentation. The goals of segmentation Group together similar-looking pixels for efficiency of further processing “Bottom-up” process Unsupervised.
Algorithms & Applications in Computer Vision Lihi Zelnik-Manor Lecture 11: Structure from Motion.
Segmentation. Terminology Segmentation, grouping, perceptual organization: gathering features that belong together Fitting: associating a model with observed.
Normalized Cuts and Image Segmentation Jianbo Shi and Jitendra Malik, Presented by: Alireza Tavakkoli.
Region Segmentation. Find sets of pixels, such that All pixels in region i satisfy some constraint of similarity.
Segmentation CSE P 576 Larry Zitnick Many slides courtesy of Steve Seitz.
Announcements Project 2 more signup slots questions Picture taking at end of class.
Today: Image Segmentation Image Segmentation Techniques Snakes Scissors Graph Cuts Mean Shift Wednesday (2/28) Texture analysis and synthesis Multiple.
From Pixels to “Blobs” : Rendering and Image Processing Alexei Efros.
Prénom Nom Document Analysis: Data Analysis and Clustering Prof. Rolf Ingold, University of Fribourg Master course, spring semester 2008.
Segmentation Graph-Theoretic Clustering.
Image Segmentation Today’s Readings Forsyth & Ponce, Chapter 14
Perceptual Organization: Segmentation and Optical Flow.
Segmentation and Clustering Today’s Readings Forsyth & Ponce, Chapter 7 (plus lots of optional references in the slides) From Sandlot ScienceSandlot Science.
Announcements vote for Project 3 artifacts Project 4 (due next Wed night) Questions? Late day policy: everything must be turned in by next Friday.
Announcements Project 3 questions Photos after class.
Computer Vision - A Modern Approach Set: Segmentation Slides by D.A. Forsyth Segmentation and Grouping Motivation: not information is evidence Obtain a.
Graph-based Segmentation
~5,617,000 population in each state
Image Segmentation Image segmentation is the operation of partitioning an image into a collection of connected sets of pixels. 1. into regions, which usually.
Image Segmentation Rob Atlas Nick Bridle Evan Radkoff.
Segmentation and Grouping Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/23/10.
Computer Vision James Hays, Brown
Segmentation Techniques Luis E. Tirado PhD qualifying exam presentation Northeastern University.
Mean-shift and its application for object tracking
Segmentation using eigenvectors Papers: “Normalized Cuts and Image Segmentation”. Jianbo Shi and Jitendra Malik, IEEE, 2000 “Segmentation using eigenvectors:
Region Segmentation Readings: Chapter 10: 10.1 Additional Materials Provided K-means Clustering (text) EM Clustering (paper) Graph Partitioning (text)
Perceptual and Sensory Augmented Computing Computer Vision WS 11/12 Computer Vision – Lecture 7 Graph-Theoretic Segmentation Bastian Leibe RWTH.
Segmentation Course web page: vision.cis.udel.edu/~cv May 7, 2003  Lecture 31.
CS 558 C OMPUTER V ISION Lecture VI: Segmentation and Grouping Slides adapted from S. Lazebnik.
Chapter 14: SEGMENTATION BY CLUSTERING 1. 2 Outline Introduction Human Vision & Gestalt Properties Applications – Background Subtraction – Shot Boundary.
CSE 185 Introduction to Computer Vision Pattern Recognition 2.
EECS 274 Computer Vision Segmentation by Clustering II.
Grouping and Segmentation
CS654: Digital Image Analysis Lecture 30: Clustering based Segmentation Slides are adapted from:
Digital Image Processing
Segmentation & Grouping Tuesday, Sept 23 Kristen Grauman UT-Austin.
Perceptual and Sensory Augmented Computing Computer Vision WS 11/12 Computer Vision – Lecture 6 Segmentation and Grouping Bastian Leibe RWTH.
Image Segmentation Shengnan Wang
Mean Shift ; Theory and Applications Presented by: Reza Hemati دی 89 December گروه بینایی ماشین و پردازش تصویر Machine Vision and Image Processing.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP10 Advanced Segmentation Miguel Tavares.
Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Computer Vision – Lecture 7 Segmentation and Grouping Bastian Leibe RWTH.
Lecture 30: Segmentation CS4670 / 5670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
CS 2750: Machine Learning Clustering Prof. Adriana Kovashka University of Pittsburgh January 25, 2016.
Normalized Cuts and Image Segmentation Patrick Denis COSC 6121 York University Jianbo Shi and Jitendra Malik.
Segmentation slides adopted from Svetlana Lazebnik.
Course Introduction to Medical Imaging Segmentation 1 – Mean Shift and Graph-Cuts Guy Gilboa.
K-Means Segmentation.
Image Segmentation Today’s Readings Szesliski Chapter 5
Segmentation by clustering: normalized cut
Segmentation by clustering: mean shift
Lecture: Clustering and Segmentation
Lecture: k-means & mean-shift clustering
Segmentation and Grouping
CS 2750: Machine Learning Clustering
Advanced Artificial Intelligence
Announcements Photos right now Project 3 questions
Digital Image Processing
Seam Carving Project 1a due at midnight tonight.
Image Segmentation CS 678 Spring 2018.
Segmentation (continued)
Announcements Project 4 questions Evaluations.
Announcements Project 4 out today (due Wed March 10)
Announcements Project 1 is out today help session at the end of class.
“Traditional” image segmentation
Image Segmentation Samuel Cheng
Presentation transcript:

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Computer Vision – Lecture 7 Segmentation and Grouping Bastian Leibe RWTH Aachen TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A AA A A A A

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Course Outline Image Processing Basics Recognition I  Global Representations Segmentation  Segmentation and Grouping  Graph-theoretic Segmentation Recognition II  Subspace representations Local Features & Matching Object Categorization 3D Reconstruction Motion and Tracking 2

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Appearance-Based Recognition Basic assumption  Objects can be represented by a set of images (“appearances”).  For recognition, it is sufficient to just compare the 2D appearances.  No 3D model is needed. 3 3D object ryry rxrx  Fundamental paradigm shift in the 90’s B. Leibe =

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Recognition Using Histograms Histogram comparison 4 B. Leibe Test image Known objects

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Comparison Measures Vector space interpretation  Euclidean distance  Mahalanobis distance Statistical motivation  Chi-square  Bhattacharyya Information-theoretic motivation  Kullback-Leibler divergence, Jeffreys divergence Histogram motivation  Histogram intersection Ground distance  Earth Movers Distance (EMD) 5 ≠

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Recognition Using Histograms Simple algorithm 1. Build a set of histograms H={h i } for each known object  More exactly, for each view of each object 2. Build a histogram h t for the test image. 3. Compare h t to each h i  H  Using a suitable comparison measure 4. Select the object with the best matching score  Or reject the test image if no object is similar enough. 6 “Nearest-Neighbor” strategy B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Histogram Backprojection „Where in the image are the colors we‘re looking for?“  Query: object with histogram M  Given: image with histogram I Compute the „ratio histogram“:  R reveals how important an object color is, relative to the current image.  Project value back into the image (i.e. replace the image values by the values of R that they index).  Convolve result image with a circular mask to find the object. 7

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Multidimensional Representations Combination of several descriptors  Each descriptor is applied to the whole image.  Corresponding pixel values are combined into one feature vector.  Feature vectors are collected in multidimensional histogram. 8 DxDx DyDy Lap B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 1. Build up histograms p(m k |o n ) for each training object. 2. Sample the test image to obtain m k, k  K.  Only small number of local samples necessary. 3. Compute the probabilities for each training object. 4. Select the object with the highest probability  Or reject the test image if no object accumulates sufficient probability. Recap: Bayesian Recognition Algorithm 9 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Recap: Colored Derivatives Generalization: derivatives along  Y axis  intensity differences  C 1 axis  red-green differences  C 2 axis  blue-yellow differences Application:  Brand identification in video 10 [Hall & Crowley, 2000] B. Leibe Y C2C2 C1C1

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 You’re Now Ready for First Applications… 11 Binary Segmen- tation Moment descriptors Skin color detection Circle detection Line detection Histogram based recognition Image Source:

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Demo Competition Design your own Computer Vision demo!  Based on the techniques from the lecture…  Topic is up to you – it should be fun!  Teams of up to 3 students  Demo day after the end of the semester –Will send around a poll for a suitable date… –Participation is optional (but it will be fun!) –Demos will count for up to 30 extra exercise points –(Small) prizes for best teams If you have questions, we’ll be happy to give advice… 12

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Topics of This Lecture Segmentation and grouping  Gestalt principles  Image segmentation Segmentation as clustering  k-Means  Feature spaces Probabilistic clustering  Mixture of Gaussians, EM Model-free clustering  Mean-Shift clustering Graph theoretic segmentation  Normalized Cuts 13 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 09/10 Examples of Grouping in Vision 14 B. Leibe Determining image regions Grouping video frames into shots Object-level grouping Figure-ground Slide credit: Kristen Grauman What things should be grouped? What cues indicate groups?

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Similarity 15 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Symmetry 16 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Common Fate 17 B. Leibe Image credit: Arthus-Bertrand (via F. Durand) Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Proximity 18 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Muller-Lyer Illusion Gestalt principle: grouping is key to visual perception. 19 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 The Gestalt School Grouping is key to visual perception Elements in a collection can have properties that result from relationships  “The whole is greater than the sum of its parts” 20 Illusory/subjective contours Occlusion Familiar configuration Slide credit: Svetlana Lazebnik Image source: Steve Lehar

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Gestalt Theory Gestalt: whole or group  Whole is greater than sum of its parts  Relationships among parts can yield new properties/features Psychologists identified series of factors that predispose set of elements to be grouped (by human visual system) 21 B. Leibe Untersuchungen zur Lehre von der Gestalt, Psychologische Forschung, Vol. 4, pp , “I stand at the window and see a house, trees, sky. Theoretically I might say there were 327 brightnesses and nuances of colour. Do I have "327"? No. I have sky, house, and trees.” Max Wertheimer ( )

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Gestalt Factors These factors make intuitive sense, but are very difficult to translate into algorithms. 22 B. Leibe Image source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Continuity through Occlusion Cues 23 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Continuity through Occlusion Cues 24 B. Leibe Continuity, explanation by occlusion

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Continuity through Occlusion Cues 25 B. Leibe Image source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Continuity through Occlusion Cues 26 B. Leibe Image source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Figure-Ground Discrimination 27 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 The Ultimate Gestalt? 28 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Image Segmentation Goal: identify groups of pixels that go together 29 B. Leibe Slide credit: Steve Seitz, Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 The Goals of Segmentation Separate image into coherent “objects” 30 B. Leibe Image Human segmentation Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 The Goals of Segmentation Separate image into coherent “objects” Group together similar-looking pixels for efficiency of further processing 31 B. Leibe X. Ren and J. Malik. Learning a classification model for segmentation. ICCV 2003.Learning a classification model for segmentation. “superpixels” Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Topics of This Lecture Segmentation and grouping  Gestalt principles  Image Segmentation Segmentation as clustering  k-Means  Feature spaces Probabilistic clustering  Mixture of Gaussians, EM Model-free clustering  Mean-Shift clustering Graph theoretic segmentation  Normalized Cuts 32 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Image Segmentation: Toy Example These intensities define the three groups. We could label every pixel in the image according to which of these primary intensities it is.  i.e., segment the image based on the intensity feature. What if the image isn’t quite so simple? 33 B. Leibe intensity input image black pixels gray pixels white pixels Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 34 B. Leibe Pixel count Input image Intensity Pixel count Intensity Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Now how to determine the three main intensities that define our groups? We need to cluster. 35 B. Leibe Input image Intensity Pixel count Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Goal: choose three “centers” as the representative intensities, and label every pixel according to which of these centers it is nearest to. Best cluster centers are those that minimize SSD between all points and their nearest cluster center c i : 36 B. Leibe Slide credit: Kristen Grauman Intensity

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Clustering With this objective, it is a “chicken and egg” problem:  If we knew the cluster centers, we could allocate points to groups by assigning each to its closest center.  If we knew the group memberships, we could get the centers by computing the mean per group. 37 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 K-Means Clustering Basic idea: randomly initialize the k cluster centers, and iterate between the two steps we just saw. 1. Randomly initialize the cluster centers, c 1,..., c K 2. Given cluster centers, determine points in each cluster –For each point p, find the closest c i. Put p into cluster i 3. Given points in each cluster, solve for c i –Set c i to be the mean of points in cluster i 4. If c i have changed, repeat Step 2 Properties  Will always converge to some solution  Can be a “local minimum” –Does not always find the global minimum of objective function: 38 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation as Clustering 39 B. Leibe K=2 K=3 img_as_col = double(im(:)); cluster_membs = kmeans(img_as_col, K); labelim = zeros(size(im)); for i=1:k inds = find(cluster_membs==i); meanval = mean(img_as_column(inds)); labelim(inds) = meanval; end Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 K-Means Clustering Java demo: 40 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 K-Means++ Can we prevent arbitrarily bad local minima? 1. Randomly choose first center. 2. Pick new center with prob. proportional to  (Contribution of p to total error) 3. Repeat until k centers. Expected error = O(log k) * optimal 41 B. Leibe Arthur & Vassilvitskii 2007 Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Feature Space Depending on what we choose as the feature space, we can group pixels in different ways. Grouping pixels based on intensity similarity Feature space: intensity value (1D) 42 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Feature Space Depending on what we choose as the feature space, we can group pixels in different ways. Grouping pixels based on color similarity Feature space: color value (3D) 43 B. Leibe R=255 G=200 B=250 R=245 G=220 B=248 R=15 G=189 B=2 R=3 G=12 B=2 R G B Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation as Clustering Depending on what we choose as the feature space, we can group pixels in different ways. Grouping pixels based on texture similarity Feature space: filter bank responses (e.g., 24D) 44 B. Leibe Filter bank of 24 filters F 24 F2F2 F1F1 … Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Smoothing Out Cluster Assignments Assigning a cluster label per pixel may yield outliers: How can we ensure they are spatially smooth? 45 B. Leibe ? Original Labeled by cluster center’s intensity Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation as Clustering Depending on what we choose as the feature space, we can group pixels in different ways. Grouping pixels based on intensity+position similarity  Way to encode both similarity and proximity. 46 B. Leibe Slide credit: Kristen Grauman X Intensity Y

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 K-Means Clustering Results K-means clustering based on intensity or color is essentially vector quantization of the image attributes  Clusters don’t have to be spatially coherent 47 B. Leibe ImageIntensity-based clustersColor-based clusters Slide credit: Svetlana Lazebnik Image source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 K-Means Clustering Results K-means clustering based on intensity or color is essentially vector quantization of the image attributes  Clusters don’t have to be spatially coherent Clustering based on (r,g,b,x,y) values enforces more spatial coherence 48 B. Leibe Slide credit: Svetlana Lazebnik Image source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Summary K-Means Pros  Simple, fast to compute  Converges to local minimum of within-cluster squared error Cons/issues  Setting k?  Sensitive to initial centers  Sensitive to outliers  Detects spherical clusters only  Assuming means can be computed 49 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Topics of This Lecture Segmentation and grouping  Gestalt principles  Image Segmentation Segmentation as clustering  k-Means  Feature spaces Probabilistic clustering  Mixture of Gaussians, EM Model-free clustering  Mean-Shift clustering Graph theoretic segmentation  Normalized Cuts 50 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Probabilistic Clustering Basic questions  What’s the probability that a point x is in cluster m ?  What’s the shape of each cluster? K-means doesn’t answer these questions. Basic idea  Instead of treating the data as a bunch of points, assume that they are all generated by sampling a continuous function.  This function is called a generative model.  Defined by a vector of parameters θ 51 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Mixture of Gaussians One generative model is a mixture of Gaussians (MoG)  K Gaussian blobs with means μ b covariance matrices V b, dimension d –Blob b defined by:  Blob b is selected with probability  The likelihood of observing x is a weighted mixture of Gaussians 52 B. Leibe, Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Expectation Maximization (EM) Goal  Find blob parameters θ that maximize the likelihood function: Approach: 1. E-step: given current guess of blobs, compute ownership of each point 2. M-step: given ownership probabilities, update blobs to maximize likelihood function 3. Repeat until convergence 53 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 EM Details E-step  Compute probability that point x is in blob b, given current guess of θ M-step  Compute probability that blob b is selected  Mean of blob b  Covariance of blob b 54 B. Leibe ( N data points) Slide credit: Steve Seitz see lecture Machine Learning!

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Applications of EM Turns out this is useful for all sorts of problems  Any clustering problem  Any model estimation problem  Missing data problems  Finding outliers  Segmentation problems –Segmentation based on color –Segmentation based on motion –Foreground/background separation ... EM demo  B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation with EM 56 B. Leibe Image source: Serge Belongie k=2k=3k=4k=5 EM segmentation results Original image

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Summary: Mixtures of Gaussians, EM Pros  Probabilistic interpretation  Soft assignments between data points and clusters  Generative model, can predict novel data points  Relatively compact storage Cons  Local minima –k-means is NP-hard even with k=2  Initialization –Often a good idea to start with some k-means iterations.  Need to know number of components –Solutions: model selection (AIC, BIC), Dirichlet process mixture  Need to choose generative model  Numerical problems are often a nuisance 57 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Topics of This Lecture Segmentation and grouping  Gestalt principles  Image segmentation Segmentation as clustering  k-Means  Feature spaces Probabilistic clustering  Mixture of Gaussians, EM Model-free clustering  Mean-Shift clustering Graph theoretic segmentation  Normalized Cuts 58 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Finding Modes in a Histogram How many modes are there?  Mode = local maximum of the density of a given distribution  Easy to see, hard to compute 59 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Mean-Shift Segmentation An advanced and versatile technique for clustering- based segmentation 60 B. Leibe D. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature Space Analysis, PAMI 2002.Mean Shift: A Robust Approach toward Feature Space Analysis Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Mean-Shift Algorithm Iterative Mode Search 1. Initialize random seed, and window W 2. Calculate center of gravity (the “mean”) of W: 3. Shift the search window to the mean 4. Repeat Step 2 until convergence 61 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean Shift vector Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Region of interest Center of mass Mean-Shift Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Tessellate the space with windows Run the procedure in parallel Slide by Y. Ukrainitz & B. Sarel Real Modality Analysis

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 The blue data points were traversed by the windows towards the mode. Slide by Y. Ukrainitz & B. Sarel Real Modality Analysis

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 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 71 B. Leibe Slide by Y. Ukrainitz & B. Sarel

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Mean-Shift Clustering/Segmentation Find features (color, gradients, texture, etc) Initialize windows at individual pixel locations Perform mean shift for each window until convergence Merge windows that end up near the same “peak” or mode 72 B. Leibe Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Mean-Shift Segmentation Results 73 B. Leibe Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 More Results 74 B. Leibe Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 More Results 75 B. Leibe Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Need to shift many windows… Many computations will be redundant. Problem: Computational Complexity B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 1. Assign all points within radius r of end point to the mode. Speedups: Basin of Attraction B. Leibe r

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 2. Assign all points within radius r/c of the search path to the mode. Speedups B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Summary Mean-Shift Pros  General, application-independent tool  Model-free, does not assume any prior shape (spherical, elliptical, etc.) on data clusters  Just a single parameter (window size h) –h has a physical meaning (unlike k-means)  Finds variable number of modes  Robust to outliers Cons  Output depends on window size  Window size (bandwidth) selection is not trivial  Computationally (relatively) expensive (~2s/image)  Does not scale well with dimension of feature space 79 B. Leibe Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Topics of This Lecture Segmentation and grouping  Gestalt principles  Image segmentation Segmentation as clustering  k-Means  Feature spaces Probabilistic clustering  Mixture of Gaussians, EM Model-free clustering  Mean-Shift clustering Graph theoretic segmentation  Normalized Cuts 80 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Images as Graphs Fully-connected graph  Node (vertex) for every pixel  Link between every pair of pixels, (p,q)  Affinity weight w pq for each link (edge) –w pq measures similarity –Similarity is inversely proportional to difference (in color and position…) 81 B. Leibe q p w pq w Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation by Graph Cuts Break Graph into Segments  Delete links that cross between segments  Easiest to break links that have low similarity (low weight) –Similar pixels should be in the same segments –Dissimilar pixels should be in different segments 82 B. Leibe w ABC Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Measuring Affinity Distance Intensity Color Texture 83 B. Leibe (some suitable color space distance) Source: Forsyth & Ponce (vectors of filter outputs)

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Scale Affects Affinity Small σ: group only nearby points Large σ: group far-away points 84 B. Leibe Slide credit: Svetlana Lazebnik Small  Medium  Large  Image Source: Forsyth & Ponce

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 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? 85 B. Leibe Slide credit: Steve Seitz A B

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Graph Cut 86 B. Leibe Image Source: Forsyth & Ponce Here, the cut is nicely defined by the block-diagonal structure of the affinity matrix.  How can this be generalized?

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Minimum Cut We can do segmentation by finding the minimum cut in a graph  Efficient algorithms exist for doing this Drawback:  Weight of cut proportional to number of edges in the cut  Minimum cut tends to cut off very small, isolated components 87 B. Leibe Ideal Cut Cuts with lesser weight than the ideal cut Slide credit: Khurram Hassan-Shafique

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Normalized Cut (NCut) A minimum cut penalizes large segments This can be fixed by normalizing for size of segments The normalized cut cost is: The exact solution is NP-hard but an approximation can be computed by solving a generalized eigenvalue problem. 88 B. Leibe assoc(A,V) = sum of weights of all edges in V that touch A J. Shi and J. Malik. Normalized cuts and image segmentation. PAMI 2000Normalized cuts and image segmentation. Slide credit: Svetlana Lazebnik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Interpretation as a Dynamical System Treat the links as springs and shake the system  Elasticity proportional to cost  Vibration “modes” correspond to segments –Can compute these by solving a generalized eigenvector problem 89 B. Leibe Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 NCuts as a Generalized Eigenvector Problem Definitions Rewriting Normalized Cut in matrix form: 90 B. Leibe Slide credit: Jitendra Malik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 SomeMore Math… 91 B. Leibe Slide credit: Jitendra Malik

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 NCuts as a Generalized Eigenvalue Problem After simplification, we get This is a Rayleigh Quotient  Solution given by the “generalized” eigenvalue problem  Solved by converting to standard eigenvalue problem Subtleties  Optimal solution is second smallest eigenvector  Gives continuous result—must convert into discrete values of y 92 Slide credit: Alyosha Efros B. Leibe This is hard, as y is discrete! Relaxation: continuous y.

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 NCuts Example 93 B. Leibe Smallest eigenvectors Image source: Shi & Malik NCuts segments

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 NCuts: Overall Procedure 1. Construct a weighted graph G=(V,E) from an image. 2. Connect each pair of pixels, and assign graph edge weights, 3. Solve for the smallest few eigenvectors. This yields a continuous solution. 4. Threshold eigenvectors to get a discrete cut  This is where the approximation is made (we’re not solving NP). 5. Recursively subdivide if NCut value is below a pre- specified value. 94 B. Leibe Slide credit: Jitendra Malik NCuts Matlab code available at

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Color Image Segmentation with NCuts 95 B. Leibe Image Source: Shi & Malik Slide credit: Steve Seitz

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Results with Color & Texture 96 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Summary: Normalized Cuts Pros:  Generic framework, flexible to choice of function that computes weights (“affinities”) between nodes  Does not require any model of the data distribution Cons:  Time and memory complexity can be high –Dense, highly connected graphs  many affinity computations –Solving eigenvalue problem  Preference for balanced partitions –If a region is uniform, NCuts will find the modes of vibration of the image dimensions 97 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Segmentation: Caveats We’ve looked at bottom-up ways to segment an image into regions, yet finding meaningful segments is intertwined with the recognition problem. Often want to avoid making hard decisions too soon Difficult to evaluate; when is a segmentation successful? 98 B. Leibe Slide credit: Kristen Grauman

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Generic Clustering We have focused on ways to group pixels into image segments based on their appearance  Find groups; “quantize” feature space In general, we can use clustering techniques to find groups of similar “tokens”, provided we know how to compare the tokens.  E.g., segment an image into the types of motions present  E.g., segment a video into the types of scenes (shots) present 99 B. Leibe

Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 References and Further Reading Background information on segmentation by clustering and on Normalized Cuts can be found in Chapter 14 of  D. Forsyth, J. Ponce, Computer Vision – A Modern Approach. Prentice Hall, 2003 More on the EM algorithm can be found in Chapter Read Max Wertheimer’s classic thoughts on Gestalt  Try the k-means and EM demos at  