Abstract

Vehicle trajectory data can reveal naturalistic driving behaviour trends. However, owing to measurement and processing errors, the trajectory data extracted from videos often contain obvious noise. In merging zones, vehicles tend to accelerate and decelerate frequently, leading to poor denoising performance of the linear Kalman filter (KF). To address this issue, this study proposes a new denoising method based on the adaptive Kalman filter, which automatically switches between KF and Unscented KF to accommodate car-following and merging behaviours, respectively. A merging behaviour detection method was designed based on the PELT method and normalized innovation squared (NIS). The F1 score of 92.9% shows the accuracy of behaviour detection. According to our results, the proposed method minimizes the range of jerk compared with other methods, reducing it from −4927.78 to 4960.72 of raw data to −44.92 to 47.14, indicating a significant improvement in denoising and trajectory smoothing. The goal of this study is to achieve high-precision trajectory data under complex real traffic scenarios.

1. Introduction

Vehicle trajectory data can be used to calibrate and validate the traffic flow model and provide a broad understanding of driving behaviour[1]. These data are available to the research community and have been widely used in recent years. Among these data, next-generation simulation (NGSIM) data have rich information, becoming the de facto basis of theoretical traffic flow research advances [2]. However, outliers falling out of a limited range cause quality issues in the trajectory data [3]. In addition, processing and measurement errors [4] are evitable [57]. Moreover, location and speed amplify noise, negatively affecting the applications of these trajectory data [8]. To achieve high-fidelity trajectory data, researchers have proposed multistep trajectory processing methods [9, 10], denoising speed, acceleration, and space headway [1113].

Methods for noise removal have improved over the years. Kalman filter (KF) [14, 15] is the most commonly used method. Unlike the feedforward method [16], which uses input signals to predict system response and control, the KF employs a feedback mechanism to continuously update the state estimation and adjust it based on the current observation value. Therefore, KF is an optimal recursive data processing algorithm [17]. Inaccurate or noisy measurements can be used to estimate the state of a linear system with high accuracy. It is also used for trajectory prediction [18, 19]. However, the simple KF is primarily used for constant-acceleration motion and performs well in trajectory noise removal and prediction under car-following scenes [20]. It cannot function correctly if vehicles exhibit complex behaviours, especially when vehicles take two-dimensional movements and interact with other vehicles [21, 22]. For instance, in some complex scenarios, turning vehicles interact with most traffic flows, which introduce complex features including variation of trajectories [23]. Furthermore, vehicles in merging areas tend to accelerate and decelerate more often owing to the strong competition for space [24]. Therefore, merged areas may be prone to a substantial number of crashes, causing personal injury and property damage. Each merging event has a probability of a near accident [25]. To improve road safety and efficiency levels, a reliable merging area trajectory data are needed to conduct a thorough study on merging behaviour.

To solve these problems, many researchers have used an extended Kalman filter (EKF) [26, 27]. For example, Abbas et al. [28] proposed a multimodel-based EKF used to predict a set of possible scenarios for a vehicle’s future position, particularly at an intersection or on a curved path. The EKF uses a low-order Taylor expansion to linearize the nonlinear function; however, the Jacobian matrix of the state vector may be difficult to calculate for complex dynamics. Therefore, the unscented Kalman filter (UKF) has been proposed to solve nonlinear dynamics [2931]. The UKF performs better than the simple KF and UKF when the system is highly nonlinear [30].

Additionally, researchers have proposed approaches based on maneuver modeling [32, 33]. These approaches meet accuracy requirements with massive data input in the long run; however, they often result in insufficient real-time performance. To achieve a balance between accuracy and real-time performance, the adaptive Kalman filter (AKF) is a relevant option. The term adaptive refers to the ability to adjust the algorithm itself dynamically based on the changing characteristics of the system and shows great robustness in antinoise [34]. For example, Xiao et al. [35] combined the constant turn rate and acceleration (CTRA) motion model and the UKF to predict vehicle trajectory and motion states. Compared with the simple KF and EKF, AKF demonstrates strong adaptability to complicated scenes and reduces the complexity of data processing, in contrast to machine learning methods, which require abundant data and training. However, the aforementioned research does not address how the adaptive process responds to changes in the underlying system, particularly when the system exhibits multiple behaviours that are consistent with complex real-world situations; thus, further research is limited.

