Download as pdf or txt
Download as pdf or txt
You are on page 1of 61

Object Detection with Discriminatively

Trained Part Based Model


P.F. Felzenszwalb, R.B. Girshick, D. McAllester and D. Ramanan

PAMI 2010

Presented by : Philippe Weinzaepfel


1st February 2013
Introduction Object localization

Object localization

Goal
Detect and localize objects from generic categories in static images
Training: bounding boxes around objects

Challenges
Illumination changes
Viewpoint
Intraclass variability
Non-rigid deformation

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 2 / 28
Introduction Part-based model

Part-based model
A collection of parts arranged in a deformable configuration
Part locations are not known: latent variables
In this paper: star model (1 root + multiple parts)
Parts filter at twice resolution of the root filter
Score of the detection:
X
score(model, x) = score(root, x) + max[score(p, y) cost(p, x, y)]
y
pparts

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 3 / 28
Introduction Part-based model

Part-based model with latent variables

Simple model
Score:
f (x) = .(x)

Part-based model
Score:
f (x) = max .(x, z)
xZ(x)

: model parameters
z: specification of object configuration
Latent SVM to learn and data-minng for hard negative examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 4 / 28
Introduction Mixture of part-based models

Mixture of part-based models

Score: max over components


Include the component in z

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 5 / 28
Introduction Outline

Outline

1 Model

2 Latent SVM

3 Training Models

4 Features

5 Post-processing

6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 6 / 28
Model Feature pyramid

Outline

3 Training Models
1 Model
Feature pyramid 4 Features
Deformable part models
Detection process 5 Post-processing
Mixture of models
6 Some experimental results
2 Latent SVM

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 7 / 28
Model Feature pyramid

Linear filter of features

Each part: linear filter of feature map


Build a feature pyramid H
5 levels per octave at training, 10 at testing
Weight vector F
Position p = (x, y, l)
Score of F at p: F 0 .(H, p)

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 7 / 28
Model Deformable part models

Outline

3 Training Models
1 Model
Feature pyramid 4 Features
Deformable part models
Detection process 5 Post-processing
Mixture of models
6 Some experimental results
2 Latent SVM

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 8 / 28
Model Deformable part models

Deformable part models

A model
A root filter F0
n parts Pi
A filter Fi
An anchor vi
A deformation cost di
A bias term b (to compare models in mixtures)

An object hypothesis
Position of root and parts z = (p0 , ..., pn )
pi = (xi , yi , li )
Hypothesis: parts at twice the resolution of root

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 8 / 28
Model Deformable part models

Deformable part models

Score of an hypothesis
Pn 0
Pn
score(p0 , ..., pn ) = i=0 Fi .(H, pi ) i=1 di .d (dxi , dyi ) +b
(dxi , dyi ) = (xi , yi ) (2(x0 , y0 ) + vi )
d (dx, dy) = (dx, dy, dx 2 , dy 2 )

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 9 / 28
Model Deformable part models

Deformable part models

Score of an hypothesis
Pn 0
Pn
score(p0 , ..., pn ) = i=0 Fi .(H, pi ) i=1 di .d (dxi , dyi ) +b
(dxi , dyi ) = (xi , yi ) (2(x0 , y0 ) + vi )
d (dx, dy) = (dx, dy, dx 2 , dy 2 )

Link to Latent SVM


The score can be written as .(H, z) with:
= (F00 , ..., Fn0 , d1 , ..., dn , b)
(H, z) = ((H, p0 ), ..., (H, pn ), d (dx1 , dy1 ), ..., d (dxn , dyn ), 1)

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 9 / 28
Model Detection process

Outline

3 Training Models
1 Model
Feature pyramid 4 Features
Deformable part models
Detection process 5 Post-processing
Mixture of models
6 Some experimental results
2 Latent SVM

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 10 / 28
Model Detection process

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 10 / 28
Model Mixture of models

Outline

3 Training Models
1 Model
Feature pyramid 4 Features
Deformable part models
Detection process 5 Post-processing
Mixture of models
6 Some experimental results
2 Latent SVM

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 11 / 28
Model Mixture of models

Mixture of models

Mixture M of m models
M = (M1 , ..., Mm )
z = (c, p0 , ..., pnc ) = (c, z 0 )
score(z) = c .(H, z 0 )

