# A Bayesian Method for Real-time Unsupervised Detection of Anomalous Road Vehicle Trajectories

Thinh Hoang Dinh, Vincent Martinez, Pierre Maréchal, Daniel Delahaye

► To cite this version:

Thinh Hoang Dinh, Vincent Martinez, Pierre Maréchal, Daniel Delahaye. A Bayesian Method for Real-time Unsupervised Detection of Anomalous Road Vehicle Trajectories. International Journal of Intelligent Transportation Systems Research, 2024, 23 (1), pp.204-218. 10.1007/s13177-024-00446-9. hal-05131413

HAL Id: hal-05131413

https://enac.hal.science/hal-05131413v1

Submitted on 1 Aug 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# A Bayesian Method for Real-time Unsupervised Detection of Anomalous Road Vehicle Trajectories

Thinh Hoang Dinh<fnref n="1" /> Ⓒ · Vincent Martinez<fnref n="2" /> · Pierre Maréchal<fnref n="1" /> · Daniel Delahaye<fnref n="3" />

Received: 30 April 2024 / Revised: 2 November 2024 / Accepted: 12 November 2024 / Published online: 27 November 2024
© The Author(s), under exclusive licence to Intelligent Transportation Systems Japan 2024

## Abstract

Anomaly detection is critical in Intelligent Transportation Systems (ITS) due to its significant impact on safety. This paper introduces a Bayesian probabilistic framework for identifying anomalous trajectories without explicitly modeling anomalies reliably. The framework can be adapted according to the sensor quality, balancing speed and accuracy, and avoids out-of-sample performance issues commonly encountered in deep learning methods. By reducing the dimensionality of time series data using Functional Principal Component Analysis (FPCA), a prior distribution of FPCA scores is learned and continuously updated in an online manner. We conducted numerical experiments to validate the method's effectiveness in detecting common road hazards such as wrong-way driving, over-speeding, and sudden hard-braking. Results demonstrated reliable detection of all tested anomalies with a single detector. Our framework significantly reduced false alarms compared to the Local Outlier Factor (LOF) method, more responsive than Isolation Forest (IF) and successfully mitigated the out-of-sample unpredictability associated with deep learning approaches like VAE-LSTM. Furthermore, it requires low computational resources, making it suitable for implementation across various embedded driving platforms. By addressing the these issues, the method could gain human trust in automated safety systems, accelerating their adoption.

**Keywords** Anomaly-detection · Data-driven · Bayesian statistics · Unsupervised · Dimensionality-reduction · ADAS

## 1 Introduction

With the ongoing rollout of new radar and communica-
tion technologies, an increased amount of information is
expected to be captured, which can subsequently be used in
the design of various Advanced Driving Assistance Systems
(ADAS) aimed at enhancing road safety. Anomaly detec-
tion is central to these safety systems. For instance, through
the Vehicle-to-Everything (V2X) network, the Decentralized
Environmental Notification Messages can be generated that

alert other road users about hazards on the road surface
[4] and reckless driving behaviors [35, 37]. Additionally,
anomaly detection is a crucial component of vehicle veri-
fication systems, such as those for tire condition verification
[18].

Anomaly detection, a well-established field of research,
encompasses a wide array of methodologies suitable for both
univariate and multivariate time series analysis [3]. These
approaches range from simple parametric models [22] to
advanced deep learning frameworks [12], including super-
vised [19, 26], unsupervised [15, 16, 27, 36], and hybrid
learning techniques. While many of these methods have
demonstrated strong performance in terms of accuracy and
responsiveness, they often lack the ability to precisely control
factors such as measurement trustworthiness, which is cru-
cial for optimizing the trade-off between speed and accuracy.
Additionally, the use of sliding windows in many of these
approaches introduces a delay, as the detector must wait for
the window to be fully populated with the measurements.

Deep learning approaches usually achieve state-of-the-art
results in terms of discriminatory power. However, in the con-
text of safety systems, it is imperative that the performance

<footnote>Thinh Hoang Dinh
thinh.hoang-dinh@univ-toulouse.fr</footnote>

<footnote>Vincent Martinez
vincent.martinez@nxp.com</footnote>

<footnote>Pierre Maréchal
pierre.marechal@math.univ-toulouse.fr</footnote>

<footnote>Daniel Delahaye
delahaye@recherche.enac.fr</footnote>

<footnote n="1">¹ Université de Toulouse, Toulouse, France</footnote>

<footnote n="2">² NXP Semiconductors Toulouse, Toulouse, France</footnote>

<footnote n="3">³ École Nationale de l'Aviation Civile, Toulouse,
France</footnote>
of such detectors is guaranteed in unseen scenarios, i.e., in out-of-sample examples. Achieving this with deep neural networks is extremely challenging. Moreover, the industry may prefer solutions that perform well on modest hardware while adhering to strict thermal and power consumption constraints. Furthermore, like all anomaly detectors, these systems must be responsive, with a fast detection time and a low false-detection rate.

Such considerations have motivated this paper to introduce an anomaly detection framework that is capable of real-time trajectory classification, and computationally efficient, adaptable, and reliable, enabling the analysis of performance guarantees and accommodating various sensor types and capabilities. The primary contributions of this paper are as follows:

1. We introduce an unsupervised anomalous trajectory detection framework, with the trajectories represented in FPCA scores, and a Bayesian-based algorithm to perform classification of abnormality of the time series in real-time, as data arrives. The algorithms are recursive, so they are highly efficient with memory consumption and computational complexity.

2. The framework was designed for reliability, in which we allow fine control over sensor and approximation errors, and the trade-off between speed and accuracy. Reliability criteria include responsiveness, false-alarm rates, sensitivity to sensor or approximation error, and out-of-sample (never seen before) generalizability.

3. By avoiding the employment of a sliding window, the detector does not need any “warm-up” time—the time period required for the detector to fill its first window.

4. We demonstrate that many common road hazards such as wrong-way driving, overspeed and aberrant braking can be detected using the same framework with good responsiveness. The unsupervised design of the detector eradicates the need to explicitly model the anomaly as the detector looks for road behaviors that are not commonly observed from the training set.

5. We show through experiments that the detector does not suffer from unpredictable out-of-sample generalization, a problem commonly associated with deep learning approaches due to their black box nature.

The organization of this paper is as follows: Section 2 offers a comprehensive review of the existing literature on anomalous trajectory detection. Section 3 introduces essential background information on FPCA. Section 4 outlines our proposed anomaly detection framework that features a Bayesian method for real-time anomaly detection. Following this, in Section 5, we display a variety of numerical simulations to demonstrate the performance of our algorithm, comparing it to other recognized anomaly detection meth-

ods like LOF, Isolation Forest and VAE-LSTM network. A deeper interpretation and discussion of these results can be found in Section 6. The paper culminates with a conclusion in Section 7.

## 2 Literature Review

