Next Article in Journal
Enhancing Leaf Area Index Estimation for Maize with Tower-Based Multi-Angular Spectral Observations
Previous Article in Journal
A Sparse-Array Design Method Using Q Uniform Linear Arrays for Direction-of-Arrival Estimation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Trajectory-BERT: Trajectory Estimation Based on BERT Trajectory Pre-Training Model and Particle Filter Algorithm

Information System Engineering College, PLA Strategic Support Force Information Engineering University, Zhengzhou 450001, China
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(22), 9120; https://doi.org/10.3390/s23229120
Submission received: 7 October 2023 / Revised: 1 November 2023 / Accepted: 7 November 2023 / Published: 11 November 2023

Abstract

:
In the realm of aviation, trajectory data play a crucial role in determining the target’s flight intentions and guaranteeing flight safety. However, the data collection process can be hindered by noise or signal interruptions, thus diminishing the precision of the data. This paper uses the bidirectional encoder representations from transformers (BERT) model to solve the problem by masking the high-precision automatic dependent survey broadcast (ADS-B) trajectory data and estimating the mask position value based on the front and rear trajectory points during BERT model training. Through this process, the model acquires knowledge of intricate motion patterns within the trajectory data and acquires the BERT pre-training Model. Afterwards, a refined particle filter algorithm is utilized to generate alternative trajectory sets for observation trajectory data that is prone to noise. Ultimately, the BERT trajectory pre-training model is supplied with the alternative trajectory set, and the optimal trajectory is determined by computing the maximum posterior probability. The results of the experiment show that the model has good performance and is stronger than traditional algorithms.

1. Introduction

In recent times, due to the advancement of high-precision positioning devices and target tracking technology [1], a great deal of trajectory data have been generated. Extensive research has been conducted in this direction in order to gain insight into target behavior, as trajectory data are the primary source of information [2]. By delving into the depths of data, people have made great strides in many areas, such as trajectory classification [3,4], prediction [5,6,7], tracking [8,9], and blind filling [10]. The aviation industry has seen a dramatic increase in air traffic, making it difficult for a single radar system to keep up with the changing regulations. Air traffic management and traffic control research [11,12,13] considers trajectory data to be an important reference point and therefore an in-depth analysis of trajectory data is essential.
In the context of receiving trajectory data, it is common for the quality of the received data is usually below standard, and there are a lot of noises and gaps in the data. The objective of this paper is to acquire the estimated trajectory that closely resembles the actual trajectory using the designed model, in cases where a trajectory with noise and missing points is acquired. Artificial modeling methods, such as Markov [14], Kalman filter [15], interacting multiple model [16] algorithm, etc., are used to pre-defined the motion model of the target in traditional methods. The trajectory data are then estimated and processed by calculating the maneuvering information such as velocity, acceleration, and steering rate in the data [17]. The validity of these features and the effectiveness of trajectory estimations will be influenced by the researchers’ experience. At the same time, due to the complexity of the target motion law, it is difficult to depict it accurately by artificial modeling.
The swift advancement of machine learning and deep learning has prompted numerous investigations into trajectory data mining. Xin Liu initially employed the technique in natural language processing (NLP) as a point of reference [18], treating trajectory points as “words”, trajectories as “sentences”, and constructing all trajectory points as “dictionaries”. The skip-gram model was employed to link the context and fill in the gaps in the trajectory points. Alessandro Crivellari employed the trajectory-to-vector approach [19] to transform the trajectory into a high-dimensional vector representation using Word2vec, and instructed the model to comprehend the correlation between trajectory points, thereby facilitating trajectory blind filling. Asif Nawaz employs a convolutional neural network to divide the map into grids [20], and utilizes a bidirectional convolutional recurrent encoder based on the attention mechanism to obtain trajectory feature information and anticipate the absent trajectory points. Alessandro Crivellari utilized the mask partial trajectory points [21] technique to train the BERT model, taking advantage of the Transformer’s impressive bidirectional representation capability, to anticipate and estimate the absent trajectory. Mashaal divided the region into hexagonal grids [22] and trained the BERT model to better capture the relationship between the six edges of each grid, so as to achieve the purpose of optimizing the missing trajectory.
Then, whether the above methods predict the trajectory by constructing a “dictionary” in the field of NLP, or predict the position after dividing the region into grids, they all belong to the training of discrete data. In the aviation field, aircraft motion has continuity, and treating aircraft motion as a discrete sequence obviously does not fit the realistic scenario. Based on the above problems, this paper proposes to use the BERT model to train the continuous trajectory sequence, and make the model learn the hidden motion law in the trajectory by masking part of the trajectory points. Then the particle filter algorithm is used to construct a trajectory candidate set for the observed noisy trajectory, and the candidate trajectory is sent to the model, which is determined by the maximum a posteriori criterion. The trajectory that best fits the true motion state is obtained.
The main contributions of this paper are as follows:
  • The BERT model has been adapted to train sequences of continuous trajectory, and the pre-training model for the BERT trajectory has been acquired;
  • For the task scenario, the BERT trajectory pre-training model and the particle filter algorithm are combined to construct a candidate trajectory set for the observed trajectory;
  • The BERT trajectory pre-training model is used to calculate the maximum posterior probability of trajectory under trajectory sets and obtain the optimal trajectory estimation.

2. Methodology

2.1. The Task Scenario

In the actual trajectory signal receiving scenario, there will be errors in locating the target by existing means, as shown in Equation (1), where Y is the observed trajectory, X is the true trajectory, and W is the observation noise. To simplify the calculation, in this paper, the error W is treated as Gaussian noise with mean 0 and variance σ 2 , as shown in Equation (2). The final application goal of this paper is to obtain an estimated trajectory X that is closest to the true trajectory through the BERT trajectory pre-training model based on an incomplete or noisy observed trajectory Y .
Y = X + W
W ~ N ( 0 , σ 2 )

2.2. Decision Criteria

