Professional Documents
Culture Documents
Computer Vision
Jia-Bin Huang, Virginia Tech
Many slides from D. Hoiem
Administrative stuffs
• Final project
• proposal due Oct 30 (Monday)
• HW 4 out tomorrow
Sample final projects
• State quarter classification
• Stereo Vision - correspondence matching
• Collaborative monocular SLAM for Multiple Robots in an unstructured environment
• Examples
• Watershed
• Felzenszwalb and Huttenlocher graph-based
• Turbopixels
• SLIC
Watershed algorithm
Watershed segmentation
• Pros
–Fast (< 1 sec for 512x512 image)
–Preserves boundaries
• Cons
–Only as good as the soft boundaries (which may be slow to
compute)
–Not easy to get variety of regions for multiple segmentations
• Usage
–Good algorithm for superpixels, hierarchical segmentation
Felzenszwalb and Huttenlocher: Graph-Based
Segmentation
http://www.cs.brown.edu/~pff/segment/
Tries to preserve boundaries like watershed but to produce more regular regions
SLIC (Achanta et al. PAMI 2012)
http://infoscience.epfl.ch/record/177415/files/Superpixel_PAMI2011-2.pdf
small
Choices in segmentation algorithms
• Oversegmentation
• Watershed + Structure random forest
• Felzenszwalb and Huttenlocher 2004
http://www.cs.brown.edu/~pff/segment/
• SLIC
• Turbopixels
• Mean-shift
• Hierarchical segmentation
• Occlusion boundaries hierarchy: Hoiem et al. IJCV 2011
(uses trained classifier to merge)
• Pb+watershed hierarchy: Arbeleaz et al. CVPR 2009
• Selective search: FH + agglomerative clustering
• Superpixel hierarchy
• Region proposals
• Propose seed superpixel, try to segment out object that
contains it
(Endres Hoiem ECCV 2010, Carreira Sminchisescu CVPR
2010)
Review: Image Segmentation
• Gestalt cues and principles of organization
• Uses of segmentation
• Efficiency
• Provide feature supports
• Propose object regions
• Want the segmented object
small
Today’s Class
• Background
• Maximum Likelihood Estimation
• Probabilistic Inference
Annotator
Ratings
10
8
9
2
8
http://www.robots.ox.ac.uk/~vgg/publications/papers/russell06.pdf
Missing Data Problems: Segmentation
You are given an image and want to assign
foreground/background pixels.
Foreground
Background
Missing Data Problems:
Segmentation
Challenge: Segment the image into figure and ground without
knowing what the foreground looks like in advance.
Three steps:
1. If we had labels, how could we model the appearance of
foreground and background?
• Maximum Likelihood Estimation
2. Once we have modeled the fg/bg appearance, how do we
compute the likelihood that a pixel is foreground?
• Probabilistic Inference
3. How can we get both labels and appearance models at once?
• Expectation-Maximization (EM) Algorithm
Maximum Likelihood Estimation
1. If we had labels, how could we model the appearance
of foreground and background?
Background
Foreground
Maximum Likelihood Estimation
data
x x1..x N parameters
ˆ argmax p (x | )
ˆ argmax p ( xn | )
n
Maximum Likelihood Estimation
x x1 .. x N
ˆ argmax p(x | )
ˆ argmax p( x n | )
n
Gaussian Distribution
p ( x n | , )
2 1
exp
xn
2
2 2
2 2
Maximum Likelihood Estimation
1 xn 2
Gaussian Distribution p ( x n | , )
2
exp
2 2
2 2
• Log-Likelihood
Maximum Likelihood Estimation
x x1 .. x N
ˆ argmax p(x | )
ˆ argmax p( x n | )
n
Gaussian Distribution
p ( x n | , )
2 1
exp
xn
2
2 2
2 2
1 1
̂
N
xn
n
ˆ 2
N
nx
ˆ 2
n
Example: MLE
Parameters used to Generate
fg: mu=0.6, sigma=0.1
bg: mu=0.4, sigma=0.1
im labels
Background
Foreground
Probabilistic Inference
Compute the likelihood that a particular model
generated a sample
component or label
p ( z n m | x n , )
Probabilistic Inference
Compute the likelihood that a particular model
generated a sample
component or label
p z n m, xn | m
p ( z n m | x n , )
p xn |
Conditional probability
( 𝐴|𝐵 ) = 𝑃 ( 𝐴 , 𝐵)
𝑃
𝑃 (𝐵)
Probabilistic Inference
Compute the likelihood that a particular model
generated a sample
component or label
p z n m, xn | m
p ( z n m | x n , )
p xn |
p z n m, xn | m
Marginalization
p z n k , x n | k
k
𝑃 ( 𝐴 ) =∑ 𝑃( 𝐴 ,𝐵=𝑘)
𝑘
Probabilistic Inference
Compute the likelihood that a particular model
generated a sample
component or label
p z n m, xn | m
p ( z n m | x n , )
p xn |
p z n m, xn | m
Joint distribution
p z n k , x n | k
k
𝑃 ( 𝐴 , 𝐵 )=P ( B ) P (A ∨B)
p x n | z n m, m p z n m | m
p x n | z n k , k p z n k | k
k
Example: Inference
Learned Parameters
fg: mu=0.6, sigma=0.1 im
bg: mu=0.4, sigma=0.1
>> pfg = 0.5;
>> px_fg = normpdf(im, mu_fg, sigma_fg);
>> px_bg = normpdf(im, mu_bg, sigma_bg);
>> pfg_x = px_fg*pfg ./ (px_fg*pfg + px_bg*(1-pfg));
p(fg | im)
Dealing with Hidden Variables
3. How can we get both labels and appearance
parameters at once?
Background
Foreground
Mixture of Gaussians mixture component
component model component prior
parameters
p x n | μ , σ , π p x n , z n m | m , m , m
2 2
m
p x n , z n m | μ , σ , π p x n , z n m | m , m , m
2 2
p x
| m , m p z n m | m
2
n
1 xn m 2
exp m
2 m
2
2 m
2
Mixture of Gaussians
1. Initialize parameters
1. Initialize parameters
nm
n
nm
n
N
Expectation Maximization (EM)
Algorithm
Goal: argmax log p x , z |
ˆ
z
Jensen’s Inequality f E X E f X
for concave functions f(x)
2. M-step: solve
2. M-step: solve
2 (t )
nm p( z n m | x n , μ , σ (t )
, π(t ) )
1 1
2 ( t 1)
n nm n m
nm
ˆ m 2
ˆ m ( t 1)
nm x n x ˆ ˆ m ( t 1)
n
nm n nm
n
N
n
EM algorithm - derivation
http://lasa.epfl.ch/teaching/lectures/ML_Phd/Notes/GP-GMM.pdf
EM algorithm – E-Step
EM algorithm – E-Step
EM algorithm – M-Step
EM algorithm – M-Step
•
•Take
derivative with respect to
EM Algorithm for GMM
EM Algorithm
• K-means is an example
• Advantages
• Simpler: can be applied when cannot derive EM
• Sometimes works better if you want to make hard predictions
at the end
• But
• Generally, pdf parameters are not as accurate as EM
Missing Data Problems: Outliers
You want to train an algorithm to predict whether a
photograph is attractive. You collect annotations from
Mechanical Turk. Some annotators try to give accurate
ratings, but others answer randomly.
Annotator
Ratings
10
8
9
2
8