In [34], a Bayesian network was developed to predict driver behavior using vehicle trajectories on highways, trained on the NGSIM US-101 dataset [9]. It predicted whether a driver would maintain or change lanes. [6] introduced a graph centrality-based metric to quantify vehicle deviations from neighboring traffic. Game theory was employed in [21] to model strategic driver behaviors. Human driving behavior was analyzed in [31], with driving styles evaluated and predicted using LASSO and linear regression in [7]. In [15], the authors introduced a clustering-based approach using latent vectors to detect anomalies in landing aircraft energy function. [27] proposed outlier detection traffic data by treating the information as a Dirichlet process mixture model.

Regarding deep learning methods, [8] provided a comprehensive review of using deep learning, emphasizing the importance of representations in sequence learning and anomaly detection. In [2], the authors introduced RE-ADTS, an unsupervised method that combines a time-series reconstructor with an anomaly detector, outperforming existing techniques in both batch and real-time scenarios. Similarly, [23] proposed a VAE-LSTM hybrid model, which integrated variational autoencoders and LSTMs to capture both local features and long-term correlations in the data, and demonstrating effectiveness in detecting multi-scale anomalies. In [29], an LSTM-based VAE-GAN framework was proposed. The method jointly trains an encoder, generator, and discriminator for swift and accurate anomaly detection based on reconstruction differences and discrimination results.

Reconstruction-based anomaly detection approaches, like those in [38] and [26], reconstruct trajectories to detect anomalies, using sparse coding and $l_0$ norm regularization, respectively. These methods often require complete data prior to analysis. In contrast, [28] utilized a Bayesian nonparametric approach with Hidden Markov Models for real-time intersection monitoring.

Other techniques include using common basis for time series, such as Fourier and Spline in [20], and PCA for dimensionality reduction in [25] and [17]. Advanced anomaly detection involves machine learning algorithms like Self-Organizing Map Neural Networks were presented in [30] and K-means clustering [14]. Specifically, [14] tracked multiple objects using a fuzzy k-means clustering algorithm and represented motion patterns with Gaussian distributions, while [30] used self-organizing feature maps to learn normal trajectory patterns and identify differences. However, a significant
limitation of these methods is their reliance on complete trajectory data, which prevents real-time, online detection.

The literature indicates that most methods put a strong emphasis on accuracy, with some also addressing reliability. Filtering-based methods, such as those proposed in [15, 16], often excel in terms of responsiveness and reliability. However, the use of sliding windows in these methods requires a warm-up period, during which observations must populate the entire window. Our approach seeks to enhance these methods by eliminating the need for a sliding window, instead performing detection in the time domain using latent space features.

# 3 Background

## 3.1 Functional Principal Component Analysis (FPCA)

Consider trajectories in a set $S$ square-integrable functionals $S = \{f_k(t)\}_{k=1}^{N_v}$ on Hilbert Space $L^2$, it is possible to represent them through the dominant modes of variation which are orthonormal basis corresponding to the eigenvectors of the covariance kernel $K(\cdot, \cdot)$. This subject is treated as per [13, 33].

On $L^2$ space, the covariance kernel is defined as:

$$K(s, t) = \frac{1}{N_v} \sum_{k=1}^{N_v} f_k(s) f_k(t) \qquad (1)$$

The goal of FPCA is to find the orthonormal functional components $V = \{v_j(t)\}_{j=1}^{\infty}$ such that “projections” of $S$ on basis $V$ “spread out” as much as possible. Equivalently saying to maximize the variance of projected functionals, we find $v_j(t)$ such that:

$$\frac{1}{N_v} \sum_{k=1}^{N_v} \langle v_j(t), f_k(t) \rangle^2 \qquad (2)$$

is maximized under the constraint:

$$\langle v_j(t), v_p(t) \rangle = 0, \forall (j, p) : j \neq p \qquad (3)$$

By Mercer's theorem, the covariance kernel admits the following decomposition:

$$K(s, t) = \sum_{i=1}^{\infty} \lambda_j v_j(s) v_j(t) \qquad (4)$$

and it was shown in [32] that the solutions $v_j(t)$ to Eq. 2 are also the solutions to the eigenvalue problem:

$$\langle K(s, t), v_j(t) \rangle = \lambda_j v_j(s) \qquad (5)$$

i.e., the eigenvectors of the covariance kernel. Theoretically, functionals $f_k(t) \in C^\infty$ are infinite-dimensional, but, in practice, we frequently deal with finite, discrete-time series. Two popular methods include (a) approximating $f_k(t)$ with a truncated basis expansion, or (b) opting for a discrete FPCA by approximating the $L^2$ inner product $\langle \cdot, \cdot \rangle$ by a numerical quadrature form. Either way, Eq. 5 becomes a matrix equation and is typically solved by finding the eigenvectors from SVD decomposition (see [13]). The principal component scores (sometimes also called loads) are then obtained via the following formula:

$$a_{ij} = \langle v_j(t), f_i(t) \rangle \qquad (6)$$

and the original functional $f_j(t)$ can be reconstructed, following the Karhunen-Loève theorem:

$$f_i(t) = \sum_{j=0}^{\infty} a_{ij} v_j(t), \quad \text{where } \mathbb{E}[a_{ij}] = 0. \qquad (7)$$

Despite the perfect reconstruction requiring an infinite number of bases, in reality, only several leading FPCA scores are sufficient to approximate the original functional to a high degree of accuracy (Fig. 1). The significant advantage of FPCA is that by construction, the basis is chosen through a precarious manner that allows representations of long time series with vectors of low dimensions in the representation domain, making machine learning methods on this domain extremely efficient. However, it also requires the availability of full-length time series in order to compute the scores per Eq. 6. However, if we assume that $a_{ij}$ follows a multivariate normal distribution, hence $a_{.,j}$ becomes a Gaussian vector that, when lending itself into the linear form of Eq. 7

<figure><img src="image_2.png" /><figcaption>**Fig. 1** Dimensionality Reduction Using FPCA. The darker the color shade, the larger the value of the vector component. After applying the FPCA transformation, only a few leading components possess significant values, while the remaining components are nearly zero. We can nullify these components and retain a vector with a significantly reduced number of dimensions</figcaption></figure>
allows us to design a method for online sequential hypothesis
testing, as data arrives.

# 4 Anomaly Detection Framework

## 4.1 Definition of Anomalous Trajectory

**Definition 4.1** Given a Hilbert-Schmidt integral operator $T$ and a square-integrable trajectory $x(t) \in L^2(\mathbb{R}_+)$. We define $a = Tx$ a representation of $x(t)$.

We can conceptualize the representation of a trajectory sim-
ilarly to performing spectral analysis. In spectral analysis,
a signal is transformed (e.g., using the Fourier Transform),
retaining only the frequencies that account for the majority
of the signal's energy. This process results in a more compact
representation of the signal, which is valuable for statistical
inference. As discussed in Section 3.1, we will use FPCA for
$T$ in the remainder of the paper since it yields the most parsi-
monious representation of the trajectory in terms of energy.

If we assume the trajectories of the vehicles can be
obtained through the following generative process:

1. Sample a set of *representation vectors* from a latent distribution: $a \sim i.i.d. p(a)$.

2. Invert transform the representation vectors $a$ back to the time domain using $T^{-1}$.

Then the anomalous trajectories are the ones whose repre-
sentations did not come from $p(a)$.