In trajectory estimation problems, the theoretical basis is the maximum a posteriori criterion, which maximizes the posterior probability by combining observations to calculate the likelihood probability. This criterion is widely used in the field of trajectory estimation, as shown in Equation (3).
max P ( X | Y ) = P ( Y | X ) × P ( X ) P ( Y )
The maximum a posteriori probability is mainly determined by two parts: the likelihood probability P ( Y | X ) and the prior probability P ( X ) . The denominator P ( Y ) can be regarded as a constant, which does not affect the decision result. The aim of this paper is to utilize deep learning to train the BERT model and express P ( X ) . The clarity of the fact that Y represents the observed data is crucial, and when employing the BERT trajectory pre-training model to estimate the observed trajectory Y , X signifies the alternative trajectory set generated by Y through particle filter. X 1 , X 2 , ⋯, X n denotes a subset of the collection of alternative trajectories, as illustrated in Equation (4), where x denotes a point in the trajectory sequence and is a two-dimensional vector encompassing latitude and longitude, thus X i can be articulated as X i : { x 1 ,   x 2 ,   ,   x n } , where x i : { l o n i , l a t i } . After the candidate trajectory set is obtained, the trajectory is fed into the BERT trajectory pre-training model by masking the trajectory point by point, and the corresponding prior probability P ( x i | x \ i ) is generated, where x \ i denotes all other points except point x i . Extensive discussions have taken place in previous papers regarding the relationship between the prior joint distribution produced by BERT and the continuous multiplication of conditional probabilities [23,24,25], as illustrated in Equation (5). Once the BERT model is provided with an alternative trajectory and subjected to meticulous mask-by-mask validation, we can ultimately derive P ( X ) from the pre-training BERT trajectory model.
max P ( X | Y ) = max { P ( X 1 | Y ) ,   P ( X 2 | Y ) ,   ,   P ( X n | Y ) }
P ( X ) P ( x 1 | x 2 x i ) · P ( x 2 | x 1 ,   x 3 x i ) P ( x i | x 1 x i 1 )
In this task scenario, the estimated value is a two-dimensional (latitude and longitude) distribution problem, and the probability distribution of the estimated value of the model is assumed to conform to the Gaussian distribution. Therefore, the prior probability P ( X ) can be expressed in Equation (6), where L l o n , L l a t is the label, P l o n and P l a t is the estimated value of the model, and is the covariance matrix, as shown in Equation (7).
P X = 1 ( 2 π ) 2 2 | | 1 2 exp { 1 2 ( L l o n P l o n , L l a t P l a t ) T 1 ( L l o n P l o n , L l a t P l a t ) }
= σ l o n l o n σ l o n l a t σ l a t l o n σ l a t l a t
In summary, the procedure for calculating the maximum a posteriori probability is shown in Algorithm 1.
Algorithm 1: Procedure for calculating the maximum a posteriori probability
1: Input an alternative trajectory X 1 and compute its prior probability p ( X 1 ) ;
2: The input trajectory sequence is masked point by point and fed into the BERT trajectory pre-training model to calculate the prior probability of trajectory points:
p ( x 1 ) : B e r t ( m a s k ,   x 2 ,   x 3 ,   ,   x n ) ,   ,   p ( x n ) : B e r t ( x 1 ,   x 2 ,   x 3 ,   ,   m a s k ) ;
3: The prior probability of the entire trajectory is estimated by multiplying the conditional probabilities one by one: p ( X 1 ) p ( x 1 ) × p ( x 2 ) × × p ( x n ) ;
4: Calculate the Likelihood:
p ( Y | X 1 ) = i P ( y i | x i ) = i = 1 n log P ( y i | x i ) = i = 1 n log 1 2 π σ 2 exp ( ( y i x i ) 2 σ 2 ) ;
5: Calculate the posterior probability: p ( X 1 | Y ) = p ( Y | X 1 ) × p ( X 1 ) p ( Y ) .

2.3. Trajectory Pre-Processing

In order to ensure that the BERT trajectory pre-training model achieves the desired training outcome, it is necessary to mask the trajectory data with a certain probability, as per the techniques employed in the realm of natural language processing. By hiding certain trajectory points in the input, specifically by substituting them with distinctive symbols, the model is able to anticipate the masked data by analyzing the data preceding and succeeding the mask. This training technique assists the model in understanding the relationship between the data, and by utilizing this approach, the BERT model can continuously modify weights to improve its learning efficiency and ability.
Using trajectory X n as a case in point, as depicted in Figure 1, where n signifies the trajectory’s length. To find the quantity of masks in this paper, consult paper [26] and apply a 15% probability to mask the trajectory sequence. In contrast with other discrete sequences, the model is a continuously sequenced process, making it impossible to use a special symbol to represent the position of the mask. In this article, the mask point is set to −9999 for the task scenario in this paper, and to comply with the unified requirements for sequence length when calculating the BERT model, the position where padding must be 0 is specified. The BERT model is expected to be able to learn the meanings of mask and padding represented by −9999 and 0 respectively through training. The purpose of training is to learn how to estimate missing positions based on contextual information by processing the input trajectory with the mask and producing the corresponding mask position as the output.

3. Train Model

3.1. Model Structure

