28
1 Tracking Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… Background State space Dynamic systems Recursive Bayesian filters Restrictive cases Kalman filter Gridbased filter Suboptimal approximations Extended Kalman filter © Michael Rubinstein

People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

1

TrackingTrackingwith focus on the particle filter

(part II)

Michael Rubinstein

IDC

Last time…

• Background– State space

– Dynamic systems

– Recursive Bayesian filters

– Restrictive cases• Kalman filter

• Grid‐based filter

– Suboptimal approximations• Extended Kalman filter

© Michael Rubinstein

Page 2: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

2

This talk

• Particle filtering– MC integration

– Sequential Importance Sampling (SIS)

– Resampling

– PF variants

• Multiple‐target trackingMultiple‐target tracking– BraMBLe: A Bayesian Multiple‐Blob Tracker/ Isard, MacCormick

© Michael Rubinstein

Dynamic Systemk‐1 k k+1

xk‐1 xk xk+1kf

kh

State equation:state vector at time instant  kstate transition function, i.i.d process noise

),( 1 kkkk vxfx −=

kxkf xvx NNN

k RRRf →×:kv

zk‐1 zk zk+1Stochastic diffusion

Observation equation: observations at time instant  kobservation function,i.i.d measurement noise

),( kkkk wxhz =kzkhkw

zwx NNNk RRRh →×:

© Michael Rubinstein

Page 3: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

3

Recursive Bayes filter)|( :1 kk zxp

• Prediction:

• Update:∫ −−−−− = 11:1111:1 )|()|()|( kkkkkkk dxzxpxxpzxp (1)

Sample space

© Michael Rubinstein

)|()|()|()|(

1:1

1:1:1

−=kk

kkkkkk zzp

zxpxzpzxp

∫ −− = kkkkkkk dxzxpxzpzzp )|()|()|( 1:11:1

(2)

Particle filtering

• Many variations, one general concept:

Represent the posterior pdf by a set of randomly chosen weighted samples (particles)

Posterior

• Randomly Chosen = Monte Carlo (MC)• As the number of samples become very large – the 

characterization becomes an equivalent representation of the true pdf

© Michael Rubinstein

Sample space

Page 4: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

4

Particle filtering

• Compared to methods we’ve mentioned last timeC bi di ib i– Can represent any arbitrary distribution

– multimodal support

– Keep track of many hypotheses as there are particles

– Approximate representation of complex model rather than exact representation of simplified model

• The basic building‐block: Importance Sampling

© Michael Rubinstein

Monte Carlo integration

• Evaluate complex integrals using probabilistic techniquestechniques

• Assume we are trying to estimate a complicated integral of a function f over some domain D:

xdxfF rr∫= )(

• Also assume there exists some PDF p defined over D

fD∫ )(

© Michael Rubinstein

Page 5: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

5

Monte Carlo integration

• Thenf r )(

• But 

xdxpxpxfxdxfF

DD

rrr

rr∫∫ == )(

)()()(

pxxfExdxpxfD

~,)()()(

)()(

⎥⎦

⎤⎢⎣

⎡=∫ r

rrr

r

r

• This is true for any PDF p over D!

xpxpD )()( ⎥⎦

⎢⎣

© Michael Rubinstein

Monte Carlo integration

• Now, if we have i.i.d random samplesl d f th i t

Nxx rr ,...,1sampled from p, then we can approximate  

by 

• Guaranteed by law of large numbers

⎥⎦

⎤⎢⎣

⎡)()(

xpxfE r

r

∑=

=N

i i

iN xp

xfN

F1 )(

)(1r

r

• Guaranteed by law of large numbers:

FxpxfEFN

sa

N =⎥⎦

⎤⎢⎣

⎡→∞→

)()(,

.

r

r

© Michael Rubinstein

Page 6: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

6

Importance Sampling (IS)

• What about ? 0)( =xp r

• If p is very small,          can be arbitrarily large, ‘damaging’ the average• Design p such that  is bounded

• Rule of thumb: take p similar to f as possible

pf /

pf /

Importance weights

Importance or proposal

• The effect: get more samples in ‘important’ areas of f, i.e. where f is large

© Michael Rubinstein

density

Convergence of MC integration• Chebyshev’s inequality: let X be a           random variable with expected value μ Pafnuty Lvovich random variable with expected value μ        and std σ. For any real number k>0,

• For example for it shows that at least

2

1}|Pr{|k

kX ≤≥− σμ

2=k

yChebyshev

For example, for          , it shows that at least half the values lie in interval 

• Let                ,  then MC estimator is)()(

i

ii xp

xfy = ∑=

=N

iiN y

NF

1

1

2=k)2,2( σμσμ +−

© Michael Rubinstein

Page 7: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

7

Convergence of MC integration• By Chebyshev’s,

δδ

≤⎟⎠⎞

⎜⎝⎛≥− }][|][Pr{|

21

NNN

FVFEF )/1( δ=k

[ ] [ ]yVN

yVN

yVN

yN

VFVN

ii

N

ii

N

iiN

1111][1

21

21

∑∑∑===

==⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡=

δ ⎠⎝NN

δδ

≤⎟⎠⎞

⎜⎝⎛≥− }][1|Pr{|

21

yVN

FFN

• Hence, for a fixed threshold, the error decreases at rate

δ ⎠⎝N

N/1

© Michael Rubinstein

Convergence of MC integration

• Meaning1. To cut the error in half, it is necessary to 

evaluate 4 times as many samples

2. Convergence rate is independent of the integrand dimension!

• On contrast, the convergence rate of grid‐based i ti d iNapproximations  decreases as        increases

© Michael Rubinstein

xN

Page 8: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

8

IS for Bayesian estimation 

kkkX

k

xp

dxzxpxfXfE :0:1:0:0

)|(

)|()())(( ∫=

• We characterize the posterior pdf using a set of samples (particles) and their weights

Ni

ik

ik wx 1:0 },{ =

kkkX kk

kkk dxzxq

zxqzxpxf :0:1:0

:1:0

:1:0:0 )|(

)|()|()(∫=

• Then the joint posterior density at time k is approximated by

∑=

−≈N

i

ikk

ikkk xxwzxp

1:0:0:1:0 )()|( δ

© Michael Rubinstein

IS for Bayesian estimation

• We draw the samples from the importance d it ith i t i ht)|(density     with importance weights

• Sequential update (after some calculation…)

)|( :1:0 kk zxq

)|()|(

:1:0

:1:0

kk

kkik zxq

zxpw ∝

© Michael Rubinstein

),|(~ 1 kikk

ik zxxqx −

Particle update

),|()|()|(

1

11

kik

ik

ik

ik

ikki

kik zxxq

xxpxzpww−

−−=

Weight update

Page 9: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

9

Sequential Importance Sampling (SIS)

[ ] [ ]kNi

ik

ik

Ni

ik

ik zwxwx ,},{SIS},{ 1111 =−−= =

• FOR i=1:N– Draw

– Update weights

• END

• Normalize weights

),|(~ 1 kikk

ik zxxqx −

),|()|()|(

1

11

kik

ik

ik

ik

ikki

kik zxxq

xxpxzpww−

−−=

• Normalize weights   

© Michael Rubinstein

State estimates

• Any function can be calculated by di t df i ti

)( kxfdiscrete pdf approximation

[ ] ∑=

=N

i

ik

ikk xfw

NxfE

1)(1)(

Robust mean• Example:– Mean (simple average)

© Michael Rubinstein

MAP Mean

Mean (simple average)– MAP estimate: particle with largest weight

– Robust mean: mean within window around MAP estimate 

Page 10: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

10

Choice of importance density

© Michael Rubinstein

Hsiao et al.

Choice of importance density

• Most common (suboptimal): the transitional iprior

)|(),|(

)|()|(

)|(),|(

11

11

11

ikk

ik

kik

ik

ik

ik

ikki

kik

ikkk

ikk

xzpwzxxq

xxpxzpww

xxpzxxq

−−

−−

−−

==⇒

=

© Michael Rubinstein

∑=

−=sN

j

jkk

jkk

ikk

ikki

kk

xzpw

xzpww

11|

1||

)|(

)|(Grid filter weight update:

Page 11: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

11

The degeneracy phenomenon

• Unavoidable problem with SIS: after a few it ti t ti l h li ibliterations most particles have negligible weights– Large computational effort for updating particles with very small contribution to 

• Measure of degeneracy ‐ the effective sample )|( :1 kk zxp

g y psize:

– Uniform:  , severe degeneracy: 

∑=

= N

iik

effw

N1

2)(1

NN eff = 1=effN© Michael Rubinstein

Resampling

• The idea: when degeneracy is above some th h ld li i t ti l ith lthreshold, eliminate particles with low importance weights and multiply particles with high importance weights

• The new set is generated by sampling with

NiN

ik

Ni

ik

ik xwx 1

1*1 },{},{ == →

The new set is generated by sampling with replacement from the discrete representation of  such that)|( :1 kk zxp j

kj

kik wxx == }Pr{ *

© Michael Rubinstein

Page 12: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

12

Resampling

G t N i i d i bl[ ] [ ]N

iik

ik

Ni

ik

ik wxwx 11* },{RESAMPLE},{ == =

]10[U• Generate N i.i.d variables

• Sort them in ascending order 

• Compare them with the cumulative sum of normalized weights

]1,0[~ Uui

Ristic et al.© Michael Rubinstein

Resampling

• Complexity: O(NlogN)– O(N) sampling algorithms exist– O(N) sampling algorithms exist

© Michael RubinsteinHsiao et al.

Page 13: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

13

Generic PF

A l SIS filt i[ ] [ ]k

Ni

ik

ik

Ni

ik

ik zwxwx ,},{PF},{ 1111 =−−= =

[ ] [ ]NiiNii }{SIS}{• Apply SIS filtering

• Calculate

• IF

•• END

[ ] [ ]kNi

ik

ik

Ni

ik

ik zwxwx ,},{SIS},{ 1111 =−−= =

effN

threff NN <[ ] [ ]N

iik

ik

Ni

ik

ik wxwx 11 },{RESAMPLE},{ == =

© Michael Rubinstein

Generic PF},{ 1−Nxi

kUniformly weighted measureApproximates )|( 1:1 −kk zxp

},{ kik wx

},{ 1* −Nxik

Compute for each particle its importance weight to Approximate

(Resample if needed)

Project ahead to approximate

)|( :1 kk zxp

},{ 11

−+ Nxi

k

},{ 11 ++ kik wx

Van der Merwe et al.

Project ahead to approximate)|( :11 kk zxp +

)|( 1:11 ++ kk zxp© Michael Rubinstein

Page 14: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

14

PF variants

• Sampling Importance Resampling (SIR)

• Auxiliary Sampling Importance Resampling (ASIR)

• Regularized Particle Filter (RPF)

• Local‐linearization particle filters

• Multiple models particle filters (maneuvering targets)

• …

© Michael Rubinstein

Sampling Importance Resampling (SIR)

• A.K.A Bootstrap filter, Condensation

• Initialize from prior distribution 

• For k > 0 do

• Resample into     

• Predict 

Ni

ii wx 100 },{ =

Ni

ik

ik wx 111 },{ =−−

Ni

ik N

x 1*

1 }1,{ =−

0X

)|(~ *11

ikkk

ik xxxpx −− =

© Michael Rubinstein

• Reweight

• Normalize weights 

• Estimate (for display)

)|( ikkk

ik xxzpw ==

kx̂

Page 15: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

15

Intermission

Questions?

© Michael Rubinstein

Multiple Targets (MTT/MOT)

• Previous challenges– Full/partial occlusionsFull/partial occlusions– Entering/leaving the scene– …

• And in addition– Estimating the number of objects– Computationally tractable for multiple simultaneous targetstargets

– Interaction between objects

– Many works on multiple single‐target filters

© Michael Rubinstein

Page 16: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

16

BraMBLe: A Bayesian Multiple‐Blob Tracker

M. Isard and J. MacCormickhCompaq Systems Research Center

ICCV 2001

Some slides taken from Qi ZhaoSome images taken from Isard and MacCormick

BraMBLE

• First rigorous particle filter implementation with variable number of targetsvariable number of targets

• Posterior distribution is constructed over possible object configurations and number

• Sensor: single static cameraT ki SIR ti l filt• Tracking: SIR particle filter

• Performance: real‐time for 1‐2 simultaneous objects

© Michael Rubinstein

Page 17: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

17

The BraMBLe posterior

)|( 1 kk zxp )|( :1 kk zxp

State at frame k Image Sequence

Number,Positions,Shapes,Velocities,

© Michael Rubinstein

,…

State space

• Hypothesis configuration:

• Object configuration:),...,,,( 21 m

kkkkk xxxmX =

),,,( ik

ik

ik

ik

ikx SVXφ=

identifier shape

max131 MNx +=

© Michael Rubinstein

identifier

position),( zx=X

velocity),( zx vv=V

shape),,,,,,,( swhswf hwwww ααθ=S

Page 18: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

18

Object model

• A person is modeled  as a generalized‐li d ith ti l i i th ldcylinder with vertical axis in the world 

coordsCalibratedCamera),,,,,,,( swhswf hwwww ααθ=S

)},(),,(),,(),0,{(),( hwhwhwwyr hsswwfii αθαθ=

© Michael Rubinstein

Observation likelihood

• Image overlaid with rectangular Grid (e.g. 5 i l )

)|( ttp XZ

pixels)

Y

CrGaussian

© Michael Rubinstein

Cr

Cb Mexican Hat(second deriv of G)

Page 19: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

19

Observation likelihood

• The response values are assumed diti ll i d d t i X

)|( ttp XZ

conditionally independent given X

∏∏ ==g ggg g lzpzp )|()|()|p( XXZ

0=gl1=gl

© Michael Rubinstein

2=glg

3=gl

Appearance models

• GMMs for background and foreground are t i d i ktrained using kmeans

© Michael Rubinstein

Bk Bkg

kggg N

Klz τμ +Δ+Σ== ∑ ),(1)0|p(

FkkF

kFgg N

Klz τμ +Σ=≠ ∑ ),(1)0|p(

4=K

16=K

Page 20: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

20

Observation likelihood

© Michael Rubinstein

⎟⎟⎠

⎞⎜⎜⎝

=

)0|p()0|p(

loggg

gg

lzlz

System (prediction) model

• The number of objects can change:– Each object has a constant probability to remain inλ

)|( 1−tt XXp

Each object has a constant probability        to remain in the scene.

– At each time step, there is constant probability       that a new object will enter the scene.  

,...)~,(,...)~,( 1,1,'1

'1

'1

nt

nt

nt

nt

nt

nt xmXxmX =→= −−−

© Michael Rubinstein

Predictionfunction Initialization

function

Page 21: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

21

Prediction function

• Motion evolution: damped constant velocity

Sh l ti 1st d t i• Shape evolution: 1st order auto‐regressive process model (ARP)

© Michael Rubinstein

1−tX 1−tV

11 8.0 −− + tt VX

Particles1tX 2

tX 1Nt−X N

tX...N Points:

N Weights: 1tπ

2tπ

1Ntπ− N

© Michael Rubinstein

Page 22: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

22

Estimate 

• Denote the set of existing i id tifi

},...,{ 1 Mt ΦΦ=M

tX̂

unique identifiers 

Total probability thatobject Φi exists

(particle,target)

© Michael Rubinstein

Results

• N=1000 particles• initialization samples always generated

© Michael Rubinstein

Page 23: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

23

Results

• Single foreground model cannot distinguish b t l i bj t idbetween overlapping objects – causes id switches

© Michael Rubinstein

Parameters

© Michael Rubinstein

Page 24: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

24

Summary

• The particle filters were shown to produce good approximations under relatively weakapproximations under relatively weak assumptions– can deal with nonlinearities– can deal with non‐Gaussian noise– Multiple hypotheses– can be implemented in O(N)p ( )– easy to implement– Adaptive focus on more probable regions of the state‐space

© Michael Rubinstein

In practice

1. State (object) model2. System (evolution) modely ( )3. Measurement (likelihood) model4. Initial (prior) state5. State estimate (given the pdf)

6. PF specifics1. Importance density2. Resampling method

• Configurations for specific problems can be found in literature

© Michael Rubinstein

Page 25: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

25

Thank you!

© Michael Rubinstein

References

• Beyond the Kalman filter/ Ristic Arulamplam GordonRistic,Arulamplam,Gordon– Online tutorial: A Tutorial on Particle Filters for Online Nonlinear/Non‐Gaussian Bayesian Tracking/ Arulampalam et al 2002

• Stochastic models, estimation and control/ Peter S. Maybeck

• An Introduction to the Kalman Filter/ Greg Welch, Gary Bishop

• Particle filters an overview/ Matthias Muhlich

© Michael Rubinstein

Page 26: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

26

Sequential derivation 1

• Suppose at time k‐1,          characterize  Ni

ik

ik wx 111:0 },{ =−−

)|( zxp• We receive new measurement         and need to approximate                      using new set of samples

• We choose q such that

)|( 1:11:0 −− kk zxpkz

)|( :1:0 kk zxp

)|(),|()|( 1:11:0:11:0:1:0 −−−= kkkkkkk zxqzxxqzxq

And we can generate new particles

),|(~ :11:0 ki

kkik zxxqx −

© Michael Rubinstein

Sequential derivation 2

• For the weight update equation, it can be h th tshown that

And so )|()|()|(

)|()|(

)|()|()|(

1:11:01

1:11:01:1

1:1:0

−−−

−−−

=

kkkkkk

kkkk

kkkkkk

zxpxxpxzp

zxpzzp

xxpxzpzxp

)|()|()|()|(

),|()|()|(

)|(),|()|()|()|(

)|()|(

:11:0

11

1:11:0:11:0

1:11:01

:1:0

:1:0

ki

kik

ik

ik

ikki

k

kkkkk

kkkkkk

kk

kkik

zxxqxxpxzpw

zxqzxxqzxpxxpxzp

zxqzxpw

−−

−−−

−−−

=

==

© Michael Rubinstein

Page 27: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

27

Sequential derivation 3

• Further, if  ),|(),|( 1:11:0 kkkkkk zxxqzxxq −− =

• Then the weights update rule becomes

(and need not store entire particle paths and full history of b i )

),|()|()|(

1

11

kik

ik

ik

ik

ikki

kik zxxq

xxpxzpww−

−−= (3)

observations)

