Space-time trajectory similarity calculation method based on graph attention and time sequence feature fusion

By employing a graph attention network and temporal feature fusion method, combined with a hierarchical partitioning tree structure, the high complexity of trajectory similarity calculation and map migration issues are resolved, achieving efficient and accurate trajectory similarity calculation and improving the applicability and accuracy of trajectory analysis tasks.

CN120578964BActive Publication Date: 2026-03-10LIAONING ECOLOGICAL ENG VOCATIONAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing trajectory similarity calculation methods have high computational complexity in large-scale trajectory data processing, are difficult to effectively capture spatial features, and require retraining when the map is moved, resulting in low computational efficiency and insufficient accuracy.

Method used

We adopt a method based on the fusion of graph attention network and temporal features. We calculate the sub-partition transition probability as the initial weight of the graph attention model, combine it with the GRU encoder-decoder model to extract the spatiotemporal features of the trajectory, and use the hierarchical partition tree structure to realize map transfer training, thereby reducing the training cost of cross-map models.

Benefits of technology

It improves the efficiency and accuracy of trajectory similarity calculation, enhances the applicability and precision of trajectory analysis tasks, and is suitable for scenarios such as urban traffic planning, travel recommendation, and trajectory clustering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120578964B_ABST
    Figure CN120578964B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of space-time trajectory data mining, and specifically relates to a space-time trajectory similarity calculation method based on graph attention and time sequence feature fusion. The present application combines hierarchical partition trees and proposes multiple map migration strategies to reduce the cross-map model training cost and solve the problem of high training cost caused by the need for model retraining in the cross-city map scenario in practical applications. The trajectory representation method of the present application can fuse spatial features and has map generalization capability, thereby improving the accuracy and applicability of trajectory analysis tasks. The present application is suitable for trajectory representation learning methods based on similarity calculation in scenarios such as urban traffic planning, travel recommendation, trajectory clustering and anomaly detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of data management and trajectory data mining, and particularly relates to a spatiotemporal trajectory representation learning method based on similarity calculation. BACKGROUND

[0002] With the continuous development of technologies such as Internet of Vehicles, intelligent transportation, and trajectory mining, various intelligent terminals equipped with GPS devices, such as smart phones and vehicle positioning devices, generate massive and rich trajectory data in daily travel. These trajectory data record the position changes of mobile objects in space and are widely used in fields such as urban transportation planning, trajectory anomaly detection, trajectory clustering analysis, and travel recommendation services.

[0003] Trajectory similarity calculation is a key basic technology in trajectory data mining and analysis. Traditional trajectory similarity calculation methods, such as dynamic time warping (DTW), longest common subsequence (LCSS), and edit distance (EDR), usually calculate based on one-by-one matching between trajectory points, resulting in a calculation complexity of O(n 2 ), which has a performance bottleneck in large-scale trajectory data processing and is difficult to efficiently support actual application scenarios. In addition, trajectory data usually has complex spatial features, such as road network constraints in space, proximity relationships between trajectory points, and the need for retraining when map migration occurs. Existing methods are difficult to effectively capture these complex features, limiting the precision and robustness of trajectory similarity calculation.

[0004] In recent years, deep learning methods have shown great potential in the field of trajectory representation learning. Some research attempts to use recurrent neural networks (RNN) or Transformer models for trajectory data representation learning. However, existing methods have the following shortcomings: on the one hand, spatial trajectory representation methods usually use grid division or road network partitioning, but the feature representation of sub-regions is usually simple one-hot encoding, which is difficult to capture the spatial proximity relationship between sub-regions; on the other hand, existing trajectory representation learning models mostly match trajectories to corresponding city road networks, and when the model is applied to a new map, the model needs to be retrained, which is time-consuming.

[0005] Therefore, finding an effective representation method for trajectories is still a challenging task. If the spatiotemporal features can be integrated and the model has the ability to generalize to new maps, the precision and applicability of trajectory analysis tasks can be improved, which can solve the above problems. SUMMARY

[0006] To solve the above problems, the application provides a graph attention network based on partition transition probability and a space-time trajectory similarity calculation method and system supporting map migration training to achieve the following objectives: the sub-partition transition probability is calculated and used as the initial weight of the partition of the graph attention model to capture the partition embedding; the partition sequence ID of the trajectory and the captured partition embedding are combined to extract the spatial features of the trajectory through a GRU-based encoder-decoder model; the trajectory time features are extracted through an RNN-based encoder-decoder model, and the two are spliced to obtain the trajectory space-time features. When training across maps, the hierarchical partition number generated during data processing is used to improve the cross-map generalization ability and reduce the migration training cost.