The encoder module of the transformer, or BERT model, as illustrated in Figure 2, is the model employed in this situation. It is important to remember that when it comes to natural language processing, the BERT model only processes discrete data. The output value is the maximum probability value in the dictionary when predicting the output, which can be classified as a classification problem. This chapter’s data are continuous, and the output is an estimated value. Consequently, to achieve the goal of trajectory estimation, this chapter modifies the module to better suit the task scenario.
Referring to the mask language model (MLM) method [26] when using BERT to train language models, this paper proposes a mask trajectory model (MTM) training method suitable for this application scenario, as shown in Figure 3. The mask trajectory data are fed into the model. Thus, the model can predict the missing trajectory through the front and back trajectory. Simultaneously, in order to enhance the training effect of the model, we add a fully connected layer on the basis of MTM in parallel. The fully connected layer is similar to the traditional encoder-decoder method, which realizes the function of mapping low-dimensional features to high-dimensional and then restoring low-dimensional features from high-dimensional to low-dimensional, so as to better extract data features. MTM is to restore the position of the mask, that is, the local trajectory, which has certain limitations, while the parallel FC-decoder layer can extract the feature of the trajectory from a global perspective. The combination of the two makes the model training better, which is verified in the subsequent experimental link.
In the expected goal, the output of the BERT model set in this paper is the estimated latitude and longitude value. Compared with Equation (6), it can be found that the model cannot express the covariance matrix, so the output of the model needs to be further modified. The solution of this paper is to send the output of FC-decoder into a one-layer fully connected layer, as shown in Figure 4. The 2-dimensional output is extended to 6-dimensional output, which is used to generate the prediction value and covariance matrix.

3.2. Loss Function

Considering that the function of the model is a prediction problem rather than a classification problem, this paper uses the SmoothL1Loss (SML1Loss) commonly used in prediction tasks, as shown in Equation (8).
S M L 1 L o s s = 0.5 ( x i x i p ) 2 , i f | x i x i p | < 1 | x i x i p | 0 . 5 , otherwise
where x i is the true value, x i p is the predicted value, when | x i x i p | is less than 1, the square error is used, otherwise the linear error is used, which makes the SML1Loss can punish outliers (such as too large or too small outliers) less than the mean square error (MSE) and mean absolute error (MAE) loss function, so that the model is more robust. To avoid zero non-differentiable and gradient explosion, the training effects of the above three loss functions are compared in the subsequent chapters. The overall loss of the model is divided into three parts: covariance matrix (Loss1), decoder (Loss2), and MTM (Loss3), as shown in Equation (9).
L o s s = L o s s 1 + L o s s 2 + L o s s 3
Among these three loss functions, L o s s 1 is the loss function of the covariance matrix generated by the model, which needs to be constructed by ourselves. Here, this paper proposes two solutions. The first one is shown in Equation (10).
L o s s 1.1 = S m L 1 L o s s ( cov s e q _ cov )
where cov is the covariance generated by the model and s e q _ cov is the covariance of the training data; The second method is given in Equation (11).
L o s s 1.2 = S M L 1 o s s ( cov s e q _ cov ) + S M L 1 o s s ( d e c o d e r _ cov s e q _ cov )
where d e c o d e r _ cov is the covariance generated by the FC-decoder layer. It can be seen from the formula that the first loss function is more targeted, while the second loss is more restrictive from a global perspective, but the expected convergence effect is not as good as the first loss function. In this paper, for these two different loss functions, comparative experiments are carried out under the same conditions in the subsequent experimental sections.

4. Set of Alternative Trajectories

4.1. Particle Filter

When using the particle filter algorithm, the state equation and the observation equation should be clarified first, as shown in Equations (12) and (13), where f ( x ) is called the state transition function, h ( x ) is called the observation function, Q k is the process noise, and R k is the observation noise, Q k and R k are treated as Gaussian noise with mean 0 and variance σ 2 .
X k = f ( X k 1 ) + Q k
Y k = h ( X k ) + R k
The basic concept of particle filter is to depict the posterior distribution of states utilizing a set of random samples with corresponding weights (commonly referred to as “particles”). The posterior distribution in this application scenario pertains to the distribution of every trajectory point along the observation trajectory. The weights and positions of the particles are adjusted based on the state observations after obtaining some random samples with corresponding weights. These samples are then used to approximate the posterior distribution of the state. Finally, the state is estimated by considering the weighted sum of these samples. Particle filters are not limited by the linear and Gaussian assumptions of the system model and describe the probability density of state variables in a sample rather than a function. This means that it does not need too many constraints on the probability distribution of the state variables, so it is widely used in nonlinear and non-Gaussian dynamic systems.
This paper postulates that the probability distribution of the observed trajectory points follows a Gaussian distribution, allowing for the representation of the probability density of the trajectory points by employing a particle filter to approximate the probability density. Over the course of this duration, the particles generated can be regarded as potential points of trajectory that were formed in close proximity to the observed points of trajectory. Through the consolidation and amalgamation of multiple potential trajectory points, a collection of trajectory candidates is generated, and the real trajectory is incorporated into the collection of trajectory candidates. Algorithm 2 provides a comprehensive outline of the entire process for the traditional particle filter.
Algorithm 2: Process of traditional particle filter algorithm
1: Setting initial values: X 0 ~ N ( μ , σ 2 ) ;
2: Generate particles and initial weights, and set the number of generated particles as n : X 0 ( i ) , W 0 ( i ) = 1 n ;
3: Prediction step: X 1 ( i ) = f ( X 0 ( i ) ) + V , V ~ N ( 0 , Q ) ;
4: Update step: the observation is assumed to be y 1 , W 1 ( i ) = f R ( y 1 h ( x 1 ( i ) ) ) W 0 ( i ) ,
   f R is the probability density function of the observation noise;
5: Weights are normalized: W 1 ( i ) = W 1 ( i ) W 1 ( i ) ;
6: The new particle X 1 ( i ) and the new weight W 1 ( i ) are calculated;
7: Repeat steps 3, 4, and 5 to obtain new particles and weights in a cycle
In the follow-up work of this paper, the equation of state in traditional particle filter algorithm is not involved. The purpose of training the BERT trajectory pre-training model in this paper is to learn the change law between trajectory points in the way of deep learning. Therefore, after the initial n particles are obtained, these particles are sent to the BERT trajectory pre-training model respectively, and the BERT trajectory pre-training model is used to replace the state transition equation f ( x ) to generate the particles at the next moment, so as to complete the work of predicting and updating particles.
If m points are collected when sampling the probability density of each observation point and the length of the observed trajectory is n , then there are m n alternative sets of trajectories, as shown in Figure 5 for simple effect. It can be inferred that when there are enough sampling points, the real trajectory will be included. The goal of this paper is to determine which trajectory is the closest to the real trajectory through the BERT trajectory pre-training model.

