grouping and segmentation
DESCRIPTION
03/12/12. Grouping and Segmentation. Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem. Announcements. HW 3: due today Graded by Tues after spring break HW 4: out soon Mean-shift segmentation EM problem for dealing with bad annotators Graph cuts segmentation. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/1.jpg)
Grouping and Segmentation
Computer VisionCS 543 / ECE 549
University of Illinois
Derek Hoiem
03/12/12
![Page 2: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/2.jpg)
Announcements
• HW 3: due today– Graded by Tues after spring break
• HW 4: out soon1. Mean-shift segmentation2. EM problem for dealing with bad annotators3. Graph cuts segmentation
![Page 3: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/3.jpg)
Today’s class
• Segmentation and grouping– Gestalt cues– By clustering (mean-shift)– By boundaries (watershed)
![Page 4: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/4.jpg)
Gestalt grouping
![Page 5: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/5.jpg)
German: Gestalt - "form" or "whole”
Berlin School, early 20th centuryKurt Koffka, Max Wertheimer, and Wolfgang Köhler
View of brain: • whole is more than the sum of its parts • holistic• parallel • analog • self-organizing tendencies
Slide from S. Saverese
Gestalt psychology or gestaltism
![Page 6: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/6.jpg)
The Muller-Lyer illusion
Gestaltism
![Page 7: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/7.jpg)
We perceive the interpretation, not the senses
![Page 8: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/8.jpg)
Principles of perceptual organization
From Steve Lehar: The Constructive Aspect of Visual Perception
![Page 9: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/9.jpg)
Principles of perceptual organization
![Page 10: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/10.jpg)
Gestaltists do not believe in coincidence
![Page 11: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/11.jpg)
Emergence
![Page 12: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/12.jpg)
From Steve Lehar: The Constructive Aspect of Visual Perception
Grouping by invisible completion
![Page 13: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/13.jpg)
From Steve Lehar: The Constructive Aspect of Visual Perception
Grouping involves global interpretation
![Page 14: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/14.jpg)
Grouping involves global interpretation
From Steve Lehar: The Constructive Aspect of Visual Perception
![Page 15: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/15.jpg)
Gestalt cues
• Good intuition and basic principles for grouping
• Basis for many ideas in segmentation and occlusion reasoning
• Some (e.g., symmetry) are difficult to implement in practice
![Page 16: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/16.jpg)
Image segmentationGoal: Group pixels into meaningful or perceptually similar regions
![Page 17: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/17.jpg)
Segmentation for feature support
50x50 Patch50x50 Patch
![Page 18: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/18.jpg)
Segmentation for efficiency
[Felzenszwalb and Huttenlocher 2004]
[Hoiem et al. 2005, Mori 2005][Shi and Malik 2001]
![Page 19: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/19.jpg)
Segmentation as a result
Rother et al. 2004
![Page 20: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/20.jpg)
Types of segmentations
Oversegmentation Undersegmentation
Multiple Segmentations
![Page 21: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/21.jpg)
Major processes for segmentation
• Bottom-up: group tokens with similar features• Top-down: group tokens that likely belong to
the same object
[Levin and Weiss 2006]
![Page 22: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/22.jpg)
Segmentation using clustering
• Kmeans
• Mean-shift
![Page 23: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/23.jpg)
Source: K. Grauman
Feature Space
![Page 24: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/24.jpg)
Image Clusters on intensity Clusters on color
K-means clustering using intensity alone and color alone
![Page 25: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/25.jpg)
K-Means pros and cons• Pros
– Simple and fast– Easy to implement
• Cons– Need to choose K– Sensitive to outliers
• Usage– Rarely used for pixel
segmentation
![Page 26: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/26.jpg)
• Versatile technique for clustering-based segmentation
D. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature Space Analysis, PAMI 2002.
Mean shift segmentation
![Page 27: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/27.jpg)
Mean shift algorithm• Try to find modes of this non-parametric
density
![Page 28: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/28.jpg)
Kernel density estimationKernel
Data (1-D)
Estimated density
![Page 29: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/29.jpg)
Kernel density estimation
Kernel density estimation function
Gaussian kernel
![Page 30: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/30.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 31: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/31.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 32: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/32.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 33: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/33.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Mean shift
Slide by Y. Ukrainitz & B. Sarel
![Page 34: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/34.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 35: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/35.jpg)
Region ofinterest
Center ofmass
Mean Shiftvector
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 36: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/36.jpg)
Region ofinterest
Center ofmass
Slide by Y. Ukrainitz & B. Sarel
Mean shift
![Page 37: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/37.jpg)
Simple Mean Shift procedure:• Compute mean shift vector
• Translate the Kernel window by m(x)
2
1
2
1
( )
ni
ii
ni
i
gh
gh
x - xx
m x xx - x
g( ) ( )kx x
Computing the Mean Shift
Slide by Y. Ukrainitz & B. Sarel
![Page 38: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/38.jpg)
Real Modality Analysis
![Page 39: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/39.jpg)
• Attraction basin: the region for which all trajectories lead to the same mode
• Cluster: all data points in the attraction basin of a mode
Slide by Y. Ukrainitz & B. Sarel
Attraction basin
![Page 40: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/40.jpg)
Attraction basin
![Page 41: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/41.jpg)
Mean shift clustering• The mean shift algorithm seeks modes of the
given set of points1. Choose kernel and bandwidth2. For each point:
a) Center a window on that pointb) Compute the mean of the data in the search windowc) Center the search window at the new mean locationd) Repeat (b,c) until convergence
3. Assign points that lead to nearby modes to the same cluster
![Page 42: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/42.jpg)
• Compute features for each pixel (color, gradients, texture, etc); also store each pixel’s position
• Set kernel size for features Kf and position Ks
• Initialize windows at individual pixel locations• Perform mean shift for each window until convergence• Merge modes that are within width of Kf and Ks
Segmentation by Mean Shift
![Page 43: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/43.jpg)
http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html
Mean shift segmentation results
![Page 44: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/44.jpg)
http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html
![Page 45: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/45.jpg)
Mean-shift: other issues• Speedups
– Binned estimation – replace points within some “bin” by point at center with mass
– Fast search of neighbors – e.g., k-d tree or approximate NN– Update all windows in each iteration (faster convergence)
• Other tricks– Use kNN to determine window sizes adaptively
• Lots of theoretical supportD. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature Space Analysis, PAMI 2002.
![Page 46: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/46.jpg)
Doing mean-shift for HW 4• Goal is to understand the basics of how mean-
shift works– Just get something working that has the right behavior
qualitatively– Don’t worry about speed
• Simplifications– Work with very small images (120x80)– Use a uniform kernel (compute the mean of color,
position within some neighborhood given by Kf and Ks)– Can use a heuristic for merging similar modes
![Page 47: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/47.jpg)
Mean shift pros and cons
• Pros– Good general-purpose segmentation– Flexible in number and shape of regions– Robust to outliers
• Cons– Have to choose kernel size in advance– Not suitable for high-dimensional features
• When to use it– Oversegmentation– Multiple segmentations– Tracking, clustering, filtering applications
• D. Comaniciu, V. Ramesh, P. Meer: Real-Time Tracking of Non-Rigid Objects using Mean Shift, Best Paper Award, IEEE Conf. Computer Vision and Pattern Recognition (CVPR'00), Hilton Head Island, South Carolina, Vol. 2, 142-149, 2000
![Page 48: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/48.jpg)
Watershed algorithm
![Page 49: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/49.jpg)
Watershed segmentation
Image Gradient Watershed boundaries
![Page 50: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/50.jpg)
Meyer’s watershed segmentation
1. Choose local minima as region seeds2. Add neighbors to priority queue, sorted by
value3. Take top priority pixel from queue
1. If all labeled neighbors have same label, assign that label to pixel
2. Add all non-marked neighbors to queue4. Repeat step 3 until finished (all remaining
pixels in queue are on the boundary)
Meyer 1991Matlab: seg = watershed(bnd_im)
![Page 51: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/51.jpg)
Simple trick• Use Gaussian or median filter to reduce number of
regions
![Page 52: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/52.jpg)
Watershed usage
• Use as a starting point for hierarchical segmentation– Ultrametric contour map (Arbelaez 2006)
• Works with any soft boundaries– Pb (w/o non-max suppression)– Canny (w/o non-max suppression)– Etc.
![Page 53: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/53.jpg)
Watershed pros and cons
• Pros– Fast (< 1 sec for 512x512 image)– Preserves boundaries
• Cons– Only as good as the soft boundaries– Not easy to get variety of regions for multiple segmentations
• Usage– Preferred algorithm for hierarchical segmentation
![Page 54: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/54.jpg)
Choices in segmentation algorithms• Oversegmentation
– Watershed + Pb my favorite– Felzenszwalb and Huttenlocher 2004 my favorite
http://www.cs.brown.edu/~pff/segment/– Turbopixels– Mean-shift
• Larger regions– Hierarchical segmentation (e.g., from Pb) my favorite– Normalized cuts– Mean-shift– Seed + graph cuts (discussed later)
![Page 55: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/55.jpg)
Felzenszwalb and Huttenlocher: Graph-Based Segmentation
+ Good for thin regions+ Fast+ Easy to control coarseness of segmentations+ Can include both large and small regions - Often creates regions with strange shapes - Sometimes makes very large errors
http://www.cs.brown.edu/~pff/segment/
![Page 56: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/56.jpg)
Turbo Pixels: Levinstein et al. 2009http://www.cs.toronto.edu/~kyros/pubs/09.pami.turbopixels.pdf
Tries to preserve boundaries like watershed but to produce more regular regions
![Page 57: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/57.jpg)
Things to remember• Gestalt cues and principles of organization
• Uses of segmentation– Efficiency– Better features– Want the segmented object
• Mean-shift segmentation– Good general-purpose segmentation method – Generally useful clustering, tracking technique
• Watershed segmentation– Good for hierarchical segmentation– Use in combination with boundary prediction
![Page 58: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/58.jpg)
Further reading
• Nicely written mean-shift explanation (with math)http://saravananthirumuruganathan.wordpress.com/2010/04/01/introduction-to-mean-shift-algorithm/
• Includes .m code for mean-shift clustering --- feel free to look at it but your code for segmentation will be different
• Mean-shift paper by Comaniciu and Meerhttp://www.caip.rutgers.edu/~comanici/Papers/MsRobustApproach.pdf
• Adaptive mean shift in higher dimensionshttp://mis.hevra.haifa.ac.il/~ishimshoni/papers/chap9.pdf
• Contours to regions (watershed): Arbelaez et al. 2009http://www.eecs.berkeley.edu/~arbelaez/publications/Arbelaez_Maire_Fowlkes_Malik_CVPR2009.pdf
![Page 59: Grouping and Segmentation](https://reader031.vdocuments.mx/reader031/viewer/2022013004/56815fcc550346895dcec7e4/html5/thumbnails/59.jpg)
Next class: EM algorithm• Make sure to bring something to take notes
(will include a long derivation)