[0007] To achieve the above objectives, the technical scheme of the application comprises the following steps:

[0008] The space-time trajectory similarity calculation method based on graph attention and time sequence feature fusion comprises the following steps,

[0009] Step 1: The spatial part of the trajectory historical data set, i.e., the trajectory point position information and the road network information, is preprocessed, and the road network is divided into multiple sub-regions. The trajectory is matched to the road section through the road network information to generate a road network restricted trajectory represented by a road section ID sequence, and then the road section ID sequence is represented as a partition ID sequence according to the sub-partition of the road network.

[0010] Step 2: The transition probability between sub-partitions is calculated through the trajectory historical data set and the divided road network partition structure, and a trajectory representation learning model based on the transition probability is established. The trajectory partition ID sequence is input into the model to obtain an initial trajectory spatial feature vector.

[0011] Step 3: The time part of the trajectory historical data set, i.e., the time sequence data of the trajectory point sampling, is input into an RNN-based encoder-decoder model to obtain an initial time feature vector. The initial spatial feature vector and the initial time feature vector are spliced to obtain an initial space-time trajectory feature vector.

[0012] Step 4: Train the trajectory representation learning model, which has two training processes: single map training or map migration training in the case of multiple maps. In the model training process of the single map task, a loss function based on positive and negative samples is designed to minimize the gap between the trajectory feature vector and the trajectory similarity of the traditional algorithm, and the model parameters are trained and optimized through the initial spatiotemporal trajectory feature vector to obtain the optimal model parameters and the final spatiotemporal trajectory feature vector; in the model training of the multiple map task, first, the single map model is trained on the source map, then according to the hierarchical partition tree structure generated in the road network partition process, the model parameters trained on the source map are migrated to the model of the new map as the initial parameters by freezing the leaf node features or feature matrix, and the loss function under the single map task is used to optimize the parameters to obtain the optimal parameters and the final spatiotemporal trajectory feature vector. Based on the extracted final spatiotemporal trajectory feature vector, the Euclidean distance between trajectory vectors is used as the basis for calculating the spatiotemporal trajectory similarity. And using the calculated spatiotemporal trajectory similarity, support downstream tasks such as trajectory clustering, trajectory anomaly detection, trajectory classification, traffic prediction and other application tasks.

[0013] Further, in step 1, the specific steps of trajectory preprocessing are as follows:

[0014] Step 1.1: Remove trajectories with a length less than 20 from the original data set to obtain a trajectory data set. Use the ST-Matching matching algorithm to map the trajectory point sequence in the trajectory data set to the real road network to form a road network restricted trajectory;

[0015] Step 1.2: Use a multi-level partitioning algorithm to recursively divide the road network into several sub-regions: specifically,

[0016] First, the road network nodes and edges in the road network are coarsened, then the Kernighan-lin algorithm is used to divide the road network into multiple sub-regions, and finally the sub-regions are de-coarsened to obtain the complete partition of the final road network; In the partitioning process, there are two parameters to limit, which are the maximum number of leaf nodes of the sub-region and the number of sub-regions that will be subdivided in each partition;

[0017] Step 1.3: Further convert the road network restricted trajectory into a sequence composed of sub-region IDs as input for subsequent model training.

[0018] Further, step 2 extracts features from the trajectory, and the specific method is as follows:

[0019] Step 2.1: According to the sub-regions divided using the road network partitioning algorithm in step 1 and the processed trajectory data set, calculate the transition probability of the sub-region, and the calculation formula is as follows:

[0020]

[0021] where count(p i → p j ) represents the number of transitions from partition p i to partition p j in the trajectory partition sequence in the dataset, and count(p i ) represents the total number of times partition p i appears as the starting point of a transition in the trajectory partition sequence.

[0022] Step 2.2: Next, use the graph attention-based structure to learn the embedding representation of the sub-region by taking the calculated transition probability as the initial weight of the attention between nodes. The calculation process is as follows:

[0023]

[0024] where a ij is the attention weight between partitions p i and p j , and e ij represents the attention relevance score between partition p i and neighbor partition p j . The calculation is as follows:

[0025]

[0026] h i and h j are the embedding representations of partition p i and neighbor partition p j , W1 and W2 belong to space, W3 and W4 belong to space, and both are learnable parameter matrices, represents all partitions adjacent to partition p i . LeakyReLU is an activation function with a negative input slope of 0.2, represents the transition probability between partition p i and p j . Next, calculate the output feature of partition p i where W5 is a learnable parameter, and ELU represents an exponential linear unit activation function.

[0027] Step 2.3: Next, use the obtained sub-partition embedding to encode the trajectory sub-region sequence through a GRU-based trajectory space encoder, and output the spatial feature representation vector of the trajectory.

[0028] Further, there are two kinds of trajectory representation learning model training processes: single map training or map migration training in multi-map cases; in the model training process of a single map task, a loss function based on positive and negative samples is designed to minimize the gap between the trajectory feature vector and the trajectory similarity calculated by the traditional algorithm, and the model parameters are trained and optimized based on the initial trajectory feature vector to obtain the optimal model parameters and the final trajectory feature vector; in the model training of a multi-map task, first, single map model training is performed on the source map, then according to the hierarchical partition tree structure generated in the road network partition process, the model parameters trained on the source map are migrated to the model of the new map as initial parameters by freezing the leaf node features or feature matrix, and the loss function under the single map task is used to optimize the parameters to obtain the optimal parameters and the final trajectory feature vector.

[0029] Further, step 3 extracts the time features of the trajectory and combines the spatial features and the time features, and the time feature extraction method is as follows:

[0030] Step 3.1: Extract the time sequence information of the trajectory sampling points in the trajectory data, i.e. T(t) = <t1, t2,..., t m > into the encoder-decoder model based on RNN to obtain the time feature vector of the trajectory.

[0031] The method of combining spatial features and time features is as follows:

[0032] Step 3.2: After obtaining the spatial feature vector and the time feature vector of the trajectory, the two vectors are combined by splicing to obtain the spatio-temporal feature vector of the trajectory, i.e. let the spatial feature vector be the time feature vector be then the spatio-temporal feature vector v T can be obtained by .

[0033] Further, step 4 trains the spatio-temporal trajectory representation learning model, and the specific steps are as follows:

[0034] Step 4 trains the trajectory representation learning model, and the specific steps are as follows:

[0035] Step 4.1: In the single map training process, the goal of trajectory representation learning model training is to minimize the difference between the spatio-temporal trajectory feature vector similarity function based on representation learning and the spatio-temporal trajectory similarity function calculated by the traditional algorithm , and the model iteration training parameters are optimized based on this goal to obtain the optimal spatio-temporal trajectory feature vector.

[0036] Step 4.2: When training across maps, first, the trajectory training is performed on the source map according to step 4.1. Then, the size of the new map and the source map is judged. If the two map scales are similar, the same scale hierarchical partition tree can be generated when the road network is partitioned, and the source map leaf node feature matrix is set as Then, the leaf node feature matrix of the target map can be initialized: E tgt = E src The leaf node feature matrix trained from the source map is used in the model of the new map as the initial parameters for training, and the spatio-temporal trajectory feature vector trained in the new map is finally obtained. If the two map scales are quite different, the hierarchical partition trees of the two maps cannot be controlled to the same scale. Considering that some features (such as road structure, network topology and spatial position) have universality, and some other features may depend on specific maps, the feature matrix is divided into a shared part and a trainable part, which is formally represented as: F tgt = F shared ‖ F trainable ; wherein, is the shared feature matrix inherited from the source map and kept fixed, is the feature matrix retrained on the target map, which is trained by splitting and inheriting the feature matrix of the source map as the initial parameters of the model training process of the new map, and the spatio-temporal trajectory feature vector trained in the new map is finally obtained.

[0037] The beneficial effects of the present application are as follows:

[0038] The application provides a spatiotemporal trajectory representation model based on similarity calculation, which can efficiently and accurately calculate the similarity between trajectories in large-scale trajectory data to solve problems such as trajectory clustering, trajectory tracing and traffic flow management. The method comprises the following steps: a hierarchical partition tree structure is used to divide the road network into regions, and the trajectory is converted into a sub-partition sequence by combining the road network matching method to generate the road network restricted trajectory; the partition transition probability is calculated by combining the road network partition result and the historical data set in space; the partition transition probability is input into the model based on the graph attention network to obtain the embedding representation of the sub-partition; and the spatial feature vector of the trajectory is generated by the encoder-decoder structure based on the GRU; the trajectory time sequence is input into the encoder-decoder model based on the RNN to generate the time feature vector of the trajectory, and the spatial feature vector and the time feature vector are spliced to obtain the spatiotemporal feature vector of the trajectory. The application combines the hierarchical partition tree and proposes a plurality of map migration strategies to reduce the training cost of the cross-map model, solve the problem of high training cost of the model in the cross-city map scenario in practical application, and improve the accuracy and applicability of the trajectory analysis task. The trajectory representation method can fuse spatial features and has map generalization ability, and is suitable for the trajectory representation learning method based on similarity calculation in the scenes of urban traffic planning, travel recommendation, trajectory clustering and anomaly detection. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to facilitate the understanding of those skilled in the art, the application will be further described below with reference to the accompanying drawings.

[0040] Figure 1 The framework of the application is shown in the schematic diagram.

[0041] Figure 2 The graph attention calculation of the application is shown in the schematic diagram.

[0042] Figure 3 The multi-map hierarchical partition tree structure of the application is shown in the schematic diagram. DETAILED DESCRIPTION

[0043] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.

[0044] The application provides a kind of space-time trajectory similarity calculation method based on graph attention and timing feature fusion, respectively model the space dimension and time dimension of trajectory, combine road network partition in space and calculate the subarea transition probability using trajectory historical data set, obtain subarea embedding using graph attention-based model, and obtain the spatial feature vector of trajectory using GRU-based encoder-decoder structure.In time, an RNN-based encoder-decoder model is used to input the trajectory time series to obtain the trajectory time feature vector.Finally, the spatial and temporal feature vectors of the trajectory are fused by vector splicing.The method comprises the following steps:

[0045] Step 1: Preprocess the spatial part of the trajectory historical data set, which includes trajectory point position information and road network information, and divide the road network into multiple subareas, first match the trajectory to the road segment by road network information to generate a road network restricted trajectory represented by a road segment ID sequence, and then convert the road segment ID sequence to a subarea ID sequence according to the subarea division of the road network.

[0046] Trajectory preprocessing and road network partitioning. In actual sampling, due to different sampling devices, unstable network signals, and other factors, the trajectory sampling position is biased. On the other hand, the calculation amount of matching by trajectory points is huge, so in the actual operation process, the trajectory points are divided into corresponding areas using the road network partitioning method.

[0047] Step 1.1: Remove trajectories with a length less than 20 from the original data set to obtain a trajectory data set. Use the ST-Matching matching algorithm to map the trajectory point sequence in the trajectory data set to the real road network to form a road network restricted trajectory.

[0048] Step 1.2: Use a multi-level partitioning algorithm to recursively divide the road network into several subareas:

[0049] First, coarse the road network nodes and edges in the road network to reduce the size of the road network, then use the Kernighan-lin algorithm to divide the road network into multiple subareas, and finally de-coarse the subareas to obtain the complete partitioning of the final road network. In the partitioning process, there are two parameters to limit, which are the maximum number of leaf nodes in the subarea and the number of subareas that will be subdivided in each partitioning.

[0050] Step 1.3: After the road network is partitioned, the road network restricted trajectory is further converted into a sequence composed of subarea IDs, which is used as input for subsequent model training.

[0051] Step 2: Calculate the transition probability between subareas using the trajectory historical data set and the partitioned road network structure, and establish a trajectory representation learning model based on the transition probability. Input the trajectory partition ID sequence into the model to obtain an initial trajectory feature vector.

[0052] Step 2.1: According to the sub-regions divided by the road network partition algorithm in step 1 and the processed trajectory dataset, the transition probability of the sub-regions is calculated, and the calculation formula is as follows:

[0053]

[0054] where count(p i →p j ) represents the number of transitions from partition p i to partition p j in the trajectory partition sequence in the dataset, and count(p i ) represents the total number of times partition p i appears as the starting point of the transition in the trajectory partition sequence.

[0055] Step 2.2: Next, use the graph attention-based structure to learn the embedding representation of the sub-regions by taking the calculated transition probability as the initial weight of the attention between nodes, and the calculation process is as follows:

[0056]

[0057] α ij is the attention weight between partitions p i and p j , where e ij represents the attention relevance score between partition p i and neighboring partition p j , which is calculated according to the following formula:

[0058]

[0059] h i and h j are the embedding representations of partition p i and neighboring partition p j , W1 and W2 belong to space, W3 and W4 belong to space, and both are learnable parameter matrices, represents all partitions adjacent to partition p i . LeakyReLU is an activation function with a negative input slope of 0.2, represents the transition probability between partition p i and p j , and then the output feature of partition p i is calculated where W5 is a learnable parameter, and ELU represents an exponential linear unit activation function.

[0060] Step 2.3: Next, the trajectory sub-region sequence is encoded by a GRU-based trajectory space encoder using the obtained sub-partition embedding and sub-partition ID sequence of the trajectory, to output a trajectory feature representation vector.

[0061] Step 3: Time feature extraction of the trajectory and combination of the spatial feature and the time feature. The time feature extraction method is as follows:

[0062] Step 3.1: Extract the time sequence information of the trajectory sampling points in the trajectory data, i.e. T(t) = <t1, t2,..., t m > into an RNN-based encoder-decoder model to obtain the time feature vector of the trajectory.

[0063] The combination method of the spatial feature and the time feature is as follows:

[0064] Step 3.2: After obtaining the spatial feature vector and the time feature vector of the trajectory, the two vectors are combined using the splicing method to obtain the spatio-temporal feature vector of the trajectory, i.e. let the spatial feature vector be the time feature vector be then the spatio-temporal feature vector v T can be obtained by .

[0065] Step 4: Train the spatio-temporal trajectory representation learning model. The initial spatio-temporal trajectory feature vector obtained in step 3 is used to train and optimize the model parameters, to obtain the optimal model parameters and the final spatio-temporal trajectory feature vector. Based on the extracted final spatio-temporal trajectory feature vector, the Euclidean distance between the trajectory vectors is used as the basis for calculating the trajectory similarity.

[0066] There are two training processes: single-map training or map migration training in the case of multiple maps. In the model training process of the single-map task, a loss function based on positive and negative samples is designed to minimize the difference between the trajectory feature vector and the trajectory similarity calculated by the traditional algorithm, and the initial spatio-temporal trajectory feature vector is used to train and optimize the model parameters, to obtain the optimal model parameters and the final spatio-temporal trajectory feature vector. In the model training of the multiple-map task, first, the single-map model training is performed on the source map, then according to the hierarchical partition tree structure generated in the road network partition process, the model parameters of the source map trained are migrated to the model of the new map as the initial parameters by freezing the leaf node features or feature matrices, and the loss function under the single-map task is used to optimize the parameters to obtain the optimal parameters and the final spatio-temporal trajectory feature vector. Based on the extracted final spatio-temporal trajectory feature vector, the Euclidean distance between the trajectory vectors is used as the basis for calculating the trajectory similarity.

[0067] Step 4.1: In the single map training process, the goal of trajectory representation learning model training is to minimize the representation learning based trajectory feature vector similarity function The difference between the trajectory similarity function calculated by the traditional algorithm Based on this goal, the model is iteratively trained and the optimal trajectory feature vector is obtained.

[0068] Step 4.2: In the cross map training, first, the trajectory training is performed in the source map according to step 4.1. Then, the size of the new map and the source map is judged. If the two map scales are similar, the same scale hierarchical partition tree can be generated when the road network is partitioned, and the source map leaf node feature matrix is set as Then the leaf node feature matrix of the target map can be initialized: E tgt = E src The leaf node feature matrix trained in the source map is used as the initial parameter in the model of the new map for training, and the trained trajectory feature vector in the new map is finally obtained. If the two map scales are quite different, the hierarchical partition trees of the two maps cannot be controlled to the same scale. Considering that some features (such as road structure, network topology and spatial position) have universality, while other features may depend on specific maps, the feature matrix is divided into shared part and trainable part, which is formalized as: F tgt = F shared ‖F trainable ; wherein, is the shared feature matrix inherited from the source map and kept fixed, is the feature matrix retrained in the target map, which is trained by dividing and inheriting the feature matrix of the source map as the initial parameter in the model training process of the new map, and the trained trajectory feature vector in the new map is finally obtained.

[0069] Please refer to Figure 1 The embodiments provided by the application: first, the data set is processed, and the processing process is divided into two parts. For the trajectory data set, the trajectories with a length less than 20 are filtered out, and then all the trajectories are matched to the road network to form road network restricted trajectories using the road network matching algorithm ST-Matching; for the road network data, the road network is divided using the recursive spatial division method of road network partitioning, which can maintain the same number of nodes in the sub-region, and the hierarchical partition tree structure is generated according to the recursive division method. Through the above steps, the trajectory is converted from a trajectory point sequence to a molecular partition sequence. Next, the partition transition probability is calculated by combining the trajectory data and the divided road network structure, and is used in the model training of the graph attention network to obtain the embedding of the partition, wherein the self-attention calculation can refer to Figure 2 Then, the spatial embedding of the trajectory is obtained using the GRU-based encoder-decoder structure, and in the cross map migration training, please refer toFigure 3 If the leaf nodes of two maps have the same level, the leaf node features can be directly migrated, and the leaf node embedding matrix of the source map is: The leaf node embedding matrix E of the target map can be obtained as follows: tgt The initialization is as follows: E tgt = E src When the sizes of the maps are different, the feature matrix migration strategy is adopted, part of the features has universality, and some other features can depend on specific maps, and the feature matrix is split into a shared part and a trainable part, which is formally represented as: F tgt = F shared ‖F trainable . Wherein, is the shared feature inherited from the source map and kept fixed, is the adjustable parameter retrained on the target map.

[0070] During the model training process, the target of the present application is to need a loss function optimization target, that is, the difference between the spatiotemporal trajectory similarity function calculated based on the representation learning and the spatiotemporal trajectory similarity function calculated by the traditional algorithm is the smallest. First, given a trajectory data set, first, a random sampling method is used to randomly select a trajectory as an anchor trajectory (Anchor Trajectory) T a . Then, a plurality of trajectories are randomly sampled from the data set, and the trajectories similar to the anchor trajectory T p are selected as positive samples, and the trajectories not similar to the anchor trajectory T n are selected as negative samples. (T a , T p , T n ) constitute a trajectory triple.

[0071] After the generation of the trajectory triple, the feature mapping is performed through the neural network function : The L2 norm ‖v a -v p ‖2 and ‖v a -v n ‖2 are used to calculate the Euclidean distance between vectors. In addition, the true similarity and can be converted to [0, 1] through exponential normalization to ensure numerical stability and comparability:

[0072] Wherein, α is an adjustable parameter for controlling the attenuation degree of similarity, and the final loss function is as follows:

[0073]

[0074] The trajectory representation method of the scheme can fuse spatial features and has map generalization capability, thereby improving the accuracy and applicability of the trajectory analysis task. The trajectory representation learning method based on similarity calculation is suitable for scenarios such as urban traffic planning, travel recommendation, trajectory clustering and anomaly detection.

[0075] The above merely describes preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A spatio-temporal trajectory similarity calculation method based on graph attention and temporal feature fusion, characterized in that, comprising the following steps, Step 1: preprocessing the spatial part of the trajectory history dataset, wherein the spatial part comprises trajectory point position information and road network information; dividing the road network into a plurality of sub-regions, first matching the trajectory to a road segment through the road network information to generate a road network limited trajectory represented by a road segment ID sequence, and then representing the road segment ID sequence as a sub-region ID sequence according to the sub-regional division of the road network; Step 2: calculating the transition probability between sub-regions through the trajectory history dataset and the divided road network sub-regional structure, and establishing a trajectory spatial representation learning model based on the transition probability, inputting the trajectory sub-region ID sequence into the model to obtain an initial spatial feature vector; Step 3: inputting the time sequence data of the trajectory points in the trajectory history dataset into an RNN-based encoder-decoder model to obtain an initial time feature vector, and performing a splicing operation on the initial spatial feature vector and the initial time feature vector to obtain an initial spatio-temporal trajectory feature vector; Step 4: training the trajectory spatial representation learning model and the RNN-based encoder-decoder model, training and optimizing the model parameters through the initial spatio-temporal trajectory feature vector to obtain optimal model parameters and a final spatio-temporal trajectory feature vector, and taking the Euclidean distance between the trajectory vectors as the basis for calculating the trajectory similarity based on the extracted final spatio-temporal trajectory feature vector.

