Hough transformation and Kalman filter in tracking · 2018-11-20 · Hough transformation...

Preview:

Citation preview

Alessio Piucci

05 April 2017 - HighRR meeting

Hough transformationand Kalman filter in tracking

What today

Alessio Piucci

What you will NOT see today:- sensors- microchips- bonding substrates

So what?Hough transformation examples in tracking and Kalman filter* Hough transformation: what?* Hough transformation: why?* Hough transformation: where?

**Forward Tracking at LHCb* Generalised Hough transformation

** ‘Retina’ algorithm for track reconstruction * bonus track: track fitting

** Kalman fit

1/28

Tracking

Alessio Piucci

Detector:hits from particles

Tracking:combine hits to reconstruct tracks

2/28

Tracking

Detector:hits from particles

Tracking:combine hits to reconstruct tracks

→ find the tracks:pattern recognition

Alessio Piucci 2/28

Tracking

Detector:hits from particles

Tracking:combine hits to reconstruct tracks

→ find the tracks:pattern recognition

→ measure track parameters:track fitting

Alessio Piucci 2/28

Hough transformation

Wikipedia:“Feature extraction technique used in image analysis, computer vision, and digital image processing.”

Original idea“Method and means for recognizing complex patterns”Paul V. C. Hough, U.S. Patent 3,069,654 , 1962Analysis of photographs from bubble chambers

‘Modern’ Hough transform“Use of the Hough Transformation to Detect Lines and Curves in Pictures”R. Duda, P. Hart, Comm. ACN, Vol 15, 1972Vision system for (‘70…) robots

Generalized Hough transform“Generalizing the Hough transform to detect arbitrary shapes”D. H. Ballard, Pattern Recognition, Vol. 13, No. 2, 1981Computer vision

Alessio Piucci 3/28

Hough transformation

Real space(framelet)

Transformed space

point-to-line

x

y

a

b

Alessio Piucci

single real point → family of straight lines → line of (a, b) parameters

4/28

Hough transformation

Real space(framelet)

Transformed space

point-to-line

x

y

a

b

Alessio Piucci

“It is an exact theorem that, if a series of points in a framelet lieon a straight line, the corresponding lines in the plane transform

[sic] intersect in a point” (P. Hough)

single real point → family of straight lines → line of (a, b) parameters

4/28

Hough transformation

Real space(framelet)

Transformed space

point-to-line

x

y

a

b

Alessio Piucci

single real point → family of straight lines → line of (a, b) parameters

5/28

Hough transformation

Real space(framelet)

Transformed space

point-to-line

x

y

a

b

Alessio Piucci

single real point → family of straight lines → line of (a, b) parameters

5/28

Hough transformation

Alessio Piucci

Transformed space

point-to-line

x

y

a

b

single real point → family of straight lines → line of (a, b) parameters

Real space(framelet)

5/28

Hough transformation

Real space(framelet)

Transformed space

point-to-line

x

y

a

b

Alessio Piucci

single real point → family of straight lines → line of (a, b) parameters

point-to-line

single (a, b) point → line on the real space (track!)

5/28

Hough transformation:why?

Alessio Piucci

Hough transf.: robustness

Alessio Piucci

Robust against:- missing points in the real space (→ hit inefficiency)- misalignment of points (→ detector resolution, m. scattering)

a

b

votes

6/30

misalignment

noise

1) real → transf projection2) sum votes

Hough transf.: robustness

Alessio Piucci

Robust against:- missing points in the real space (→ hit inefficiency)- misalignment of points (→ detector resolution, m. scattering)

a

votes

bthr. = 2

cluster size = 4

6/30

1) real → transf projection2) sum votes3) clustering

- clustering threshold- clustering window

misalignment

noise

Hough transf.: parallelization

Alessio Piucci

Parallelization of projections

array of accumulators7/30

Hough transf.: not optimal for...

Alessio Piucci 8/30

It needs ‘enough votes’:few available votes (= few detector planes)