This study proposes a method to reconstruct the acceleration data of vehicles in merging zones. First, the constant-acceleration KF and UKF are used to process the acceleration data and calculate the NIS of the KF. Subsequently, a method combined with the pruned exact linear time (PELT) changepoint detection and NIS results is used to identify merging behaviours. Furthermore, outliers are identified and removed during filtering process for noise removal. The outlier-handle method satisfied the Markov assumption made by the KF. Finally, the proposed method is applied to merge zone open data.

The main contributions of this study can be summarized as follows:(1)A novel adaptive approach to denoise traffic acceleration data is proposed based on the characteristics of car-following and merging behaviours. This approach improves the precision of trajectory data in complex traffic scenarios.(2)Merging behaviours are identified separately from car-following behaviours. The power of NIS and changepoint detection was leveraged to overcome the limitations of traditional measures such as velocity and acceleration. This method provides a new way to identify different car behaviours with offline data and facilitate more accurate modeling of traffic flow.(3)Mahalanobis distance is used in this study to measure the distance between an outlier and its distribution, while Chebyshev’s theorem is applied to determine the threshold for outliers with raw data. This procedure has significant guiding significance in outlier removal procedures, especially when processing reality data.

The remainder of this paper is organized as follows: Section 2 describes the characteristics of the data and acquisition process. Section 3 describes the proposed method. Section 4 presents the results of the jerk analysis and a comparison with other methods. This paper concludes with a discussion and conclusions in Section 5.

2. Trajectory Data

2.1. Data Description

Open data downloadable at https://seutraffic.com/ in the ubiquitous traffic eye database [36] were used to verify the proposed method. The video was recorded at the Kazimen interchange in Nanjing City, China (Figure 1) using a DJI Mavic Pro. The unmanned aerial vehicle (UAV) flew for 1184 s at a height of 285 m and covered approximately 352 m. Finally, 2513 trajectories were recorded. After running the image recognition algorithm, the data contained vehicle IDs, timestamps, lane logs, speed, acceleration, and vehicle locations that were saved in the Frenet frame.

The east-west direction, where the merging zone belongs, was selected as the research section. The results of the study by Westphal [37] showed that the merging behaviour of vehicles on ramps only affected the outermost lane of the main lane. Thus, this study focused on lanes 1–3. Figure 2 shows lane IDs and traffic directions.

First, the macroscopic characteristics of traffic flow are described. Figure 3 shows that the velocity distribution is a normal distribution with a 50 km/h mean, consistent with the actual speed distribution. Reasonable ranges in acceleration and deceleration were established as 0 m/s2 to 5 m/s2 and −6 m/s2 to 0 m/s2 [38], respectively. Compared to the raw data, the percentage of acceleration >2 m/s2 and deceleration <−2 m/s2 were 0.05% and 0.01%, respectively, indicating normal driving conditions.

Second, the outliers of acceleration and deceleration with a limit range of −6 m/s2 to 5 m/s2 were analyzed, as shown in Figure 4. Most acceleration values in Figure 4 fall within the range of −6 m/s2 to 5 m/s2, but some outliers exist, such as maximum deceleration and acceleration values of −150 m/s2 and 50 m/s2, respectively. Outliers were handled during the filtering process to avoid adverse effects on the final result caused by smoothing them before filtering, which violates the Markov assumption of KF on the observed data.

To determine the frequent interval of merging behaviour, moving least squares (MLS) was used to reconstruct the spatiotemporal evolution of the traffic flow in lanes 1–3. This can fit the instantaneous speed distribution per second for each vehicle. Figure 5 shows the characteristics of the velocity drop and recovery in different spatial and temporal dimensions.

