55
Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Embed Size (px)

Citation preview

Page 1: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Trackingwith focus on the particle filter

(part II)Michael Rubinstein

IDC

Page 2: 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• Grid-based filter

– Suboptimal approximations• Extended Kalman filter

© Michael Rubinstein

Page 3: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

This talk

• Particle filtering– MC integration– Sequential Importance Sampling (SIS)– Resampling– PF variants

• Multiple-target tracking– BraMBLe: A Bayesian Multiple-Blob Tracker/ Isard,

MacCormick

© Michael Rubinstein

Page 4: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Dynamic System

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

Observation equation:

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

),( 1 kkkk vxfx

kxkf

xvx NNNk RRRf :

kv

),( kkkk wxhz kz

khkw

zwx NNNk RRRh :

© Michael Rubinstein

k-1 k k+1xk-1 xk xk+1

zk-1 zk zk+1

kf

kh

Stochastic diffusion

Page 5: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Recursive Bayes filter

• Prediction:

• Update:

© Michael Rubinstein

11:1111:1 )|()|()|( kkkkkkk dxzxpxxpzxp (1)

)|(

)|()|()|(

1:1

1:1:1

kk

kkkkkk zzp

zxpxzpzxp

kkkkkkk dxzxpxzpzzp )|()|()|( 1:11:1

(2)

Sample space

)|( :1 kk zxp

Page 6: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Particle filtering

• Many variations, one general concept:

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

characterization becomes an equivalent representation of the true pdf

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

© Michael Rubinstein

Sample space

Posterior

Page 7: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Particle filtering

• Compared to methods we’ve mentioned last time– 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

Page 8: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Monte Carlo integration

• Evaluate complex integrals using probabilistic techniques

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

• Also assume there exists some PDF p defined over D

xdxfFD

)(

© Michael Rubinstein

Page 9: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Monte Carlo integration

• Then

• But

• This is true for any PDF p over D!

xdxpxp

xfxdxfF

DD

)(

)(

)()(

pxxp

xfExdxp

xp

xfD

~,)(

)()(

)(

)(

© Michael Rubinstein

Page 10: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Monte Carlo integration

• Now, if we have i.i.d random samples sampled from p, then we can approximate

by

• Guaranteed by law of large numbers:

Nxx

,...,1

)(

)(

xp

xfE

N

i i

iN xp

xf

NF

1 )(

)(1

Fxp

xfEFN

sa

N

)(

)(,

.

© Michael Rubinstein

Page 11: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Importance Sampling (IS)

• What about ? • 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

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

0)( xp

pf /

pf /

© Michael Rubinstein

Importance weights

Importance or proposal density

Page 12: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Convergence of MC integration• Chebyshev’s inequality: let X be a

random variable with expected value μ and std σ. For any real number k>0,

• 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

1}|Pr{|

kkX

2k)2,2(

Pafnuty Lvovich Chebyshev

© Michael Rubinstein

Page 13: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Convergence of MC integration• By Chebyshev’s,

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

yVN

yVN

yVN

yN

VFVN

ii

N

ii

N

iiN

1111][

12

12

1

}

][|][Pr{|

21

NNN

FVFEF

}

][1|Pr{|

21

yV

NFFN

)/1( k

N/1

© Michael Rubinstein

Page 14: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Convergence of MC integration

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

evaluate 4 times as many samples2. Convergence rate is independent of the

integrand dimension!• On contrast, the convergence rate of grid-based

approximations decreases as increases

© Michael Rubinstein

xN

Page 15: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

IS for Bayesian estimation

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

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

Ni

ik

ik wx 1:0 },{

N

i

ikk

ikkk xxwzxp

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

© Michael Rubinstein

kkk

X kk

kkk

kkk

X

k

dxzxqzxq

zxpxf

dxzxpxfXfE

:0:1:0:1:0

:1:0:0

:0:1:0:0

)|()|(

)|()(

)|()())((

Page 16: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

IS for Bayesian estimation

• We draw the samples from the importance 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 17: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Sequential Importance Sampling (SIS)

• FOR i=1:N– Draw– Update weights

• END• Normalize weights

kNi

ik

ik

Ni

ik

ik zwxwx ,},{SIS},{ 1111

),|(~ 1 kikk

ik zxxqx

),|(

)|()|(

1

11

kik

ik

ik

ik

ikki

kik zxxq

xxpxzpww

© Michael Rubinstein

Page 18: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

State estimates

• Any function can be calculated by discrete pdf approximation

)( kxf

N

i

ik

ikk xfw

NxfE

1

)(1

)(

© Michael Rubinstein

MAP Mean

Robust mean• Example:– Mean (simple average)– MAP estimate: particle with

largest weight– Robust mean: mean within

window around MAP estimate

Page 19: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Choice of importance density

© Michael Rubinstein

Hsiao et al.

Page 20: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Choice of importance density

• Most common (suboptimal): the transitional prior

© Michael Rubinstein

)|(),|(

)|()|(

)|(),|(

11

11

11

ikk

ik

kik

ik

ik

ik

ikki

kik

ikkk

ikk

xzpwzxxq

xxpxzpww

xxpzxxq

sN

j

jkk

jkk

ikk

ikki

kk

xzpw

xzpww

11|

1||

)|(

)|(Grid filter weight update:

Page 21: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

The degeneracy phenomenon

• Unavoidable problem with SIS: after a few iterations most particles have negligible weights– Large computational effort for updating particles

with very small contribution to

• Measure of degeneracy - the effective sample size:

– Uniform: , severe degeneracy:

)|( :1 kk zxp

N

i

ik

effw

N1

2)(

1

NNeff 1effN

© Michael Rubinstein

Page 22: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Resampling

• The idea: when degeneracy is above some threshold, eliminate particles with low importance weights and multiply particles with high importance weights

• The new set is generated by sampling with replacement from the discrete representation of such that

NiN

ik

Ni

ik

ik xwx 1

1*1 },{},{

)|( :1 kk zxp jk

jk

ik wxx }Pr{ *

© Michael Rubinstein

Page 23: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Resampling

• Generate N i.i.d variables• Sort them in ascending order • Compare them with the cumulative sum of

normalized weights

Ni

ik

ik

Ni

ik

ik wxwx 11* },{RESAMPLE},{

]1,0[~Uui

Ristic et al.© Michael Rubinstein

Page 24: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Resampling• Complexity: O(NlogN)

– O(N) sampling algorithms exist

© Michael RubinsteinHsiao et al.

Page 25: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Generic PF

• Apply SIS filtering• Calculate• IF

• • END

kNi

ik

ik

Ni

ik

ik zwxwx ,},{PF},{ 1111

kNi

ik

ik

Ni

ik

ik zwxwx ,},{SIS},{ 1111

effN

threff NN N

iik

ik

Ni

ik

ik wxwx 11 },{RESAMPLE},{

© Michael Rubinstein

Page 26: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Generic PF},{ 1Nxik

},{ kik wx

},{ 1* Nxik

},{ 11

Nxik

},{ 11 kik wx

Van der Merwe et al.

Uniformly weighted measureApproximates )|( 1:1 kk zxp

Compute for each particle its importance weight to Approximate

(Resample if needed)

Project ahead to approximate

)|( :11 kk zxp

)|( :1 kk zxp

)|( 1:11 kk zxp© Michael Rubinstein

Page 27: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

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

Page 28: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Sampling Importance Resampling (SIR)

• A.K.A Bootstrap filter, Condensation

© Michael Rubinstein

• Initialize from prior distribution • For k > 0 do

• Resample into • Predict • Reweight• Normalize weights • Estimate (for display)

Ni

ii wx 100 },{

Ni

ik

ik wx 111 },{

Ni

ik Nx 1

*1 }

1,{

0X

)|(~ *11

ikkk

ik xxxpx

)|( ikkk

ik xxzpw

kx̂

Page 29: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Intermission

Questions?

© Michael Rubinstein

Page 30: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Multiple Targets (MTT/MOT)• Previous challenges

– Full/partial occlusions– Entering/leaving the scene– …

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

targets– Interaction between objects

– Many works on multiple single-target filters

© Michael Rubinstein

Page 31: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

BraMBLe: A Bayesian Multiple-Blob Tracker

M. Isard and J. MacCormickCompaq Systems Research Center

ICCV 2001

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

Page 32: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

BraMBLE

• First rigorous particle filter implementation with variable number of targets

• Posterior distribution is constructed over possible object configurations and number

• Sensor: single static camera• Tracking: SIR particle filter• Performance: real-time for 1-2 simultaneous

objects

© Michael Rubinstein

Page 33: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

The BraMBLe posterior

© Michael Rubinstein

)|( :1 kk zxp

State at frame k Image Sequence

Number,Positions,Shapes,Velocities,…

Page 34: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

State space

• Hypothesis configuration:

• Object configuration:

© Michael Rubinstein

),...,,,( 21 mkkkkk xxxmX

),,,( ik

ik

ik

ik

ikx SVX

identifier

position

),( zxX

velocity

),( zx vvV

shape),,,,,,,( swhswf hwwww S

max131 MN x

Page 35: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Object model

• A person is modeled as a generalized-cylinder with vertical axis in the world coords

© Michael Rubinstein

CalibratedCamera),,,,,,,( swhswf hwwww S

)},(),,(),,(),0,{(),( hwhwhwwyr hsswwfii

Page 36: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Observation likelihood

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

© Michael Rubinstein

Y

Cr

Cb Mexican Hat(second deriv of G)

Gaussian

)|( ttp XZ

Page 37: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Observation likelihood

• The response values are assumed conditionally independent given X

© Michael Rubinstein

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

0gl

2gl1gl

3gl

)|( ttp XZ

Page 38: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Appearance models

• GMMs for background and foreground are trained using kmeans

© Michael Rubinstein

Bk Bkg

kggg N

Klz ),(

1)0|p(

Fk

kF

kFgg N

Klz ),(

1)0|p(

4K

16K

Page 39: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Observation likelihood

© Michael Rubinstein

)0|p(

)0|p(log

gg

gg

lz

lz

Page 40: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

System (prediction) model• The number of objects can change:

– 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.

© Michael Rubinstein

r

i

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

'1

'1

nt

nt

nt

nt

nt

nt xmXxmX

)|( 1tt XXp

Predictionfunction Initialization

function

Page 41: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Prediction function

• Motion evolution: damped constant velocity• Shape evolution: 1st order auto-regressive process

model (ARP)

© Michael Rubinstein

1tX 1tV

11 8.0 tt VX

Page 42: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Particles

© Michael Rubinstein

1tX

2tX

1NtX N

tX...N Points:

N Weights:1t

2t

1Nt N

t

Page 43: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Estimate

• Denote the set of existing unique identifiers

© Michael Rubinstein

},...,{ 1 Mt M

Total probability that object i exists

(particle,target)

tX̂

Page 44: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Results

• N=1000 particles• initialization samples always generated

© Michael Rubinstein

Page 45: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Results

• Single foreground model cannot distinguish between overlapping objects – causes id switches

© Michael Rubinstein

Page 46: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Parameters

© Michael Rubinstein

Page 47: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Summary

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

state-space

© Michael Rubinstein

Page 48: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

In practice1. State (object) model2. System (evolution) model3. 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 49: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Thank you!

© Michael Rubinstein

Page 50: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

References

• Beyond the Kalman filter/ Ristic,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 51: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Sequential derivation 1

• Suppose at time k-1, characterize

• We receive new measurement and need to approximate using new set of samples

• We choose q such that

And we can generate new particles

Ni

ik

ik wx 111:0 },{

)|( 1:11:0 kk zxp

kz)|( :1:0 kk zxp

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

),|(~ :11:0 kikk

ik zxxqx

© Michael Rubinstein

Page 52: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Sequential derivation 2

• For the weight update equation, it can be shown 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

kik

ik

ik

ik

ikki

k

kkkkk

kkkkkk

kk

kkik

zxxq

xxpxzpw

zxqzxxq

zxpxxpxzp

zxq

zxpw

© Michael Rubinstein

Page 53: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Sequential derivation 3

• Further, if • Then the weights update rule becomes

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

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

),|(),|( 1:11:0 kkkkkk zxxqzxxq

),|(

)|()|(

1

11

kik

ik

ik

ik

ikki

kik zxxq

xxpxzpww

N

i

ikk

ikkk xxwzxp

1:1 )()|(

(3)

© Michael Rubinstein

Page 54: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

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) alternative:

– i.e. the transitional prior

)|(),|(),|(

11

11ikk

ik

ik

kikkoptk

ikk

xzpwwzxxpzxxq

optq ikw

)|()|(),|(

1

11ikk

ik

ik

ikkoptk

ikk

xzpwwxxpzxxq

© Michael Rubinstein

Page 55: Tracking with focus on the particle filter (part II) Michael Rubinstein IDC

Generic PF

• Resampling reduces degeneracy, but new problems 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