Score as .(H, z)
= (1 , ..., m )
(H, z) = (0, ..., 0, (H, z 0 ), 0, ..., 0)

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 11 / 28
Latent SVM Problem

Outline

3 Training Models
1 Model
4 Features
2 Latent SVM
Problem 5 Post-processing
Semi-convexity
Optimization 6 Some experimental results
Data-mining hard examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 12 / 28
Latent SVM Problem

Problem

Classifier that score an example x with:

f (x) = max .(x, z)


zZ(x)

Z(x): set of possible latent values for x


As for SVM, we learn by minimizing
n
1 X  
LD () = kk2 + C max 0, 1 yi f (xi )
2
i=1
 
with D = hx1 , y1 i, ..., hxn , yn i a set of labeled examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 12 / 28
Latent SVM Semi-convexity

Outline

3 Training Models
1 Model
4 Features
2 Latent SVM
Problem 5 Post-processing
Semi-convexity
Optimization 6 Some experimental results
Data-mining hard examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 13 / 28
Latent SVM Semi-convexity

Semi-convexity
n
1 X  
LD () = kk2 + C max 0, 1 yi f (xi )
2
i=1
A latent SVM is semi-convex
The loss function is convex in for negative examples.

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 13 / 28
Latent SVM Semi-convexity

Semi-convexity
n
1 X  
LD () = kk2 + C max 0, 1 yi f (xi )
2
i=1
A latent SVM is semi-convex
The loss function is convex in for negative examples.

SVM

Convexity:
f linear in
Hinge loss is convex as
maximum of two convex
functions
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 13 / 28
Latent SVM Semi-convexity

Semi-convexity
n
1 X  
LD () = kk2 + C max 0, 1 yi f (xi )
2
i=1
A latent SVM is semi-convex
The loss function is convex in for negative examples.

LSVM
SVM

Convexity: f is convex as maximum of convex


functions
f linear in
For negative examples, the loss function
Hinge loss is convex as is convex
maximum of two convex
functions
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 13 / 28
Latent SVM Semi-convexity

Semi-convexity
n
1 X  
LD () = kk2 + C max 0, 1 yi f (xi )
2
i=1
A latent SVM is semi-convex
The loss function is convex in for negative examples.
LD () is convex when latent variables are specified for positive
examples.
LSVM
SVM

Convexity: f is convex as maximum of convex


functions
f linear in
For negative examples, the loss function
Hinge loss is convex as is convex
maximum of two convex
functions If there is a single possible latent value
for each positive example: f is linear
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 13 / 28
Latent SVM Optimization

Outline

3 Training Models
1 Model
4 Features
2 Latent SVM
Problem 5 Post-processing
Semi-convexity
Optimization 6 Some experimental results
Data-mining hard examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 14 / 28
Latent SVM Optimization

Optimization

Zp specifying a latent value for each positive example


D(Zp ) derived from D by restricting latent values for positive examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 14 / 28
Latent SVM Optimization

Optimization

Zp specifying a latent value for each positive example


D(Zp ) derived from D by restricting latent values for positive examples
LD () = minZp LD (, Zp ) = minZp LD(Zp ) ()
LD () 6 LD (, Zp )

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 14 / 28
Latent SVM Optimization

Optimization

Zp specifying a latent value for each positive example


D(Zp ) derived from D by restricting latent values for positive examples
LD () = minZp LD (, Zp ) = minZp LD(Zp ) ()
LD () 6 LD (, Zp )

Algorithm
Relabel positive examples: Optimize LD (, Zp ) over Zp , i.e. select

zi = argmax .(xi , z)
zZ(xi )
.
Optimize : Stochastic gradient descent

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 14 / 28
Latent SVM Optimization

Stochastic gradient descent