**Definition 4.2** The null hypothesis the framework attempts to test is $H_0: d(a_y - \mathbb{E}[a]) > \tau$ with the representation of the trajectory $y(t): a_y = Ty(t)$. In this definition, $d(\cdot, \cdot)$ is some distance measure.

Informally, the framework attempts to test if, with the accu-
mulated evidence so far about $y(t)$, what is the probability
that its representation $a_y$ lies at least $\tau$ distance away from
the mean of $p(a)$. It is important to emphasize that $a_y$ is a
random variable, since $y(t)$ is only partially observed. In this
way, we allow the detector to work with incomplete data to
improve responsiveness.

## 4.2 The Detection Framework

As discussed in Section 1, our detector is designed in a
data-driven manner with the aim of ensuring reliability. The
framework consists of two distinct stages: the learning phase
and the detection phase, as illustrated in Fig. 2. The learn-
ing phase is responsible for achieving unsupervised learning
of nominal trajectories, eliminating the need for explicit
anomaly modeling. FPCA is employed to reduce the dimen-
sionality of the time series trajectories. This reduction results
in a simplified, low-dimensional representation of the trajec-
tories, which facilitates the subsequent fitting of distribution
parameters used in the detection or operation phase. In the

<figure><img src="image_3.png" /><figcaption>**Fig. 2** Outline of the two phases of our detection framework for anomalous time series. The learning phase employs dimensionality reduction for efficient learning of the representation distribution. The detection phase performs real time hypothesis testing of anomalous trajectory</figcaption></figure>
detection phase, in order to achieve high responsive rate, we leverage several design principles from linear signal filters (e.g., Kalman filter) to update the statistic regarding hypothesis $H_0$ (Definition 4.2) in an online, continuous manner. Particularly, observations of the trajectory can be used to compute the likelihood term which, through Bayes' theorem, refines the posterior distribution of the representation vector that most likely explains the observed trajectory. This posterior estimate is then compared with the prior distribution obtained from the learning phase to detect anomaly.

### 4.2.1 Learning Phase

Consider a specific road patch, denoted as $P$, which is presumed to be a rectangular section with dimensions $w \times l$. It's important to note that within this patch, a single traffic mode exists at any given time, implying that the traffic pattern remains homogeneous. An illustrative example of such a patch could be a segment of a carriageway, where vehicles are mandated to maintain the same direction and adhere to a uniform speed limit (refer to Fig. 3). A patch containing two lanes moving in opposite directions would be deemed invalid.

Trajectories of vehicles traversing the designated patch $P$ could be extracted from a security camera like the NGSIM-101 dataset [1] or V2X Cooperative Awareness Message (CAM) traces [5]. This data forms the training set $S = \{(x_k^i, y_k^i), i \in 0, 1, \dots, n, k \in 1, 2, \dots, N_v\}$. It's worth noting that vehicles may pass through the patch $P$ at various speeds, resulting in a significant variance in the lengths of the trajectories. To address this, we analyze the distribution of these lengths, selecting its mode value as $n$. We then adjust the trajectories accordingly: those shorter than $n$ are extended using cubic splines, while longer ones are truncated. The moment a vehicle enters the patch is defined as $i = 0$.

Consider a training set of vehicle trajectories with a consistent temporal length $n$ denoted as $S_x = \{x_k \in \mathbb{R}^n, 1 \le k \le N_v\}$ for the lateral (lane changing) component, and $S_y = \{y_k \in \mathbb{R}^n, 1 \le k \le N_v\}$. We can utilize Discrete FPCA (as detailed in Section III) to determine the FPCA scores (also

<figure><img src="image_4.png" /><figcaption>Fig. 3 Illustration of the road patch of interest $P$. All vehicles should be moving in the same direction within the road patch</figcaption></figure>

referred to as representations) for each individual trajectory [13, 32]. In essence, FPCA converts a time-domain trajectory vector $\mathbb{R}^n$ into a representation vector also of dimension $\mathbb{R}^n$. However, only the first few elements carry significant weight, with the rest approaching zero. Consequently, we only consider the first $m << n$ coefficients to derive the sets of representations $P_x = \{z_{x,k} \in \mathbb{R}^m, 1 \le k \le N_v\}$ and $P_y = \{z_{y,k} \in \mathbb{R}^m, 1 \le k \le N_v\}$ for the lateral and longitudinal components of the trajectory, respectively.

The final step involves fitting a Gaussian distribution, denoted as $p(a|\mathfrak{M})$, onto these representation sets $P_x, P_y$ using the EM algorithm.

## 4.3 Detection Phase

We formalize our problem as follows. An ego-vehicle $E$ traveling near a potential outlier vehicle $O$ and records a series of state observations from $O$ denoted as $\mathbf{x}_{1:n} = [x_1, x_2, \dots, x_n]^\top, n < t_{max}$. The random variable $x_k$ denotes the state observation at time $T_{obs} + (k - 1)T_s$, given that observation starts at $T_{obs}$ and the sampling time is $T_s$. For convenience, suppose $T_{obs} = kT_s, k \in \mathbb{N}$. We also denote $x^i$ as the random variable of observation at $iT_s$.

### 4.3.1 Recursive Computation of Posterior Distribution's Parameters

From earlier discussion, we see that each longitudinal trajectory $\mathbf{x}_k$ corresponds to one FPCA score vector $a_k \in \mathbb{R}^m$. If we define the measurement model:

$$x^i = \mu^{T_{obs}+i} + \sum_{k=1}^{m} a_k \phi_k^{T_{obs}+i} + \epsilon^i \quad (8)$$

where $T_{obs}$ is the time when the first measurement of the nearby vehicle is recorded and $\phi_k$ are the eigenfunctions $v_j$ of the covariance kernel defined in Eq. 4, and the noise term $\epsilon_i \sim i.i.d. N(0, \sigma_\epsilon^2)$. Equation 8 implies:

$$p(x^i|a) = \frac{1}{\sqrt{2\pi}\sigma_{\epsilon}} \exp\left(-\frac{1}{2\sigma_{\epsilon}^2}\left(x^i - \mu^{T_{obs}+i} - \sum_{k=1}^{m} a_k \phi_k^{T_{obs}+i}\right)^2\right)$$

Because the noise $\epsilon_i$ are assumed to be independent samples, we can write:

$$p(x^1, x^2, \dots, x^n|a) \triangleq p(x_{1:n}|a) = \prod_{i=1}^{n} p(x^i|a)$$

The noise term here is a random variable that controls the level of trust the algorithm places on each measurement.
Highly accurate sensor systems will yield small $\sigma_{\epsilon}$, requiring fewer measurements for accurate detection. From Bayes theorem:

$$p(a|x_{1:n}) = \frac{p(x_{1:n}|a)p(a)}{\int_a p(x_{1:n}|a)p(a)da} \quad (9)$$

where $p(a)$ is the prior distribution of FPCA score vectors, which is revealed to be $p(a|\mathfrak{M})$ obtained from the learning phase.