4.2. Construct the Set of Alternative Trajectories

In this paper, BERT pre-training model is used to replace the state transition equation in the traditional particle filter algorithm. In order to explore what method is used to generate the best particle effect, this paper makes two improvements to the traditional particle algorithm, among which Algorithm A is shown in Algorithm 3.
Algorithm 3: Improved particle filter Algorithm A
Trajectory of observation:  Y : { y 1 ,   y 2 ,   ,   y n } ;
1: Create the primary particles: x ( 1 , m ) = y 1 + random ( m ) ;
2: Obtain m trajectories with varying initial observations:
Y 1 : { x ( 1 , m ) 1 ,   y 2 ,   ,   y n } ,   Y 2 : { x ( 1 , m ) 2 ,   y 2 ,   ,   y n } ,   ,   Y m : { x ( 1 , m ) m ,   y 2 ,   ,   y n } ;
3: Mask the trajectory data: Y 1 : { x ( 1 , m ) 1 ,   m a s k ,   ,   y n } ;
4: The second batch of particles is generated by the BERT trajectory pre-training model: Y 1 : { x ( 1 , m ) 1 ,   x ( 2 , m ) 1 ,   ,   y n } ;
5: Mask the trajectory data: Y 1 : { y 1 ,   x ( 2 , m ) 1 ,   m a s k ,   ,   y n } ;
6: The third batch of particles is generated by the BERT trajectory pre-training model: Y 1 : { y 1 ,   x ( 2 , m ) 1 ,   x ( 3 , m ) 1 ,   ,   y n } ;
7: Alternate trajectories are obtained by generating particles one by one in order: X 1 : { x ( 1 , m ) 1 ,   x ( 2 , m ) 1 ,   ,   x ( n , m ) 1 } .
In Algorithm A, the first batch of particles is obtained by adding random noise (Gaussian distribution with mean 0 and variance 0.3) to the first trajectory point of observation trajectory data, where m represents the number of generated particles, and the first observation point is replaced by m particles, respectively, so that different trajectories of m initial observation points are obtained, where x ( 1 , m ) i ( i = 1 ,   2 ,   ,   m ) represents the i t h particle in the first batch of m particles, and Y i ( i = 1 ,   2 ,   ,   m ) represents the i t h trajectory constructed. Taking the first trajectory Y 1 as an example, in order to generate the next batch of particles, the observation trajectory point after the first batch of particles is masked and sent to the BERT trajectory pre-training model, and the prediction data generated by the model is the second batch of particles. In the subsequent process, the above operations are repeated to obtain all particles in order. It should be noted here that when generating the particle at the next time, only the particles at the previous time are used, and the rest of the data in the sequence are still the observation data. Algorithm A is adjusted to obtain Algorithm B as shown in Algorithm 4.
Algorithm 4: Improved particle filter Algorithm B
Trajectory of Observation:  Y : { y 1 ,   y 2 ,   ,   y n } ;
1: Create the primary particles: x ( 1 , m ) = y 1 + random ( m ) ;
2: Obtain m trajectories with varying initial observations:
Y 1 : { x ( 1 , m ) 1 ,   y 2 ,   ,   y n } , Y 2 : { x ( 1 , m ) 2 ,   y 2 ,   ,   y n } ,   ,   Y m : { x ( 1 , m ) m ,   y 2 ,   ,   y n } ;
3: Mask the trajectory data: Y 1 : { x ( 1 , m ) 1 ,   m a s k ,   ,   y n } ;
4: The second batch of particles is generated by the BERT trajectory pre-training model: Y 1 : { x ( 1 , m ) 1 ,   x ( 2 , m ) 1 ,   ,   y n } ;
5: Mask the trajectory data: Y 1 : { x ( 1 , m ) 1 ,   x ( 2 , m ) 1 ,   m a s k ,   ,   y n } ;
6: The third batch of particles is generated by the BERT trajectory pre-training model: Y 1 : { x ( 1 , m ) 1 , x ( 2 , m ) 1 ,   x ( 3 , m ) 1 ,   ,   y n } ;
7: Alternate trajectories are obtained by generating particles one by one in order: X 1 : { x ( 1 , m ) 1 ,   x ( 2 , m ) 1 ,   ,   x ( n , m ) 1 } .
In Algorithm B, the first and second particles are generated in the same method as in Algorithm A, but the third batch is generated in a different way, with the resulting particles constantly replacing the observed data. Therefore, when predicting the particles the next time, all the generated particles before the current time and the observed data after the current time are involved in the prediction. Figure 6 shows the process of constructing the set of alternative trajectories using the particle filter algorithm. After all the particles are obtained, the Cartesian product algorithm is used to cross-arrange and combine the particles to obtain the alternative trajectory set.

5. Experimental Analysis

5.1. Evaluation Indicators

Considering that the problem studied in this paper is trajectory estimation, the mean absolute error (MAE), which is widely used in this field, is used as an evaluation index to measure the quality of trajectory prediction. At the same time, in order to compare the intuitive difference between the estimated trajectory and the real trajectory, this paper defines the average distance deviation (MEDV) to more intuitively show the accuracy of the model, as shown in Equations (14) and (15).
M A E = 1 n i = 1 n ( | A i , L a t E i , L a t | + | A i , L o n E i , L o n | )
M E D V = 1 n 1 n d i s t a n c e ( A i , E i )
where n is the number of samples, A i is the predicted trajectory, E i is the actual trajectory, and d i s t a n c e is the algorithm used to calculate the geographical distance between different latitude and longitude. The smaller the values of these two evaluation indexes are, the closer the estimated trajectory is to the actual trajectory, and the estimation effect is better.

5.2. Datasets

