cascade object detection with deformable part models

58
Cascade Object Detection with Deformable Part Models Pedro Felzenszwalb Ross Girshick University of Chicago David McAllester TTI at Chicago

Upload: others

Post on 23-May-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cascade Object Detection with Deformable Part Models

Cascade Object Detection with Deformable Part Models

Pedro Felzenszwalb Ross GirshickUniversity of Chicago

David McAllesterTTI at Chicago

Page 2: Cascade Object Detection with Deformable Part Models

What we do

We build fast cascade detectors fromstate-of-the-art deformable part models

more than one order of magnitude speedup

UofC-TTI object detection system

Page 3: Cascade Object Detection with Deformable Part Models

Speedup examplesbaseline cascade speedup

bicycle 14.7 sec/image 0.6 sec/image 24x

bus 14.5 sec/image 0.7 sec/image 21x

car 11.9 sec/image 0.9 sec/image 13x

person 12.8 sec/image 1.9 sec/image 7x

PASCAL 2007average

14.5x

Single-threaded implementationsCascade thresholds set for full recall (i.e., “slow mode”)

Average image size: 382 x 471 pixels

Page 4: Cascade Object Detection with Deformable Part Models

Star models

test imagepart-based

deformable model detection

Page 5: Cascade Object Detection with Deformable Part Models

Object hypothesis score

∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 6: Cascade Object Detection with Deformable Part Models

Object hypothesis score

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 7: Cascade Object Detection with Deformable Part Models

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 8: Cascade Object Detection with Deformable Part Models

ai(ω)

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 9: Cascade Object Detection with Deformable Part Models

ai(ω)

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score of root

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 10: Cascade Object Detection with Deformable Part Models

ai(ω)

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

sum over non-root parts

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 11: Cascade Object Detection with Deformable Part Models

ai(ω)

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

score of i-th part at displaced location

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 12: Cascade Object Detection with Deformable Part Models

ai(ω)

Object hypothesis score

δi

ω ∆ set of (dx, dy) part displacements

di(δ) cost of moving i-th part by δ ∈ ∆

Ω set of (x, y, scale) part locations

mi(ω) score of i-th part at ω ∈ Ω

minus cost of i-th displacement

score(ω, δ1, . . . , δn) =

m0(ω)+n

i=1

mi(ai(ω) + δi)− di(δi)

Page 13: Cascade Object Detection with Deformable Part Models

Root location score

Maximize over part displacementsδi

ω

score(ω) = m0(ω) +n

i=1

scorei(ai(ω))

scorei(η) = maxδi∈∆

(mi(η + δi)− di(δi))

Page 14: Cascade Object Detection with Deformable Part Models

Root location score

Maximize over part displacementsδi

ω

anchor position of i-th part

score(ω) = m0(ω) +n

i=1

scorei(ai(ω))

scorei(η) = maxδi∈∆

(mi(η + δi)− di(δi))

Page 15: Cascade Object Detection with Deformable Part Models

Root location score

Maximize over part displacementsδi

ω

optimal appearance/displacement tradeoff

score(ω) = m0(ω) +n

i=1

scorei(ai(ω))

scorei(η) = maxδi∈∆

(mi(η + δi)− di(δi))

Page 16: Cascade Object Detection with Deformable Part Models

Object detection

Using fast distance transforms + dynamic programming

Baseline algorithm: O(pn|Ω|)

is huge, cost to compute , is expensive

Bottleneck in practiceUse a cascade to compute in fewer locations

mi(ω)|Ω|

p

mi(ω)

Detection by thresholding score(ω)

Page 17: Cascade Object Detection with Deformable Part Models

Our object models

mixture of 3 left-right asymmetric star models

comp. 1

comp. 2

comp. 3

root filters 8 part filters deformation costs

Page 18: Cascade Object Detection with Deformable Part Models

Star-cascade ingredients

1. A hierarchy of models defined by a part ordering

2. A sequence of thresholds: → prune

→ prune

→ prune

ω

δ1

δ2

→ prune ω

t = ((t1, t1), . . . , (tn, tn))

m0(ω)?≤ t1

∀δ1 : m0(ω)− d1(a1(ω)⊕ δ1)?≤ t1

m0(ω)− d1(a1(ω)⊕ δ∗1) +m1(a1(ω)⊕ δ∗1)?≤ t2

∀δ2 : m0(ω)− d1(a1(ω)⊕ δ∗1) +m1(a1(ω)⊕ δ∗1)− d2(a2(ω)⊕ δ2)?≤ t2...

