Track similarity measurement method based on attention map comparative learning
By converting trajectory data into graph structures and combining unsupervised learning and multi-hop graph attention networks to generate trajectory vectors, the existing methods are solved in terms of computational complexity and accuracy, and an efficient multi-dimensional trajectory similarity measurement is achieved.
Patent Information
- Application Number
- CN202510556770.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-07-18
AI Technical Summary
Existing trajectory similarity measurement methods are insufficient in computational complexity and accuracy, especially when dealing with large-scale and heterogeneous trajectory data.
The trajectory data is converted into graph structure data, and graph enhancement strategies and unsupervised learning are used to combine multi-hop graph attention networks to generate trajectory vectors and similarity measurements are performed through Euclidean distance.
It significantly reduces the labeling cost of the model, improves the calculation accuracy, and can effectively process the similarity measurement of multi-dimensional trajectory data.
Smart Images

Figure CN120336880A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of trajectory data processing, and particularly relates to a method for measuring trajectory similarity based on attention map contrast learning. Background Art
[0002] Trajectory data usually contains the position information and timestamp information of moving objects and is composed in a time series to describe the motion characteristics of objects. The purpose of trajectory similarity measurement is to calculate the similarity of the motion characteristics of different objects. By calculating the similarity of trajectory data, tasks such as trajectory data simplification and matching, trajectory pattern recognition, and trajectory line anomaly detection are achieved. However, different similarity measurement methods may produce different effects during application. Therefore, it is crucial to achieve efficient and accurate similarity measurement of multi-dimensional features of trajectory data.
[0003] To measure the similarity between trajectories, some scholars have proposed similarity measurement methods based on the distance between trajectories. For example, the Dynamic Time Warping (DTW) method calculates the similarity between trajectories through non-linear time alignment and can effectively handle the situation where trajectories are out of sync in time. However, the calculation complexity of DTW is high and it depends on trajectory alignment, resulting in low efficiency when processing large-scale trajectory data and inaccurate similarity calculation. The Longest Common Subsequence (LCS) method evaluates similarity by finding the longest common subsequence of trajectory lines. Compared with the DTW method, the LCS method does not depend on trajectory alignment and can handle partially missing or misaligned trajectory data. However, the LCS method mainly focuses on the relative order of trajectories and is prone to false matching problems for trajectory parts that are far apart or irrelevant. The Fréchet distance metric measures similarity by traversing the maximum or minimum distance between trajectory lines in space and can avoid both trajectory alignment and trajectory mismatch problems. However, this method only focuses on the geometric features of trajectory lines. These methods can effectively measure the similarity between two trajectories by calculating the Euclidean distance between trajectories. However, these methods mainly focus on the geometric features of trajectory lines and depend on trajectory alignment. Therefore, the calculation complexity is high when processing a large number of trajectories, and they show certain limitations when facing the heterogeneity and diversity of trajectory data. Summary of the Invention
[0004] To solve the problems existing in the prior art, the present invention provides a method for measuring trajectory similarity based on attention graph contrast learning. The method includes: obtaining a trajectory dataset and performing data cleaning on the trajectory dataset; generating corresponding graph structure data according to the trajectory dataset after data cleaning, and performing graph enhancement processing on the graph structure data; inputting the graph structure data after graph enhancement into a set encoder to generate corresponding trajectory vectors; the set encoder adopts unsupervised learning combined with a multi-hop graph attention network; using the Euclidean distance to measure the similarity of trajectory vectors corresponding to different trajectory data. The method proposed by the present invention can effectively calculate the similarity of different feature trajectory data.
[0005] The present invention adopts the following technical solutions. A method for measuring trajectory similarity based on attention graph contrast learning includes:
[0006] Obtaining a trajectory dataset and performing data cleaning on the trajectory dataset;
[0007] Generating corresponding graph structure data according to the trajectory dataset after data cleaning, and performing graph enhancement processing on the graph structure data;
[0008] Inputting the graph structure data after graph enhancement into a set encoder to generate corresponding trajectory vectors; the set encoder adopts unsupervised learning combined with a multi-hop graph attention network;
[0009] Using the Euclidean distance to measure the similarity of trajectory vectors corresponding to different trajectory data.
[0010] Further, the method for performing data cleaning on the trajectory dataset includes: using the drift point deletion method and the trajectory line segmentation method to perform data cleaning on the trajectory dataset.
[0011] Further, generating corresponding graph structure data according to the trajectory dataset after data cleaning includes:
[0012] Mapping the trajectory points in the trajectory dataset to the nodes of the graph structure data, and taking the interval between adjacent trajectory points as the edge of the graph structure data;
[0013] Using the Mercator projection method to convert the longitude and latitude of the trajectory dataset into coordinate values, and obtaining the turning angle between the trajectory points in the trajectory dataset and the interval distance between adjacent trajectory points according to the coordinate values;
[0014] Generating graph structure data according to the turning angle between the trajectory points and the interval distance between adjacent trajectory points.
[0015] Further, the graph enhancement processing on the graph structure data is specifically:
[0016] The graph enhancement processing includes a graph topology-based enhancement method and a graph feature-based enhancement method;
[0017] The graph topology-based enhancement method includes: node discarding, random sampling, and edge removal methods;
[0018] The graph feature-based enhancement method includes: feature discarding and feature masking methods.
[0019] Furthermore, the set encoder adopts unsupervised learning combined with a multi-hop graph attention network, specifically:
[0020] The structure of the encoder includes: a graph convolutional layer, a batch normalization layer, an activation layer, a global pooling layer, and an aggregation projection layer, where the graph convolutional layer adopts a multi-hop graph attention network.
[0021] Furthermore, the Euclidean distance is used to measure the similarity of the trajectory vectors corresponding to different trajectory data, expressed as:
[0022]
[0023] where Sim(A,B) is the similarity value between trajectory line A and trajectory line B, and its range is between [0,1]. The closer the value is to 1, the more similar the two trajectories are. On the contrary, the closer the value is to 0, the less similar they are. a and b represent the equal-length feature vectors corresponding to the trajectory lines obtained after passing through the encoder, d(a,b) represents the Euclidean distance between the equal-length feature vector a and the equal-length feature vector b, n represents the encoded dimension, and a i and b i respectively represent the encoded vector values of the i-th dimension.
[0024] The beneficial effects of the present invention are as follows: By converting trajectory data into graph structure data, designing multi-dimensional feature indicators for describing trajectories and graph enhancement strategies, the present invention effectively solves the problems of single features and high computational complexity of traditional algorithms. Then, by combining unsupervised contrast learning with a multi-hop graph attention network, multi-dimensional feature information of trajectories is extracted to obtain high-dimensional feature vectors, significantly reducing the labeling cost of the model and improving the computational accuracy. Finally, the Euclidean distance is used to calculate multi-dimensional feature vectors to realize the similarity measurement of multi-feature trajectory data, and it has excellent performance in the similarity calculation of multi-feature trajectory data. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0026] Figure 1 Schematic structural diagram of a trajectory similarity measurement method based on attention map contrast learning according to an embodiment of the present invention;
[0027] Figure 2 Schematic structural diagram of an encoder according to an embodiment of the present invention;
[0028] Figure 3 Schematic diagram of a trajectory line training sample according to an embodiment of the present invention;
[0029] Figure 4 Schematic diagram of the experimental results of comparing the model parameter combinations of an encoder according to an embodiment of the present invention;
[0030] Figure 5 Schematic diagram of comparing the accuracy of a graph enhancement method according to an embodiment of the present invention;
[0031] Figure 6 Schematic diagram of the contribution degree of different features to an encoder model according to an embodiment of the present invention;
[0032] Figure 7 Schematic diagram of the comparison result of the feature trajectory line similarity matrix obtained by different methods according to an embodiment of the present invention;
[0033] Figure 8 Schematic diagram of the trajectory line features according to an embodiment of the present invention. Detailed implementation manners
[0034] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0035] The present invention mainly proposes a trajectory similarity measurement model TS-AGCL (Trajectory Similarity Measurement Based on Attention-Graph Contrastive Learning); first, TS-AGCL converts trajectory data into graph-structured data, and effectively solves the problems of single features and high computational complexity of traditional algorithms by designing multi-dimensional feature indicators for describing trajectories and graph enhancement strategies. Then, TS-AGCL combines unsupervised contrastive learning with a multi-hop graph attention network to extract multi-dimensional feature information of trajectories and obtain high-dimensional feature vectors, significantly reducing the labeling cost of the model and improving the calculation accuracy; finally, TS-AGCL calculates the similarity of multi-feature trajectory data by calculating the Euclidean distance of multi-dimensional feature vectors. Specifically, the structural schematic diagram of a trajectory similarity measurement method based on attention-graph contrastive learning according to an embodiment of the present invention is as shown in Figure 1 shown, including:
[0036] Obtain a trajectory data set and perform data cleaning on the trajectory data set;
[0037] In the embodiment of the present invention, the trajectory data source adopts the Geolife trajectory data set and the Shenzhen taxi trajectory data set, and data cleaning is performed by methods such as drift point removal and trajectory line segmentation.
[0038] Generate corresponding graph-structured data according to the trajectory data set after data cleaning, and perform graph enhancement processing on the graph-structured data;
[0039] In the embodiment of the present invention, the trajectory points on the trajectory line are mapped to the nodes of the graph-structured data, and the interval between adjacent trajectory points is defined as an edge. Considering the spatial, motion, and semantic features of the trajectory line comprehensively, the feature representation of the trajectory line is as shown in Figure 8 shown, where the spatial position feature of the trajectory is composed of the longitude and latitude coordinates of the trajectory points. As shown in Figure 8 (a), in order to reduce the influence of the earth's curvature on the accuracy of trajectory data, the present invention uses Mercator projection to convert the longitude and latitude information of the trajectory into corresponding plane coordinate values, denoted as (X0, X1,..., X n ), (Y0, Y1,..., Y n ); the motion feature of the trajectory is composed of the translation amounts (DX1, DX2,..., DX n ), (DY1, DY2,..., DY n ) of the longitude and latitude coordinates of the trajectory points and the turning angles (α1, α2,..., α n ) between the trajectory points, as shown in Figure 8(as shown in (b)); the semantic features of the trajectory are composed of the straight-line distances (DS1, DS2,..., DS n ), time differences (ΔT1, ΔT2,..., ΔT n ), and speeds (V1, V2,..., V n ), where n is the number of trajectory points; as shown in Figure 8 (c) and Figure 8 (d), in a two-dimensional space, the coordinate translation amount between trajectory points can reflect the position change of the moving object, which can be obtained by calculating the longitude difference and latitude difference of the trajectory points. The expression is:
[0040]
[0041] In the formula, DX i represents the calculated latitude difference of the i-th trajectory point, DY i is the calculated longitude difference of the i-th trajectory point, X i represents the latitude of the i-th trajectory point, X i-1 represents the latitude of the (i - 1)-th trajectory point, Y i represents the longitude of the i-th trajectory point, and Y i-1 represents the longitude of the (i - 1)-th trajectory point.
[0042] The turning angle between trajectory points is calculated based on the inverse trigonometric function within the quadrant where its coordinate translation amount is located. The corresponding angle calculation method can be selected according to the quadrant where the coordinate translation amount is located. When the latitude coordinate translation amount is greater than 0, the angle value can be calculated by the arctangent function; when the latitude coordinate translation amount is less than 0, it is necessary to add π or subtract π to the value after arctangent according to the situation of the longitude coordinate translation amount; when the latitude coordinate translation amount is equal to 0, the result is ±90°. The expression is:
[0043]
[0044] In the formula, α i represents the angle change value of the i-th trajectory point, Error indicates no calculation result, DY i is the calculated longitude difference of the i-th trajectory point, and DX i represents the calculated latitude difference of the i-th trajectory point.
[0045] Since the longitude and latitude coordinates of the trajectory line are converted into corresponding plane coordinate values after projection, the distance between trajectory points can be calculated according to the distance formula between two points in the plane. The speed of the trajectory point needs to calculate the ratio of the time difference between trajectory points to the obtained distance value. The specific calculation process is as follows:
[0046]
[0047] In the formula, DS i , ΔT i , V i respectively represent the distance, time difference, and speed between the i-th trajectory points, t i represents the time of the i-th trajectory point, t i-1 represents the time of the (i - 1)-th trajectory point, X i represents the latitude of the i-th trajectory point, X i-1 represents the latitude of the (i - 1)-th trajectory point, Y i represents the longitude of the i-th trajectory point, Y i-1 represents the longitude of the (i - 1)-th trajectory point; (i = 1, 2, 3,..., n), indicating that the value of i is a positive integer from 1 to n.
[0048] In order to transform the features of the trajectory line at different scales into the same standard range for effective model training, it is necessary to normalize the multi-feature information of the trajectory line. The spatial features and semantic features of the trajectory adopt the Min - Max Normalization method, and the motion features of the trajectory adopt the ratio of the angular value α (node angular value) of the trajectory point to the maximum angular value [-π, π] within its range. The specific calculation process is shown in the following formula:
[0049]
[0050] In the formula, X i ′, Y i ′ respectively represent the normalized latitude coordinate and longitude coordinate of the i-th trajectory point; α′ represents the normalized angular value; after feature normalization, the multi-feature values of the trajectory line are fixed between [-1, 1], thereby improving the efficiency and performance of model training.
[0051] In graph contrastive learning, graph augmentation aims to generate positive and negative samples by modifying the original graph structure or adding certain features to improve the learning ability and generalization ability of the model. When the graph data is limited or the graph structure is incomplete, the potential information of the graph structure data can be effectively captured through graph augmentation strategies. In the embodiments of the present invention, the graph augmentation methods include two types: the augmentation method based on the graph topology structure and the augmentation method based on the graph features.
[0052] The enhancement methods based on graph topology include Node Dropping (ND), Subgraphs induced by Random Walks (RWS), and Edge Removing (ER); among them, the node dropping strategy and the edge removing strategy simulate the loss of nodes or edges by deleting certain nodes or edges in the graph, so as to enhance the robustness of the model in the case of graph structure loss; the random sampling strategy constructs subgraphs for training by sampling nodes or edges, which can reduce the scale of the graph and speed up the calculation, while improving the diversity of training samples. The optional sampling methods in the embodiments of the present invention include random walk sampling or neighborhood sampling, which are applicable to large-scale graph data structures.
[0053] The enhancement methods based on graph features include Feature Dropping (FD) and Feature Masking (FM); among them, feature masking generates a mask vector for the feature vector of each node, and selectively retains or eliminates feature information after multiplying the mask vector by the feature vector; feature dropping directly deletes certain features, making some dimensions of the node features completely disappear, which is more suitable for simulating the situation of feature loss.
[0054] The graph structure data after graph enhancement is input into a set encoder to generate corresponding trajectory vectors; the set encoder adopts unsupervised learning combined with a multi-hop graph attention network;
[0055] The trajectory line transformed into a graph structure needs to use an encoder for trajectory encoding after the graph enhancement strategy to effectively capture the deep features of positive and negative samples, so as to provide a trajectory embedding representation with robustness and generalization ability. The architecture of the encoder in the embodiments of the present invention includes a graph convolutional layer, a batch normalization layer, an activation layer, a global pooling layer, and an aggregation projection layer. The specific encoder architecture is as Figure 2 shown.
[0056] In order to effectively capture the feature information between trajectory points, the graph convolutional layer in the embodiments of the present invention adopts a multi-hop graph attention network. The core idea is to enrich the node feature aggregation process through the neighbor information of multiple hops, so as to introduce graph structure information at different levels. In the embodiments of the present invention, on the framework of a Graph Neural Network (GNN), the graph attention mechanism and diffusion technology are combined, and the neighbor node information is aggregated layer by layer in a multi-hop manner, and the attention mechanism is used to dynamically adjust the weights of each hop neighbor during the aggregation process. Its specific calculation process can be divided into four main steps:
[0057] First, calculate the attention scores between directly connected nodes to achieve attention aggregation of single-hop neighbors; second, use diffusion technology to complete the feature propagation and attention calculation of multi-hop neighbors; then, adopt the multi-head attention mechanism to capture spatial feature information from different perspectives. Finally, through residual connection and layer normalization operations, effective aggregation of node features is achieved, and its specific expression is:
[0058]
[0059] In the formula, h A,B represents the attention score between node A and node B, G represents the entire graph structure data, V A and V B represent node A and node B in the graph, f() represents the attention aggregation function, h A,D represents the attention score between node A and node D, h B,C represents the attention score between node B and node C, h C,D represents the attention score between node C and node D, which means that through the path points between node A and node D in h A,D the feature propagation of multi-hop neighbors is carried out, so as to spread the attention to consider all paths between nodes to enhance graph structure learning.
[0060] The batch normalization layer can alleviate the problems of gradient disappearance and gradient explosion during training, improve training stability, and accelerate convergence by accelerating the training of deep neural networks. Its core idea is to normalize the input of each layer so that the input of each neuron has the same mean and variance. The specific implementation process includes calculating the mean and variance, sample normalization, scaling, and translation to obtain the output value. At the same time, in order to avoid the problem of gradient disappearance, the activation layer introduces a non-linear mapping through the ReLU activation function to make the neural network fit more complex patterns, and the expression is:
[0061]
[0062] In the formula, x^ i represents the normalized eigenvalue, x i represents the i-th eigenvalue in the feature vector, μ and σ represent the sample mean and variance, ε represents a very small constant to prevent the denominator from being 0, y i represents the standardized output value, and γ and β are learning parameters to control the scale and offset of the output.
[0063] The global pooling layer can significantly reduce the number of model parameters by compressing the feature map information. Its scope of action is the entire feature map, so it can help the model capture the global information of the input features. In the embodiments of the present invention, average pooling is used to capture the mean information of the feature map. The role of the projection layer is to map the pooled feature space to the specific space required by the model, while removing some redundant information to facilitate the calculation and processing of the subsequent model. The projection layer usually includes multiple linear transformations to achieve dimension conversion. To enhance the non-linear expression ability of the model, the present invention adopts a combination structure of Linear and ReLU. The expression for the average pooling in the embodiments of the present invention to capture the mean information of the feature map is:
[0064]
[0065] In the formula, x represents the sample feature, y represents the mean information of the feature map, H and W are the height dimension and width dimension of the feature map respectively, and x ij represents the feature value when the height dimension is i and the width dimension is j.
[0066] In contrastive learning, the loss function aims to pull the feature representations of similar samples closer and push the feature representations of dissimilar samples farther by optimizing the relative distance between samples, so as to learn a feature space with strong discrimination ability. Its main goal is to enhance the representation ability of the model, enabling it to distinguish different categories of samples, and by minimizing the contrastive loss, promoting the model to learn more discriminative feature representations. To address the problem of class imbalance in the dataset and improve the model's ability to distinguish similar samples, the embodiments of the present invention adopt the RINCE (Robust InfoNCE Loss) loss function to learn the feature representations of samples. Compared with the InfoNCE loss, the RINCE loss enables the model to better capture the subtle differences between samples by simultaneously optimizing the representations of positive and negative samples.
[0067] The Euclidean distance is used to measure the similarity of the trajectory vectors corresponding to different trajectory data, which is expressed as:
[0068]
[0069] Among them, Sim(A,B) is the similarity value between trajectory line A and trajectory line B, and its range is between [0,1]. The closer the value is to 1, the more similar the two trajectories are. On the contrary, the closer the value is to 0, the less similar they are. a and b represent the equal-length feature vectors corresponding to the trajectory lines obtained after passing through the encoder, d(a,b) represents the Euclidean distance between the equal-length feature vector a and the equal-length feature vector b, n represents the encoded dimension, and a i and b i respectively represent the encoded vector values of the i-th dimension;
[0070] In a specific experimental embodiment of the present invention, in order to verify the accuracy and robustness of the model, the embodiment of the present invention randomly selects a total of 800 trajectory lines from the Geolife dataset and the Shenzhen taxi trajectory dataset as references. At the same time, 4,800 trajectory data containing different features are formed as training samples by changing the spatial features, motion features, and semantic features of the reference trajectory lines. According to the feature combination method of the trajectory lines, the training samples are divided into 6 categories, as Figure 3 shown. Among them, Figure 3 (a) to Figure 3 (e) the T0 represents the reference trajectory line; only changing the speed or spatial position of the reference trajectory line gives Figure 3 T1 in Figure 3 (a) and Figure 3 T2 in Figure 3 (b); compared with the reference trajectory line, Figure 3 T3 and T4 in
[0071] (c) and Figure 4 (d) represent trajectory lines with different speeds and spatial positions and different turning angles and spatial positions respectively; Figure 4 T5 in Figure 4 (e) represents a trajectory line completely different from the reference trajectory. Figure 4 In deep learning, the performance and performance of the model are affected by multiple parameters, mainly including batch size, learning rate, and model depth, etc. Analyzing the parameters of the model can help understand the behavior of the model and optimize the model performance. In the embodiment of the present invention, by analyzing the relationship between the model learning rate and batch size and the relationship between the hidden layer dimension and model depth to determine the best performance of the model; among them, the learning rates are taken as 0.01, 0.001, 0.0001, and 0.00001 respectively; the batch sizes are taken as 16, 32, 64, 128, and 256 respectively; the hidden layer dimensions are taken as 16, 32, 64, 128, and 256 respectively; the model depths are taken as 2, 3, 4, and 5 respectively. The experimental results are as Figure 4 shown,
[0072] Graph augmentation helps the model learn graph representations from different perspectives by generating diverse graph structure data, thereby improving the discriminative ability of the model and enhancing the effect of graph contrast learning. The graph augmentation methods adopted in the embodiments of the present invention include node dropout, random sampling, edge removal, feature dropout, and feature masking; when no graph augmentation method is adopted, it is represented by I (Identity). The different graph augmentation methods and their accuracies are as Figure 5 shown. From the model accuracy results of different graph augmentation strategies shown in Figure 5 , it can be seen that the model accuracy without using the graph augmentation strategy is significantly lower than that of any model using the graph augmentation strategy; among the single graph augmentation strategies, the effect of feature augmentation is better than that of topological augmentation; in the strategy combining topological augmentation and feature augmentation, the combination of node dropout and feature masking achieves the best model accuracy. In addition, in the comparison between inter-topological augmentation and inter-feature augmentation, the inter-topological augmentation strategy is better than the inter-feature augmentation; generally speaking, although different graph augmentation strategies have different effects on the model accuracy, the strategy combining topological augmentation and feature augmentation achieves the optimal performance, which indicates that the topological and feature augmentation strategies have an important impact on the accuracy of graph contrast learning, and selecting the optimal augmentation strategy according to the data characteristics can improve the model effect.
[0073] By measuring the contribution degrees of different features to the model, it can help understand the decision-making process of the model and perform feature selection according to specific tasks. Therefore, in the embodiments of the present invention, single features and all features are selected to measure the contribution degrees of different features to the model. The specific parameter settings are as follows: the batch size is set to 128, the learning rate is 0.001, the model depth is 4, the hidden layer dimension is 64, and the graph augmentation strategy selects the combination of node dropout and feature masking. The experimental results are as Figure 6 shown. Through the analysis of Figure 6 , it can be obtained that the contribution rate of single features is generally lower than that of the all-feature combination. And among the single features, the corner and speed features have a more significant impact on the model. The main reason is that the all-feature combination can comprehensively consider the spatial features, motion features, and semantic features of the trajectory data, thereby effectively reducing the deviation of single features in model calculation. Therefore, in the subsequent experiments of the embodiments of the present invention, the all-feature combination method is adopted to measure the similarity between trajectory lines.
[0074] For the trajectory data with different features, in the embodiments of the present invention, three methods, namely the TS-AGCL model, the Fréchet distance, and dynamic time warping, are further used for comparative experiments. The experimental data uses the above 6 types of trajectory data with different features. Among them, the training set and the test set are divided according to the ratio of 8:2. The experimental results are as Figure 7 shown, where Figure 7 (a) is the similarity matrix of feature trajectory lines obtained by the dynamic time warping algorithm, Figure 7(b) is the similarity matrix of the feature trajectory lines obtained by the Fréchet distance algorithm, Figure 7 (c) is the similarity matrix of the feature trajectory lines obtained by the TS-AGCL model. The comparison of the model accuracies is shown in Table 1:
[0075] Table 1 Comparison results of model accuracies
[0076]
[0077] From Figure 7 It can be seen that when the spatial position features change little, for the similarity measurement between the reference trajectories T0, the similarities calculated by the three methods are all 100%; only changing the speed feature T1 of the trajectory line, the similarities calculated by the model proposed in the present invention have a large gap. Therefore, T0 and T1 can be distinguished, while the traditional algorithms have a poor discrimination effect. When the spatial position features change greatly, the similarities calculated by the traditional algorithms are all below 20%, while the model proposed in the present invention calculates a higher similarity for the trajectory lines with the same feature and a lower similarity for the trajectory lines with different features, and can distinguish the trajectory lines with different features. It can be seen from Table 1 that the accuracy of the model proposed in the present invention is significantly better than the other two algorithms.
[0078] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A trajectory similarity measurement method based on attention map contrast learning, characterized in that Including: Obtain a trajectory dataset and perform data cleaning on the trajectory dataset; Generate corresponding graph structure data according to the trajectory dataset after data cleaning, and perform graph augmentation processing on the graph structure data; Input the graph structure data after graph augmentation into a set encoder to generate corresponding trajectory vectors; the set encoder adopts unsupervised learning combined with a multi-hop graph attention network; Use the Euclidean distance to measure the similarity of trajectory vectors corresponding to different trajectory data.
2. The trajectory similarity measurement method based on attention map contrast learning according to claim 1, characterized in that: The method for performing data cleaning on the trajectory dataset includes: using a drift point deletion method and a trajectory line segmentation method to perform data cleaning on the trajectory dataset.
3. The trajectory similarity measurement method based on attention map contrastive learning according to claim 1, wherein: Generating corresponding graph structure data according to the trajectory dataset after data cleaning includes: Mapping the trajectory points in the trajectory dataset to the nodes of the graph structure data, and taking the interval between adjacent trajectory points as the edge of the graph structure data; Using the Mercator projection method to convert the longitude and latitude of the trajectory dataset into coordinate values, and obtaining the turning angle between the trajectory points in the trajectory dataset and the interval distance between adjacent trajectory points according to the coordinate values; Generate graph structure data according to the turning angle between the trajectory points and the interval distance between adjacent trajectory points.
4. A method for trajectory similarity measurement based on attention map contrastive learning according to claim 1, characterized in that: Performing graph augmentation processing on the graph structure data specifically includes: The graph augmentation processing includes a graph topology enhancement method and a graph feature enhancement method; The graph topology enhancement method includes: node discarding, random sampling, and edge removal methods; The graph feature enhancement method includes: feature discarding and feature masking methods.
5. A method for measuring trajectory similarity based on attention map contrast learning according to claim 1, characterized in that: The set encoder adopts unsupervised learning combined with a multi-hop graph attention network specifically as: The structure of the encoder includes: a graph convolutional layer, a batch normalization layer, an activation layer, a global pooling layer, and an aggregation projection layer, where the graph convolutional layer adopts a multi-hop graph attention network.
6. The trajectory similarity measurement method based on attention map contrast learning according to claim 1, wherein: Using the Euclidean distance to measure the similarity of trajectory vectors corresponding to different trajectory data is expressed as: Among them, Sim(A, B) is the similarity value between trajectory line A and trajectory line B, which ranges from [0, 1]. The closer the value is to 1, the more similar the two trajectories are. On the contrary, the closer the value is to 0, the less similar they are. a and b represent the equal-length feature vectors corresponding to the trajectory lines obtained after passing through the encoder. d(a, b) represents the Euclidean distance between the equal-length feature vector a and the equal-length feature vector b. n represents the dimension after encoding, and a i and b i respectively represent the encoded vector values of the i-th dimension.