→ sensitive to occupancy, reconstruction of fake lines

(It can be) sensitive to noise

Need exact parametrisation of the space

Complexity rising ~ dn-2 (n = number of parameters n,d = dimension of the real space)

a

bvotes

Hough transformation:where?

Alessio Piucci

Tracking @ LHCb

Alessio Piucci

Hough transformation to reconstruct lines→ pattern recognition in tracking!

9/28

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

10/28

x

zy

B

VELO

T

TT

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

Foward Tracking: VELO(TT) → T extrapolation

x

zy

B

VELO

T

TT

10/28

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

Foward Tracking: VELO(TT) → T extrapolation

x

zy

B

VELO

T

TT

10/28

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

Foward Tracking: VELO(TT) → T extrapolation

x

zy

B

VELO

T

TT

10/28

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

Foward Tracking: VELO(TT) → T extrapolation

x

zy

B

VELO

T

TT

10/28

Forward Tracking

Alessio Piucci

LHCb: bending on xz plane (linear extrapolation on y)→ 2D problem

Foward Tracking: VELO(TT) → T extrapolation

x

zy

B

VELO

T

TT

10/28

Hough clustering in Forward Tracking

Alessio Piucci

You know: track before B + B field

You want: complete track (after B)

B

11/28

Hough clustering in Forward Tracking

Alessio Piucci

B

You know: track before B + B field

You want: complete track (after B)

You need: a single hit after B

11/28

Hough clustering in Forward Tracking

Alessio Piucci

You know: track before B + B field

You want: complete track (after B)

You need: a single hit after BB

Hough-like clusterization:- define a reference plane- project all hits on it- all hits on the same track (...straight line...) cluster together

11/28

Forward Tracking: some more details

Alessio Piucci 12/28

Hough-like clusterization in Forward Tracking:

2-dimensional real space (xz)

1 dimensional transformed space (x, fixed zref

)

12 available votes (detector hits)

transformation: depends on the input VELO track

all hits on T (not true…) must be projected againfor any VELO track

@LHCb Upgrade condition (~ x3.6 tracks wrt LHC Run 2):~ 250 tracks (on SciFi) / event ~ 70 cluster candidates / VELO track

Alessio Piucci

Generalized Hough Transformation

Alessio Piucci

Generalized Hough Transformationsearch for the model in the image?!

Generalized Hough Transform

Alessio Piucci 13/28

Standard Hough transform:- good for low-dimensionality problems- need parametrization of the shape to reconstruct- search for an object described by a model, in the image

Generalized Hough Transform

Alessio Piucci 13/28

Standard Hough transform:- good for low-dimensionality problems- need parametrization of the shape to reconstruct- search for an object described by a model, in the image

Generalized Hough Transform (GHT) idea:Model → templates of the model → template matching

search for the location of the model in the image?!

GHT: get prepared...

Alessio Piucci 14/28

- get your (not analytic) sample shape Ψ(x, y)- define an angle Ω, with n values (Ω

1, Ω

2, …, Ω

n)

x

yΨ(x, y)

Ω1 = 0

Ω2 = 0.1

. . . (x, y)2ac

Ωn = 3.14

GHT: get prepared...

Alessio Piucci 14/28

x

yΨ(x, y)

Ω1 = 0

Ω2 = 0.1

. . . (x, y)2ac

Ωn = 3.14

- get your (not analytic) sample shape Ψ(x, y)- define an angle Ω, with n values (Ω

1, Ω

2, …, Ω

n)

- define r(x, y), θ(x, y) wrt a reference point (x

c, y

c)

(xc, y

c) r

θ

GHT: get prepared...

Alessio Piucci

x

yΨ(x, y)

Ω1 = 0

Ω2 = 0.1

. . . (x, y)2ac

Ωn = 3.14

- get your (not analytic) sample shape Ψ(x, y)- define an angle Ω, with n values (Ω

1, Ω

2, …, Ω

n)

- define r(x, y), θ(x, y) wrt a reference point (x

c, y

c)