Based on the development of deep learning, neural networks can model complex motion laws, and can estimate trajectory more accurately than traditional methods. In order to train the trajectory pre-training model with better performance and enable the model to learn the complex motion laws contained in the trajectory, it is necessary to select high-precision trajectory data. The data used in this paper are from the public ADS-B data set from January to May 2021 provided by the OpenSky website, which meets the requirements of the model for data accuracy. By analyzing this dataset, it is found that there are problems of duplication and missing trajectory points, so it is necessary to clean and reconstruct this dataset first. Related work mainly includes trajectory selection in specific regions, outlier cleaning, trajectory segmentation, linear interpolation, data normalization, sliding window data segmentation, etc. Paper [27] has made a detailed explanation, and is not repeated here.
The experimental data use the L2J model data in the real ADS-B data, which is a civil aircraft. The data scale is large, the trajectory is relatively complete, and the maneuvering law is diverse, which can fully support the training of the model. After cleaning and reconstruction, a total of 3600 trajectory data were obtained, and 300,000 training data were obtained after sliding window partition, of which 65% of the sample trajectory data were used as the training set, 25% of the data were used as the validation set, and 10% of the data were used as the test set. In the construction of observation data, Gaussian noise with mean 0 and variance 0.3 is added to the real ADS-B in this paper.

5.3. Experimental Parameter Settings

The Adam optimizer is used in model training, weight decay is set to l−5, learning rate is l−3, training batch size is set to 1024, and a graphics card with 24 G video memory is used for training, the detailed parameters of the experiment are shown in Table 1.

5.4. Analysis of Experimental Results

5.4.1. Comparison of Different Loss Functions

Figure 7 compares the training effects of three loss functions. It can be seen that the variable loss function SML1Loss has the best effect, which is more suitable for the task scenario of this chapter. At the same time, in order to verify the performance of calculating covariance loss function, a comparison experiment is carried out under the condition of using SML1Loss loss function. The experimental results are shown in Figure 8. It is easy to see that the training effect of simple and direct calculation of covariance loss function is better, and the learning of the model for covariance is more focused on the data at the position of the mask. In the subsequent experiments, the above two loss functions are used.

5.4.2. Functional Analysis of the FC-Decode Layer

In this subsection, in order to verify the effect of the FC-decoder layer on BERT model training, the comparison experiment of removing the FC-decoder layer and only retaining the MTM layer is performed. The results are shown in Figure 9. It can be seen that MTM combined with FC-decoder can effectively improve the training effect. The analysis is because FC-decoder can focus on the characteristics of the trajectory at the global level and pay more attention to the global characteristics of the trajectory, while MTM focuses on restoring the information of the masked position and pays more attention to the local characteristics of the trajectory. The combination of the two can extract trajectory features more effectively, and improve the performance of the model.

5.4.3. Effect Analysis of Positional Embedding and Token Embedding

In order to verify the role of positional embedding and token embedding, the following comparative experiment is performed, as shown in Figure 10. It can be seen that the use of token embedding plays a great positive role in model training. For deep learning, a small dimension means insufficient description of the inherent laws of data, while dimension expansion after token embedding can better describe the characteristics of data [28]. In addition, there is time correlation between trajectory points, and the time characteristics cannot be well captured due to parallel calculation during model training. Therefore, by adding positional embedding, the model can learn the location information between data to improve the training performance of the model.

5.4.4. Determine the Optimal Parameters of the Model

After determining the loss function and structure of the model, this paper conducts a combination exploration of the input dimension, output dimension, the number of heads and the number of encoder layers of the model, and makes the following eight sets of comparison experiments to find the optimal model parameters, as shown in Table 2. The experimental results are shown in Figure 11. As can be seen, parameter 6 is the best.

5.4.5. Verify the Model Training Effect

The BERT trajectory pre-training model proposed in this paper is trained on 15% of the trajectory points in the mask sequence, so that the model can predict the value of the mask position from the rest of the trajectory points. In order to verify whether the model has learned the inherent movement law of the data during the training, the verification experiment in this section selects a test track and removes part of the data according to the proportion of 20%, 40% and 80%, to simulate the situation that the receiving track is interrupted due to signal interruption and other factors in the actual signal receiving scene. It needs to be explained that this is only to verify whether the model training is effective. In the verification, the incomplete trajectory is fed into the BERT trajectory pre-training model to see whether the model can complete the missing points through the incomplete trajectory. The experimental results are shown in Figure 12.
The experimental results show that the model can fill the missing points through the incomplete trajectory, and even in the case of the trajectory missing 80% of points, it can still obtain more accurate estimation results through the front and back trajectories, and restore the trajectory in line with the real movement trend. Therefore, it can be determined that the training of the model is effective. It is proved that the model can learn the movement law of the data by masking the trajectory points. In this section, MAE and MEDV are used as evaluation indicators to show the performance of the model more intuitively, as shown in Table 3.

5.4.6. Comparison of Performance of Two Particle Filter Algorithms

According to the above experiments, the optimal parameters of the model are determined and the model is trained according to these parameters, and the BERT trajectory pre-training model is obtained. The effectiveness of model training is verified by experiments. In order to compare the performance of the two particle filter algorithms, this section makes an experimental comparison between the two algorithms and without particle filter candidates. In the experiment, a lot of memory space will be occupied when constructing the candidate trajectory set. Limited by the computer memory, 500,000 candidate trajectories are finally constructed with the particle number of 15, and the candidate trajectories are sent to the model and the maximum a posteriori is calculated. Finally, the trajectory with the largest posterior probability value is selected as the final estimated trajectory, and the experimental results are shown in Figure 13. It can be seen that the performance of Algorithm A is better than that of Algorithm B. In Algorithm B, the analysis is due to the fact that when predicting the particle at the next time, the model cannot make good use of the observation data to correct the particle, which leads to the accumulation of errors and the performance degradation. The observed trajectory also belongs to the candidate trajectory set in essence, and because it is more consistent with the movement trend of the real trajectory, it will also show good performance when using BERT alone. However, as the number of particles increases, we can infer that the performance of BERT combined with particle filtering will be further improved. In order to visually compare the performance differences, MAE and MEDV are selected as the evaluation indicators to measure the performance of the algorithm in the experiment in this section, as shown in Table 4.

