The DPM Detectorfidler/slides/2017/CSC420/lecture19.pdfThe DPM Detector P. Felzenszwalb, R....

Preview:

Citation preview

The DPM Detector

P. Felzenszwalb, R. Girshick, D. McAllester, D. Ramanan

Object Detection with Discriminatively Trained Part Based Models

T-PAMI, 2010Paper: http://cs.brown.edu/

~

pff/papers/lsvm-pami.pdf

Code: http://www.cs.berkeley.edu/

~

rbg/latent/

Sanja Fidler CSC420: Intro to Image Understanding 1 / 53

The HOG Detector

The HOG detector models an object class as a single rigid template

Figure: Single HOG template models people in upright pose.

Sanja Fidler CSC420: Intro to Image Understanding 2 / 53

But Objects Are Composed of Parts

Sanja Fidler CSC420: Intro to Image Understanding 3 / 53

Even Rigid Objects Are Composed of Parts

Sanja Fidler CSC420: Intro to Image Understanding 4 / 53

Objects Are Composed of Deformable Parts

Revisit the old idea by Fischler & Elschlager 1973

Objects are composed of parts at specific relative locations. Our modelshould probably also model object parts.

Di↵erent instances of the same object class have parts in slightly di↵erentlocations. Our object model should thus allow slight slack in part position.

Figure: Objects are a collection of deformable parts[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 5 / 53

The DPM Model

The DPM model starts by borrowing the idea of the HOG detector. It takesa HOG template for the full object. (If you take something that works,things can only get better, right?)

Sanja Fidler CSC420: Intro to Image Understanding 6 / 53

The DPM Model

DPM now wants to add parts. It wants to add them at locations relative tothe location of the root filter. Relative makes sense: if we move, we take ourparts with us.

Sanja Fidler CSC420: Intro to Image Understanding 7 / 53

The DPM Model

Add a part at a relative location and scale.

Sanja Fidler CSC420: Intro to Image Understanding 8 / 53

The DPM Model

Each part has an appearance, which is modeled with a HOG template

Each part’s template is at twice the resolution as the root filter

Sanja Fidler CSC420: Intro to Image Understanding 9 / 53

The DPM Model

Give some slack to the location of the part. Why is this a good idea?

Sanja Fidler CSC420: Intro to Image Understanding 10 / 53

The DPM Model

People are of di↵erent heights, thus have feet at di↵erent locations relativeto the head. And we want to detect all people, not just the average ones.

Sanja Fidler CSC420: Intro to Image Understanding 11 / 53

The DPM Model

People are of di↵erent heights, thus have feet at di↵erent locations relativeto the head. And we want to detect all people, not just the average ones.

Sanja Fidler CSC420: Intro to Image Understanding 11 / 53

The DPM Model

People are of di↵erent heights, thus have feet at di↵erent locations relativeto the head. And we want to detect all people, not just the average ones.

Sanja Fidler CSC420: Intro to Image Understanding 12 / 53

The DPM Model

People are of di↵erent heights, thus have feet at di↵erent locations relativeto the head. And we want to detect all people, not just the average ones.

Sanja Fidler CSC420: Intro to Image Understanding 13 / 53

The DPM Model

We will, however, trust less detections where parts are not exactly in theirexpected location. DPM penalizes part shifts with a quadratic function:

a(x � vx

)2 + b(x � vx

) + c(y � vy

)2 + d(y � vy

)

(here a, b, c , d are weights that are used to penalize di↵erent terms)

Sanja Fidler CSC420: Intro to Image Understanding 14 / 53

The DPM Model

And finally, DPM has a few parts. Typically 6 (but it’s a parameter you canplay with). How many weights does a 6-part DPM model have?

How shall we score this part-model guy in an image (how to do detection)?

Sanja Fidler CSC420: Intro to Image Understanding 15 / 53

Remember the HOG Detector

The HOG detector computes image pyramid, HOG features, and scores eachwindow with a learned linear classifier

[Pic from: R. Girshik]Sanja Fidler CSC420: Intro to Image Understanding 16 / 53

DPM Detector

For DPM the story is quite similar (pyramid, HOG, score window with alearned linear classifier), but now we also need to score the parts.

[Pic from: R. Girshik]Sanja Fidler CSC420: Intro to Image Understanding 17 / 53

Scoring

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 18 / 53

Scoring

More specifically, we will score a location (window) in the image as follows:

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

⇣ nX

i=0

Fi

· HOG (l , pi

)�nX

i=1

w

def

i · (dx , dy , dx2, dy2)⌘

where

F0 is the (learned) HOG template for root filter

Fi

is the (learned) HOG template for part i

HOG (l , pi

) means a HOG feature cropped in window defined by part

location pi

at level l of the HOG pyramid

w

def

i are (learned) weights for the deformation penalty

(dx , dy , dx2, dy2) with (dx , dy) = (xi

, yi

)� ((x0, y0) + v

i

) tell us how

far the part i is from its expected position (x0, y0) + v

i

)