- for each point of the shape,compute the gradient direction ω(r, θ)

(xc, y

c)

ω(r, θ)

r

θ

14/28

GHT: get prepared...

Alessio Piucci

- get your (not analytic) sample shape Ψ(x, y)- define an angle Ω, with n values (Ω

1, Ω

2, …, Ω

n)

- define r(x, y), θ(x, y) wrt a reference point (x

c, y

c)

- for each point of the shape,compute the gradient direction ω(r, θ)

- find the closest Ω and fill the table with (r, θ)

x

yΨ(x, y)

(xc, y

c) r

θ

Ω1 = 0 (r, θ)

1a (r, θ)

1b (r, θ)

1c . . .

Ω2 = 0.1 (r, θ)

2a (r, θ)

2b (r, θ)

2c . . .

. . . (x, y)2ac

Ωn = 3.14 (r, θ)

na (r, θ)

nb (r, θ)

nc . . .

“all shape pointswith ω ≈ 0.1”

14/28

ω(r, θ)

Alessio Piucci 15/28

GHT: now use it!

x

yω(x, y)

- for each point of the image (x,y), compute ω(x, y)

- find the closest Ω mapped

Alessio Piucci 15/28

GHT: now use it!

x

yω(x, y)

(r1, θ

1)

(r2, θ

2)

- for each point of the image (x,y), compute ω(x, y)

- find the closest Ω mapped

- retrieve all (ri, θ

j) corresponding to Ω

Alessio Piucci 15/28

GHT: now use it!

x

yω(x, y)

(r1, θ

1)

(r2, θ

2)

(xc1

, yc1

)

(xc2

, yc2

)

- for each point of the image (x,y), compute ω(x, y)

- find the closest Ω mapped

- retrieve all (ri, θ

j) corresponding to Ω

- compute the reference point ( x’c(x, y), y’

c(x, y) )

Alessio Piucci 15/28

GHT: now use it!

x

yω(x, y)

(r1, θ

1)

(r2, θ

2)

(xc1

, yc1

)

(xc2

, yc2

)

- for each point of the image (x,y), compute ω(x, y)

- find the closest Ω mapped

- retrieve all (ri, θ

j) corresponding to Ω

- compute the reference point ( x’c(x, y), y’

c(x, y) )

- reference points from the same modelwill cluster together

Alessio Piucci 15/28

- for each point of the image (x,y), compute ω(x, y)

- find the closest Ω mapped

- retrieve all (ri, θ

j) corresponding to Ω

- compute the reference point ( x’c(x, y), y’

c(x, y) )

- reference points from the same modelwill cluster together

- the local maxima (x’c, y’

c) give you

the positions of the model!

Do you want to rotate and scale?Just use 2 additional parameters

GHT: now use it!

x

y(x

c, y

c)

ω(x, y)

(r1, θ

1)

(r2, θ

2)

(xc1

, yc1

)

(xc2

, yc2

)

Alessio Piucci 16/28

- any non-analytic shape you want

- no exact parametrization needed

- robust against noise/partial deformation of shapes

- handle multiple occurrences of the shape

- ‘easy’ implementation for > 2 dimensions

But...- storage and computation requirements can easily explode...

GHT: pro and cons

Alessio Piucci

‘Retina’ algorithmfor track reconstruction

Conflict of interest:based on my master thesis :)

Alessio Piucci 17/28

‘Retina’ algorithm for tracking

Original idea“An artificial retina for fast track finding”L. Ristori, NIM A, 452 (2000), 2000Inspired by mechanism of visual receptive fields

(D. H. Hubel, T. N. Wiesel, J. Physiol, 148 (1959))

~ variation of the Generalized Hough Transformation

First implementation (*):(software) 2014 – (hardware) on going

(*) A. Abba, P. Marino, M. J. Morello, N. Neri, D. Ninci, A. Piucci, G. Punzi, F. Spinella, L. Ristori, S. Stracka, D. Tonelli