5.4.7. Compare Kalman Filter Algorithms

In order to evaluate the performance of the BERT trajectory pre-training model, this section makes a comparison experiment with the Kalman filter method which is widely used in the field of trajectory optimization. The key idea of the Kalman filter is to combine the state equation with the observation equation, obtain the optimal solution, use the final optimal solution to predict the current value, and modify the current value and the current covariance matrix with the observation value. The observed value is understood as the co-ordinates obtained in practice, and there is observation error; the predicted value is the motion law obtained by the mathematical model, and there is a situation inconsistent with the actual situation. It uses the covariance matrix of the state estimation error to measure the reliability of the estimation (Kalman gain). If the predicted state is reliable, the Kalman gain is small; if the observed state is reliable, the Kalman gain is large, and the estimated value and covariance matrix are updated in an optimized way. The Kalman filter algorithm is shown in Algorithm 5.
Algorithm 5: Kalman filter algorithm process
1: A priori estimate: x k = A x k 1 + + B μ k 1 + Q k
2: The covariance of the prior estimate: P k = A P k 1 + A T + Q k
3: Calculate Kalman gain: K k = H T P k H P k H T + R k
4: Update the estimate: x k + = K k ( y k H x k ) + x k
5: Update the covariance matrix: P k + = ( 1 K k H ) P k
When using the Kalman filter algorithm, the state equation in line with the motion scene should be constructed first. Considering that only latitude and longitude are used as input data when training the BERT trajectory pre-training model, the Kalman filter algorithm with constant velocity is selected as a comparison for experimental verification. Its state equation and observation equation are as follows:
x k + 1 y k + 1 v x , k + 1 v y , k + 1 = 1 0 T 0 0 1 0 T 0 0 1 0 0 0 0 1 x k y k v x , k v y , k + 0.5 a x T 2 0 0 0.5 a y T 2 a x T 0 0 a y T + Q k
z k = 1 0 0 0 0 1 0 0 x k + 1 y k + 1 v x , k + 1 v y , k + 1 + R k
By comparing the experimental results shown in Figure 14, it can be seen that the optimized trajectory of the Kalman filter is more dependent on the observed data, that is, the optimization is carried out on the basis of the observed data, and is also affected by the equation of motion. The state equation is used to express the law of motion, which is equivalent to adding constraints to the motion and restricting the regional scope when locating the next point. Although this method can lead to more accurate positioning accuracy, there are still many errors when describing the motion state of the aircraft. The BERT trajectory pre-training model is obtained by training a large number of historical trajectories. Its internal parameters have been able to better express the trajectory motion law when dealing with noisy observation data, so the real trajectory can be smoothly and accurately optimized from the observation data, meaning the performance is more prominent, as shown in Table 5.
Because the BERT pre-training model uses a variety of data during training, it can also perform well in the face of the trajectory of different sports types. Kalman filters do not work well when trajectories are in complex and variable motion patterns, such as heading mutations, as shown in Figure 15. Their generalization performance is poor due to their heavy reliance on observations and state equations, while the BERT pre-training models can still optimize trajectories well, demonstrating the validity of the methods presented in this chapter, as shown in Table 6.

6. Conclusions

Aiming at a key problem—the difficulty of manually modeling complex trajectories in real scenarios—this paper proposes a trajectory-estimation method based on a BERT trajectory pre-training model combined with a particle filter algorithm. Firstly, the real ADS-B data were cleaned and reconstructed, and then sent to the BERT model with adjusted structure for training after mask processing. Then, it explored the optimal parameters of the model and verified the training effect of the model through a series of verification experiments. Then, the particle filter algorithm was used to construct the trajectory set to verify the performance of the model. Finally, the comparison experiment with the traditional Kalman filter algorithm shows the advantages of the BERT trajectory pre-training model. However, due to the limitation of hardware conditions, it is impossible to traverse all possible candidate trajectories. In theory, when the number of particles is enough and the set of candidate trajectories is complete enough, the true trajectory can be restored by calculating the maximum a posteriori. The experiments in this paper prove the feasibility of the method, which provides a new research idea for the problem of trajectory estimation.

Author Contributions