Main question: How shall we compute that nasty maxp1,...,pn?

Sanja Fidler CSC420: Intro to Image Understanding 19 / 53

Scoring

More specifically, we will score a location (window) in the image as follows:

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

⇣ nX

i=0

Fi

· HOG (l , pi

)�nX

i=1

w

def

i · (dx , dy , dx2, dy2)⌘

where

F0 is the (learned) HOG template for root filter

Fi

is the (learned) HOG template for part i

HOG (l , pi

) means a HOG feature cropped in window defined by part

location pi

at level l of the HOG pyramid

w

def

i are (learned) weights for the deformation penalty

(dx , dy , dx2, dy2) with (dx , dy) = (xi

, yi

)� ((x0, y0) + v

i

) tell us how

far the part i is from its expected position (x0, y0) + v

i

)

Main question: How shall we compute that nasty maxp1,...,pn?

Sanja Fidler CSC420: Intro to Image Understanding 19 / 53

Scoring

Push the max inside (why can we do that?):

score(l , p0) = F0 ·HOG (l , p0)+nX

i=1

maxp

i

⇣Fi

·HOG (l , pi

)�w

def

i ·�def

(xi

, yi

)⌘

Sanja Fidler CSC420: Intro to Image Understanding 20 / 53

Scoring

Push the max inside:

score(l , p0) = F0 ·HOG (l , p0)+nX

i=1

maxp

i

⇣Fi

·HOG (l , pi

)�w

def

i ·�def

(xi

, yi

)⌘

We can compute this with dynamic programming. Any idea how?

Sanja Fidler CSC420: Intro to Image Understanding 20 / 53

Computing the Score with Dynamic Programming

Figure: We can compute Fi

· HOG (l , pi

) for the full level l via cross-correlation ofthe HOG feature matrix at level l with the template (filter) F

i

Sanja Fidler CSC420: Intro to Image Understanding 21 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 22 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 23 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 24 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 25 / 53

Computing the Score with Dynamic Programming

Figure: We can compute these scores e�ciently with something called distance transforms

(this is exact). But works equally well: Simply limit the scope of where each part could be to asmall area, e.g., a few HOG cells up,down,left,right relative to yellow spot (this is approx).

Sanja Fidler CSC420: Intro to Image Understanding 26 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 27 / 53

Computing the Score with Dynamic Programming

Sanja Fidler CSC420: Intro to Image Understanding 28 / 53

Detection

