35
Object Detection with Deformable Part Models (DPM) Pedro F. Felzenszwalb School of Engineering and Dept. of Computer Science Monday, December 5, 11

Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Object Detection with Deformable Part Models (DPM)

Pedro F. FelzenszwalbSchool of Engineering and Dept. of Computer Science

Monday, December 5, 11

Page 2: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Spring 2012 Course

ENGN2520Pattern Recognition and Machine Learning

Meeting: Tue/Thu 2:30-3:50Instructor: Pedro Felzenszwalb

\We will consider applications in computer vision, signal processing, speech recognition and information retrieval.

Topics include: decision theory, parametric and non-parametric learning, dimensionality reduction, graphical models, exact and approximate inference, semi-supervised learning, generalization bounds and support vector machines.

Prerequisites: basic probability, linear algebra, calculus and some programming experience.

Monday, December 5, 11

Page 3: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Object category detectionGoal: detect all pedestrians, cars, trees, squirrels, ...Object category detection in computer vision

Goal: detect all pedestrians, cars, monkeys, etc in image

Monday, December 5, 11

Page 4: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Why is it hard?

• Objects in a category have highly variable appearance

- Photometric variation

- Viewpoint variation

- Intra-class variability

- Cars come in a variety of shapes (sedan, minivan, etc)

- People wear different clothes and take different poses

Monday, December 5, 11

Page 5: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

PASCAL Challenge

• Objects from 20 categories

- person, car, bicycle, bus, airplane, sheep, cow, table, ...

• Objects are annotated with bounding boxes

Monday, December 5, 11

Page 6: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Monday, December 5, 11

Page 7: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Starting point: sliding window classifiers

Feature vector x = [... , ... , ... , ... ]

• Detect objects by testing each subwindow

- Reduces object detection to binary classification

- Dalal & Triggs: HOG features + linear SVM

Monday, December 5, 11

Page 8: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Histogram of Gradient (HOG) features

• Image is partitioned into 8x8 pixel blocks

• In each block we compute a histogram of gradient orientations

- Invariant to changes in lighting, small deformations, etc.

Monday, December 5, 11

Page 9: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

HOG Filters

• HOG filter is a template for HOG features

• Score is dot product of filter and feature vector

Image pyramid HOG feature pyramid

HOG pyramid H

Score of F at position p is F ⋅ φ(p, H)

filter F

φ(p, H) = HOG features in subwindow specified by p

p

Monday, December 5, 11

Page 10: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Dalal & Triggs: HOG + linear SVMs

Typical form of a model

φ(p, H)

φ(q, H)

There is much more background than objectsStart with random negatives and repeat: 1) Train a model 2) Harvest false positives to define “hard negatives”

Monday, December 5, 11

Page 11: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Deformable part models

• Collection of templates arranged in a deformable configuration

• Each model has global template + part templates

• Fully trained from bounding boxes alone

Monday, December 5, 11

Page 12: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

2 component bicycle model

root filterscoarse resolution

part filtersfiner resolution

deformationmodels

Each component has a root filter F0 and n part models (Fi, vi, di)

Monday, December 5, 11

Page 13: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Object hypothesis

Image pyramid HOG feature pyramid

Multiscale model captures features at two-resolutions

Score is sum of filter scores minus

deformation costs

p0 : location of rootp1,..., pn : location of parts

z = (p0,..., pn)

Monday, December 5, 11

Page 14: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

filters deformation parameters

displacementsscore(p0, . . . , pn) =

n�

i=0

Fi · �(H, pi)�n�

i=1

di · (dx2i , dy2

i )

concatenation of HOG features and part

displacement features

concatenation filters and deformation parameters

score(z) = � · �(H, z)

Score of a hypothesis

“data term” “spatial prior”

Monday, December 5, 11

Page 15: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Matching• Define an overall score for each root location

- Based on best placement of parts

• High scoring root locations define detections

- “sliding window approach”

• Efficient computation

- Dynamic Programming

- Generalized distance transforms (max-convolution)

score(p0) = maxp1,...,pn

score(p0, . . . , pn).

For each part, pick location with high score near ideal location relative to root

Monday, December 5, 11

Page 16: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

head filter

Dl(x, y) = maxdx,dy