Methodology, H.Y. and J.D.; Software, Y.W.; Writing—original draft, Y.W.; Writing—review & editing, C.G. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Schafer, M.; Strohmeier, M.; Lenders, V.; Martinovic, I.; Wilhelm, M. Bringing up OpenSky: A large-scale ADS-B sensor network for research. In Proceedings of the Ipsn-14 International Symposium on Information Processing in Sensor Networks, Berlin, Germany, 15–17 April 2014; pp. 83–94. [Google Scholar]
  2. Graser, A. An exploratory data analysis protocol for identifying problems in continuous movement data. J. Locat. Based Serv. 2021, 15, 89–117. [Google Scholar] [CrossRef]
  3. Kontopoulos, I.; Makris, A.; Tserpes, K. A Deep Learning Streaming Methodology for Trajectory Classification. ISPRS Int. J. Geo-Inf. 2021, 10, 250. [Google Scholar] [CrossRef]
  4. Chen, X.; Liu, Y.; Achuthan, K.; Zhang, X. A ship movement classification based on Automatic Identification System (AIS) data using Convolutional Neural Network. Ocean Eng. 2020, 218, 108182. [Google Scholar] [CrossRef]
  5. Franco, L.; Placidi, L.; Giuliari, F.; Hasan, I.; Cristani, M.; Galasso, F. Under the hood of transformer networks for trajectory forecasting. Pattern Recognit. 2023, 138, 109372. [Google Scholar] [CrossRef]
  6. Giuliari, F.; Hasan, I.; Cristani, M.; Galasso, F. Transformer Networks for Trajectory Forecasting. arXiv 2020, arXiv:2003.08111. [Google Scholar]
  7. Guo, D.; Wu, E.Q.; Wu, Y.; Zhang, J.; Law, R.; Lin, Y. FlightBERT: Binary Encoding Representation for Flight Trajectory Prediction. IEEE Trans. Intell. Transp. Syst. 2022, 24, 1828–1842. [Google Scholar] [CrossRef]
  8. Gao, C.; Yan, J.; Zhou, S.; Varshney, P.K.; Liu, H. Long short-term memory-based deep recurrent neural networks for target tracking. Inf. Sci. 2019, 502, 279–296. [Google Scholar] [CrossRef]
  9. Gao, C.; Yan, J.; Zhou, S.; Chen, B.; Liu, H. Long short-term memory-based recurrent neural networks for nonlinear target tracking. Signal Process. 2019, 164, 67–73. [Google Scholar] [CrossRef]
  10. Zeng, J.; Zhao, Y.; Yu, Y.; Gao, M.; Zhou, W.; Wen, J. BMAM: Complete the missing POI in the incomplete trajectory via mask and bidirectional attention model. EURASIP J. Wirel. Commun. Netw. 2022, 2022, 53. [Google Scholar] [CrossRef]
  11. Harrison, M. ADS-X the Next Gen Approach for the Next Generation Air Transportation System. In Proceedings of the 25th Digital Avionics Systems Conference, Portland, OR, USA, 15–19 October 2006; pp. 1–8. [Google Scholar]
  12. Luckenbaugh, G.; Landriau, S.; Dehn, J.; Rudolph, S. Service Oriented Architecture for the Next Generation Air Transportation System. In Proceedings of the Integrated Communications, Navigation and Surveillance Conference, Herndon, VA, USA, 30 April–3 May 2007; pp. 1–9. [Google Scholar]
  13. Sipe, A.; Moore, J. Air traffic functions in the NextGen and SESAR airspace. In Proceedings of the IEEE/AIAA Digital Avionics Systems Conference, Orlando, FL, USA, 23–29 October 2009; pp. 2.A.6-1–2.A.6-7. [Google Scholar]
  14. Wang, X.; Jiang, X.; Chen, L.; Wu, Y. KVLMM: A Trajectory Prediction Method Based on a Variable-Order Markov Model with Kernel Smoothing. IEEE Access 2018, 6, 25200–25208. [Google Scholar] [CrossRef]
  15. Chiou, Y.S.; Wang, C.L.; Yeh, S.C. Reduced-complexity scheme using alpha–beta filtering for location tracking. IET Commun. 2011, 5, 1806–1813. [Google Scholar] [CrossRef]
  16. Sanchez Pedroche, D.; Amigo, D.; Garcia, J.; Molina, J.M. Architecture for Trajectory-Based Fishing Ship Classification with AIS Data. Sensors 2020, 20, 3782. [Google Scholar] [CrossRef]
  17. Huang, H.; Hong, F.; Liu, J.; Liu, C.; Feng, Y.; Guo, Z. FVID: Fishing Vessel Type Identification Based on VMS Trajectories. J. Ocean Univ. China 2018, 18, 403–412. [Google Scholar] [CrossRef]
  18. Liu, X.; Liu, Y.; Li, X. Exploring the Context of Locations for Personalized Location Recommendations; AAAI Press: Washington, DC, USA, 2016. [Google Scholar]
  19. Crivellari, A.; Beinat, E. From Motion Activity to Geo-Embeddings: Generating and Exploring Vector Representations of Locations, Traces and Visitors through Large-Scale Mobility Data. ISPRS Int. J. Geo-Inf. 2019, 8, 134. [Google Scholar] [CrossRef]
  20. Nawaz, A.; Huang, Z.; Wang, S.; Akbar, A.; AlSalman, H.; Gumaei, A. GPS Trajectory Completion Using End-to-End Bidirectional Convolutional Recurrent Encoder-Decoder Architecture with Attention Mechanism. Sensors 2020, 20, 5143. [Google Scholar] [CrossRef] [PubMed]
  21. Crivellari, A.; Resch, B.; Shi, Y. TraceBERT-A Feasibility Study on Reconstructing Spatial-Temporal Gaps from Incomplete Motion Trajectories via BERT Training Process on Discrete Location Sequences. Sensors 2022, 22, 1682. [Google Scholar] [CrossRef] [PubMed]
  22. Musleh, M.; Mokbel, M. A Demonstration of KAMEL: A Scalable BERT-based System for Trajectory Imputation. In Proceedings of the Companion of the 2023 International Conference on Management of Data, Seattle, WA, USA, 18–23 June 2023; pp. 191–194. [Google Scholar]
  23. Wang, A.; Cho, K. BERT has a Mouth, and It Must Speak: BERT as a Markov Random Field Language Model. arXiv 2019, arXiv:1902.04094. [Google Scholar]
  24. Goyal, K.; Dyer, C.; Berg-Kirkpatrick, T. Exposing the Implicit Energy Networks behind Masked Language Models via Metropolis—Hastings. arXiv 2021, arXiv:2106.02736. [Google Scholar]
  25. Yamakoshi, T.; Hawkins, R.D.; Griffiths, T.L. Probing BERT’s priors with serial reproduction chains. arXiv 2022, arXiv:2202.12226. [Google Scholar]
  26. Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv 2018, arXiv:1810.04805. [Google Scholar]
  27. Wu, Y.; Yu, H.; Du, J.; Liu, B.; Yu, W. An Aircraft Trajectory Prediction Method Based on Trajectory Clustering and a Spatiotemporal Feature Network. Electronics 2022, 11, 3453. [Google Scholar] [CrossRef]
  28. Mikolov, T.; Chen, K.; Corrado, G.; Dean, J. Efficient Estimation of Word Representations in Vector Space. arXiv 2013, arXiv:1301.3781. [Google Scholar]
