API

Gaussian Component

class pymrt.tracking.utils.GaussianComponent(n, weight, mean, cov)

Gaussian Mixture Component

A Gaussian mixture component is composed of weight (\(w\)), mean vector (\(\mu\)), and covariance matrix (\(\Sigma\)). A multivariate Gaussian distribution \(\mathcal{N}(\mu, \Sigma)\) evaluated at position \(x\) is given by

\[f(x) = \frac{1}{\sqrt{(2\pi) ^ k \left| \Sigma \right|}} e^{-\frac{1}{2} (x - \mu) ^ T \Sigma ^ {-1} (x - \mu)} \]

A multivariate Gaussian Mixture Component, denoted \(\mathcal{N}(w, \mu, \Sigma)\) is a equivalent to a multivariate Gaussian distribution with a weight factor, i.e. \(w \mathcal{N}(\mu, \Sigma)\). As a result, a GM evaluated at position \(x\) is given by

\[f_{GM}(x) = w f(x) \]

where \(f(x)\) is the density of a multivariate Gaussian distribution evaluated at location \(x\).

n

int – Dimensionality of the space the Gaussian component is evaluated on.

weight

float – Weight of this Gaussian Component.

mean

numpy.ndarray – Mean vector (column) \(\mu\) of shape (n, 1).

cov

numpy.ndarray – Covariance matrix of shape (n, n).

dmvnorm(x)

Density of multivariate normal distribution evaluated at location x

dmv_part1 calculates

\[\frac{1}{\sqrt{(2\pi) ^ k \left| \Sigma \right|}} e^{-\frac{1}{2} (x - \mu) ^ T \Sigma ^ {-1} (x - \mu)} \]
dmvnormcomp(x)

Density of multivariate GM component evaluated at location x

kalman_update(F, Q)

Update a GM Component based on a linear prediction model.

Assume each target follows a linear Gaussian dynamic model:

\[f_{k|k=1} (x|\eta) = N(x; F_{k-1}\eta, Q_{k-1}) \]

Tracking Models

Constant Velocity Model Base Class

class pymrt.tracking.models.CVModel(n)

Constant Velocity Model

Assume that the target of interest is moving at a constant velocity in a n-dimensional space. The location in the n-dimensional space is observable. Thus the dimensionality of the measurement space is \(n\) and the dimensionality of the state space is \(2n\).

Parameters:n (int) – Dimensionality of space the target is moving in.
n

int – Dimensionality of the space the target is moving in. It is the same as observation space in constant velocity model.

x_dim

int – Dimensionality of state space.

_t

int – Time intervals for each sample.

_F

numpy.ndarray – Dynamic model linear motion multiplier.

_G

numpy.ndarray – Dynamic model linea error multiplier.

w_generator

RandomGenerator – Random generator for state update error estimation.

r_generator

RandomGenerator – Random generator for measurement error estimation.

generate_new_state(x_prime, noise=True, noise_array=None)

Generate new state based on previous state vector $x’$.

Parameters:
  • x_prime (numpy.ndarray) – State vector of size (self.x_dim, ).
  • noise (bool) – Whether the generated state includes disturbance.
  • noise_array (numpy.ndarray) – First order disturbance to the target state. It needs to be a column vector of size \(n\). If it is set to None, the disturbance is generated by w_generator.
Returns:

Next state vector of size

(self.x_dim, ).

Return type:

x (numpy.ndarray)

generate_observation(x_prime, noise=True, noise_array=None)

Generate Observation based on current state vector.

Parameters:
  • x_prime (numpy.ndarray) – State vector of size (self.x_dim, ).
  • noise (bool) – Whether the generated state includes disturbance.
  • noise_array (numpy.ndarray) – First order disturbance to the target state. It needs to be a column vector of size \(n\). If it is set to None, the disturbance is generated by d_generator.
Returns:

Measurement vector of size

(self.z_dim, ).

Return type:

z (numpy.ndarray)

Constant Velocity Model Base Class with Track ID

class pymrt.tracking.models.CVIDModel(n)

Constant Velocity Model with Track ID

Assume that the target of interest is moving at a constant velocity in a n-dimensional space. The location in the n-dimensional space is observable. However, in order to associate observation with a specific target, a track_id field needs to be added to the state vector. Thus the dimensionality of the measurement space is \(n\) and the dimensionality of the state space is \(2n+1\)

Parameters:n (int) – Dimensionality of space the target is moving in.
n

int – Dimensionality of the space the target is moving in. It is the same as observation space in constant velocity model.

x_dim

int – Dimensionality of state space.

_t

int – Time intervals for each sample.

_F

numpy.ndarray – Dynamic model linear motion multiplier.

_G

numpy.ndarray – Dynamic model linea error multiplier.

generate_new_state(x_prime, noise=True, noise_array=None)

Generate new state based on previous state vector $x’$.

Parameters:
  • x_prime (numpy.ndarray) – State vector of size (self.x_dim, ).
  • noise (bool) – Whether the generated state includes disturbance.
  • noise_array (numpy.ndarray) – First order disturbance to the target state. It needs to be a column vector of size \(n\). If it is set to None, the disturbance is generated by w_generator.
Returns:

Next state vector of size

(self.x_dim, ).

Return type:

x (numpy.ndarray)

generate_observation(x_prime, noise=True, noise_array=None)

Generate Observation based on current state vector.

Parameters:
  • x_prime (numpy.ndarray) – State vector of size (self.x_dim, ).
  • noise (bool) – Whether the generated state includes disturbance.
  • noise_array (numpy.ndarray) – First order disturbance to the target state. It needs to be a column vector of size \(n\). If it is set to None, the disturbance is generated by r_generator.
Returns:

Measurement vector of size

(self.z_dim, ).

Return type:

z (numpy.ndarray)

Base Model for GM-PHD

class pymrt.tracking.models.GmPhdModel

Defines the parameters needed for the model to be used with Gaussian-Mixture Probability Hypothesis Density Multi-target Tracking Filter.

birth

list – List of GMs defining the birth probability across the state space.

ps

float – Persistence probability (between 0 to 1)

pd

float – Detection probability (between 0 to 1)

lambda_c

float – Poisson distribution parameter for clutter process (Assume it is a Poission Point Process).

gm_T

float – GM truncate threshold.

gm_U

float – GM merge threshold.

gm_Jmax

int – Max number of GM to track in calculation.

Constant Velocity Model for GM-PHD

class pymrt.tracking.models.GmPhdCvModel(n)

Constant Velocity Model for Gaussian-Mixture Probability Hypothesis Density Filter