a discriminatively trained, multiscale, deformable …efros/courses/lbmv09/presentations/...a...

58
A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning Based Methods in Vision February 16, 2009 P. Felzenszwalb, D. McAllester, and D. Ramanan Images taken from P. Felzenszwalb, D. Ramanan, N. Dalal and B. Triggs

Upload: others

Post on 16-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

A Discriminatively Trained, Multiscale, Deformable Part Model

Edward Hsiao

16-721 Learning Based Methods in Vision

February 16, 2009

P. Felzenszwalb, D. McAllester, and D. Ramanan

Images taken from P. Felzenszwalb, D. Ramanan, N. Dalal and B. Triggs

Page 2: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Overview

Page 3: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

• Split detection window into 8x8 non-overlapping pixel regions called cells

• Compute 1D histogram of gradients in each cell and discretize into 9 orientation bins

• Normalize histogram of each cell with the total energy in the four 2x2 blocks that contain that cell -> 9x4 feature vector

• Apply a linear SVM classifier

Page 4: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

9 orientation bins0 - 180° degrees

block

cell

9x4 feature vector per cell

normalizeFeature vector

f = […,…,…, ,…]

Page 5: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

9 orientation bins0 - 180° degrees

block

cell

9x4 feature vector per cell

normalizeFeature vector

f = […,…,…, ,…]

Page 6: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

9 orientation bins0 - 180° degrees

block

cell

9x4 feature vector per cell

normalizeFeature vector

f = […,…,…, ,…]

Page 7: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

9 orientation bins0 - 180° degrees

block

cell

9x4 feature vector per cell

normalizeFeature vector

f = […,…,…, ,…]

Page 8: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

SVM Review

1=⋅ xw

1−=⋅ xw

1=c

1−=c