Gradient descent
n
1 2
X  
LD () = kk + C max 0, 1 yi f (xi )
2
i=1
n
X
LD () = + C h(, xi , yi ) (subgradient)
i=1
(
0 if yi f (xi ) > 1
h(, xi , yi ) =
yi (xi , zi ()) otherwise

Issue
Too costly to go over data to compute the exact gradient.

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 15 / 28
Latent SVM Optimization

Stochastic gradient descent

Approximation of the gradient


Pn
Approximate i=1 h(, xi , yi ) by nh(, xi , yi ) for one example hxi , yi i

Algorithm
Let t be the learning rate for iteration t
Let i be a random example
Let zi = argmaxzZ(xi ) .(xi , z)
Update = t i LD ()

Convergence
1
Learning rate t = t
Depends on the number of training examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 16 / 28
Latent SVM Data-mining hard examples

Outline

3 Training Models
1 Model
4 Features
2 Latent SVM
Problem 5 Post-processing
Semi-convexity
Optimization 6 Some experimental results
Data-mining hard examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 17 / 28
Latent SVM Data-mining hard examples

Recall: Data-mining hard examples in SVM


Many negative instances
Bootstrapping
Collect hard negatives as incorrectly classified examples from a previous
model.

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 17 / 28
Latent SVM Data-mining hard examples

Recall: Data-mining hard examples in SVM


Many negative instances
Bootstrapping
Collect hard negatives as incorrectly classified examples from a previous
model.

Hard and easy examples


H(, D) = {hx, yi D | yf (x) < 1}
E(, D) = {hx, yi D | yf (x) > 1}

(D) = argmin LD () (unique)


Goal
Find a subset C D such that (C) = (D).
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 17 / 28
Latent SVM Data-mining hard examples

Recall: Data-mining hard examples in SVM

Algorithm
t = (Ct ) (model training)
If H(t , D) Ct , stop and return t
Remove easy examples
Add hard examples

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 18 / 28
Latent SVM Data-mining hard examples

Recall: Data-mining hard examples in SVM

Algorithm
t = (Ct ) (model training)
If H(t , D) Ct , stop and return t
Remove easy examples
Add hard examples

Proof
Let C D. If H(, D) C, (C) = (D).
The algorithm terminates.

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 18 / 28
Latent SVM Data-mining hard examples

Data-mining hard examples in LSVM


Feature cache F : set of (i, v) with 1 6 i 6 n and v = (xi , z) with
z Z(xi ) (one for positive examples)
I(F ) examples indexedPby F
LF () = 12 kk2 + C iI(F ) max(0, 1 yi (max(i,v)F .v))

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 19 / 28
Latent SVM Data-mining hard examples

Data-mining hard examples in LSVM


Feature cache F : set of (i, v) with 1 6 i 6 n and v = (xi , z) with
z Z(xi ) (one for positive examples)
I(F ) examples indexedPby F
LF () = 12 kk2 + C iI(F ) max(0, 1 yi (max(i,v)F .v))

Modified stochastic gradient descent


Let t be the learning rate for iteration t
Let i I(F ) be a random example indexed by F
Let vi = argmaxvV (i) .v
Update = t i LD ()

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 19 / 28
Latent SVM Data-mining hard examples

Data-mining hard examples in LSVM


Feature cache F : set of (i, v) with 1 6 i 6 n and v = (xi , z) with
z Z(xi ) (one for positive examples)
I(F ) examples indexedPby F
LF () = 12 kk2 + C iI(F ) max(0, 1 yi (max(i,v)F .v))

Modified stochastic gradient descent


Let t be the learning rate for iteration t
Let i I(F ) be a random example indexed by F
Let vi = argmaxvV (i) .v
Update = t i LD ()

We would like to find a small F such that (F ) = (D(Zp ))


H(, D) = {(i, (xi , zi )) | zi = argmaxzZ(xi ) .(xi , z) and yi (.(xi , zi )) < 1}
E(, D) = {(i, v) F |yi (.v) > 1}
Same procedure
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 19 / 28
Training Models Learning parameters

Outline

Initialization
1 Model
4 Features
2 Latent SVM
5 Post-processing
3 Training Models
Learning parameters 6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 20 / 28
Training Models Learning parameters

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 20 / 28
Training Models Initialization

Outline

Initialization
1 Model
4 Features
2 Latent SVM
5 Post-processing
3 Training Models
Learning parameters 6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 21 / 28
Training Models Initialization

Initialization

Phase 1: Initializing root filters


Split positive examples according to aspect ratio in m groups
Decide area of Fi according to aspect ratio and area
Train the root filter Fi with classical SVM

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 21 / 28
Training Models Initialization

Initialization

Phase 1: Initializing root filters


Split positive examples according to aspect ratio in m groups
Decide area of Fi according to aspect ratio and area
Train the root filter Fi with classical SVM
Phase 2: Merging components
Train mixture of models with no part (latent: component and p0 )

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 21 / 28
Training Models Initialization

Initialization
Phase 1: Initializing root filters
Split positive examples according to aspect ratio in m groups
Decide area of Fi according to aspect ratio and area
Train the root filter Fi with classical SVM
Phase 2: Merging components
Train mixture of models with no part (latent: component and p0 )
Phase 3: Initializing part filters
Initialize 6 rectangles to cover high energy of the root filter
Anchor at center or symmetric according to vertical axis
di = (0, 0, 1, 1)

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 21 / 28
Features HOG, PCA and analytic dimension reduction

Outline

4 Features
HOG, PCA and analytic
1 Model
dimension reduction
2 Latent SVM
5 Post-processing
3 Training Models
6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 22 / 28
Features HOG, PCA and analytic dimension reduction

Features
36-dimensional HOG descriptors (9 orientations, 4 normalizations,
non-contrast sensitive)

11 main eigenvectors
Projection is costly

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 22 / 28
Features HOG, PCA and analytic dimension reduction

Features
36-dimensional HOG descriptors (9 orientations, 4 normalizations,
non-contrast sensitive)

11 main eigenvectors
Projection is costly
Similar results when using 9+4 basis vectors
(18+9)+4=31 for contrast and non-contrast sensitive
Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 22 / 28
Post-processing Bounding box prediction

Outline

4 Features
1 Model
5 Post-processing
Bounding box prediction
2 Latent SVM
Non-Maxima Suppression
Contextual information
3 Training Models
6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 23 / 28
Post-processing Bounding box prediction

Bounding box prediction

Input z: position of each part +


root width
Outputs (x1, y1, x2, y2):
position of the prediction
bounding box

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 23 / 28
Post-processing Bounding box prediction

Bounding box prediction

Input z: position of each part +


root width
Outputs (x1, y1, x2, y2):
position of the prediction
bounding box
How: for each component of a
mixture, 4 linear functions
learned by linear least-square
regression on training data

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 23 / 28
Post-processing Non-Maxima Suppression

Outline

4 Features
1 Model
5 Post-processing
Bounding box prediction
2 Latent SVM
Non-Maxima Suppression
Contextual information
3 Training Models
6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 24 / 28
Post-processing Non-Maxima Suppression

Non-Maxima Suppression

Issue
For one object, there are a lot of overlapping detections

Solution
Sort detections by score
Add the detection one by one and skip if there exists a detection with
overlap of at least 50%

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 24 / 28
Post-processing Contextual information

Outline

4 Features
1 Model
5 Post-processing
Bounding box prediction
2 Latent SVM
Non-Maxima Suppression
Contextual information
3 Training Models
6 Some experimental results

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 25 / 28
Post-processing Contextual information

Contextual information

Rescore the detection score


Best score for k other categories: c(I) = (s1 , s2 , ..., sk )
For a detection (B, s), classify g = ((s), xw1 , yh1 , xw2 , yh2 , c(I))
Learned from training data

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 25 / 28
Some experimental results Models

Outline

4 Features
1 Model
5 Post-processing
2 Latent SVM
6 Some experimental results
Models
3 Training Models
Detections

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 26 / 28
Some experimental results Models

Models

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 26 / 28
Some experimental results Models

Models

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 26 / 28
Some experimental results Detections

Outline

4 Features
1 Model
5 Post-processing
2 Latent SVM
6 Some experimental results
Models
3 Training Models
Detections

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 27 / 28
Some experimental results Detections

Detections

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 27 / 28
Some experimental results Detections

Detections

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 27 / 28
Conclusion

Conclusion

Recent extensions
Speeding-up detection using cascade classifier
Grammar models

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 28 / 28
Conclusion

Conclusion

Recent extensions
Speeding-up detection using cascade classifier
Grammar models

Thanks for your attention.

Any question ?

Philippe Weinzaepfel Latent SVM for Object Detection 1st Feburary 2013 28 / 28

You might also like