Page 19: Cascade Object Detection with Deformable Part Models

Star-cascade algorithm

test image object model+ part ordering

+ thresholds

Page 20: Cascade Object Detection with Deformable Part Models

Star-cascade algorithm

HOG pyramidfrom test image

object model+ part ordering

+ thresholds

Page 21: Cascade Object Detection with Deformable Part Models

Star-cascade algorithm

HOG pyramidfrom test image

object model+ part order+ thresholds

Page 22: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation:

Page 23: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation:

Page 24: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations

Page 25: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations

Page 26: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 27: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 28: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 29: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 30: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 31: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 32: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 33: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: fail

m0(ω) ≥ t1

Page 34: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: pass

m0(ω) ≥ t1

Page 35: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ1) ≥ t1

Page 36: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ1) ≥ t1

Page 37: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ1) ≥ t1

Page 38: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search result: pass

m0(ω)− d1(δ1) ≥ t1

Page 39: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test partial score result: fail

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1) ≥ t2

Page 40: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: pass

m0(ω) ≥ t1

Page 41: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test root locations result: pass

m0(ω) ≥ t1

Page 42: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ1) ≥ t1

Page 43: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ1) ≥ t1

Page 44: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search result: pass

m0(ω)− d1(δ1) ≥ t1

cached!

Page 45: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test partial score result: pass

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1) ≥ t2

Page 46: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1)− d2(δ2) ≥ t3

Page 47: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search result: pass

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1)− d2(δ2) ≥ t3

Page 48: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: displacement search result: pass

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1)− d2(δ2) ≥ t3

Page 49: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: test partial score result: pass

m0(ω)− d1(δ∗1) +m1(ω ⊕ δ∗1)− d2(δ

∗2) +m2(ω ⊕ δ∗2) ≥ t3

Page 50: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test: ...

model:

operation: continue testing remaining parts

Page 51: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test: all tests passed => detection!

model:

operation: report object hypothesis

Page 52: Cascade Object Detection with Deformable Part Models

filter score tables

Root

Part 1

Part 2

m0(ω)

m1(ω)

m2(ω)

Star-cascade algorithm

cascade test:

model:

operation: continue with root locations...

Page 53: Cascade Object Detection with Deformable Part Models

Threshold selection

We want safe and effective thresholds

don’t prune many true positives

but do prune lots of true negatives

Page 54: Cascade Object Detection with Deformable Part Models

PAA thresholds

Probably Approximately Admissible thresholds

P (error(t) > ) ≤ δ

error(t) = Px∼D(cascade-score(t,ω) = score(ω))

min of partial scores over examples in X

provably safe empirically effective

Theorem: |X| ≥ 2n/ ln(2n/δ) =⇒ (, δ)−PAA thresholds

X = IID set of positive examples ∼ D

Page 55: Cascade Object Detection with Deformable Part Models

Example resultshigh recall less recall ⇒ faster

23.2x faster(618ms per/image)

31.6x faster(454ms per/image)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

recall

pre

cisi

on

PASCAL 2007 comp3 class: motorbike

baseline (AP 48.7)cascade (AP 48.9)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

recall

pre

cisi

on

PASCAL 2007 comp3 class: motorbike

baseline (AP 48.7)cascade (AP 41.8)

Page 56: Cascade Object Detection with Deformable Part Models

Simplified part models

‣ PCA of HOG features

‣ Project filters and features onto top 5 PCs (top 5 PCs account for ~ 90% of variance)

‣ Double number of cascade stages

- 1st half: place PCA filters

- 2nd half: replace PCA filters with full filters

‣ ~ 3x speedup (included in previous numbers)

Page 57: Cascade Object Detection with Deformable Part Models

Grammar models

‣ We focus on star models

- simple algorithm & good PASCAL results

‣ We give a cascade algorithm for a general class of grammar models

- trees with variable structure

- but no shared parts

- future work: empirical evaluation

Page 58: Cascade Object Detection with Deformable Part Models

Conclusion

‣ A simple cascade algorithm for star models

- ~ 15x speedup with no loss in AP scores

- > 15x speedup with controlled recall sacrifice

- parallel implementation ⇒ several frames per second

‣ Cascade for a general class of grammar models

‣ Detection is cheaper than scoring parts everywhere

‣ Get the source code from:

http://www.cs.uchicago.edu/~rbg/cascade