• Finally, the (filtered) posterior density is approximated by ∑

=

−≈N

i

ikk

ikkk xxwzxp

1:1 )()|( δ

© Michael Rubinstein

Choice of importance density

• Choose q to minimize variance of weights

• Optimal choice:

– Usually cannot sample from  or solve for(in some specific cases is works)

• Most commonly used (suboptimal)

)|(),|(),|(

11

11ikk

ik

ik

kikkoptk

ikk

xzpwwzxxpzxxq

−−

−−

∝⇒=

optq ikw

• Most commonly used (suboptimal) alternative: 

– i.e. the transitional prior

)|()|(),|(

1

11ikk

ik

ik

ikkoptk

ikk

xzpwwxxpzxxq

−−

∝⇒=

© Michael Rubinstein

Page 28: People | MIT CSAIL - Tracking1 Tracking with focus on the particle filter (part II) Michael Rubinstein IDC Last time… • Background – State space – Dynamic systems – Recursive

28

Generic PF

• Resampling reduces degeneracy, but new problems ariseproblems arise…

1. Limits parallelization2. Sample impoverishment: particles with high 

weights are selected many times which leads to loss of diversity

– if process noise is small – all particles tend to collapse to single point within few interations

– Methods exist to counter this as well…

© Michael Rubinstein