1)( ≥⋅ ii xwc

1)( subject to 21 minimize 2 ≥⋅ ii xwcw

w2

Page 9: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Hinge Loss))(1 ,0max( ii xwc ⋅−

0)(1 >⋅− ii xwc if incorrectly classified or inside margin

1

1correctly classified

marginalincorrectly classified

))(1 ,0max(minarg1

2 ∑=

⋅−+n

iii

wxwcwλ

Page 10: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

HOG & Linear SVM

not pedestrian

pedestrian

0<⋅ fw

0>⋅ fw

HOG space

Page 11: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Histogram of Oriented Gradients (HOG)

Test image HOG descriptor

Positive components

Negative components

w+

w-

Page 12: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Average Gradients

person car motorbike

Page 13: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Deformable Part Models

Root filter8x8 resolution

Page 14: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Deformable Part Models

Root filter8x8 resolution

Part filter4x4 resolution

Quadratic spatial model

2,

2,,, iiyiixiiyiix ybxbyaxa +++

Page 15: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

HOG Pyramid

),( pHφ concatenation of HOG features in a subwindow of the HOG pyramid H at position p = (x,y,l)

Page 16: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Deformable Part Models

Root filter F0 Part filters P1 …Pn

),,,,( iiiiii basvFP =

score =

filter response part placement

Page 17: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Part Models

),,,,( iiiiii basvFP =

root filter

part filter

iv1,is

2,is

iF

2,

2,,, iiyiixiiyiix ybxbyaxa +++

Quadratic spatial model

iyix bb ,, <

iyix bb ,, =

0≥ib

Page 18: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Star Graph / 1-fan

root filterposition

part filterpositions

Page 19: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Distance Transforms

quadratic distance specified by ai and bi

filter response

part anchor location part position

Page 20: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Quadratic 1-D Distance Transform

Page 21: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Quadratic 1-D Distance Transform

Page 22: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Quadratic 1-D Distance Transform

Page 23: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Distance Transforms in 2-D

input column distance transform

fulldistance transform

Page 24: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Latent SVM

HOG & Linear SVM

)()( xwxfw Φ⋅=

0Fw =

)~,~,~,~, . . . ,~,~,~,~

),),((, . . . ),),((),),(((),(222

12

111

10

nnnn

n

yxyxyxyxpxHpxHpxHzx φφφ=Φ

))(1 ,0max(minarg1

2*i

n

iwi

wxfyww ∑

=

−+= λ

),(max)()(

zxwxfxZzw Φ⋅=

),,...,,,,...,( 110 nnn babaFFw =

)),(()( 0pxHx φ=Φ

Deformable Parts & Latent SVM

))(1 ,0max(minarg1

2*i

n

iwi

wxfyww ∑

=

−+= λ

Page 25: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Semi-convexity

convex in w

∑∑∈∈

++−+=negi

iwposi

iww

xfxfww ))(1 ,0max())(1 ,0max(minarg 2* λ

•If fw(x) is linear in w, this is a standard SVM (convex)

•If fw(x) is arbitrary, this is in general not convex

•If fw(x) is convex in w, the hinge loss is convex for negative examples (semi-convex)- hinge loss is convex in w if positive examples are restricted to single choice of Z(x)

convex

),(max)()(

zxwxfxZzw Φ⋅=

∑∑∈∈

++Φ⋅−+=negi

iwposi

iiw

xfzxwww ))(1 ,0max()),(1 ,0max(minargˆ 2λ

Optimization is now convex!

Page 26: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Coordinate Descent

1. Hold w fixed, and optimize the latent values for the positive examples

2. Hold {zi} fixed for positive examples, optimize w by solving the convex problem

),(maxarg)(

zxwzixZz

i Φ⋅=∈

∑∑∈∈

++Φ⋅−+=negi

iwposi

iiw

xfzxwww ))(1 ,0max()),(1 ,0max(minargˆ 2λ

Page 27: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 28: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 29: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 30: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 31: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 32: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 33: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Data Mining Hard Negatives

positive examplesnegative examples

HOG Space

Page 34: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Model Learning Algorithm

• Initialize root filter

• Update root filter

• Initialize parts

• Update model

Page 35: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Root Filter Initialization

• Select aspect ratio and size by using a heuristic- model aspect is the mode of data- model size is largest size > 80% of the data

• Train initial root filter F0 using an SVM with no latent variables- positive examples anisotropically scaled to aspect and size of filter- random negative examples

Page 36: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Root Filter Update

• Find best scoring placement of root filter that significantly overlaps the bounding box

• Retrain F0 with new positive set

Page 37: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Part Initialization

• Greedily select regions in root filter with most energy

• Part filter initialized to subwindow at twice the resolution

• Quadratic deformation cost initialized to weak Gaussian

Page 38: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Model Update

• Positive examples – highest scoring placement with > 50% overlap with bounding box

• Negative examples – high scoring detections with no target object (add as many as can fit in memory)

• Train a new model using SVM

• Keep only hard examples and add more negative examples

• Iterate 10 times

positive example

hard negative example

Page 39: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Results – PASCAL07 - Person

0.9562 0.87200.9519 0.8298

0.7723 0.7536 0.7186 0.6865

Page 40: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Results – PASCAL07 - Bicycle

1.4806 1.4282 1.3662 1.3189

2.1838 1.81492.1014 1.6054

Page 41: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Results – PASCAL07 - Car

1.1035 1.0645 1.0623 1.0525

1.5663 1.25941.3875 1.1390

Page 42: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Results – PASCAL07 - Horse

-0.4573 -0.5014 -0.5106 -0.5499

-0.3007 -0.4138-0.3946 -0.4254

Page 43: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Results - Person

-1.1999 -0.7230 -0.0189 0.1432 0.3267

So do more realistic images give higher scores?

Page 44: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Superhuman

2.56!

Page 45: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Gradient Domain Editing

gx gx'

gy gy'

Decompose Edit Reconstruct

∂∂

∂∂

=∇yx

,

f(x,y)

gf =∇

gf ∇=∇2

(Solve Poisson Equation)

Page 46: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Generating a “person”

9 orientation bins 18 orientation binsfor positive and negative

Page 47: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Generating a “person”

gx

gy

initial “person”initial orientation bin assignments

Page 48: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Simulated Annealing

highercost

−−=

TccP currentnew )(exp

T is initially high and decreases with number of iterations

Page 49: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Person

Score: 2.56 Score: 0.96

Page 50: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Generated Images

Score: 3.14

Car

Score: 0.84

Horse

Score: 1.57

Score: -0.30

Page 51: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Generated Images

Score: 2.63

Bicycle

Score: 0.80

Cat

Score: 2.18

Score: -0.71

Page 52: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Gradient Erasing

OriginalScore: 0.83

ErasedScore: 2.78

Difference image

Page 53: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Gradient Erasing

OriginalScore: -0.76

ErasedScore: 0.26

Difference image

Page 54: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Gradient Addition

Score: 0.83 Score: 3.03

Page 55: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Gradient Addition

Score: 2.15

Page 56: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Discriminatively Trained Mixtures of Deformable Part Models

P. Felzenszwalb, D. McAllester, and D. Ramanan

http://www.cs.uchicago.edu/~pff/latentSlide taken from P. Felzenszwalb

Page 57: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Questions?

Page 58: A Discriminatively Trained, Multiscale, Deformable …efros/courses/LBMV09/presentations/...A Discriminatively Trained, Multiscale, Deformable Part Model Edward Hsiao 16-721 Learning

Thank You