Alessio Piucci 18/28

‘Retina’: mapping

- construct your track phase space

- divide your phase space in cells

u

v

Alessio Piucci 18/28

‘Retina’: mapping

- construct your track phase space

- divide your phase space in cells

- cell = a track in the space = a set of hits in the detector, the receptors

x

x

u

v

Alessio Piucci 18/28

‘Retina’: mapping

z

x

- construct your track phase space

- divide your phase space in cells

- cell = a track in the space = a set of hits in the detector, the receptors

- map your detector with setsof receptors (template of tracks) u

v

Alessio Piucci

‘Retina’: reconstruction

- hit on the detector:only near receptors are excited,with double weight ( exp(-d2/2σ2) )

- sum of responses of receptors

z

x

d

19/28

Alessio Piucci

‘Retina’: reconstruction

z

x

- hit on the detector:only near receptors are excited,with double weight ( exp(-d2/2σ2) )

- sum of responses of receptors

- clusterization: local maxima are tracks

z

x

d

19/28

Alessio Piucci

‘Retina’: reconstruction

z

x

- hit on the detector:only near receptors are excited,with double weight ( exp(-d2/2σ2) )

- sum of responses of receptors

- clusterization: local maxima are tracks

z

x

d

19/28

Alessio Piucci 20/28

‘Retina’: realistic environment

- realistic benchmark:track reconstructionat LHCb Upgrade @ 40 MHz

- 3D tracks in magnetic field: 5D problem

Full LHCb Upgrade MC

Alessio Piucci 21/28

‘Retina’: comments

- offline tracking quality with 25k cells only

- high-parallelizable algorithm, sub-μs latency

- (@ 40 MHz tracking) it requires throughput and bandwidth like hell:only feasible on last-generation FPGA (Stratix 10, Virtex UltraScale)(~150 chips, out bandwidth ~20 Tb/s, switching network = )

- needs deep hardware and software optimisation

Alessio Piucci

Bonus track:track fitting

Alessio Piucci 22/28

Kalman filter

Technique used to extract signal from noisy/missing measurements

“A new approah to linear filtering and prediction problems”R. E. Kálmán, Journal of Basing Engineering, 1960

Widely used in avionics and navigation systems:- Apollo missions- radar systems, to follow targets- cruise missiles, to reach targets- …

Based on Bayesian inference:- have some (a-priori) hypothesis- gain in evidences → update the hypothesis

Alessio Piucci

Kalman fit

a

b

c

x1

x2

23/28

A-priori knowledge:- B map- detector material description

Recursive procedure:a) current state

b) prediction of next state c) update state

Alessio Piucci

Kalman fit

a

b

c

x1

x2

A-priori knowledge:- B map- detector material description

Recursive procedure:a) current state

b) prediction of next state c) update state

23/28

Alessio Piucci

Kalman fit

a

b

c

x1

x2

A-priori knowledge:- B map- detector material description

Recursive procedure:a) current state

b) prediction of next state c) update state

23/28

Alessio Piucci

Kalman fit

a

b

c

x1

x2

A-priori knowledge:- B map- detector material description

Recursive procedure:a) current state

b) prediction of next state c) update state

23/28

Alessio Piucci

Kalman fit

a

b

c

x1

x2

d) smoothingA-priori knowledge:- B map- detector material description

Recursive procedure:a) current state

b) prediction of next state c) update state

23/28

Alessio Piucci 24/28

Kalman fit: formalism

State driven by a linear stochastic process:

State and measurement are related:x = particle statez = measurement

xk+1

= Akx

k + Bu

k + w

k

zk = H

kx

k + v

k

k k+1

Alessio Piucci

Kalman fit: formalism

x = particle statez = measurement

xk+1

= Akx

k + Bu

k + w

k

zk = H

kx

k + v

k w = process noise v = meas. noise

w v

k k+1

State driven by a linear stochastic process:

State and measurement are related:

24/28

Alessio Piucci

Kalman fit: formalism

x = particle statez = measurement

