A method for real-time trajectory prediction of over-limit and overload vehicles based on collaborative filtering
By combining multi-dimensional similarity calculation and DBSCAN clustering with the BiLSTM-Transformer model, the problems of personalization and road network constraints in trajectory prediction of overloaded vehicles are solved, achieving high-precision and robust trajectory prediction and improving the adaptability and practicality of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-16
- Publication Date
- 2026-03-31
AI Technical Summary
Existing vehicle trajectory prediction methods struggle to accurately characterize individual patterns when dealing with overloaded vehicles, are unable to effectively model complex long-term dependencies, and produce prediction results that do not conform to road network constraints, resulting in unusable predicted trajectories and poor practicality.
A collaborative filtering-based approach is adopted to identify similar vehicle groups through multi-dimensional similarity calculation and DBSCAN clustering. The BiLSTM-Transformer model is combined to capture short-term dynamics and long-term dependencies, and a Hidden Markov Model is used for road network matching to generate predicted trajectories that meet road constraints.
It achieves high-precision and robust trajectory prediction for overloaded vehicles, improves the generalization performance of the model and the practicality of the prediction results, and provides interpretable insights into vehicle operation patterns, making it suitable for intelligent traffic management.
Smart Images

Figure CN121542775B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation and vehicle behavior prediction technology, specifically to a real-time trajectory prediction method for overloaded vehicles based on collaborative filtering, and more particularly to a trajectory prediction method for overloaded vehicles that combines multi-dimensional behavior clustering with a BiLSTM-Transformer hybrid model. Background Technology
[0002] With the rapid development of the highway transportation industry, overloaded and oversized transport has become a key focus of traffic management departments due to its serious threat to road traffic safety and the lifespan of infrastructure. Accurate prediction of the travel trajectories of overloaded and oversized vehicles is a crucial technological prerequisite for achieving proactive safety warnings, optimizing the allocation of road network enforcement resources, and preventing serious traffic accidents.
[0003] Currently, vehicle trajectory prediction methods can be mainly divided into two categories: model-driven and data-driven. Traditional model-driven methods (such as Kalman filtering and vehicle kinematic models) have simple modeling of the vehicle's physical constraints and are difficult to cope with the changing driving behaviors in complex traffic environments, especially the unique driving characteristics exhibited by overloaded vehicles due to differences in load, inertia, etc., resulting in limited prediction accuracy. In recent years, data-driven methods, represented by recurrent neural networks (RNNs) and their variants (such as LSTM and GRU), have been widely used due to their powerful temporal modeling capabilities. These methods predict future trajectories by learning patterns in historical trajectory data, achieving better results than traditional methods.
[0004] However, existing deep learning-based trajectory prediction methods still face the following significant technical challenges when applied to overloaded vehicles:
[0005] Different overloaded vehicles have vastly different purposes, routes, and work habits (e.g., gravel trucks on fixed routes vs. long-distance, unpredictable freight trucks). Directly training the model by mixing data from all vehicles will result in the model learning a vague "average behavior," failing to accurately characterize the individualized patterns of specific vehicles or groups, leading to poor model generalization and inaccurate predictions.
[0006] While existing mainstream models such as LSTM can handle short-term dependencies, their ability to capture "long-term dependencies"—which require combining travel patterns from several hours or even days ago (such as periodic intercity transportation) to infer future routes—is limited. The trajectories of overloaded vehicles often exhibit complex spatiotemporal patterns, making it difficult for existing models to effectively model the complex global dependencies between trajectory points.
[0007] Most deep learning methods directly output latitude and longitude coordinate sequences. These predicted points are often discretely distributed in the road network space, which may deviate from the actual roads and not comply with topological rules such as road connectivity and one-way restrictions. This results in the predicted trajectory being unusable in the actual road network, greatly reducing its practicality.
[0008] Existing methods often treat trajectory prediction as a purely coordinate sequence prediction problem, neglecting the rich contextual features highly correlated with the trajectory, such as the origin and destination points (OD) of vehicle trips and travel time preferences. These features are key to distinguishing vehicle behavior patterns, but their deep correlation with spatial trajectories has not yet been effectively utilized in existing prediction frameworks.
[0009] Therefore, there is an urgent need for a method to predict the trajectory of overloaded vehicles that can overcome the above-mentioned defects, automatically identify similar behavioral groups, deeply integrate multi-dimensional features, accurately model long-term complex dependencies, and output predicted trajectories that conform to road network constraints. Summary of the Invention
[0010] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0011] A method for real-time trajectory prediction of overloaded and oversized vehicles based on collaborative filtering includes the following steps:
[0012] S101: Obtain historical GPS trajectory data of multiple overloaded vehicles, the historical GPS trajectory data including timestamps, latitude and longitude coordinates and instantaneous vehicle speed;
[0013] S102: The historical GPS trajectory data is preprocessed, including data cleaning, interpolation, stop point detection, and origin-destination (OD) point identification, to obtain preprocessed historical trajectory data; wherein, OD point identification is achieved by setting a stop time threshold and a movement distance threshold, the stop time threshold ranges from 21 minutes to 69 minutes, and the movement distance threshold is 500 meters;
[0014] S103: Based on the preprocessed historical trajectory data, calculate the comprehensive similarity between every two overloaded vehicles; the comprehensive similarity is obtained by weighted fusion of trajectory spatial similarity, OD point similarity, and travel time similarity, with weights of 0.4, 0.4, and 0.2, respectively; the trajectory spatial similarity is calculated using the Longest Common Subsequence (LCSS) algorithm, the OD point similarity is calculated using the Jaccard similarity coefficient, and the travel time similarity is calculated using cosine similarity.
[0015] S104: Convert the comprehensive similarity into a comprehensive distance matrix, and use the DBSCAN clustering algorithm to cluster overloaded vehicles based on the comprehensive distance matrix to obtain multiple similar vehicle groups; wherein, the hyperparameters of the DBSCAN algorithm include the similarity threshold Eps and the neighborhood density threshold MinPts, which are selected through silhouette coefficient optimization;
[0016] S105: For each similar vehicle group, calculate the cluster center features, including the representative trajectory, the set of OD points, and the average travel time vector; the representative trajectory is selected from the trajectory with the highest similarity to the average trajectory of all vehicles in the cluster, the set of OD points is the union of the OD points of all vehicles in the cluster, and the average travel time vector is obtained by taking the mean after trigonometric transformation.
[0017] S106: Obtain the current historical trajectory data of the target overloaded vehicle, and extract its historical trajectory, OD point set and average travel time vector;
[0018] S107: Calculate the overall similarity between the target vehicle and each similar vehicle group, and match the target vehicle to the similar vehicle group with the highest overall similarity.
[0019] S108: Train a BiLSTM-Transformer trajectory prediction model using historical trajectory data of matched similar vehicle groups; the BiLSTM-Transformer trajectory prediction model includes a BiLSTM layer and a Transformer encoder layer to capture short-term dynamics and long-term dependencies.
[0020] S109: Input the historical trajectory data of the target vehicle into the trained BiLSTM-Transformer trajectory prediction model, and output the predicted trajectory point sequence for future time steps; the historical trajectory data is input in a sliding window manner, with a window size of 50 time steps, and the prediction is made for the next 10 time steps.
[0021] S110: Perform road network matching on the predicted trajectory point sequence, and use the Hidden Markov Model (HMM) algorithm to map the predicted trajectory points to the real road network, and output the final predicted trajectory that conforms to the vehicle driving logic; wherein, the HMM algorithm uses the predicted trajectory points as the observed state and the road network segments as the hidden state, and solves the maximum likelihood sequence through the Viterbi algorithm.
[0022] Preferably, the specific steps for detecting the dwell point in step S102 include:
[0023] S1021: For vehicle trajectory data, detect a set of points whose maximum movement distance does not exceed 500 meters within a continuous time range;
[0024] S1022: Calculate the dwell time of the point set. If the dwell time is between 21 minutes and 69 minutes, it is identified as the dwell point.
[0025] S1023: Mark the start and end points of the stop points as OD points.
[0026] Preferably, the calculation of trajectory space similarity in step S103 specifically includes:
[0027] S1031: Historical trajectory of vehicle A and the historical trajectory of vehicle B Each point contains latitude and longitude coordinates;
[0028] S1032: Set spatial distance threshold The length of the longest common subsequence dp[n,m] is calculated using dynamic programming, with the recurrence relation as follows:
[0029]
[0030] S1033: Calculate trajectory space similarity .
[0031] Preferably, the calculation of OD point similarity in step S103 specifically includes:
[0032] S1034: The set of OD points for vehicle A The set of OD points of vehicle B Calculate the Jaccard similarity coefficient:
[0033]
[0034] If the distance between two OD points is less than or equal to 100 meters, they are considered to be common OD points.
[0035] Preferably, the calculation of travel time similarity in step S103 specifically includes:
[0036] S1035: For the start time t of the journey, it is mapped to a two-dimensional vector using trigonometric functions.
[0037]
[0038] S1036: Calculate the cosine similarity of the time vectors of vehicle A and vehicle B:
[0039]
[0040] in, and These are the time vectors of the two vehicles, respectively.
[0041] Preferably, the hyperparameter optimization step of the DBSCAN clustering algorithm in step S104 includes:
[0042] S1041: Select different combinations of Eps and MinPts, and calculate the silhouette coefficient SC of the clustering results under each combination;
[0043] S1042: Select the combination with the largest profile coefficient as the optimal hyperparameter; the formula for calculating the profile coefficient is:
[0044]
[0045]
[0046] in, For the sample The average distance to other samples within the same cluster. For the sample Average distance to other cluster samples The total number of samples.
[0047] Preferably, the construction step of the BiLSTM-Transformer trajectory prediction model in step S108 includes:
[0048] S1081: The input trajectory sequence is processed using a BiLSTM layer to extract bidirectional temporal features; the BiLSTM consists of a forward LSTM and a backward LSTM, and the output is the concatenation result of the hidden states;
[0049] S1082: Map the BiLSTM output to the Transformer dimension through a linear projection layer, using the following formula: ;
[0050] S1083: Add positional encoding (PE) to the projected features to obtain features with temporal information. Position encoding uses sine and cosine functions;
[0051] S1084: Calculates attention weights using a multi-head self-attention mechanism, the formula is as follows: ,in Depend on Obtained by linear transformation;
[0052] S1085: Nonlinear transformation is performed using a feedforward network (FFN), the formula is as follows: ;
[0053] S1086: Outputs global features through the residual normalization layer for trajectory prediction.
[0054] 8. The method according to claim 1, wherein the specific steps of road network matching in step S110 include:
[0055] S1101: Construct an HMM model by taking the predicted trajectory points as the observed state and the actual road network segments as the hidden state.
[0056] S1102: Define the launch probability based on the Euclidean distance from the trajectory point to the road segment, and define the transition probability based on the road segment connectivity and travel time constraints;
[0057] S1103: Use the Viterbi algorithm to solve the maximum apparent hidden state sequence and realize trajectory point mapping;
[0058] S1104: Output the matched trajectory sequence, ensuring that the trajectory is continuous and conforms to the road topology rules.
[0059] Preferably, the sliding window scrolling prediction step in step S109 includes:
[0060] S1091: Using 50 historical time step trajectory data as initial input, predict the next 10 time steps;
[0061] S1092: Combine the predicted 10 time-step data with some historical data to form a new 50-time-step input sequence;
[0062] S1093: Repeat S1091 and S1092 to achieve multiple rounds of rolling prediction until the required prediction duration is covered.
[0063] Preferably, the method further includes an evaluation step: using mean squared error (MSE), mean absolute error (MAE), and half-versine distance (Haversine Distance) as indicators to evaluate the error between the predicted trajectory and the true trajectory; wherein, the half-versine distance is calculated using the following formula:
[0064]
[0065] in The difference in latitude between the actual point and the predicted point. The latitude of the actual point. The latitude of the prediction point. This represents the difference in longitude between the actual point and the predicted point.
[0066] Compared with existing technologies, the trajectory prediction method for overloaded and oversized vehicles based on DBSCAN clustering and BiLSTM-Transformer provided by this invention has the following significant advantages:
[0067] This invention introduces the DBSCAN clustering step based on multi-dimensional comprehensive similarity (spatial trajectory, OD point, and travel time), which can automatically and accurately group overloaded vehicles with similar behavioral patterns into the same group. Matching the most similar group to the target vehicle for model training effectively solves the problem of ambiguous model learning targets caused by data heterogeneity. Simultaneously, by combining a BiLSTM-Transformer hybrid model architecture, the BiLSTM layer excels at capturing local temporal dynamics and short-term driving patterns, while the Transformer encoder's self-attention mechanism effectively models global long-distance dependencies and complex trajectory patterns. The complementary advantages of these two approaches result in a significant leap in overall prediction accuracy. The DBSCAN algorithm can automatically identify noise points (vehicles with abnormal behavior), further enhancing the method's robustness to data noise.
[0068] By employing a process of "clustering first, then matching, and then training for prediction," this invention achieves targeted modeling of subgroups with different behavioral patterns. When faced with a new target vehicle, the method can dynamically match it to the most similar group and use the group's "experience" for prediction. This mechanism transforms the model from a "general but mediocre" model into one with "personalized" prediction capabilities for different behavioral patterns, significantly improving the model's generalization performance in diverse overloaded vehicle scenarios.
[0069] This invention adds a road network matching step based on a Hidden Markov Model (HMM) after the deep learning model outputs the original coordinate sequence. This step "attaches" the predicted points to the real road network, ensuring that the final output trajectory strictly follows physical constraints such as road connectivity and directionality. The generated trajectory is a "on-road" trajectory that can be directly used by navigation and early warning systems and conforms to the actual driving logic of vehicles, greatly enhancing the practical value of the prediction results. Furthermore, the clustering process itself generates the intermediate result of "similar vehicle groups," providing traffic managers with interpretable insights into "which vehicles have similar operating patterns and frequently travel which routes," helping to understand the group's operational patterns and assisting in decision-making.
[0070] This invention forms a complete, end-to-end automated processing flow, from data preprocessing, multi-dimensional feature calculation, automatic clustering, model training to final prediction and road network matching. Key parameters (such as Eps and MinPts in DBSCAN) can be optimized using internal indicators such as the profile coefficient, reducing over-reliance on domain expert experience, demonstrating the method's intelligence, and making it more suitable for large-scale, real-time intelligent traffic management applications. Attached Figure Description
[0071] Figure 1 This is a schematic diagram of the DBSCAN clustering process for overloaded and oversized vehicles based on vehicle similarity, provided in an embodiment of the present invention.
[0072] Figure 2 This is a block diagram of the overall structure of the lightweight deep neural network model used in this embodiment of the invention;
[0073] Figure 3 This is a schematic diagram of the BiLSTM structure in an embodiment of the present invention;
[0074] Figure 4 This is a schematic diagram of the BiLSTM-Transformer trajectory prediction fusion model in an embodiment of the present invention. Detailed Implementation
[0075] The following detailed description of specific embodiments of the present invention, in conjunction with the accompanying drawings, is provided to illustrate the invention. These embodiments are intended to explain the invention but are not intended to limit its scope. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0076] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments. For example... Figure 1 As shown in the figure, a real-time trajectory prediction method for overloaded and oversized vehicles based on collaborative filtering according to an embodiment of the present invention aims to achieve high-precision and robust prediction of the future driving trajectory of overloaded and oversized vehicles through multi-dimensional similarity clustering and deep sequence models. Specifically, it includes the following steps:
[0077] S101: Obtain historical GPS trajectory data of multiple overloaded vehicles.
[0078] This is the starting point for data-driven analysis, providing the raw data foundation for subsequent analysis. Specifically, GPS historical trajectory data of multiple vehicles identified as overloaded or exceeding weight limits can be obtained in batches from data sources such as highway management systems and transport vehicle monitoring platforms. Each data record should include core fields such as timestamp, latitude and longitude coordinates, and instantaneous vehicle speed.
[0079] S102: Preprocess the historical GPS trajectory data to obtain preprocessed historical trajectory data.
[0080] This step aims to remove noise from the raw data and identify key behavioral points, providing high-quality input for subsequent similarity calculations. The preprocessing operations specifically include:
[0081] Data cleaning: Remove abnormal records with latitude and longitude coordinates that are significantly outside the geographical range, instantaneous vehicle speed that is negative, or unreasonable.
[0082] Interpolation processing: For data gaps caused by signal loss, linear interpolation is used to fill in the gaps based on the latitude, longitude and timestamp of the previous and subsequent valid points to ensure the temporal continuity of the trajectory.
[0083] Destination point detection and origin / destination (OD) point identification: This sub-step is used to extract key features reflecting the vehicle's driving pattern. Specifically:
[0084] S1021: For vehicle trajectory data, detect a set of points whose maximum movement distance within a continuous time range does not exceed a specific distance threshold (e.g., 500 meters). These point sets may characterize the vehicle's parking behavior.
[0085] S1022: Calculate the duration of dwell time for this set of points. Set a dwell time threshold range of 21 to 69 minutes. If the dwell time falls within this threshold range, the set of points is identified as a dwell point. This range takes into account the typical dwell time of overloaded vehicles at service areas, checkpoints, or loading / unloading points, helping to filter out short-term stops such as those caused by traffic congestion.
[0086] S1023: Mark the first stop in a trip as the origin and the last stop as the destination, thus forming an OD point pair to characterize the travel endpoint characteristics of the vehicle.
[0087] S103: Calculate the overall similarity between any two overloaded vehicles.
[0088] The core of this step is to comprehensively quantify the behavioral similarity between vehicles from three dimensions: spatial trajectory patterns, destination point preferences, and travel time habits. The comprehensive similarity is obtained by weighted fusion of trajectory spatial similarity, OD point similarity, and travel time similarity, with weights of 0.4, 0.4, and 0.2, respectively. The specific calculation method is as follows:
[0089] Trajectory space similarity calculation: This sub-step is used to measure the shape similarity of the historical driving paths of two vehicles.
[0090] S1031: Define the historical trajectory of vehicle A and the historical trajectory of vehicle B , where each point Includes latitude and longitude coordinates.
[0091] S1032: Set a spatial distance threshold (For example, 200 meters). The Longest Common Subsequence (LCSS) algorithm is used for calculation. Dynamic programming is used to find the longest common subsequence among two trajectory sequences, where the point-to-point spatial distance is less than... length of common subsequence The recursive formula is:
[0092] ,
[0093] S1033: Calculate trajectory space similarity This value is between 0 and 1.
[0094] OD point similarity calculation: This sub-step is used to measure the degree of overlap between two vehicles in their choice of origin and destination.
[0095] S1034: Define the set of OD points for vehicle A as follows: The set of OD points for vehicle B is The Jaccard Similarity Coefficient is used for calculation, and the formula is as follows:
[0096] .
[0097] Specifically, when determining whether two OD points are the same, considering GPS positioning errors, if the great circle distance between the two points is less than or equal to 100 meters, they are considered to be common OD points.
[0098] Travel time similarity calculation: This sub-step is used to measure the similarity between two vehicles in terms of travel time.
[0099] S1035: Considering the periodicity of time (with a period of 1440 minutes per day), the starting time t (minutes) of each trip is mapped to a two-dimensional vector using trigonometric functions to capture the cyclical characteristics of time: .
[0100] S1036: Calculate the average vector of the start time vectors of all trips for vehicles A and B. and Then calculate the cosine similarity between the two:
[0101]
[0102] Comprehensive similarity calculation: The similarity scores from the three dimensions mentioned above are linearly weighted and fused to obtain the comprehensive similarity score between vehicles A and B. :
[0103]
[0104] S104: Use the DBSCAN clustering algorithm to cluster overloaded vehicles.
[0105] This step aims to automatically categorize vehicles with similar driving behaviors based on the comprehensive similarity calculated in step S103. Specifically:
[0106] First, the overall similarity The combined distance required to convert to the DBSCAN algorithm: This forms a comprehensive distance matrix between all pairs of vehicles.
[0107] Clustering was performed using the DBSCAN (Density-Based Spatial Clustering) algorithm. Since the input is a custom distance matrix, DBSCAN can discover clusters of arbitrary shapes without requiring a pre-specified number of clusters. Its hyperparameters, the neighborhood distance threshold Eps and the minimum number of neighbors for the core point MinPts, were selected through optimization.
[0108] S1041: Select different combinations within a reasonable range (e.g., Eps between [0.1, 0.5], MinPts between [3, 10]).
[0109] S1042: Cluster each combination and calculate the silhouette coefficient of the clustering results. For the sample Profile coefficient The calculation formula is: ,in It is a sample The average distance to other samples within the same cluster. It is a sample The average distance to all samples in the nearest other cluster. The silhouette coefficient of the entire clustering result. For all samples The mean. Choose to make The maximum combination of Eps and MinPts is used as the optimal hyperparameter to perform the final clustering, thereby obtaining multiple groups of similar vehicles.
[0110] S105: For each similar vehicle group, calculate the cluster center characteristics.
[0111] This step aims to extract a representative feature vector for each clustering result, which will be used for rapid matching of target vehicles in the subsequent process. Specific features include:
[0112] Representative trajectory: Calculate the average trajectory of all historical trajectories of vehicles in the cluster (which can be achieved through methods such as DTW centroid averaging), and select the actual trajectory of the vehicle with the highest similarity to this average trajectory (LCSS) as the representative trajectory of the cluster.
[0113] OD point set: Take the union of the OD point sets of all vehicles in the cluster, and use it as the OD point feature of the cluster.
[0114] Average travel time vector: The arithmetic mean of the travel start time vectors of all vehicles in the cluster (see S1035) is used to obtain the average travel time vector of the cluster.
[0115] S106: Obtain the current historical trajectory data of the target overloaded vehicle to be predicted, and extract its three features—historical trajectory, OD point set, and average travel time vector—using the same method as S102 and S103.
[0116] S107: Calculate the similarity between the three features of the target vehicle and the central feature of each similar vehicle group (obtained in S105). The calculation method is the same as in S103, using weighted fusion (weights 0.4, 0.4, 0.2) to obtain the comprehensive similarity between the target vehicle and each group. Match the target vehicle to the similar vehicle group with the highest comprehensive similarity. This step fully utilizes group behavior patterns, providing the most relevant training data for subsequent prediction models.
[0117] S108: Train the BiLSTM-Transformer trajectory prediction model using historical trajectory data of matched similar vehicle groups.
[0118] This step is the model building and training phase, where a deep sequence prediction model capable of simultaneously capturing short-term dynamics and long-term dependencies is trained using data from the matched clusters. The specific model building steps include:
[0119] S1081: BiLSTM layer processing: The input is a trajectory sequence (latitude and longitude) of fixed length (e.g., 50 time steps). The BiLSTM layer consists of a forward LSTM and a backward LSTM, which learn the contextual information of the sequence from both directions. The final hidden state output of the layer It incorporates bidirectional short-term time-series characteristics.
[0120] S1082: Linear projection: Projecting the output of the BiLSTM Through a linear layer (weight matrix) bias The dimensions required to project onto the Transformer model: .
[0121] S1083: Add positional encoding: Since the Transformer itself does not have the ability to perceive temporal information, it is necessary to add positional encoding to the projected features. Add position encoding get Location encoding Generated using sine and cosine functions, each time step is assigned a unique encoding vector.
[0122] S1084: Multi-head self-attention mechanism: A query (Q), key (K), and value (V) matrix is generated after linear transformation. Attention weights are calculated using a multi-head self-attention module, with the following formula: ,in It represents the dimension of the key vector. This mechanism allows the model to focus on information in the sequence that is important for the current prediction, thereby capturing long-term dependencies.
[0123] S1085: Feedforward Network (FFN): Each attention sublayer is followed by a feedforward neural network, typically consisting of two linear transformations and a ReLU activation function. This is used to enhance the nonlinear expressive power of the model.
[0124] S1086: Residual Connections and Layer Normalization: Residual connections and layer normalization are applied around each sub-layer (self-attention layer, feedforward layer) to stabilize the training process of the deep network and prevent gradient vanishing or exploding. Finally, the Transformer encoder outputs a feature representation rich in global information for prediction.
[0125] Training process: The historical trajectory segments of matched similar vehicle groups are used as the training set. The trajectory points of the past several time steps (e.g., 50 steps) are used as input, and the trajectory points of the future several time steps (e.g., 10 steps) are used as labels. The model parameters are optimized by minimizing loss functions such as the mean squared error (MSE) between the predicted coordinates and the true coordinates.
[0126] S109: Use the trained model to predict the trajectory of the target vehicle.
[0127] S1091: Obtain the latest historical trajectory sequence of the target vehicle (e.g., latitude and longitude points of the last 50 time steps) and input it into the BiLSTM-Transformer trajectory prediction model trained in step S108.
[0128] S1092: The model outputs a sequence of predicted trajectory points for the next 10 time steps.
[0129] (Optional Rolling Forecast) S1093: If a longer future period needs to be predicted, a rolling forecast method can be used. Specific steps include:
[0130] The trajectory points predicted by the model for the next 10 time steps are combined with some historical data (such as the last 40 historical points) to form a new time step sequence of length 50.
[0131] Input this new sequence back into the model to predict the next 10 time steps.
[0132] Repeat this process until the required total forecast duration is covered.
[0133] S110: Perform road network matching on the predicted trajectory point sequence.
[0134] Since the model directly predicts latitude and longitude coordinates, these points may fall outside the road network. This step aims to "attach" the original predicted points to the real road network, generating a final trajectory that conforms to the road topology and traffic rules. Specifically:
[0135] S1101: Construct a Hidden Markov Model (HMM). The observed state is the sequence of predicted trajectory points output by S109, and the hidden state is the candidate road segments in the real road network.
[0136] S1102: Define model parameters:
[0137] Emission probability: Defined as a function (such as a Gaussian function) of the vertical distance from the predicted trajectory point ot to the candidate road segment ri. The closer the distance, the higher the probability.
[0138] Transition probability: defined as the likelihood of transitioning from the previous road segment ri-1 to the current road segment ri. Factors considered include: whether the road segment is connected, whether the vehicle's travel time based on historical average speed is reasonable, and steering preferences.
[0139] S1103: Use the Viterbi algorithm to find the most likely hidden state sequence (actual driving segment sequence) given an observation sequence (prediction points). This algorithm efficiently finds the global optimum through dynamic programming.
[0140] S1104: Output the optimal road segment sequence decoded by the Viterbi algorithm, and take the point (or road segment centerline) on each road segment that is closest to the projection of the original prediction point, and connect them to form the final prediction trajectory that conforms to the road network topology.
[0141] In summary, the method for predicting the trajectory of overloaded and oversized vehicles based on DBSCAN clustering and BiLSTM-Transformer provided in this invention has the following significant advantages compared to existing technologies:
[0142] DBSCAN clustering is used to select the group data with the most similar behavioral patterns for target vehicles for model training, which greatly improves the homogeneity of training data and the relevance of model learning. Combining the BiLSTM-Transformer hybrid model, BiLSTM can capture the local temporal dynamics and short-term dependencies of trajectories, while Transformer's self-attention mechanism can effectively model the long-term global dependencies and complex patterns of trajectories, thereby improving the overall accuracy of trajectory prediction.
[0143] Clustering is performed using multi-dimensional comprehensive similarity (spatial trajectory, origin-destination points, and travel time) to comprehensively characterize vehicle driving behavior, making the clustering results more scientific and effectively addressing the shortcomings of single-feature similarity calculation. The DBSCAN algorithm can automatically discover clusters of arbitrary shapes and exclude noise points (vehicles with abnormal behavior), enhancing the method's robustness to data noise and outliers. The personalized matching mechanism based on clustering enables the method to adapt to overloaded vehicles with different behavioral patterns, demonstrating good generalization ability.
[0144] The final Hidden Markov Model (HMM) step ensures that the prediction results conform to the real road network constraints and vehicle driving logic, outputting a practical "on-road" trajectory that can be applied to route planning and risk warning, rather than scattered coordinate points, greatly enhancing the practical value of the prediction results. At the same time, the clustering process itself provides interpretable information on "which vehicles have similar behaviors," helping traffic management departments understand the group operation patterns of overloaded vehicles.
[0145] High degree of automation and intelligence: From data preprocessing, similarity calculation, cluster analysis, model training to final prediction and road network matching, the whole process is highly automated, requiring only a small amount of hyperparameter tuning (such as DBSCAN parameters being automatically optimized through profile coefficients), reducing reliance on human experience and meeting the needs of intelligent traffic management.
[0146] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for real-time trajectory prediction of over-limit overloaded vehicles based on collaborative filtering, characterized in that, The method comprises the following steps: S101: obtaining historical GPS trajectory data of a plurality of over-limit and overloaded vehicles, the historical GPS trajectory data comprising a timestamp, latitude and longitude coordinates, and instantaneous vehicle speed; S102: preprocessing the historical GPS trajectory data, including data cleaning, interpolation processing, stop point detection, and origin-destination (OD) point identification, to obtain preprocessed historical trajectory data; wherein the OD point identification is achieved by setting a stop time threshold and a moving distance threshold, the stop time threshold ranging from 21 minutes to 69 minutes, and the moving distance threshold being 500 meters; S103: calculating a comprehensive similarity between each two over-limit and overloaded vehicles based on the preprocessed historical trajectory data; the comprehensive similarity is obtained by weighted fusion of trajectory space similarity, OD point similarity, and travel time similarity, the weights being 0.4, 0.4, and 0.2 respectively; the trajectory space similarity is calculated using the longest common subsequence (LCSS) algorithm, the OD point similarity is calculated using the Jaccard similarity coefficient, and the travel time similarity is calculated using the cosine similarity; S104: converting the comprehensive similarity into a comprehensive distance matrix, and clustering the over-limit and overloaded vehicles based on the comprehensive distance matrix using a DBSCAN clustering algorithm to obtain a plurality of similar vehicle groups; wherein the hyperparameters of the DBSCAN algorithm include a similarity threshold Eps and a neighborhood density threshold MinPts, which are selected by contour coefficient optimization; S105: for each similar vehicle group, calculating a cluster center feature, including a representative trajectory, an OD point set, and an average travel time vector; the representative trajectory is selected as the trajectory with the highest average trajectory similarity to all vehicles in the cluster, the OD point set is the union of the OD points of all vehicles in the cluster, and the average travel time vector is obtained by averaging the values after trigonometric functionization; S106: obtaining current historical trajectory data of a target over-limit and overloaded vehicle, and extracting the historical trajectory, the OD point set, and the average travel time vector thereof; S107: calculating the comprehensive similarity of the target vehicle with each similar vehicle group, and matching the target vehicle to the similar vehicle group with the highest comprehensive similarity; S108: training a BiLSTM-Transformer trajectory prediction model using the historical trajectory data of the matched similar vehicle group; the BiLSTM-Transformer trajectory prediction model comprises a BiLSTM layer and a Transformer encoder layer, and is used to capture short-term dynamics and long-term dependencies; S109: inputting the historical trajectory data of the target vehicle into the trained BiLSTM-Transformer trajectory prediction model to output a predicted trajectory point sequence at future time steps; the historical trajectory data is input in a sliding window manner, the window size being 50 time steps, and 10 future time steps are predicted. S110: Network matching is performed on the predicted trajectory point sequence, a hidden Markov model (HMM) algorithm is used to map the predicted trajectory points to the real road network, and a final predicted trajectory conforming to the vehicle driving logic is output; wherein the HMM algorithm takes the predicted trajectory points as the observation state and the road network section as the hidden state, and the maximum likelihood sequence is solved by using the Viterbi algorithm.
2. The method of claim 1, wherein, The specific steps of the stop point detection in step S102 include: S1021: For the vehicle trajectory data, a point set with a maximum moving distance of not more than 500 meters in a continuous time range is detected; S1022: The stop time of the point set is calculated, and if the stop time is between 21 minutes and 69 minutes, the point is identified as a stop point; S1023: The start point and the end point in the stop point are marked as OD points.
3. The method of claim 1, wherein, The calculation of the trajectory space similarity in step S103 specifically includes: S1031: For the historical trajectory of vehicle A and the historical trajectory of vehicle B where each point contains latitude and longitude coordinates; S1032: Set a spatial distance threshold , the length of the longest common subsequence is calculated using dynamic programming , the recursive formula is: , S1033: Calculate trajectory space similarity .
4. The method of claim 1, wherein, The calculation of the OD point similarity in step S103 specifically includes: S1034: For the OD point set of vehicle A and the OD point set of vehicle B , calculate the Jaccard similarity coefficient: , If the distance between two OD points is less than or equal to 100 meters, they are considered as common OD points.
5. The method of claim 1, wherein, The calculation of the travel time similarity in step S103 specifically includes: S1035: For the travel start time t, a two-dimensional vector is mapped by a trigonometric function: , S1036: The time vector cosine similarity of vehicle A and vehicle B is calculated: , wherein and are the time vectors of the two vehicles, respectively.
6. The method of claim 1, wherein, The hyperparameter optimization step of the DBSCAN clustering algorithm in step S104 includes: S1041: Different combinations of Eps and MinPts are selected, and the silhouette coefficient SC of the clustering result under each combination is calculated; S1042: The combination with the largest silhouette coefficient is selected as the optimal hyperparameter; the silhouette coefficient calculation formula is: , , where, is the sample average distance to other samples in the same cluster, is the sample average distance to other cluster samples, is the total number of samples.
7. The method of claim 1, wherein, The construction step of the BiLSTM-Transformer trajectory prediction model in step S108 includes: S1081: The input trajectory sequence is processed using a BiLSTM layer to extract bidirectional time sequence features; the BiLSTM is composed of a forward LSTM and a backward LSTM, and the output hidden state splicing result is output; S1082: The BiLSTM output is mapped to the Transformer dimension through a linear projection layer, and the formula is: ; S1083: add position encoding PE to the projected feature to obtain a feature with timing information The position encoding uses sine and cosine functions. S1084: Calculate the attention weight by multi-head self-attention mechanism, the formula is wherein is obtained by linear transformation; S1085: Non-linear transformation using a feed-forward network FFN, formula ; S1086: The global features are output through a residual normalization layer for trajectory prediction.
8. The method of claim 1, wherein, The specific steps of the network matching in step S110 include: S1101: The predicted trajectory points are taken as the observation state, and the real road network section is taken as the hidden state to construct an HMM model; S1102: The emission probability is defined based on the Euclidean distance from the trajectory point to the road section, and the transition probability is defined based on the connectivity and travel time constraints of the road section; S1103: The maximum likelihood hidden state sequence is solved using the Viterbi algorithm to realize the mapping of the trajectory points; S1104: The matched trajectory sequence is output to ensure that the trajectory is continuous and conforms to the road topology rules.
9. The method of claim 1, wherein, The steps of the sliding window rolling prediction in step S109 include: S1091: 50 historical time step trajectory data are taken as the initial input to predict the next 10 time steps; S1092: The predicted 10 time step data are combined with part of the historical data to form a new 50 time step input sequence; S1093: repeat S1091 and S1092 to realize multiple rounds of rolling prediction until a required prediction time length is covered.
10. The method of claim 1, wherein, The method further comprises an evaluation step: using mean square error (MSE), mean absolute error (MAE) and Haversine distance as indexes to evaluate the error between the predicted trajectory and the real trajectory; wherein the formula for calculating the Haversine distance is: , wherein is a difference in latitude between the real point and the predicted point, is a latitude of the real point, is a latitude of the predicted point, is a difference in longitude between the real point and the predicted point.
Citation Information
Patent Citations
Automatic driving vehicle track prediction method and system based on double cross Transformer
CN118419065A
Multi-modal vehicle trajectory prediction method based on graph interaction mechanism
CN119202892A