Figure 5 shows that the driving speed was relatively high when most vehicles did not merge, particularly in the first 400 s. During this period, the vehicles primarily moved at a constant velocity or acceleration. By contrast, the acceleration varied, as can be observed in the range of 800 s to 1000 s. Notably, between 200 s and 400 s, lane 1 experienced a drop in speed followed by a recovery. The other two lanes were unaffected by this phenomenon with relatively small changes in speed rate. Note that the dynamics of speed change were similar, and all of them almost dropped to the minimum synchronously in a local space-time region where vehicles merged into main lanes with high probability. This observation provides a preliminary basis for designing the AKF threshold.

2.2. Data Preprocessing

The location data in Figure 6 are in the Frenet frame, which is based on a given curve and represents a point’s position by displacement along the reference line and lateral offset distance. The Frenet frame is useful because any road can be standardized as a straight tunnel, simplifying trajectory planning for curved roads. However, the Frenet frame has separate coordinate systems for each lane, making it difficult to represent lane-crossing behaviours. Therefore, Frenet data should be converted to a global Cartesian frame.

The process of converting the data from the Frenet frame to the Cartesian frame is divided into the following steps:

2.2.1. Selection of Reference Lines

The reference lines are the upper and lower boundary lines of the lane and centerline. The OpenCV library was utilized to identify boundaries and extract reference points from aerial videos, and the resulting selection is shown in Figure 7. Subsequently, the locations of reference points in the Cartesian frame can be determined based on the pixel scale e.g., () and () successively. For the centerline, the location of the reference points can be determined by calculating the median of the corresponding points in the upper and lower boundaries.

2.2.2. Coordinate Transformation

For any point in the Frenet coordinate system , let , where is the projected distance, is the lateral offset, and the corresponding point in the Cartesian coordinate system is , which is between two adjacent reference points; that is, and . Therefore, we have and . Figure 8 illustrates the relationship between the Frenet coordinate system and the Cartesian coordinate system. can be calculated using the following equation:where is the distance between and and is the angle between the line passing through points and and the x-axis.

Subsequently, the difference in displacement along the reference line between and the nearest reference point can be approximated by

Let . Accordingly, if the nearest reference point below is the starting point of the reference line.

Substituting into equation (1) gives the Cartesian coordinate of :

3. Proposed Methods

3.1. Adaptive Kalman Filter Design

The KF was named after Rudolf E. Kalman, one of the primary developers of its theory [39]. It can effectively reduce measurement noise and estimate true values in trajectory processing while remaining robust to model uncertainties. In vehicle dynamics, the variance of the acceleration change is rather small if the vehicle is running at a constant speed or acceleration. Therefore, the constant-acceleration KF is applied with the assumption that the initial acceleration equals zero.

For linear discrete dynamic systemswhere is the state vector at time and is the state transition matrix. represents the process noise, a multivariate normal distribution with a mean of 0.

In equation (5), is the measurement of the real state , is the observation model that maps the real state space to the observed state space, and is the observation noise, assumed to be zero-mean Gaussian white noise with covariance .

To predict and update the state estimation, KF can be explained as follows:where is the a priori state estimate, is the a posteriori estimate covariance matrix, and is the covariance matrix of . is the identity matrix and is the Kalman gain.

Finally, the state vector for constant-acceleration motion is given bywhere is the distance moved, is the velocity, and is the acceleration at time .

However, dealing with nonlinear processes is difficult for a standard KF. When merging behaviour occurs, vehicles are affected by the steering wheel angle and throttle opening; thus, the acceleration distribution exhibits apparent nonlinear characteristics. If a standard KF is applied to these accelerations, the nonlinear process will be considered as large observation noise, leading to a slower prediction changing trend compared with the observation. Trajectory data extracted from aerial videos primarily include location, velocity, and acceleration; thus, they lack microscopic data of steering wheel angle and throttle opening for the standard KF. Therefore, this study used the UKF to simulate the merging process.

As this study is primarily concerned with merging behaviour, the road cross-section was chosen from the nose of the ramp, where lanes 1 and 2 overlapped completely with the specific scene. In addition to the lateral and longitudinal displacements, merging behaviour also involves the heading angle. Therefore, polar coordinates are more suitable to represent the merging angle between the driving direction of the vehicle at time k and the direction of lateral displacement. This angle will be included in the state vector of the UKF.