Figure 1. Trajectory preprocessing.
Figure 1. Trajectory preprocessing.
Sensors 23 09120 g001
Figure 2. BERT Model Architecture.
Figure 2. BERT Model Architecture.
Sensors 23 09120 g002
Figure 3. Structure of BERT trajectory pre-training model.
Figure 3. Structure of BERT trajectory pre-training model.
Sensors 23 09120 g003
Figure 4. Schematic of the covariance matrix generation.
Figure 4. Schematic of the covariance matrix generation.
Sensors 23 09120 g004
Figure 5. Schematic of the alternative trajectories: The colored lines are alternate trajectories, the red stars are particles, the red line is actual trajectory.
Figure 5. Schematic of the alternative trajectories: The colored lines are alternate trajectories, the red stars are particles, the red line is actual trajectory.
Sensors 23 09120 g005
Figure 6. Flowchart of the particle filter algorithm to construct the set of alternative trajectories.
Figure 6. Flowchart of the particle filter algorithm to construct the set of alternative trajectories.
Sensors 23 09120 g006
Figure 7. Comparison of different loss functions.
Figure 7. Comparison of different loss functions.
Sensors 23 09120 g007
Figure 8. Comparison of different covariance loss functions.
Figure 8. Comparison of different covariance loss functions.
Sensors 23 09120 g008
Figure 9. Compare the effect of FC-Decoder.
Figure 9. Compare the effect of FC-Decoder.
Sensors 23 09120 g009
Figure 10. Comparing the effect of positional embedding and token embedding.
Figure 10. Comparing the effect of positional embedding and token embedding.
Sensors 23 09120 g010
Figure 11. Comparison of different experimental parameters.
Figure 11. Comparison of different experimental parameters.
Sensors 23 09120 g011
Figure 12. Verifying the model training effect: (a) Missing 20% of trajectory points; (b) Missing 40% of trajectory points; (c) Missing 80% of trajectory points.
Figure 12. Verifying the model training effect: (a) Missing 20% of trajectory points; (b) Missing 40% of trajectory points; (c) Missing 80% of trajectory points.
Sensors 23 09120 g012
Figure 13. Performance comparison of two algorithms and BERT.
Figure 13. Performance comparison of two algorithms and BERT.
Sensors 23 09120 g013
Figure 14. Performance comparison between BERT trajectory pre-training model and Kalman filter algorithm in trajectory 1.
Figure 14. Performance comparison between BERT trajectory pre-training model and Kalman filter algorithm in trajectory 1.
Sensors 23 09120 g014
Figure 15. Performance comparison between BERT trajectory pre-training model and Kalman filter algorithm in trajectory 2.
Figure 15. Performance comparison between BERT trajectory pre-training model and Kalman filter algorithm in trajectory 2.
Sensors 23 09120 g015
Table 1. Experimental parameter.
Table 1. Experimental parameter.
ParameterThe Numerical
OptimizerAdam
Rate of learningl−3
Weight declinel−5
Epoch100
Batch Size1024
Dropout0.1
Sequence length100
Table 2. Parameter Setting.
Table 2. Parameter Setting.
Parameter SettingLoss
Input
Dimensions
Output
Dimensions
Number
of Heads
Number of
Encoder
Parameter 1128256440.2619
Parameter 2256256440.2547
Parameter 3128128440.3783
Parameter 464128440.3956
Parameter 5256128440.3653
Parameter 6256256240.2387
Parameter 7256256420.2657
Parameter 8256256220.2734
Table 3. Trajectory evaluation metrics for different proportions of missing points.
Table 3. Trajectory evaluation metrics for different proportions of missing points.
Percentage of Missing PointsEvaluation Indicators
MAEMEDV/km
20%0.003190.484
40%0.008731.358
80%0.021233.391
Table 4. Comparison of the evaluation indicators of the two algorithms and BERT.
Table 4. Comparison of the evaluation indicators of the two algorithms and BERT.
ParameterTrajectory DataMAEMEDV/km
Number of ParticlesNumber of Alternative Trajectories
\\Observe Trajectory0.051158.183
15500,000Algorithm A Trajectory0.028434.492
15500,000Algorithm B Trajectory0.0979615.408
\\BERT0.030154.860
Table 5. Comparison of the evaluation indicators of BERT trajectory pre-training model and Kalman filter algorithm in trajectory 1.
Table 5. Comparison of the evaluation indicators of BERT trajectory pre-training model and Kalman filter algorithm in trajectory 1.
ParameterTrajectory DataMAEMEDV/km
Number of ParticlesNumber of Alternative Trajectories
\\Observe Trajectory0.053428.301
15500,000Trajectory estimation by BERT0.031044.913
\\Trajectory estimation by Kalman filter0.035225.529
Table 6. Comparison of the evaluation indicators of BERT trajectory pre-training model and Kalman filter algorithm in trajectory 2.
Table 6. Comparison of the evaluation indicators of BERT trajectory pre-training model and Kalman filter algorithm in trajectory 2.
ParameterTrajectory DataMAEMEDV/km
Number of ParticlesNumber of Alternative Trajectories
\\Observe Trajectory0.046657.390
15500,000Trajectory estimation by BERT0.035085.435
\\Trajectory estimation by Kalman filter0.038876.267
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wu, Y.; Yu, H.; Du, J.; Ge, C. Trajectory-BERT: Trajectory Estimation Based on BERT Trajectory Pre-Training Model and Particle Filter Algorithm. Sensors 2023, 23, 9120. https://doi.org/10.3390/s23229120

AMA Style

Wu Y, Yu H, Du J, Ge C. Trajectory-BERT: Trajectory Estimation Based on BERT Trajectory Pre-Training Model and Particle Filter Algorithm. Sensors. 2023; 23(22):9120. https://doi.org/10.3390/s23229120

Chicago/Turabian Style

Wu, You, Hongyi Yu, Jianping Du, and Chenglong Ge. 2023. "Trajectory-BERT: Trajectory Estimation Based on BERT Trajectory Pre-Training Model and Particle Filter Algorithm" Sensors 23, no. 22: 9120. https://doi.org/10.3390/s23229120

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop