theory and implementation of particle filters

26
12 Nov 2004 1 Theory and Implementation of Particle Filters Miodrag Bolic Assistant Professor School of Information Technology and Engineering University of Ottawa [email protected] 12 Nov 2004 2 Big picture Goal: Estimate a stochastic process given some noisy observations Concepts: Bayesian filtering Monte Carlo sampling sensor t Observed signal 1 t Observed signal 2 Particle Filter t Estimation

Upload: api-3855364

Post on 14-Nov-2014

969 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Theory and Implementation of Particle Filters

12 Nov 2004 1

Theory and Implementation of Particle Filters

Miodrag Bolic

Assistant Professor

School of Information Technology and Engineering

University of Ottawa

[email protected]

12 Nov 2004 2

Big picture

Goal: Estimate a stochastic process given some noisy observationsConcepts:

Bayesian filteringMonte Carlo sampling

sensort

Observed signal 1

t

Observed signal 2ParticleFilter

t

Estimation

Page 2: Theory and Implementation of Particle Filters

12 Nov 2004 3

Particle filtering operations

Particle filter is a technique for implementing recursive Bayesian filter by Monte Carlo sampling

The idea: represent the posterior density by a set of random particles with associated weights.

Compute estimates based on these samples and weights

Sample space

Posterior density

12 Nov 2004 4

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

Page 3: Theory and Implementation of Particle Filters

12 Nov 2004 5

Motivation

The trend of addressing complex problems continues

Large number of applications require evaluation of integrals

Non-linear models

Non-Gaussian noise

12 Nov 2004 6

Sequential Monte Carlo Techniques

Bootstrap filtering

The condensation algorithm

Particle filtering

Interacting particle approximations

Survival of the fittest

Page 4: Theory and Implementation of Particle Filters

12 Nov 2004 7

History

First attempts – simulations of growing polymersM. N. Rosenbluth and A.W. Rosenbluth, “Monte Carlo calculation of the average extension of molecular chains,” Journal of Chemical Physics, vol. 23, no. 2, pp. 356–359, 1956.

First application in signal processing - 1993N. J. Gordon, D. J. Salmond, and A. F. M. Smith, “Novel approach to nonlinear/non-Gaussian Bayesian state estimation,” IEE Proceedings-F, vol. 140, no. 2, pp. 107–113, 1993.

BooksA. Doucet, N. de Freitas, and N. Gordon, Eds., Sequential Monte Carlo Methods in Practice, Springer, 2001.B. Ristic, S. Arulampalam, N. Gordon, Beyond the Kalman Filter: Particle Filters for Tracking Applications, Artech House Publishers, 2004.

TutorialsM. S. Arulampalam, S. Maskell, N. Gordon, and T. Clapp, “A tutorial on particle filters for online nonlinear/non-gaussian Bayesian tracking,” IEEE Transactions on Signal Processing, vol. 50, no. 2, pp. 174–188, 2002.

12 Nov 2004 8

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

Page 5: Theory and Implementation of Particle Filters

12 Nov 2004 9

ApplicationsSignal processing

Image processing and segmentation

Model selection

Tracking and navigation

CommunicationsChannel estimation

Blind equalization

Positioning in wireless networks

Other applications1)

Biology & Biochemistry

Chemistry

Economics & Business

Geosciences

Immunology

Materials Science

Pharmacology & Toxicology

Psychiatry/Psychology

Social Sciences

1) A. Doucet, S.J. Godsill, C. Andrieu, "On Sequential Monte Carlo Sampling Methods for Bayesian Filtering", Statistics and Computing, vol. 10, no. 3, pp. 197-208, 2000

12 Nov 2004 10

Bearings-only tracking

The aim is to find the position and velocity of the tracked object.

The measurements taken by the sensor are the bearings or angles with respect to the sensor.

Initial position and velocity are approximately known.

System and observation noises are Gaussian.

Usually used with a passive sonar.

Page 6: Theory and Implementation of Particle Filters

12 Nov 2004 11

Bearings-only trackingStates: position and velocity xk=[xk, Vxk, yk, Vyk]

T

Observations: angle zk

Observation equation: zk=atan(yk/ xk)+vk

State equation: xk=Fxk-1+ Guk

x

y

Trajectory

xk xk+1

ykyk+1

zkzk+1

12 Nov 2004 12

Bearings-only tracking

Blue – True trajectory

Red – Estimates

Page 7: Theory and Implementation of Particle Filters

12 Nov 2004 13

Car positioning

Observations are the velocity and turn information1)

A car is equipped with an electronic roadmap

The initial position of a car is available with 1km accuracy

In the beginning, the particles are spread evenly on the roads

As the car is moving the particles concentrate at one place

1) Gustafsson et al., “Particle Filters for Positioning, Navigation, and Tracking,” IEEE Transactions on SP, 2002

12 Nov 2004 14

Detection of data transmitted over unknown Rayleighfading channelThe temporal correlation in the channel is modeled using AR(r) processAt any instant of time t, the unknowns are , and , and our main objective is to detect the transmitted symbol sequentially

Detection over flat-fading channels

g(t)s(t) y(t)

h(t)

Channel

v(t)

st yt

Sampling

Page 8: Theory and Implementation of Particle Filters

12 Nov 2004 15

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

12 Nov 2004 16

Fundamental concepts

State space representation

Bayesian filtering

Monte-Carlo sampling

Importance sampling

State space model

Solution Problem

Estimate posterior

Difficult to draw samples

Integrals are not tractable

Monte Carlo Sampling

ImportanceSampling

Page 9: Theory and Implementation of Particle Filters

12 Nov 2004 17

Representation of dynamic systems

The state sequence is a Markov random process

State equation: xk=fx(xk-1, uk)

xk state vector at time instant kfx state transition functionuk process noise with known distribution

Observation equation: zk=fz(xk, vk)

zk observations at time instant kfx observation functionvk observation noise with known distribution

12 Nov 2004 18

Representation of dynamic systems

The alternative representation of dynamic system is by densities.

State equation: p(xk|xk-1)

Observation equation: p(zk|xk)

The form of densities depends on:Functions fx(·) and fz(·)

Densities of uk and vk

Page 10: Theory and Implementation of Particle Filters

12 Nov 2004 19

Bayesian Filtering

The objective is to estimate unknown state xk, based on a sequence of observations zk, k=0,1,… .

Objective in Bayesian approach

Find posterior distribution p(x0:k|z1:k)

By knowing posterior distribution all kinds of estimates can be computed:

12 Nov 2004 20

Update and propagate steps

k=0

Bayes theorem

Filtering density:

Predictive density:

)()(

)|()|( 0

0

0000 x

z

xzzx p

p

pp =

PropagateUpdate Propagate PropagateUpdate Update…p(x0)

p(x0|z0) p(x1|z1)p(x1|z0) p(x2|z1) p(xk|zk-1) p(xk|zk) p(xk+1|zk)

z0 z1 z2

∫= 0000101 )|()|()|( xzxxxzx dppp

Page 11: Theory and Implementation of Particle Filters

12 Nov 2004 21

Update and propagate steps

k>0

Derivation is based on Bayes theorem and Markov property

Filtering density:

Predictive density:

)|()|(

)|()|( 1:1

1:1:1 −

= kk

kk

kkkk p

p

pp zx

zz

xzzx

∫ ++ = kkkkkkk dppp xzxxxzx )|()|()|( :11:11

12 Nov 2004 22

Meaning of the densities

Bearings-only tracking problemp(xk|z1:k) posterior

What is the probability that the object is at the location xk for all possible locations xk if the history of measurements is z1:k?

p(xk|xk-1) priorThe motion model – where will the object be at time instant k given that it was previously at xk-1?

p(zk|xk) likelihoodThe likelihood of making the observation zk given that the object is at the location xk.

Page 12: Theory and Implementation of Particle Filters

12 Nov 2004 23

Bayesian filtering - problems

Optimal solution in the sense of computing posterior

The solution is conceptual because integrals are not tractable

Closed form solutions are possible in a small number of situations

Gaussian noise process and linear state space model

Optimal estimation using the Kalman filter

Idea: use Monte Carlo techniques

12 Nov 2004 24

Monte Carlo method

Example: Estimate the variance of a zero mean Gaussian process

Monte Carlo approach:

1. Simulate M random variables from a Gaussian distribution

2. Compute the average

dxxpxv )(2∫+∞

∞−

=

),0(~ 2)( σNx m

∑ ==

M

m

mxM

v1

2)( )(1

Page 13: Theory and Implementation of Particle Filters

12 Nov 2004 25

Importance sampling

Classical Monte Carlo integration – Difficult to draw samples from the desired distributionImportance sampling solution:

1. Draw samples from another (proposal) distribution 2. Weight them according to how they fit the original distribution

Free to choose the proposal densityImportant:

It should be easy to sample from the proposal densityProposal density should resemble the original density as closely as possible

12 Nov 2004 26

Importance sampling

Evaluation of integrals

Monte Carlo approach:

1. Simulate M random variables from proposal density π(x)

2. Compute the average

dxxx

xpxfdxxpxfXfE

XX

)()(

)()()()())(( ππ∫∫ ==

)(~)( xx m π

∑ =≈

M

m

w

m

mm

m

x

xpxf

MxfE

1 )(

)()(

)(

)(

)()(

1))((

43421π

Page 14: Theory and Implementation of Particle Filters

12 Nov 2004 27

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

12 Nov 2004 28

Sequential importance samplingIdea:

Update filtering density using Bayesian filtering

Compute integrals using importance sampling

The filtering density p(xk|z1:k) is represented using

particles and their weights

Compute weights using:

{ }M

mm

km

k wx 1)()( , =

),(

),(

:1)(

:1)(

)(

km

k

km

kmk zx

zxpw

π=

x

Posterior

Page 15: Theory and Implementation of Particle Filters

12 Nov 2004 29

Sequential importance sampling

Let the proposal density be equal to the prior

Particle filtering steps for m=1,…,M:

1. Particle generation

2a. Weight computation

2b. Weight normalization

3. Estimate computation

)|(~ 1)(

−kkm

k xxpx

)|( )()*(1

)*( mkk

mk

mk xzpww −=

∑=

= M

m

mk

mkm

k

w

ww

1

)*(

)*()(

∑=

=M

m

mk

mkkk wxgzxgE

1

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

12 Nov 2004 30

Resampling

Problems:

Weight Degeneration

Wastage of computational resources

Solution ⇒ RESAMPLING

Replicate particles in proportion to their weights

Done again by random sampling

{ }M

mm

km

k

M

m

m

k wxM

x 1)()(

1

)(~

,~1

, ==⎭

⎬⎫

⎩⎨⎧

Page 16: Theory and Implementation of Particle Filters

12 Nov 2004 31

Resampling

M

m

mk M

x1

)(1

1,

=−

⎭⎬⎫

⎩⎨⎧

x

{ }M

mm

km

k wx 1)()( , =

M

m

m

kM

x1

)(~ 1,

=⎭⎬⎫

⎩⎨⎧

M

m

mk M

x1

)(1

1,

=+

⎭⎬⎫

⎩⎨⎧

{ }M

mm

km

k wx 1)(1

)(1 , =++

M

m

m

kM

x1

)(

1

~ 1,

=

+

⎭⎬⎫

⎩⎨⎧

M

m

mk M

x1

)(2

1,

=+

⎭⎬⎫

⎩⎨⎧

12 Nov 2004 32

Particle filtering algorithmInitialize particles

Output

Output estimates

1 2 M. . .

Particlegeneration

New observation

Exit

Normalize weights

1 2 M. . .

Weigthcomputation

Resampling

More observations?

yes

no

Page 17: Theory and Implementation of Particle Filters

12 Nov 2004 33

Bearings-only tracking example

MODEL States:xk=[xk, Vxk, yk, Vyk]

T

Observations: zk

Noise

State equation: xk=Fxk-1+ Guk

Observation equation: zk=atan(yk/ xk)+vk

ALGORITHMParticle generation

Generate M random numbers

Particle computation

Weight computation

Weight normalization

Resampling

Computation of the estimates

)(~

(m)k

m

k(m)k GF uxx +=

),atan( 2)(

)()*(

vmk

mk

km

k x

yzΝw σ−=

),σ~N( u(m)k

20u

),σ~N(v),σ~N( vkuk22 0,0u

{ }M

mm

km

k

M

m

m

k wM 1

)()(

1

)(~

,~1

, ==⎭

⎬⎫

⎩⎨⎧

xx

12 Nov 2004 34

Bearings-Only Tracking Example

Page 18: Theory and Implementation of Particle Filters

12 Nov 2004 35

Bearings-Only Tracking Example

12 Nov 2004 36

Bearings-Only Tracking Example

Page 19: Theory and Implementation of Particle Filters

12 Nov 2004 37

General particle filter

If the proposal is a prior density, then there can be a poor overlap between the prior and posterior

Idea: include the observations into the proposal density

This proposal density minimize

),|(),|( )(1 1 k

mkkkk zxxpzxx

k−=−π

)( )*(mkwVar

12 Nov 2004 38

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

Page 20: Theory and Implementation of Particle Filters

12 Nov 2004 39

Advantages of particle filters

Ability to represent arbitrary densities

Adaptive focusing on probable regions of state-space

Dealing with non-Gaussian noise

The framework allows for including multiple models (tracking maneuvering targets)

12 Nov 2004 40

Disadvantages of particle filters

High computational complexity

It is difficult to determine optimal number of particles

Number of particles increase with increasing model dimension

Potential problems: degeneracy and loss of diversity

The choice of importance density is crucial

Page 21: Theory and Implementation of Particle Filters

12 Nov 2004 41

Variations

Rao-Blackwellization:Some components of the model may have linear dynamics and can be well estimated using a conventional Kalman filter.

The Kalman filter is combined with a particle filter to reduce the number of particles needed to obtain a given level of performance.

12 Nov 2004 42

Variations

Gaussian particle filtersApproximate the predictive and filtering density with Gaussians

Moments of these densities are computed from the particles

Advantage: there is no need for resampling

Restriction: filtering and predictive densities are unimodal

Page 22: Theory and Implementation of Particle Filters

12 Nov 2004 43

Outline

Motivation

Applications

Fundamental concepts

Sample importance resampling

Advantages and disadvantages

Implementation of particle filters in hardware

12 Nov 2004 44

Challenges and results

Challenges Reducing computational complexity

Randomness – difficult to exploit regular structures in VLSI

Exploiting temporal and spatial concurrency

ResultsNew resampling algorithms suitable for hardware implementation

Fast particle filtering algorithms that do not use memories

First distributed algorithms and architectures for particle filters

Page 23: Theory and Implementation of Particle Filters

12 Nov 2004 45

Complexity

4M random number generations

Propagation of the particles

M exponential and arctangent functions

Bearings-only tracking problemNumber of particles M=1000

ComplexityInitialize particles

Output

Output estimates

1 2 M. . .

Particlegeneration

New observation

Exit

Normalize weights

1 2 M. . .

Weigthcomputation

Resampling

More observations?

yes

no

12 Nov 2004 46

Mapping to the parallel architecture

ProcessingElement 1

ProcessingElement 4

ProcessingElement 2

CentralUnit

Start

New observation

Exit

1 2 M. . .

Particle generation

Resampling

1 2 M. . .

Weightcomputation

Propagation of particles

ProcessingElement 3

Processing elements (PE)Particle generation

Weight Calculation

Central UnitAlgorithm for particle propagation

Resampling

1 M

1 M

Page 24: Theory and Implementation of Particle Filters

12 Nov 2004 47

PE 2PE 1 PE 3 PE 4

Propagation of particles

ProcessingElement 1

ProcessingElement 4

ProcessingElement 2

CentralUnit

ProcessingElement 3

Disadvantages of the particle propagation step

Random communication pattern

Decision about connections is not known before the run time

Requires dynamic type of a network

Speed-up is significantly affected

Particles after resampling

p

12 Nov 2004 48

Parallel resampling

1 2

3 4

N=13N=0

N=0 N=3

14

4 1 2

3 4

N=8N=0

N=0 N=8

4

4

1 2

3 4

N=4N=4

N=4 N=4

1

1

1 1

SolutionThe way in which Monte Carlo sampling is performed is modified

Advantages

Propagation is only local

Propagation is controlled in advance by a designer

Performances are the same as in the sequential applications

ResultSpeed-up is almost equal to the number of PEs (up to 8 PEs)

Page 25: Theory and Implementation of Particle Filters

12 Nov 2004 49

PE1

PE2 PE4

PE3

CentralUnit

Architectures for parallel resampling

Controlled particle propagation after resampling

Architecture that allows adaptive connection among the processing elements

12 Nov 2004 50

1

2

4

8

16

32

1

10

100

1000

1 10 100

Number of PEs

Sam

ple

per

iod

(u

s) 500

1000

5000

10000

50000

Virtex II Pro design space

K=14

Number ofparticles M

Limit: Available memory

Limit: Logic blocks

Space explorationHardware platform is Xilinx Virtex-II Pro

Clock period is 10ns

PFs are applied to the bearings-only tracking problem

Page 26: Theory and Implementation of Particle Filters

12 Nov 2004 51

Summary

Very powerful framework for estimating parameters of non-linear and non-Gaussian models

Main research directions Finding new applications for particle filters

Developing variations of particle filters which have reduced complexity

Finding the optimal parameters of the algorithms (number of particles, divergence tests)

ChallengePopularize the particle filter so that it becomes a standard tool for solving many problems in industry