3.2. Removal of Outliers

To avoid conflicting with the Markov assumption, we handle outliers during the filtering process instead of processing them before. This ensures that smoothed outliers do not contain information from previous or subsequent values. To achieve this, we use the Mahalanobis distance to measure the distance between a point and its distribution.where is the mean of the normal distribution, is the state vector, and is the a posteriori estimate covariance matrix.

Figure 4 illustrates that the acceleration data had numerous outliers, which can be classified into two categories: those exceed the vehicle’s dynamic limit and outliers within a reasonable interval but are isolated and deviated from the overall trend. These two categories can be distinguished by comparing the Mahalanobis distance. Typically, 99.7% of a normal distribution falls within three standard deviations from the mean; however, since this distribution is only approximately normal, Chebyshev’s theorem suggests that about 96% of data fall within five standard deviations. Therefore, in this case, five standard deviations are used as a threshold to identify outliers.

3.3. Merging Behaviour Detection

In trajectory data, it is commonly assumed that merging behaviour occurs instantaneously, with a vehicle’s lane ID changing after a single frame. However, in reality, merging behaviour takes a variable amount of time to complete, making it difficult to identify solely based on measures such as a vehicle’s velocity or acceleration. To address this issue, a new method is proposed that combines NIS [40] and changepoint detection to effectively identify merging behaviour.

The NIS is used to check whether a KF is consistent with measured residuals and the associated innovation covariance matrix. By normalizing the residuals using covariance and analyzing the resulting NIS, it is possible to identify situations where the KF assumption of constant car-following behaviour may not hold true. In this way, trajectory data that do not correspond to car-following scenarios can be filtered out based on predictions and measurements. The NIS can be calculated aswhere γ(k) is the innovation vector.

However, it should be noted that while a drastic change in the NIS may indicate the emergence of braking in a car-following scenario, it does not necessarily imply that the vehicle is merging. Therefore, in order to accurately identify merging behaviours, it is necessary to look beyond just prediction and measurements.

To effectively utilize trajectory data, we employed the PELT changepoint detection method. This method can be easily integrated into the KF and offers a good balance between algorithm complexity and detection accuracy, especially when the data structure is not overly complex. The PELT algorithm uses observations to identify potential acceleration changepoints in the time series. It further divides the time interval when the NIS fluctuates, which helps capture the variable and complex nature of merging behaviour over time. By examining these results, merging behaviour can be determined from a temporal perspective. The PELT detection method is as follows:where denotes acceleration, k is the number of changepoints in the history, and the acceleration time series were split into k + 1 distinct segments. represents the location of the changepoint for j = 1, …, k. To simplify the analysis, without loss of generality,  = 0 and were also set. is the cost function of each segment, while is a penalty item that prevents overfitting, and is a constant independent of the position and number of acceleration changepoints. As a common choice, L2 normalization was selected as the cost function.

For a given acceleration segment, the PELT method assumes a constant for all that satisfieswhere s and t are the start and end points of the segment, respectively.

For , we havewhere , represents the set of possible values for , and the number of elements in the set increased with the recursive calculation. The initial value is . Let

Accordingly,where and is the detected acceleration changepoint.

Thus, the merging behaviour is identified further by detecting the acceleration changepoint.

The value of is crucial for the PELT results. Many false changepoints will be detected if the penalty value is too low. By contrast, real changepoints may not be found if the penalty value is too high. In addition to manually selecting parameters with good performance after several trials, parameters can be selected according to the following formula:where α is the sensitivity ranging 0 to 1. When α is 1, it corresponds to minimizing the Bayesian information criterion (BIC).

By combining NIS and PELT changepoint detection, we were able to determine the merging behaviour within a specified space range and period. The framework of this method is illustrated in Figure 9.

4. Results