[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 29 / 53

Training

You can’t train this model as simple as the HOG detector, via SVM. Forthose taking CSC411: Why not?

Sanja Fidler CSC420: Intro to Image Understanding 30 / 53

Training

You can’t train this model as simple as the HOG detector, via SVM. Forthose taking CSC411: Why not?

Because the part positions are not annotated (we don’t have ground-truth,and SVM needs ground-truth). We say that the parts are latent.

You can train the model with something called latent SVM. For ML bu↵s:

Check the Felzenswalb paperFor those with even stronger ML stomach: Yu, Joachims, LearningStructural SVMs with Latent Variables, ICML’09.

Sanja Fidler CSC420: Intro to Image Understanding 30 / 53

Results

Figure: Performance of the HOG detector on person class on PASCAL VOC

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 31 / 53

Results

Figure: DPM version 1: adds the parts

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 31 / 53

Results

Figure: DPM version 2: adds another template (called mixture or component).Supposed to detect also people sitting down (e.g., occluded by desk).

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 31 / 53

Results

Figure: DPM version 3: adds multiple mixtures (components)

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 31 / 53

Results

[Pic from: R. Girshik]

Sanja Fidler CSC420: Intro to Image Understanding 31 / 53

Learned Models

[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 32 / 53

Learned Models

[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 33 / 53

Learned Models

(Takes some imagination to see a cat...)[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 34 / 53

Results

[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 35 / 53

Results

[Pic from: Felzenswalb et al., 2010]

Sanja Fidler CSC420: Intro to Image Understanding 36 / 53

DPM

As you already know, the code is available:

http://www.cs.berkeley.edu/~rbg/latent/

Trivia:

Takes about 20-30 seconds per image per class. Speed-ups exist.

Depending on the size of the dataset, training takes around 12 hours

(for most PASCAL classes).

Has some cool post-processing tricks: bounding box prediction and

context re-scoring. Each typically results in around 2% improvement in

AP.

In the code, if you switch o↵ the parts, you get the Dalal & Triggs’

HOG detector.

Sanja Fidler CSC420: Intro to Image Understanding 37 / 53

Results

Sanja Fidler CSC420: Intro to Image Understanding 38 / 53

Object Class Detection

Pre 2014

HOG detectorDeformable Part-based Model

Post 2014 (neural networks)

R-CNNFast(er) R-CNNYolo, SSD

[Credit for the slides to follow: Bin Yang]

Sanja Fidler CSC420: Intro to Image Understanding 39 / 53

The CNN Era

[Slide credit: Renjie Liao]

Sanja Fidler CSC420: Intro to Image Understanding 40 / 53

RCNN: Regions with CNN Features

[Slide credit: Ross Girshick]

Sanja Fidler CSC420: Intro to Image Understanding 41 / 53

Training

Sanja Fidler CSC420: Intro to Image Understanding 42 / 53

Training

Sanja Fidler CSC420: Intro to Image Understanding 42 / 53

Training

Sanja Fidler CSC420: Intro to Image Understanding 42 / 53

RCNN: Performance

Sanja Fidler CSC420: Intro to Image Understanding 43 / 53

RCNN: Performance

Sanja Fidler CSC420: Intro to Image Understanding 44 / 53

Faster R-CNN

Sanja Fidler CSC420: Intro to Image Understanding 45 / 53

Region Proposal Network (RPN)

Sanja Fidler CSC420: Intro to Image Understanding 46 / 53

Region Proposal Network (RPN)

Sanja Fidler CSC420: Intro to Image Understanding 47 / 53

Faster R-CNN: Performance

Sanja Fidler CSC420: Intro to Image Understanding 48 / 53

Car Example

[Slide credit: Joseph Chet Redmon]

Sanja Fidler CSC420: Intro to Image Understanding 49 / 53

Car Example

[Slide credit: Joseph Chet Redmon]

Sanja Fidler CSC420: Intro to Image Understanding 49 / 53

Car Example

[Slide credit: Joseph Chet Redmon]

Sanja Fidler CSC420: Intro to Image Understanding 49 / 53

Real Time Object Detection?

Sanja Fidler CSC420: Intro to Image Understanding 50 / 53

YOLO: You Only Look Once

[Slide credit: Redmon J et al. You only look once: Unified, real-time object detection. CVPR’16]

Sanja Fidler CSC420: Intro to Image Understanding 51 / 53

YOLO: Output Parametrization

[Slide credit: Redmon J et al. You only look once: Unified, real-time object detection. CVPR’16]

Sanja Fidler CSC420: Intro to Image Understanding 52 / 53

SSD: Single Shot MultiBox Detector

[Slide credit: Wei L, et al. SSD: Single Shot MultiBox Detector. ECCV’16]

Sanja Fidler CSC420: Intro to Image Understanding 53 / 53

That’s It For CSC420... But There Is Much More ofComputer Vision For Those Interested!

Sanja Fidler CSC420: Intro to Image Understanding 54 / 53

Recommended