�Rl(x + dx, y + dy)� di · (dx2, dy2)

⇥Transformed response

max-convolution, computed in linear time(spreading, local max, etc)

input image

Response of filter in l-th pyramid level

Rl(x, y) = F · �(H, (x, y, l))

cross-correlation

Monday, December 5, 11

Page 17: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

+

x

xx

...

...

...

model

response of root filter

transformed responses

response of part filters

feature map feature map at twice the resolution

combined score of

root locations

color encoding of filter

response values

Monday, December 5, 11

Page 18: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Matching results

(after non-maximum suppression)

~1 second to search all scales on a multi-core computer

Monday, December 5, 11

Page 19: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Learning• Training data: images with bounding boxes

• Need to learn the model structure, filters and deformation costs

Training

Monday, December 5, 11

Page 20: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Latent SVM

LD(�) =12

||�||2 + Cn�

i=1

max(0, 1� yif�(xi))

Minimize

D = (�x1, y1⇥, . . . , �xn, yn⇥)Training data yi ⇥ {�1, 1}

We would like to find β such that: yif�(xi) > 0

Classifiers that score an example x using

β are model parametersz are latent values

f�(x) = maxz�Z(x)

� · �(x, z)

Monday, December 5, 11

Page 21: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Semi-convexity

• Maximum of convex functions is convex

• is convex in β

• is convex for negative examplesmax(0, 1� yif�(xi))

f�(x) = maxz�Z(x)

� · �(x, z)

LD(�) =12

||�||2 + Cn�

i=1

max(0, 1� yif�(xi))

Convex if latent values for positive examples are fixed

Monday, December 5, 11

Page 22: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Latent SVM training

• Convex if we fix z for positive examples

• Optimization:

- Initialize β and iterate:

- Pick best z for each positive example

- Optimize β via gradient descent with data-mining

LD(�) =12

||�||2 + Cn�

i=1

max(0, 1� yif�(xi))

f�(x) = maxz�Z(x)

� · �(x, z)

Monday, December 5, 11

Page 23: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Learning models from bounding boxes

• Reduce to Latent SVM training problem

• Positive example: some z should have high score

• Bounding box defines range of root locations

- Parts can be anywhere

- This defines Z(x)

f�(x) = maxz�Z(x)

� · �(x, z)

Monday, December 5, 11

Page 24: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Background

• Negative example specifies no z should have high score

• One negative example per root location in a “background” image

- Huge number of negative examples

- Consistent with requiring low false-positive rate

f�(x) = maxz�Z(x)

� · �(x, z)

Monday, December 5, 11

Page 25: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

• Sequence of training rounds

- Separate examples based on bounding box aspect ratio (“pose”)

- Train multiple root filters

- Initialize parts from root

- Merge into a mixture

- Train final model

Monday, December 5, 11

Page 26: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

6 component car model

root filterscoarse resolution

part filtersfiner resolution

deformationmodels

2 of 3 symmetric pairs shown

Monday, December 5, 11

Page 27: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

6 component person model1 component from of each symmetric pair

Monday, December 5, 11

Page 28: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Bottle

Cat

Monday, December 5, 11

Page 29: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Car detections

high scoring false positiveshigh scoring true positives

Monday, December 5, 11

Page 30: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Person detections

high scoring true positiveshigh scoring false positives

(not enough overlap)

Monday, December 5, 11

Page 31: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Horse detections

high scoring true positives high scoring false positives

Monday, December 5, 11

Page 32: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Cat detections

high scoring true positives high scoring false positives (not enough overlap)

Monday, December 5, 11

Page 33: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Precision/Recall results on Cars 2010

Monday, December 5, 11

Page 34: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Precision/Recall results on Plants 2010

Monday, December 5, 11

Page 35: Object Detection with Deformable Part Models (DPM) · Learning models from bounding boxes • Reduce to Latent SVM training problem • Positive example: some z should have high score

Comparison of Car models

0 0.1 0.2 0.3 0.4 0.5 0.6 0.70

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

recall

prec

isio

nclass: car, year 2006

1 Root (0.48)2 Root (0.58)1 Root+Parts (0.55)2 Root+Parts (0.62)2 Root+Parts+BB (0.64)

Monday, December 5, 11