2. The method of claim 1, wherein the method is based on graph attention and temporal feature fusion for spatio-temporal trajectory similarity computation. In step 1, the trajectory data preprocessing and road network division are as follows: Step 1.1: removing trajectories with a length less than 20 from the original trajectory dataset to obtain a trajectory dataset; using the ST-Matching matching algorithm to map the trajectory point sequence in the trajectory dataset to the real road network to form a road network limited trajectory; Step 1.2: using a multi-level division algorithm to recursively divide the road network into a plurality of sub-regions: specifically, first, coarsening the road network nodes and edges in the road network, then using the Kernighan-lin algorithm to divide the road network into a plurality of sub-regions, and finally de-coarsening the sub-regions to obtain the complete partition of the final road network; two limiting parameters are set during the division process, namely the maximum number of leaf nodes of the sub-region and the number of sub-regions into which a region is subdivided each time; Step 1.3: further converting the road network limited trajectory into a sequence composed of sub-region IDs as input for subsequent model training.

3. The spatio-temporal trajectory similarity calculation method based on graph attention and time sequence feature fusion according to claim 1, characterized in that: Step 2 extracts the spatial features of the trajectory, and the specific method is as follows: Step 2.1: according to the sub-regions divided using the road network partition algorithm in step 1 and the processed trajectory dataset, the transition probability of the sub-regions is calculated, and the calculation formula is as follows: ; wherein represents the number of transitions from a partition P i to a partition P j in the sequence of trajectory partitions in the representative data set, and represents the total number of occurrences of a partition P i as a transition starting point in the sequence of trajectory partitions. Step 2.2: using a graph attention-based structure, the calculated transition probability is used as the initial weight of the attention between nodes to learn the embedding representation of the sub-region, and the calculation process is as follows: ; is the attention weight between partitions p i and p j where e ij represents the attention correlation score between partitions p i and neighboring partitions p j is calculated according to the following formula: ; and is the partition with neighbor partitions , the embedding representation of and belongs to space, and belongs to space, are learnable parameter matrices, represents all the partitions adjacent to the partition ; LeakyReLU is an activation function with a negative input slope of 0.2, represents the transition probability between the partitions and , and then the output features of the partition are calculated , where is a learnable parameter, and ELU represents an exponential linear unit activation function; Step 2.3: next, using the obtained sub-regional embedding, a GRU-based trajectory spatial encoder is used to encode the trajectory sub-region sequence to output the spatial feature representation vector of the trajectory.

4. The spatio-temporal trajectory similarity calculation method based on graph attention and temporal feature fusion according to claim 1, characterized in that: Step 3 extracts the time features of the trajectory and combines the spatial features with the time features, and the time feature extraction method is as follows: Step 3.1: extract the time series information of trajectory sampling points in the trajectory data, i.e. ; input it into the RNN-based encoder-decoder model to obtain the time feature vector of the trajectory; The method for combining the spatial features with the time features is as follows: Step 3.2: After obtaining the spatial feature vector and the temporal feature vector of the trajectory, the two vectors are combined using a splicing method to obtain the spatiotemporal feature vector of the trajectory, i.e., let the spatial feature vector be , and the temporal feature vector be , then the spatiotemporal feature vector can be obtained through ; There are two kinds of trajectory representation learning model training processes: single-map training or map migration training in a multi-map situation; in the model training process of a single-map task, a loss function based on positive and negative samples is designed to minimize the gap between the trajectory spatio-temporal feature vector and the trajectory similarity of the traditional algorithm, and the model parameters are trained and optimized through the initial trajectory spatio-temporal feature vector to obtain the optimal model parameters and the final trajectory spatio-temporal feature vector; in the model training of a multi-map task, first, the single-map model training is performed on the source map, then according to the hierarchical partition tree structure generated in the road network partition process, the model parameters of the source map trained are migrated to the model of the new map as the initial parameters by freezing the leaf node features or feature matrices, and the loss function under the single-map task is used to optimize the parameters to obtain the optimal parameters and the final trajectory spatio-temporal feature vector.

Citation Information

Patent Citations

  • Low-frequency GPS track road network matching method based on multi-dimensional data fusion analysis

    CN111368881A

  • Multi-aircraft 4D trajectory prediction method based on graph attention hybrid neural network

    CN119443151A