Vehicle No. 173 was chosen as a case study to examine the proposed method’s process. The acceleration data were analyzed using a constant-acceleration KF and the NIS was calculated based on measurements and predictions. Figure 10 displays the results, which revealed fluctuations between 894 and 898 seconds. Consequently, PELT changepoint detection was continuously applied to the acceleration data of Vehicle No. 173 (marked in red in Figure 11) based on observation data. As shown in Figure 11, the changepoints’ locations fell within an intense growth period of NIS, indicating merging behaviour occurred. The comparison with aerial video (Figure 12) showed that during the merging zone, Vehicle No. 173 crossed longitudinally from lane one to lane three, which means merging behaviour really happened; this result is consistent with our detection outcome. In total, we used 923 vehicle trajectories for the experiment and applied our proposed method to these trajectories. Our method achieved a merging behaviour detection recall rate of 92.3% and precision of 93.5%, resulting in an F1 score of 92.9%. These findings indicating that the proposed method performs well in detecting merging behaviours.

Directly comparing and verifying the improvement effect is not feasible since the ground truth is unknown. Therefore, to evaluate the filtering performance, first, we randomly selected multiple trajectory data from different periods. We compared our method with the simple moving average (SMA) because it can remove high-frequency noise while preserving the underlying trends and patterns and is also robust to outliers. Figure 13 shows the comparison of filtering effect. The SMA processing lags behind the trend of raw data for all vehicles except No. 821. The acceleration data of No. 821 change abruptly both in the overall and local trends, which are well balanced by SMA. However, this may lead to information loss, especially when there is a significant difference between maximum and minimum values.

Secondly, we utilized indirect quantitative indicators, specifically jerk analysis, for comparison. The advantage of jerk analysis in vehicle acceleration judgment lies in providing a more comprehensive and precise understanding of a vehicle’s motion dynamics. By analyzing and comparing indicators such as the percentage of jerk sign reversal within a 1-second window, the percentage of the absolute value of jerk above a given threshold, and the range of jerk between different methods, we can better evaluate the mechanical and human-machine feasibility of acceleration data, and consequently, assess the effectiveness of the denoising process.

Table 1 shows that the proposed method significantly minimized the range of jerk compared with other methods, reducing it from −4927.78 to 4960.72 of raw data to −44.92 to 47.14. Additionally, a good reduction effect was achieved in the average value for the percentage of the absolute value of jerk greater than 15 m/s3. For the percentage of jerk sign reversal within 1 s, the degree of average reduction was second to that of the SMA. These findings demonstrate the effectiveness of the proposed method. Note that the maximum sign inversion of jerk was 100% in all columns owing to the characteristics of the data itself. Some vehicles entered lane 3 from lane 4 in a short period of time, and the driving time was relatively short; therefore, the sign reversal was 100%.

To demonstrate the transferability of the proposed method, we conducted experiments using the NGSIM I-80 dataset, which is one of the most popular datasets for studying merging behaviour. The results are presented in Table 2, with Jerk analysis results cited from Rafati Fard et al. [10]. As can be seen, the proposed method achieved good denoising effectiveness in this dataset, reducing the range of Jerk from −1846 to 1640 of raw data to −54.33 to 53.67. Additionally, the proposed method achieves good performance in the other two indicators.

5. Summary and Conclusions

This paper presents a novel approach for processing acceleration data in vehicle merging zones, utilizing the unique characteristics of car-following and merging behaviours. The proposed method employs an adaptive mechanism that identifies different vehicle behaviours based on the results of NIS and PELT, taking advantage of the characteristic differences produced by AKF. Outliers are detected using Mahalanobis distance during the filtering process to ensure the accuracy of predictions and maintain data integrity, significantly enhancing the precision of our method.

Compared to the commonly used simple moving average (SMA) method, the proposed approach shows a more accurate filtering result and strong applicability to merging scenes. The resulting trajectory data also suggest a more reliable set of characteristics corresponding with mechanical and human-machine feasibility. However, to improve the generalizability of our approach, further studies are required to investigate the changepoint detection method and parameters in relation to specific traffic scenes and traffic flow characteristics.

In conclusion, our proposed method demonstrates a significant improvement in the processing of acceleration data in vehicle merging zones. By utilizing adaptive mechanisms, our approach offers a more accurate and reliable set of trajectory data, which has promising applications in traffic safety and traffic flow optimization.

Data Availability

The trajectory data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This study was financially supported by the National Natural Science Foundation of China (No. 52272337).