If $p(a)$ is Gaussian, the posterior distribution $p(a|x_{1:n})$ is also Gaussian due to self-conjugacy of Gaussian distribution. The mean and covariance matrix of the posterior can be computed through completion of squares (see prior work [10]). The computation steps are summarized in Algorithm 1, where $\mu_a$, $\Sigma_a$ is the mean and covariance matrix of the prior distribution $p(a)$; $\Phi^{T_{obs}+k} = [\phi_1^{T_{obs}+k}, \phi_2^{T_{obs}+k}, \dots]^{\top}$; $C_{\times}^{T_{obs}+k} = \frac{1}{\sigma_{\epsilon}^2}(\phi^{T_{obs}+k} \otimes \phi^{T_{obs}+k})$ where $\otimes$ being the outer product, and $C_{\dagger}^{T_{obs}+k} = \frac{1}{\sigma_{\epsilon}^2}(-\mu^{T_{obs}+k} + \chi^{T_{obs}+k})\phi^{T_{obs}+k}^{\top}$.

**Algorithm 1 Recursive Computation of Posterior Distribution Parameters.**

1: initialize $\Sigma_a^{-1} \leftarrow \Sigma_a^{-1}$, $\mu_a^{*'} \leftarrow \Sigma_a^{-1}$.

2: for $T_{obs} \in \mathbb{N}$ do

3: if data arrives then

4: $\Sigma_a^{-1} \leftarrow \Sigma_a^{-1} + \frac{1}{\sigma_{\epsilon}^2}(\phi^{T_{obs}+k} \otimes \phi^{T_{obs}+k})$

5: $\mu_a^{*'} \leftarrow \mu_a^{*'} + \frac{1}{\sigma_{\epsilon}^2}(-\mu^{T_{obs}+k} + \chi^{T_{obs}+k})\phi^{T_{obs}+k}^{\top}$

6: $\mu_a^{*} \leftarrow \Sigma_a^{*} \mu_a^{*'}$

7: end if

8: end for

9: return $\max_{T_{obs}} L_{\mathfrak{M}}$

<caption>**Fig. 4** Density function of two 2D Gaussian latent distributions $p(a^*)$ and $p(R^{-1/2}a^*)$. The latent representation $A$ is identified as an anomaly due to its substantial distance from the cluster's centroid</caption>

### 4.3.2 Hypothesis Testing of $H_0$

As discussed in Section 4.1, a trajectory is considered if its representation lies far away from the centroid of the representation's distribution, which also coincides with its mean in the Gaussian case. If we choose $d$ the Mahalanobis distance parametrized by the covariance of $p(a)$: $\Sigma_a$, we can rewrite Definition 4.2 for Hypothesis $H_0$ as follows:

**Definition 4.3** A trajectory is defined as abnormal if the Mahalanobis distance from its FPCA representation $a^*$ in Eq. 7 to the prior distribution of FPCA vectors $p(a)$ is larger than some threshold $\hat{d}$:

$$||a^* - \mathbb{E}[a]||_{\Sigma_a} \geq \hat{d}, \quad (10)$$

and from the Karhunen-Loève theorem, it is known that $\mathbb{E}[a] = 0$, thus the definition is equivalent to:

$$||a^*||_{\Sigma_a} \geq \hat{d}. \quad (11)$$

The condition described by Definition 4.3 can be equivalently understood as a two-step process: (i) transforming the Euclidean space $\mathbb{R}^m$ by a linear operator defined by $R = \Sigma_a^{-1/2}$ and (ii) on this new space, the transformed vector $\Sigma_a^{-1/2}a^*$ lies within the circle whose diameter is $\hat{d}$ (Fig. 4).

Let $Q = R^{-1}$. Conditioned on past observations $x_{1:n}$, we have the posterior estimate of $a^* \sim N(\mu_a^*, \Sigma_a^*)$ where $\mu_a^*$ and $\Sigma_a^*$ are computed recursively from Algorithm 1. Like before, we introduce a transformed latent representation $c^* = R^{-1}a^*$ whose prior is the multivariate normal distribution $N(0, I)$:

$$c^* \sim N(Q\mu_a^*, Q\Sigma_a^*Q^{\top})$$

<figure><img src="image_5.png" /></figure>
We further define:

$$Q^* = (Q \Sigma_a^* Q^\top)^{1/2}$$

then the random variable:

$$v = Q^{*-1}(c^* - Q\mu_a^*)$$

is a normal random vector. Equivalently:

$$c^* = Q^*v + Q\mu_a^*,$$

which leads to:

$$ \begin{aligned} c^{*\top}c^* &= (Q^*v + Q\mu_a^*)^\top(Q^*v + Q\mu_a^*) \\ &= v^\top Q^{*\top}Q^*v + 2\mu_a^{*\top}Q^\top Q^*v \\ &\quad + \mu_a^{*\top}Q^\top Q\mu_a^* \end{aligned} \qquad (12) $$

This expression bears the form of a Generalized Chi-Squared random variable $x^\top Q_2 x + q_1^\top x + q_0$ and a closed form analytical solution generally does not exist. However, note that as $\Sigma_a^* \to 0$ and $Q$ is full rank, the second order term converges to zero faster than the first order term. Hence, as $\Sigma_a^*$ is sufficiently small:

$$c^{*\top}c^* \approx 2\mu_a^{*\top}Q^\top Q^*v + \mu_a^{*\top}Q^\top Q\mu_a^* \qquad (13)$$

which is simply a Gaussian distribution with parameters:

$$\mu_p = \mu_a^{*\top} Q^\top Q \mu_a^* \qquad (14)$$

$$\sigma_p^2 = 4\mu_a^{*\top} Q^\top Q^* Q^{*\top} Q\mu_a^* \qquad (15)$$

and the nominal p-value is:

$$p_n = F_N \left( \frac{d^2 - \mu_p}{\sigma_p} \right) \qquad (16)$$

where $F_N$ is the CDF of a normal distribution.

### Algorithm 2 Bayesian Anomaly Detection in FPCA Score Domain.

1: initialize $\Sigma_a^{*-1} \leftarrow \Sigma_a^{-1}$, $\mu_a^{*\prime} \leftarrow \Sigma_a^{-1}$ from the Learning Phase.

2: **for** $T_{obs} \in \mathbb{N}$ **do**

3: **if** data arrives **then**

4: update $\Sigma_a^{*-1}$, $\mu_a^{*\prime}$ according to Algorithm 1.

5: compute p-value from Eq. 16.

6: **if** p value < threshold **then**

7: trigger anomaly alarm

8: **end if**

9: **end if**

10: **end for**

We summarize the detection process in Algorithm 2. The algorithm requires specifying a threshold value for triggering of the alarm. We usually set this value at 0.05, implying that if the detector is confident with 95% probability that the underlying representation of the trajectory is located at the distance at least $\hat{d}$ away from the expectation of the distribution.

# 5 Numerical Results

## 5.1 Data Preparation

The NGSIM US-101 dataset [9] comprises genuine vehicle trajectories collected from traffic cameras installed along a section of the US-101 highway in California. Each trajectory has a temporal resolution of up to 100 milliseconds, which is sufficiently precise for macroscopic traffic modeling. The dataset includes labels that extend beyond mere vehicle positions and timestamps to encompass vehicle dimensions (length and width), the lane the vehicle occupies, and measurements such as headway, headway distance, and time with respect to leading vehicles.

We used the Local_X and Local_Y fields in the dataset, which represent the position of the vehicle's center relative to the highway's geometry. Missing data were managed through interpolation of the nearest values. For the position values, the data were used as is. However, for the velocity values, a moving average filter with a window size of 5 was applied to reduce noise.

In practical applications, the learning phase should be continuously active. The mean trajectory can be derived either from the ego-vehicle's own trajectory data or by averaging multiple trajectories collected by the vehicle's onboard radar systems. For efficient transmission, only the diagonal elements of the covariance matrix need to be shared. These elements can be computed by a central facility leveraging trajectory data extracted from traffic cameras, following the algorithm detailed in this section. We refer to [10] for an example involving V2X network to collect and compute such data.

We defined the road patch $P$ whose width spans all the lanes and length is 900ft ($\approx$ 274m) and randomly collected 200 vehicle trajectories passing through $P$. Let $t_M$ be the mode of the distribution of trajectories length in $S$. Because the Discrete FPCA required a time series of equal length, the outliers significantly longer or shorter than $t_M$ were removed. Those that fell within the acceptable range of $\pm 10$ time steps were either trimmed or extrapolated with a second-order cubic spline to meet the requirement (see Fig. 5a).

To underscore the findings, we compare the results with those obtained using the well-established Local Outlier Factor (LOF), Isolation Forest (IF), marginal likelihood [10]
<figure><img src="image_6.png" /><figcaption>**Fig. 5** All longitudinal trajectories of vehicles from the NGSIM dataset (a) and (b) the FPCA components f1, f2 of Eq. 6. The top shows the mean component, and the bottom shows the FPCA components used to dimensionally reduce the trajectories to 2D representations in Fig. 8</figcaption></figure>

and the deep-learning based VAE-LSTM network [23] for anomaly detection. The implementations for LOF and IF are straightforward. The implementation of the VAE-LSTM network is given in Appendix A1.

Despite having access to all measurements, the LOF method accurately identified only the second (speeding) and fourth (wrong-way driving) trajectories (Fig. 6), failing to detect the anomaly of a vehicle that suddenly stopped. Additionally, the progression of LOF curves as measurements became sequentially available indicated a susceptibility to false alarms with this approach. We also compared our results against the prior work of [10], which employed the marginal likelihood instead of the posterior distribution parameters to test the anomalous time-series hypothesis. In both [10] and this paper, the detection threshold $\hat{d}$ is set to the same value. Our current Bayesian method appeared to be less respon-

sive compared to the marginal likelihood method [10], but it did not suffer from the instability problem caused by reconstruction error due to FPCA. We also noted that the deep learning-based VAE-LSTM performed well in detecting all anomalous trajectories, but it required a small delay at the beginning, and a dilemma regarding its capability to generalize well to out-of-sample trajectories, hindering its ability to detect these types of examples (Fig. 7).

## 5.2 Learning the Nominal Distribution

The discrete FPCA process, described in Section 3.1 revealed that the first two principal components (Fig. 5b) explained up to 99.67% of variance in the dataset. This allowed us to assume that the first two FPCA components were sufficient to reconstruct $\mathcal{S}$ as well as to discriminate against anomalies.

<figure><img src="image_7.png" /><figcaption>**Fig. 6** Calculating Negative LOF with $k$ Neighbors = 5: (a) The LOF (Local Outlier Factor) for all trajectories, with the first five representing test trajectories and the remaining ones constituting the training set. (b)</figcaption></figure>

The LOF's progression over time corresponding to partial observations. The dotted lines represent the thresholds for the 5th and 95th percentiles
<figure><img src="image_8.png" /><figcaption>**Fig. 7** Marginal likelihood method: probability that the trajectory is nominal. The dotted black line is the alarm threshold</figcaption></figure>

<figure><img src="image_9.png" /><figcaption>**Fig. 8** Decomposition of time series in the training set to representation forms. Data points are yellow scattered dots. The fitted Gaussian distribution contours are also shown</figcaption></figure>

However, it is noteworthy that although theoretically in the functional domain $C^\infty$, FPCA will yield an “almost exact” reconstruction of any functional $f \in C^\infty$ but realistically, the discrete implementation leads to increasing error towards the end of the trajectories. For this reason, we proposed to only perform detection on the first 90% segment of the trajectory, leaving the remaining 10% as a safety margin.

Each time series decomposed with the two principal components above will become a 2D vector in the representation domain. Since the movement is unimodal in this road patch, we opted for fitting a Gaussian distribution $p(a)$ over the set of representation vectors $\mathcal{P}$ (Fig. 8).

## 5.3 Effects of Noise and Parameters Tuning

Performance trends become apparent when comparing various values of $\sigma_e^2$. Decreasing $\sigma_e^2$ is entailed by faster convergence of $\Sigma_a^*$ to zero. This, in turn, allows the distance between the transformed latent representation and the origin

to be estimated more accurately, resulting in a more reactive detector. However, this sensitivity escalates the likelihood of false alarms, as can be observed from Fig. 9(b), where there are notable dips in confidence early in the time series, and the false negative period of the wrong-way driving trajectory lasts longer and hits higher confidence peak.

## 5.4 Benchmark on NGSIM 101 Dataset

To illustrate the efficacy of the proposed Bayesian anomaly detector (referenced in Eq. 16), we employ the same test trajectories outlined in the preceding section. Figure 9(a) depicts the time-varying p-value. From the figure, the detector reacts immediately to anomalies, except in the case of speeding vehicle detection, although it may take some time to reach the threshold line for the alarm to activate. The convergence rate depends on the configured confidence we place on each measurement (Section 5.3). The detector aims to balance reliability and responsiveness, and its performance can be fine-tuned by lowering the threshold value or $\sigma_e$ if high-quality sensors are available. This configuration allows the detector to avoid reliability issues associated with other approaches by trading off response time.

The Isolation Forest algorithm (Fig. 10) generally exhibits good detection performance alongside a reduced false alarm rate. However, the initial overlapping anomaly score values suggest that the initial dozens of timesteps can be disregarded. Interestingly, the system accurately identified instances of opposite direction driving from the onset. Furthermore, it correctly classified a suddenly stopped vehicle with approximately a 25 timestep delay, at around timestep 65.

While the marginal likelihood method [10] (Fig. 7) initially seems advantageous in terms of alarm time and false alarms, its limitation lies in assuming that the FPCA reconstruction error at each time $t$, given by $e(t) = x(t) - \mu(t) - \sum_k a_k \phi_k(t)$, is an independent sample from a Gaussian distribution. This assumption proves restrictive as $e(t)$ typically exhibits time-dependent drifts, and its expected value does not consistently approximate zero. In other words, the marginal likelihood method shows increased sensitivity because it does not account for the FPCA reconstruction error [10].

In VAE-LSTM approach, Fig. 11 illustrates the predicted future trajectory (dashed line) based on an input sequence of 32 observations from the trajectory (blue line). The reconstruction error was used to compute the anomaly score for the nominal trajectory (orange line) and three anomalous cases: speeding, stopping, and wrong-way driving (Fig. 12). In the original paper [23], anomaly detection for the entire window, i.e., for the first sequence, was only possible after $n_{window}$ measurements. To ensure a fair comparison with our method, we divided the threshold equally over time, resulting in a
<figure><img src="image_10.png" /><figcaption>**Fig. 9** Bayesian method: probability that the trajectory is nominal. The dotted black line is the alarm threshold set corresponding to $p = 0.05$</figcaption></figure>

linear threshold curve (Fig. 12). The results show that the VAE-LSTM detector was capable of detecting a stopping vehicle with a 10-timestep delay, which is comparable to our Bayesian method. It also detected a speeding vehicle with a 5-timestep delay and exhibited zero delay for wrong-way driving detection, achieving the best performance among the group (Fig. 13).

However, we noticed an intriguing behavior of the VAE-LSTM network. In the wrong-way driving case, when the sliding window had fully shifted to include fully the 32 observations of the reverse driving trajectory, the LSTM part of the network outputted the correct prediction for future trajectory, despite the network was never trained on wrong-way driving trajectories. This resulted in a deactivation of anomaly alarm since the reconstruction error fell below the threshold curve (Fig. 14). The Bayesian detector, on the other hand, guarantees that this never happens (see Appendix A2).

<figure><img src="image_11.png" /><figcaption>**Fig. 10** Anomaly scores computed in real-time with Isolation Forest</figcaption></figure>

# 6 Discussion

Table 1 provides a comprehensive comparison of the evaluated methods. The Alarm Time (AT) reflects the detector's responsiveness, while the False Detection (FD) period indicates the false alarm rate. Following the discussions in Section 5.4, although the Bayesian detector did not achieve the best results in terms of AT or FD, the framework is noteworthy for being the only method in the group that is not significantly affected by false alarms for normal driving behavior, as seen with LOF, sensitivity to approximation error, as with Marginal Likelihood, slow response rates, as with IF, or unpredictable behavior in out-of-sample examples, as with VAE-LSTM. As a result, the Bayesian detector proves to be a reliable choice.

These results highlight a fundamental trade-off between speed and accuracy [11]. For example, the marginal likelihood method [10] achieves excellent responsiveness but requires precise trajectory approximation. In realistic settings, where measurements are often contaminated by noise, this method becomes susceptible to false alarms. The Bayesian framework offers the ability to control these factors through the $\sigma_{\epsilon}$ parameter, which determines the level of trust placed on each measurement. For high-quality sensors providing accurate measurements, this value can be set lower, resulting in a faster response rate (an example was given in Fig. 9). Additionally, varying the number of FPCA coefficients can control the approximation error, enhancing responsiveness if the nature of the time series allows. These features make the Bayesian detector particularly desirable from an operational perspective.

We would also like to further discuss the out-of-sample performance of the VAE-LSTM approach. It is evident that neural network approaches consistently deliver highly accurate predictions. Neural networks generally possess good generalization capabilities, which is desirable in most machine learning applications. However, as demonstrated in Section 5.4, this can be problematic in anomaly detection.
**Fig. 11** The VAE-LSTM's trajectory prediction based on past 32 observations as input (blue line), the actual traveled trajectory (orange line) and other anomalous trajectories

<figure><img src="image_12.png" /></figure>

**Fig. 12** The anomaly score computed from the prediction of the VAE-LSTM network. The y axis is drawn in log-scale. Anomaly score curves crossing the nominal regime border will trigger the alarm

<figure><img src="image_13.png" /></figure>

**Fig. 13** The VAE-LSTM network actually predicts with good accuracy the wrong-way driving trajectory, despite never trained on these data

<figure><img src="image_14.png" /></figure>

**Fig. 14** The anomaly score computed from the prediction of VAE-LSTM for wrong-way driving scenario. Anomaly score curves crossing the nominal regime border will trigger the alarm

<figure><img src="image_15.png" /><figcaption>**Table 1** Comparisons between different anomaly detection methods</figcaption></figure>

<table><thead><tr><th rowspan="2">Method</th><th colspan="2">Normal</th><th colspan="2">Speeding</th><th colspan="2">Stopped</th><th colspan="2">Opposite</th><th rowspan="2">Reliability Issues</th></tr><tr><th>AT</th><th>FD</th><th>AT</th><th>FD</th><th>AT</th><th>FD</th><th>AT</th><th>FD</th></tr></thead><tbody><tr><td>Marginal Likelihood</td><td>∞</td><td>0</td><td><u>35</u></td><td>0</td><td><b>46</b></td><td>0</td><td><b>1</b></td><td>0</td><td>Requires good approx. error</td></tr><tr><td>Bayesian</td><td>∞</td><td>0</td><td>56</td><td>0</td><td>56</td><td>0</td><td>10</td><td>14</td><td></td></tr><tr><td>LOF</td><td>65; 96</td><td>4</td><td><b>25</b></td><td>0</td><td><u>48</u></td><td>50</td><td><b>1</b></td><td>0</td><td>False Alarm for normal scenario</td></tr><tr><td>Isolation Forest</td><td>∞</td><td>0</td><td>65</td><td>0</td><td>65</td><td>0</td><td><b>1</b></td><td>0</td><td>Low responsiveness</td></tr><tr><td>VAE-LSTM</td><td>∞</td><td>0</td><td>42</td><td>0</td><td>50</td><td>0</td><td><b>1</b></td><td>0</td><td>Unpredictable OOS performance</td></tr></tbody></table>

AT: alarm time, FD: maximum false negative time period. OOS: out-of-sample

The bold entries signify the best results among the comparison, and the underlined entries signify the second best results
Good prediction of unseen scenarios, such as wrong-way driving, prevents the classification of such scenarios as abnormal, thereby undermining the effectiveness of the anomaly detection system. The linear transform employed in the FPCA step of the Bayesian framework ensures a bijective relationship between the latent representation space and the functional trajectory space, ensuring out-of-sample trajectories are located far away from the learned latent distribution, improving discriminatory ability of the detector. This property can be proven theoretically in Appendix A2.

We did not encounter train misings (i.e., continuous missing data) in the NGSIM-101 dataset that requires data imputation. However, in reality, such scenario is common in which nearest-neighbor imputation can be considered. For a full review of data imputation, please consult [24].

A notable limitation of our detector arises from approximating the Generalized Chi-squared distribution, which negatively affects the responsiveness of the anomalies that happen early in the time series. Moreover, the Gaussian assumption of the latent representations can also be a limiting factor for the detector to operate with multi-modal data, such as vehicle trajectories when traffic patterns vary with time. An expansion of the framework to use Gaussian Mixtures may be more desirable in such case. Moreover, similar to the Fourier Transform, FPCA experiences the “window effect” when applied to finite time series, which means the approximation power diminishes near the trajectory’s endpoint. This factor should be carefully considered when constructing the road patch *P*.

Our future work will be devoted to addressing these issues to extend the applicability of the framework by considering multi-modality, as well as studying other basis function choices for more effective detection.

## 7 Conclusion

In this paper, we have introduced a novel unsupervised anomaly detection framework and provided an in-depth exploration of its mathematical properties. Our numerical simulations have demonstrated that this method exhibits the ability to detect a wide array of anomalous driving behaviors reliably, without the need for explicit anomaly modeling. The detector can be configured to eliminate many of the reliability problem associated with time series anomaly detection such as responsiveness, false-alarms, out-of-sample generalizability. These characteristics make the method particularly favorable for real-world implementation, and its low computational requirements also make it feasible for widespread deployment across various embedded driving platforms.

While the current detector demonstrates promising performance, future work will focus on addressing its limitations. Specifically, this includes expanding its capabilities to handle multi-modal trajectory data and experimenting alternative basis functions to further improve its approximation power.

## List of Abbreviations

<table><thead><tr><td>Abbreviation</td><td>Definition</td></tr></thead><tbody><tr><td>ADAS</td><td>Advanced Driver Assistance System</td></tr><tr><td>LASSO</td><td>Least Absolute Shrinkage and Selection Operator</td></tr><tr><td>IF</td><td>Isolation Forest</td></tr><tr><td>KL</td><td>Karhunen-Loève (see FPCA)</td></tr><tr><td>LOF</td><td>Local Outlier Factor</td></tr><tr><td>ITS</td><td>Intelligent Transportation System</td></tr><tr><td>PCA</td><td>Principal Component Analysis</td></tr><tr><td>FPCA</td><td>Functional Principal Component Analysis</td></tr><tr><td>V2X</td><td>Vehicle-to-Everything</td></tr></tbody></table>

# Appendix A

## A1. Implementation Details of VAE-LSTM from [23]

In general, we follow the framework proposed in [23], but we made several modifications to the network architecture to better suit our problem. Specifically, we reimplemented the structure in PyTorch 2.3. For the VAE, we added residual connections to each convolutional layer to improve gradient flow (Fig. 15). Similarly, in the LSTM network, we incorporated a residual connection into the output after passing through a fully connected layer. Since we hypothesized that the immediate actions of the drivers do not depend on history earlier than the last 3.2 seconds (32 timesteps), we only used 1 embedding to predict the next one in the LSTM network.

The hyperparameters were selected based on several ablation studies: the number of hidden units for the VAE is 512, the latent dimension is 6, the initial learning rate is 1e-3, and the batch size is 32. Both networks were trained for 100 epochs using the Adam optimizer with a decaying learning rate that reduced by 50% every 30 epochs.

To prepare the training data, we opted to train on the smoothed velocity instead of positional functionals, as the former is closer to a stationary signal. We created a training set using a sliding window with a stride of 1 and a length of 32, resulting in approximately 23,500 data points for training the VAE. The same dataset was used to train the LSTM, with additional logic to ensure temporal dependency between time series. The training process took less than 30 minutes
for both networks on a workstation equipped with an AMD EPYC 7763 Processor, 64GB RAM and an NVIDIA RTX 4000 Ada GPU.

<figure><img src="image_16.png" /><figcaption>Fig. 15 High-level architecture of the re-implemented VAE</figcaption></figure>

## A2. Guaranteed Out-of-Sample Performance of FPCA

In this section, we will show the guaranteed out-of-sample performance of the FPCA transform employed in the Learning Phase introduced in Section 4.2.1.

**Proposition 7.1** Let $x(t)$, $y(t)$ be two functionals representing two distinct trajectories. Suppose that FPCA transforms $x(t)$, $y(t)$ into two finite dimensional truncated representation vectors $Z$, $W$ where $Z, W \in \mathbb{R}^m$. Then the $L^2$ distance between $Z$ and $W$ can be bounded by the Euclidean norm $\|x(t) - y(t)\|_2$ through the following identity:

$$ \|x(t) - y(t)\|_2 \le \|Z - W\|_2 E \quad (17) $$

where:

$$ E = \sqrt{\sum_{i=1}^{m} \int_{t=-\infty}^{+\infty} e_i(t)^2 dt} $$

and $e_i(t)$ are the eigenfunctions of the covariance kernel, ordered from the largest eigenvalues to the smallest.

**Proof** We have:

$$ \begin{aligned} \|x(t) - y(t)\|_2^2 &= \int_{t=-\infty}^{t=+\infty} (x(t) - y(t))^2 dt \\ &\approx \int_{t=-\infty}^{+\infty} \left( \sum_{k=1}^{m} (z_k - w_k) e_k(t) \right)^2 dt \end{aligned} $$

Let $d_k \triangleq z_k - w_k$:

$$ \begin{aligned} \|x(t) - y(t)\|_2^2 &\approx \int_{t=-\infty}^{+\infty} \sum_i \sum_j d_i d_j e_i(t) e_j(t) dt \\ &= \sum_i \sum_j \int_{t=-\infty}^{+\infty} d_i d_j e_i(t) e_j(t) dt \\ &= \sum_{i=1}^{m} \int_{t=-\infty}^{+\infty} d_i^2 e_i(t)^2 dt \\ &= \sum_{i=1}^{m} d_i^2 \int_{t=-\infty}^{+\infty} e_i(t)^2 dt \end{aligned} $$

Since we have employed truncated expansion:

$$ E^2 = \sum_{i=1}^{m} \int_{t=-\infty}^{+\infty} e_i(t)^2 dt < \infty $$

We can apply the Cauchy-Schwarz inequality:

$$ \|x(t) - y(t)\|_2^2 \le \|Z - W\|_2^2 E^2 \quad (18) $$

Inequality Eq. 17 can be rewritten into:

$$ \|Z - W\|_2 \ge \frac{1}{E} \|x(t) - y(t)\|_2, $$

and equality can happen if all eigenfunctions are normalized. This imply that the distance between two representations $Z$ and $W$ are well separated if the Euclidean distance between $x(t)$ and $y(t)$ is large. The detector, according to Eq. 16 will assign low p-value to such scenario. Uncommon trajectories such as the wrong-way driving trajectory, having large Euclidean distance to the nominal ones, will trigger the alarm.

**Acknowledgements** We would like to thank Pr. Pierre Maréchal (IMT Toulouse) for his valuable input for the paper.

**Author Contributions** DD conceived the idea and methodology and edited the manuscript. TH contributed to methodology and coding, as well as manuscript writing. VM focused on manuscript revision and editing.

**Funding** Our work has benefitted from the AI Interdisciplinary Institute ANITI. ANITI is funded by the French "Investing for the Future - PIA3" program under the Grant agreement n° ANR-19-PI3A-0004.
**Availability of Data and Materials** The Python code is available from the corresponding author upon request.

**Declarations**

**Ethics Approval and Consent to Participate** Not applicable.

**Consent for Publication** Informed consent was obtained from all individual participants included in the study.

**Competing Interests** The authors declare that they have no competing interests.

**References**

1. Alexiadis, V.: Video-based vehicle trajectory data collection. In: Transportation Research Board 86th Annual Meeting. Citeseer (2006)

2. Amarbayasgalan, T., Pham, V.H., Theera-Umpon, N., Ryu, K.H.: Unsupervised anomaly detection approach for time-series in multidomains using deep reconstruction error. Symmetry **12**(8), 1251 (2020)

3. Blázquez-García, A., Conde, A., Mori, U., Lozano, J.A.: A review on outlier/anomaly detection in time series data. ACM Comput. Surv. (CSUR) **54**(3), 1–33 (2021)

4. Bondre, S.V., Bondre, V., Yadav, U., Thakare, B., Nanwani, J.: Automated road anomaly detector in vanet by using deep learning (2023). https://doi.org/10.1109/ocit59427.2023.10431273

5. CAR 2 CAR Consortium: Survey on ITS-G5 CAM statistics. https://www.car-2-car.org/

6. Chandra, R., Bhattacharya, U., Mittal, T., Bera, A., Manocha, D.: Cmetric: A driving behavior measure using centrality functions. arXiv:2003.04424 (2020)

7. Cheung, E., Bera, A., Kubin, E., Gray, K., Manocha, D.: Identifying driver behaviors using trajectory features for vehicle navigation. In: 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 3445–3452. IEEE (2018)

8. Choi, K., Yi, J., Park, C., Yoon, S.: Deep learning for anomaly detection in time-series data: Review, analysis, and guidelines. IEEE Access **9**, 120043–120065 (2021)

9. Colyar, J., Halkias, J.: Us highway 101 dataset. federal highway administration research and technology fact sheet. publication number: Fhwa-hrt-07-030. Tech. Rep. (2007)

10. Dinh, T.H., Martinez, V., Delahaye, D.: Recognition of outlying driving behaviors: A data-driven perspective with applications to v2x collective perception. In: 2021 IEEE Vehicular Networking Conference (VNC), pp. 52–59. IEEE (2021)

11. Green, D.M., Luce, R.D.: Speed-accuracy trade. J. Acoust. Soc. Am. (1972). https://doi.org/10.1121/1.1981369

12. Hinami, R., Mei, T., Satoh, S.: Joint detection and recounting of abnormal events by learning deep generic knowledge. In: Proceedings of the IEEE International Conference on Computer Vision, pp. 3619–3627 (2017)

13. Hong, Y.: scikit-fda: Principal Component Analysis for Functional Data. B.S. thesis (2020)

14. Hu, W., Xiao, X., Fu, Z., Xie, D., Tan, T., Maybank, S.: A system for learning statistical motion patterns. IEEE Trans. Pattern Anal. Mach. Intell. **28**(9), 1450–1464 (2006)

15. Jarry, G., Couellan, N., Delahaye, D.: On the use of generative adversarial networks for aircraft trajectory generation and atypical approach detection. In: Air Traffic Management and Systems IV: Selected Papers of the 6th ENRI International Workshop on ATM/CNS (EIWAC2019) 6, pp. 227–243. Springer (2021)

16. Jarry, G., Delahaye, D., Nicol, F., Feron, E.: Aircraft atypical approach detection using functional principal component analysis. J. Air Transp. Manag. **84**, 101787 (2020)

17. Jin, X., Zhang, Y., Li, L., Hu, J.: Robust pca-based abnormal traffic flow pattern isolation and loop detector fault detection. Tsinghua Sci. Technol. **13**(6), 829–835 (2008)

18. Ko, D., Kang, S., Kim, H.S., Lee, W., Bae, Y.S., Park, J.: Anomaly segmentation based on depth image for quality inspection processes in tire manufacturing. Appl. Sci. (2021). https://doi.org/10.3390/APP112110376

19. Lee, S., Kim, H.G., Ro, Y.M.: Stan: Spatio-temporal adversarial networks for abnormal event detection. In: 2018 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 1323–1327. IEEE (2018)

20. Li, C., Han, Z., Ye, Q., Jiao, J.: Visual abnormal behavior detection based on trajectory sparse reconstruction analysis. Neurocomputing **119**, 94–100 (2013)

21. Li, N., Oyler, D.W., Zhang, M., Yildiz, Y., Kolmanovsky, I., Girard, A.R.: Game theoretic modeling of driver and vehicle interactions for verification and validation of autonomous vehicle control systems. IEEE Trans. Control Syst. Technol. **26**(5), 1782–1797 (2017)

22. Li, Y., Liu, W., Huang, Q.: Traffic anomaly detection based on image descriptor in videos. Multimed. Tools Appl. **75**(5), 2487–2505 (2016)

23. Lin, S., Clark, R., Birke, R., Schönborn, S., Trigoni, N., Roberts, S.: Anomaly detection for time series usingvae-lstm hybrid model. In: ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4322–4326. IEEE (2020)

24. Lin, W.C., Tsai, C.F.: Missing value imputation: a review and analysis of the literature (2006–2017). Artif. Intell. Rev. **53**, 1487–1509 (2020)

25. Liu, S.W., Ngan, H.Y., Ng, M.K., Simske, S.J.: Accumulated relative density outlier detection for large scale traffic data. Electron. Imaging **2018**(9), 239–1 (2018)

26. Lu, C., Shi, J., Jia, J.: Abnormal event detection at 150 fps in matlab. In: Proceedings of the IEEE international conference on computer vision, pp. 2720–2727 (2013)

27. Ngan, H.Y., Yung, N.H., Yeh, A.G.: Outlier detection in traffic data based on the dirichlet process mixture model. IET Intell. Transp. Syst. **9**(7), 773–781 (2015)

28. Nguyen, V., Gupta, S., Rana, S., Li, C., Venkatesh, S.: A bayesian nonparametric approach for multi-label classification. In: Asian conference on machine learning, pp. 254–269. PMLR (2016)

29. Niu, Z., Yu, K., Wu, X.: Lstm-based vae-gan for time-series anomaly detection. Sensors **20**(13), 3738 (2020)

30. Owens, J., Hunter, A.: Application of the self-organising map to trajectory classification. In: Proceedings Third IEEE International Workshop on Visual Surveillance, pp. 77–83. IEEE (2000)

31. Ramanishka, V., Chen, Y.T., Misu, T., Saenko, K.: Toward driving scene understanding: A dataset for learning driver behavior and causal reasoning. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7699–7707 (2018)

32. Ramsay, J., Silverman, B.: Principal components analysis for functional data. Functional data analysis pp. 147–172 (2005)

33. Ramsay, J.O., Silverman, B.W.: Applied functional data analysis: methods and case studies, vol. 77. Springer (2002)

34. Song, R.: Driver intention prediction using model-added Bayesian network. Proc. Inst. Mech. Eng. Pt. D J. Automobile Eng. **235**(5), 1236–1244 (2021)

35. Wang, B., Li, W., Khattak, Z.H.: Anomaly detection in connected and autonomous vehicle trajectories using lstm autoencoder and gaussian mixture model. Electronics (2024). https://doi.org/10.3390/electronics13071251
36. Xu, D., Ricci, E., Yan, Y., Song, J., Sebe, N.: Learning deep representation of appearance and motion for anomalous event detection. arXiv:1510.01553 (2015)

37. Zhang, K., Liu, H., Clarke, S.: Atada: Adaptive time aware anomaly detection approach for real-time intelligent transportation systems (2023). https://doi.org/10.1109/bigdata59044.2023.10386785

38. Zhao, B., Fei-Fei, L., Xing, E.P.: Online detection of unusual events in videos via dynamic sparse coding. In: CVPR 2011, pp. 3313–3320. IEEE (2011)

**Publisher's Note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.