xk+1

= Akx

k + Bu

k + w

k

zk = H

kx

k + v

k

A = k → k+1 state transport matrixH = meas. → state connection matrix

w = process noise v = meas. noise

w v

k k+1

Ak

H

State driven by a linear stochastic process:

State and measurement are related:

24/28

Alessio Piucci

Kalman fit: taxonomy

Bayesian inference approach:

xk+1

, ek+1

= a-priori state estimate and estimate error

→ Pk+1

(ek+1

) estimate error covariance matrix

a-posteriori x’k+1

as linear combination of a-priori xk+1

and weighted

difference of zk+1

measurement and its prediction Hk+1

xk+1

:

K(Hk+1

, Pk+1

, Rk+1

) = gain matrix,

minimizes the a-posteriori error covariance

x’k+1

= xk+1

+ Kk+1

(zk+1

- Hxk+1

)

25/28

Alessio Piucci

Kalman fit: flowchart

a-priori xk , P

k

measurement update1) compute the Kalman gain K

k

2) update the state estimation

3) update the error covariance P’k

prediction1) project the state k → k+1

2) project the error covariance Pk+1

x’k = x

k + K

k(z

k - Hx

k)

xk+1

= Akx

k + Bu

k + w

k

26/28

Alessio Piucci

Kalman fit: comments

- usually gives the best precision:* optimal estimator:

if Gaussian noise → minimises the mean square err of params* if not Gaussian noise → is the best linear estimator

- non linear formulations on the market (extended Kalman fit)

- (really) timing consuming→ code vectorisation, simplified geometry and B propagation

27/28

Alessio Piucci

Final comments

- Hough clustering: powerful technique for pattern recognition* simple (and elegant) idea* fast* starting point for many custom and advanced solutions

- Kalman fit:* statistically solid* ‘standard solution’ for highest precision

Are not unique and universal solutions to life, universe and everything:first evaluate what do you need in your case

→ looking forward to see you at the incomingTrack reconstruction and fitting hands-on!

28/28

Thanks!

Backup

‘Modern’ Hough transform

Alessio Piucci

Original algorithm: problem with vertical lines (in the real space)!

Generalized transform:Hesse normal form

r = x cosθ + y sinθ

x

y

r

θ

real point → sinusoid

LHCb detector

Alessio Piucci

VELO TT TRICH1

RICH2

Muon stations

HCAL

ECAL

Forward Tracking (in reality)

2016 real data, p – Pb collision

Alessio Piucci

Forward Tracking (in reality)

2016 real data, p – Pb collision

Alessio Piucci

Alessio Piucci

‘Retina’: the idea

Biological inspiration:

- visual cortex has specialized neurons (shape, colour, …)→ track templates

- each neuron is sensitive to a small region of the retina→ template the phase space into cells

- strength of the response prop. how close the actual image is to the tune→ weights from templates

Alessio Piucci

‘Retina’: realistic environment

- realistic benchmark:track reconstruction at LHCb Upgrade @ 40 MHz

- 3D tracks in magnetic field: 5D problem

- 2D x 3D factorisation:

(u, v) x (d, z0, k)

main parameters2D pattern recognition

Full LHCb Upgrade MC

perturbationsinterpolation of lateral cells

u

v

Alessio Piucci

Linearized fit

Based on principal component analysis:- take your complex n-dim space- define a linear transformation:

project first m ‘more important’ variables to m axis

Measure a track by m parameters:

pi = p

i(x)

→ pi ≈ p

i(x

0) + w

i * (x – x

0)

x0 = hits from template tracks

wi = pre-calculated constants

nhits

dim space

(nhits

- m) dim plane

Alessio Piucci

Linearized fit: comments

- is just a set of scalar products:highly-parallelizable on hardware (FPGA, GPU)

- suited for fast and precise online track fitting

- complexity of the system case-by-case depending:your detector and physics region defineshow many constants you will need

- it makes really sense only if you perform onlinetracking on hardware

Recommended