A vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement
By using dynamic graph alignment and POI enhancement, this method addresses the problem that topological constraints and semantic attributes are not fully considered in existing vehicle trajectory similarity calculations. It achieves efficient and robust trajectory similarity calculation in complex traffic environments, improving the accuracy of similarity calculation and semantic understanding capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 湖南工商大学
- Filing Date
- 2026-03-11
- Publication Date
- 2026-05-08
AI Technical Summary
Existing vehicle trajectory similarity calculation methods fail to fully consider the topological constraints and semantic attributes of urban road networks in complex and dynamic traffic environments, leading to misjudgments and distorted representations. Furthermore, they lack an understanding of the functional changes in the fine-grained space within the trajectory, making it difficult to achieve efficient and robust similarity calculation in complex traffic environments.
By using a dynamic graph alignment and POI enhancement method, a multimodal semantic alignment mechanism is constructed by dynamically adjusting the grid resolution using a three-dimensional spatiotemporal octree structure and combining the POI data distribution density and functional weights. A multi-layer graph attention network is then used for iterative cross-modal information propagation and feature alignment to generate a unified trajectory multimodal representation.
It achieves efficient and robust similarity calculation of trajectories in complex traffic environments, improves the accuracy of similarity calculation and semantic understanding capabilities, and supports applications such as path recommendation, anomaly detection and traffic management.
Smart Images

Figure CN121834375B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement. Background Technology
[0002] With the rapid development of GPS, mobile communication, and IoT technologies, urban transportation systems have generated massive amounts of vehicle trajectory data. This trajectory data not only records the spatiotemporal location changes of vehicles, but also implies multi-dimensional information such as driving behavior, road network structure, regional functional characteristics, and urban dynamics. Trajectory similarity calculation, as a fundamental task in trajectory data processing and analysis, widely supports key applications in intelligent transportation systems, such as real-time route recommendation, traffic flow anomaly detection, traffic operation monitoring, traffic management, personalized navigation, and urban planning.
[0003] Current trajectory similarity calculation methods can be mainly categorized into geometric distance-based methods, grid-based or raster-based methods, road network matching-based methods, and deep learning representation-based methods. However, in complex and dynamic urban traffic environments, existing methods still face several challenges and limitations:
[0004] Traditional similarity measurement methods, such as Dynamic Time Warping (DTW), Longest Common Subsequence (LCSS), Edit Distance (EDR), and Fréchet Distance (Fréchet Distance), are mainly calculated based on the geometric shape of point sequences in Euclidean space. Although these methods can effectively characterize the shape similarity and temporal alignment of trajectories, they generally ignore the topological constraints of urban road networks (such as one-way streets, no-turn zones, grade-separated interchanges, etc.) and semantic attributes (such as road class and speed limit information). This often leads to misjudgments such as geometrically similar but unreachable road networks or geometrically dissimilar but equivalent paths, limiting their practicality in real navigation and path reasoning.
[0005] To reduce the computational complexity of continuous trajectory data and enhance its robustness to noise, gridding or rasterization methods are widely used. These methods discretize the continuous space, effectively addressing the instability of pure geometric distance or pure point sequence encoding in complex geometric shapes such as boundary regions, sharp turns, and U-turns. However, traditional methods typically employ uniform grid division, and the resolution often needs to be pre-set. Excessive resolution can lead to lengthy and sparse sequences in high-density areas (such as city centers), increasing storage and computational overhead. Conversely, insufficient resolution can result in the loss of key details in low-density areas or complex geometric regions (such as sharp turns, roundabouts, and ramps), leading to distorted representations. Although adaptive data structures such as quadtrees and octrees have been introduced, the partitioning criteria mostly rely on the distribution density of spatial points, failing to fully consider the local geometric characteristics of the trajectory itself (such as curvature and turning angle). Therefore, insufficient partitioning may still occur in critical areas such as densely turning regions, affecting the accuracy of similarity judgment.
[0006] Trajectory similarity depends not only on its spatial geometry but also on the functional semantics of the areas it passes through, such as the distribution of POI categories around the origin and destination, functional area attributes, and activity purpose. Point of Interest (POI) data is an important source of regional functional semantics. Existing methods typically aggregate the POI categories associated with the entire trajectory globally or use the origin and destination POIs as features when fusing POI information. This lacks precise correlation with the fine-grained space within the trajectory, making it difficult to characterize the functional changes of the areas the trajectory passes through during the journey. It also fails to distinguish the differentiated impact of different POI categories within the same area on travel behavior, resulting in limited performance in similarity retrieval based on travel intent.
[0007] Mapping GPS trajectories to road networks through map matching and then using graph neural networks to learn road segment representations is an effective way to introduce topological constraints. However, existing road network representation methods based on graph neural networks mainly rely on static topological connections and road attributes (length, type, number of lanes, etc.) provided by OpenStreetMap, failing to fully explore and utilize the dynamic traffic patterns emerging from large-scale historical trajectory data. They ignore these "behavioral priors" statistically obtained from the data, resulting in road network representations that lack the ability to characterize actual traffic patterns and have weak generalization ability when facing scenarios such as temporary traffic control and congestion detours.
[0008] Existing methods for calculating vehicle trajectory similarity still have significant shortcomings in adaptive multi-scale geometric representation, fine-grained semantic fusion, data-driven road network behavior semantic modeling, dynamic and robust multimodal alignment, and multi-level collaborative supervision. Therefore, there is an urgent need for a new technical framework that can efficiently compress data while accurately depicting complex trajectory morphologies, deeply understanding regional functional semantics, organically integrating real traffic patterns, and having the ability to dynamically adjust the fusion strategy based on data conditions. This would comprehensively improve the accuracy and robustness of trajectory similarity calculation in real and complex traffic environments. Summary of the Invention
[0009] In view of this, this invention proposes a vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement. This method solves the problems in existing vehicle trajectory similarity calculation methods, such as distortion in the representation of complex geometric shapes and sparse regions due to fixed grid division, separation of geometric features and regional functional semantics, lack of prior knowledge of real traffic patterns in road representation, and difficulty in dynamic alignment due to rigid multimodal information fusion. This invention provides a method that, while ensuring efficiency, takes into account multi-scale geometric details, regional semantic connotations, and road topological patterns. It can meet the needs of efficient, robust, and interpretable similarity calculation of large-scale trajectory data in complex dynamic traffic environments and supports applications in scenarios such as path recommendation, anomaly detection, travel profiling, and traffic management.
[0010] To achieve the above objectives, this invention provides a method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement, characterized by the following steps:
[0011] S1. The original vehicle trajectory point sequence The GPS point sequence is cleaned, its spatiotemporal features are extracted, a road network topology map is constructed based on OpenStreetMap, and the GPS point sequence is mapped into a structured road sequence using a map matching algorithm.
[0012] S2. Based on the density constraints and geometric curvature constraints of vehicle trajectory points in each candidate grid cell, the grid resolution is dynamically adjusted through a three-dimensional spatiotemporal octree structure. The multi-level grid codes of the leaf grid nodes and parent nodes of each vehicle trajectory point are extracted. The geometric grid representation sequence of vehicle trajectory points is generated through a multi-scale gating fusion mechanism.
[0013] S3. Obtain POI data of different categories within each grid cell and calculate the distribution density and functional weight of POI data. Construct the semantic feature vector of the grid cell and dynamically fuse the semantic feature vector with the features of corresponding points in the grid representation sequence to generate a semantically enhanced grid representation sequence.
[0014] S4. A dual-probability-guided graph attention mechanism is adopted to statistically analyze the transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window from the structured road sequence as learnable prior knowledge. The final road topological semantic representation, which integrates static road attributes, topological connections and dynamic traffic patterns, is output through a multi-layer multi-head attention mechanism.
[0015] S5. Construct a multimodal semantic alignment mechanism for dynamic graph interaction, and generate a unified trajectory multimodal representation through global aggregation nodes;
[0016] S501. The GPS point sequence from step S1, the enhanced grid representation sequence from step S3, and the final road topology semantic representation from step S4 are used to calculate the cross-modal association weights between the three modalities: GPS modal features, grid modal features, and road modal features. These are then aggregated through the sequence readout module to obtain the GPS modal trajectory-level representation, the Grid modal trajectory-level representation, and the road modal trajectory-level representation, which are then used as dynamic... Figure 3 The initial features of each modality are used to construct dynamic edge weights between modalities based on the cross-modal association weights;
[0017] The sequence readout module employs average pooling and attention pooling.
[0018] S502. Construct a fully connected dynamic graph with three modalities as nodes and associated weights as edges. Use a multi-layer graph attention network to perform iterative cross-modal information propagation and feature alignment, and aggregate to generate a unified trajectory multimodal representation.
[0019] S6. Construct a joint loss function that includes local structure alignment loss, global contrastive learning loss and modality fusion gating regularization loss, and perform supervised training and optimization on the unified trajectory multimodal representation generated in step S5;
[0020] S7. Using the optimized model, extract the unified multimodal representation of the two trajectories to be compared and calculate the similarity. The similarity is output as the final similarity score of the two trajectories.
[0021] Preferably, the preprocessing and map matching specifically include the following steps:
[0022] S101, Clean the original vehicle trajectory point sequence For trajectories with fewer than 20 and more than 200 trajectory points, extract the GPS modal features of the vehicle trajectory.
[0023] S102. Extracting the road network topology map from OpenStreetMap data , where the node set The set of edges represents the intersections and endpoints of roads. This represents a directed road segment connecting nodes. Each road segment's initial vector includes the road segment length, road type, number of lanes, and speed limit. All road segment initial vectors are stacked into a matrix.
[0024] S103, The original vehicle trajectory point sequence Projected onto the road network topology map, a hidden Markov model is used for map matching. The state transition probability is determined by the topological connectivity and directional consistency between road segments, and the transmission probability is determined by the distance between the GPS point and the candidate road segment.
[0025] Preferably, generating the final mesh representation sequence of vehicle trajectory points specifically includes the following steps:
[0026] S201. Map vehicle trajectory points to a normalized three-dimensional spatiotemporal coordinate system to construct a standardized trajectory point sequence. ;
[0027] S202, Calculate the density constraint and geometric curvature constraint, and then apply the standardized trajectory point sequence... Mapped to a unit three-dimensional spacetime cube;
[0028] The density constraint is obtained by counting the total number of trajectory points within a node;
[0029] The ordered point sequence of a single trajectory within a grid cell is extracted and arranged, and the local curvature of the trajectory within the node is calculated. Then, the curvature of multiple trajectories within the node is aggregated across trajectories to obtain the geometric curvature constraint of the node. Grids with density constraints or geometric curvature constraints exceeding a preset threshold are divided into 8 three-dimensional small grids using an octree.
[0030] S203. Calculate vehicle trajectory points through multi-level coding and micro-displacement. The leaf grid nodes and their parent nodes are identified, and the vehicle trajectory points are calculated. The relative positional deviation within the leaf network;
[0031] S204. By using a multi-scale gating fusion mechanism, the leaf grid node features, parent node features, and micro displacement features are linearly fused to generate a geometric grid representation sequence of vehicle trajectory points.
[0032] Preferably, generating semantically enhanced grid representation sequences specifically includes:
[0033] S301, Based on each grid cell The distribution density of K types of POI data within the spatial range is statistically analyzed, and the distribution density is fused with the corresponding preset POI data functional weights to form a semantic feature vector.
[0034] S302, Obtain each trajectory point POI semantic feature vector of the leaf node and the semantic feature vector of the parent node's POI Semantic fusion weights are calculated using a bilinear attention mechanism;
[0035] The bilinear attention mechanism performs an outer product operation on the POI semantic feature vectors of the leaf node and the parent node where the trajectory point is located, and then calculates the fusion weight through a learnable weight matrix and activation function. The weighted fusion of the two semantic vectors is then added to the geometric grid representation sequence.
[0036] S303. Multimodal fusion of the POI semantic feature vector of the leaf node where the trajectory point is located and the POI semantic feature vector of the parent node with the geometric semantic features, and combination of the semantic enhancement representations of all trajectory points to generate a semantic enhancement grid representation sequence.
[0037] Preferably, the road topology semantic representation learning and generation of the final trajectory using a dual-probability-guided graph attention mechanism specifically includes:
[0038] S401. Obtain the initial feature vector corresponding to the structured road sequence by searching, construct the initial feature matrix of the road sequence of the current trajectory, and statistically analyze the transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window from historical road trajectory data.
[0039] S402. Calculate the attention coefficients between adjacent road segments, obtain the attention weights through Softmax normalization, use K attention heads to calculate in parallel, concatenate all attention head outputs and perform linear transformation, repeat L times to obtain the final trajectory road topology semantic representation.
[0040] Preferably, the cross-modal correlation weights among the three modes—GPS modal features, grid modal features, and road modal features—include: GPS-grid edge weight, grid-road edge weight, and road-GPS edge weight.
[0041] The GPS-grid edge weights are obtained by weighting two sub-indicators: spatial coverage and temporal synchronization. Spatial coverage represents the concentration of GPS points within the grid, and temporal synchronization represents the synchronization between the access time pattern and the grid's historical time pattern.
[0042] The grid-road edge weight is obtained by weighted synthesis of three sub-indicators: spatial alignment, functional consistency, and topological constraint strength. The spatial alignment represents the proportion of geometric coverage length of road segments within the grid, the functional consistency represents the functional consistency between the grid POI semantics and the road attributes, and the topological constraint strength represents the density of the grid being penetrated or connected by the road network.
[0043] The road-GPS edge weights are obtained by weighted synthesis of three sub-indicators: matching accuracy, motion rationality, and topological constraint satisfaction. The matching accuracy represents the projection accuracy of map matching. The motion rationality includes speed rationality and direction consistency. The speed rationality represents the rationality of GPS instantaneous speed and road segment speed limit. The direction consistency represents the consistency of motion direction. The topological constraint satisfaction represents the topological connectivity of the matching path.
[0044] Preferably, the attention coefficients of the multi-layer graph attention network are jointly determined by node feature similarity and dynamic edge weights.
[0045] Preferably, the joint loss function is expressed as follows:
[0046] ;
[0047] in, Denotes the joint loss function. This represents the local structural alignment loss. This represents the global contrastive learning loss. This represents the modal gating regularization loss. , The hyperparameter representing the balancing contribution of the three loss factors;
[0048] Minimize the joint loss function using backpropagation. Simultaneously optimize all learnable parameters of the trajectory representation network and the dynamic fusion gating network.
[0049] Preferably, cosine similarity is used to calculate the similarity between the two trajectories to be compared, and the expression is:
[0050] ;
[0051] in, , This represents two trajectories to be compared. , Representing trajectories , The representation vector, Represents the dot product. Representing vectors Norm, similarity The range of values is The larger the value, the higher the semantic similarity of the trajectories.
[0052] Preferably, an adjustable temperature parameter is introduced. The scaling and offset of trajectory similarity are expressed as follows:
[0053] ;
[0054] in, Indicates temperature parameter, Used to control the sharpness of the score distribution.
[0055] Compared with the prior art, the beneficial effects of the present invention are:
[0056] This invention introduces two types of constraints in trajectory gridding representation: local geometric curvature variation and spatial distribution density. This drives the recursive partitioning of a three-dimensional spatiotemporal octree, enabling "on-demand fine-grained" perception of complex geometric shapes such as sharp turns and U-turns. It also maintains a coarser granularity in sparse or flat regions of the trajectory to reduce redundancy. To address the quantization error and boundary discontinuity issues caused by discretization, it further introduces relative position deviation encoding within the grid cells to compensate for the continuity accuracy of the discrete grid representation. This effectively overcomes the quantization error and boundary discontinuity issues while significantly compressing the data size, achieving a high-fidelity and stable trajectory geometric representation.
[0057] This invention innovatively sinks the POI distribution density and functional weights down to the grid cells, constructs fine-grained semantic features and dynamically integrates them with geometric embeddings, enabling the model to understand the regional functions and effectively distinguish trajectories with similar geometric shapes but different travel purposes. This allows the trajectory representation to simultaneously possess geometric structure and regional functional connotations, improving the effectiveness of similarity calculation semantics in tasks such as functional area retrieval, travel intention similarity assessment and result interpretation.
[0058] This invention is based on the structured road sequence obtained by matching OSM road network and map. It uses the transition probability and co-occurrence probability statistically obtained from real trajectory as learnable priors to guide the graph attention network to learn road representation. This enables the model to encode not only static topology, but also the driver's high-frequency turning preference at intersections and the stable co-occurrence pattern of continuous road segments, thereby enhancing the robustness, generalization and interpretability of road semantic representation, and showing stronger robustness to noise trajectory and temporary detours.
[0059] This invention constructs a decentralized dynamic graph structure with GPS, Grid, and Road as nodes. Based on fine-grained indicators such as spatial coverage, functional consistency, and matching accuracy, it calculates and adjusts the fusion weights between modalities in real time. Through a graph attention network, it performs peer-to-peer iterative information propagation, achieving adaptive, robust alignment, and collaborative enhancement of trimodal semantics. Compared with fixed weights or fusion strategies centered on a single modality, this mechanism can adaptively adjust the contribution of each modality according to the scene and data quality, achieving deep semantic alignment and collaborative enhancement without the need for a preset central modality. Finally, it outputs a unified, stable, and efficient trajectory-level multimodal representation. Attached Figure Description
[0060] Figure 1 This is a flowchart of a vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement proposed in this invention;
[0061] Figure 2 This is a schematic diagram of the adaptive octree mesh generation based on density constraints and geometric curvature constraints of the present invention;
[0062] Figure 3 This is a schematic diagram of the biprobability-guided graph attention mechanism of the present invention. Detailed Implementation
[0063] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0064] To address the issues of "semantic coordinate system" misalignment between continuous trajectory signals (GPS / grid) and road topological semantics and POI functional semantics, representation instability caused by fixed-resolution grids and discretization quantization errors, similarity ranking shifts due to reliance solely on ensemble distance supervision, and fusion bias and training instability resulting from fixed weights / centralized alignment in multimodal fusion, this embodiment provides a vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement, specifically including the following steps:
[0065] S1. Trajectory Data Preprocessing and Multimodal Feature Extraction: Obtaining the Original Vehicle Trajectory Point Sequence The original vehicle trajectory points are cleaned, the spatiotemporal features of the GPS point sequence are extracted, a road network topology map is constructed based on OpenStreetMap, and the GPS point sequence is mapped into a structured road sequence through a map matching algorithm;
[0066] S101. Clean the original vehicle trajectory point sequence For trajectories with fewer than 20 and more than 200 trajectory points, extract the GPS modal features of the vehicle trajectory.
[0067] S102. Extracting the road network topology map from OpenStreetMap data , where the node set The set of edges represents the intersections and endpoints of roads. This represents a directed path segment connecting nodes, with each segment including a static attribute vector. =[length, road_type, lanes, max_speed], representing the road segment length, road type, number of lanes, and speed limit, respectively. A learnable mapping (MLP / Embedding) is used to encode the static attributes into... A 3D vector, expressed as:
[0068] ;
[0069] Stack all the initial vectors of the road segments into a matrix (or look up a table), the expression is:
[0070] ;
[0071] in, This represents the initial road feature vector of all road segments in the road network. The resulting set or matrix of road features is used to index road features based on road segment identifiers obtained through map matching. Subsequent trajectories can then be retrieved from the matched road segment ID sequence. Quickly extract the corresponding road feature sequence;
[0072] S103, The original vehicle trajectory point sequence Projected onto the road network topology map, map matching is performed using a Hidden Markov Model, expressed as:
[0073] ;
[0074] in, Indicates candidate road segments, The probability of a road segment transition during the Hidden Markov Model (HMM) phase is determined by the topological connectivity and directional consistency between road segments. The probability of transmission is determined by the distance between the GPS point and the candidate road segment;
[0075] For the matched road sequence, extract the feature representation corresponding to each road segment:
[0076] ;
[0077] in, This represents a multilayer perceptron. This represents the road feature dimension and outputs the trajectory road sequence after map matching. The expression is:
[0078] ;
[0079] in, This indicates the number of matched road segments, which serves as the input to the subsequent road topology representation learning module.
[0080] S2. Curvature-Density Constraint Adaptive Mesh Generation and Representation: Based on the density and geometric curvature constraints of vehicle trajectory points within each candidate mesh cell, the mesh resolution is dynamically adjusted using a 3D spatiotemporal octree structure. The leaf mesh nodes and multi-level mesh codes of each trajectory point falling into the mesh are extracted. A multi-scale gating fusion mechanism is used to generate a geometric mesh representation sequence of vehicle trajectory points that combines global generalization with local displacement details. Specifically, this includes:
[0081] S201. Map the vehicle trajectory points to a normalized three-dimensional spatiotemporal coordinate system to construct a continuous and uniform sequence of standardized trajectory points. ,in Indicates the first Normalized spatiotemporal coordinates of a moment;
[0082] S202, Standardize the trajectory point sequence Mapped to a unit three-dimensional spacetime cube In the middle, initialize the root node of the octree, and the root node covers the entire space region. And associate all trajectory points with the root node;
[0083] Define any grid node to be processed. The set of cross-track points included:
[0084] ;
[0085] in, Represents the set of all trajectory points. Indicates falling into a grid cell The set of trajectory points within the trajectory (this set may contain trajectory points from different trajectories);
[0086] Calculate the density constraint and geometric curvature constraint separately:
[0087] Density constraint The access intensity across trajectory statistical grid cells is calculated by directly counting the total number of trajectory points contained within a node, expressed as:
[0088] ;
[0089] Geometric curvature constraints are derived because curvature depends on the temporal order of the same trajectory. This is achieved by extracting and arranging the ordered sequence of points within a single trajectory within a grid cell, calculating the local curvature of the trajectory within a node, and then aggregating the curvatures of multiple trajectories within a node across trajectories. The expression for this is:
[0090] ;
[0091] By time Sort in ascending order, if Define a unit direction vector for its adjacent points:
[0092] ;
[0093] And calculate the local curvature index of the trajectory within the node, expressed as:
[0094] ;
[0095] in, The dot product represents the property that when the trajectory is approximately a straight line within a node, adjacent direction vectors are approximately parallel, and the dot product is close to 1. Approaching 0; when the trajectory has sharp turns or severe vibrations. Increase;
[0096] When a node contains multiple trajectories, cross-trajector aggregation of the curvature within the trajectories is performed to obtain the node curvature constraint:
[0097] ;
[0098] in, It can be the mean, weighted mean (by...) (Weighted) or maximum value;
[0099] Set density threshold (In this embodiment, the value is set to 10), curvature threshold (This embodiment is set to) and maximum tree depth (In this embodiment, it is set to 7), for the current node Perform the following division determination:
[0100] ;
[0101] As long as the trajectory points within the current grid are too dense ( > Or the trajectory shape is too complex ( > If the minimum grid precision limit is not met, further subdivision is necessary.
[0102] like If true, then the node will be... The spatial extent is divided in half along the x, y, and t dimensions, generating 8 child nodes of equal size. The trajectory points are reassigned to their corresponding child nodes; the above steps are repeated for all newly generated child nodes until all nodes are marked as leaf nodes, and the partitioning result is as follows. Figure 2 As shown;
[0103] This results in a non-uniform grid structure that is "well-spaced and dynamic." Larger grids are retained on straight highway sections (low curvature, moderate density) to maintain the macro topology; while the grid is automatically refined at intersections, overpasses (high curvature), or congested areas (high density) to capture micro-behavior.
[0104] S203. Calculate vehicle trajectory points through multi-level coding and micro-displacement. The leaf grid nodes and their parent nodes are identified, and the vehicle trajectory points are calculated. The relative positional deviation within the leaf network;
[0105] Multi-level discrete grid coding is represented as a quadruple:
[0106] ;
[0107] in, Indicates the leaf node level. This represents a globally unique index for a leaf node. Represents the globally unique index of the parent node; relative position deviation within the grid. The difference between the coordinates of the trajectory point and the center coordinates of the leaf node is expressed as:
[0108] ;
[0109] S204. By using a multi-scale gating fusion mechanism, the leaf grid node features, parent node features, and micro displacement features are linearly fused to generate a geometric grid representation sequence of vehicle trajectory points.
[0110] Map leaf node indices to parent node indices as embedding vectors and and relative position deviation The displacement feature vector is mapped through a multilayer perceptron. Then calculate the adaptive gating coefficient. The adaptive gating coefficient, used to measure the weighting of microscopic details and macroscopic structure, is expressed as follows:
[0111] ;
[0112] in, This represents the Sigmoid activation function. This represents a vector concatenation operation. , All of these represent learnable gating parameters;
[0113] The fused geometric mesh representation sequence is calculated based on adaptive gating coefficients. The expression is:
[0114] ;
[0115] in, Indicates element-wise multiplication, representing a sequence. As input to subsequent models.
[0116] Step S2 breaks through the traditional grid partitioning that relies solely on spatial density, and constructs a recursive partitioning mechanism with dual constraints of "curvature-density". This enables "on-demand fine-grained" perception of complex trajectory geometry (such as sharp turns and U-turns). To address the quantization error problem caused by grid discretization, it innovatively introduces relative position deviation encoding within the grid, achieving accuracy compensation from discrete units to continuous values. Combined with a multi-scale gating aggregation strategy, the model can intelligently adjust the feature weights of local micro-details and macro-spatial topology, thereby significantly compressing the data scale while constructing a trajectory representation base that combines global structural robustness with high-fidelity local geometry.
[0117] S3. Obtain POI data of different categories within each grid cell and calculate the distribution density and functional weight of POI data. Construct the semantic feature vector of the grid cell and dynamically fuse the semantic feature vector with the features of corresponding points in the grid representation sequence to generate a semantically enhanced grid representation sequence.
[0118] S301, Based on each grid cell The distribution density of K types of POI data within a spatial range is expressed as follows:
[0119] ;
[0120] in, Indicates the first POI-like data in grid cells The number inside, Represents the area of a grid cell;
[0121] The distribution density is correlated with the corresponding preset POI data function weights. The elements are fused to form a semantic feature vector, expressed as:
[0122] ;
[0123] in, Represents grid cells semantic feature vectors, Indicates the first Functional weights of POI-like data Represents the grid cell number Distribution density of POI-like data;
[0124] S302, Obtain each trajectory point POI semantic feature vector of the leaf node and the semantic feature vector of the parent node's POI The semantic fusion weights are calculated using a bilinear attention mechanism. This mechanism performs an outer product operation on the semantic feature vectors of the leaf node and parent node of the trajectory point, and then calculates the fusion weights using a learnable weight matrix and activation function. The weighted fusion of the two semantic vectors is then added to the geometric mesh representation sequence. The expression is as follows:
[0125] ;
[0126] in, This indicates the outer product operation. This represents the Sigmoid activation function;
[0127] S303. Combine the POI semantic feature vector of the leaf node where the trajectory point is located with the POI semantic feature vector of the parent node and the geometric semantic feature vector. Multimodal fusion is performed using the following expression:
[0128] ;
[0129] The semantically enhanced representations of all trajectory points are combined to generate a semantically enhanced mesh representation sequence:
[0130] ;
[0131] This sequence includes both multi-scale set structure features and regional functional semantic information, providing a rich semantic foundation for subsequent multimodal alignment.
[0132] Step S3 proposes a statistically enhanced grid semantic injection method. By introducing POI distribution density and functional weight, the semantic feature vector of the grid cell is constructed and dynamically fused with the grid geometric embedding. This breaks through the limitation of traditional grid partitioning relying solely on spatial topology and realizes a semantic upgrade from "geometric partitioning" to "functional understanding". This enhances the regional semantic perception capability of trajectory representation and provides a grid representation with both geometric structure and semantic connotation for trajectory similarity calculation.
[0133] S4. A dual-probability-guided graph attention mechanism is adopted. The transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window are statistically analyzed from the structured road sequence to model the single-step transition frequency between adjacent road segments and the path co-occurrence relationship within the local sliding window. The transition probability and co-occurrence probability are used as learnable prior knowledge, so that the model can transmit information based on topological connectivity and statistically obtained traffic patterns when aggregating neighborhood information. The final trajectory road topological semantic representation, which integrates static road attributes, topological connectivity and dynamic traffic patterns, is output through a multi-layer multi-head attention mechanism.
[0134] S401. Obtain the initial feature vector corresponding to the structured road sequence by searching, that is, the road sequence of trajectory matching. ,in Indicates time The matched road segment identifier is used to retrieve the initial feature vector of the corresponding road segment from the initial feature matrix of the entire road network, and the initial feature matrix of the road sequence of the current trajectory is constructed as follows:
[0135] ;
[0136] From the historical road trajectory data obtained from map-matching, the transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window are statistically analyzed for the road network map. any adjacent road segment and Based on trajectory dataset The statistical transition probability is expressed as:
[0137] ;
[0138] in, Represents any adjacent road segment in the road network topology map and The transition probability, Indicates road segment Directly transferred to Number of times, Indicates the route passed through Total number of times;
[0139] For the local path co-occurrence probability, given a window size s (set to 3 in this embodiment), the co-occurrence relationship within the trajectory sliding window is statistically expressed as follows:
[0140] ;
[0141] in, Indicates any adjacent road segment and Co-occurrence probability within the sliding time window This represents road segments within a given window size s. and The number of times they appear together;
[0142] S402, Calculate adjacent road segments and The attention coefficients are normalized using Softmax to obtain the attention weights.
[0143] For the Layered graph attention network, road segment The input is represented as Its adjacent road segments are The expression for the attention coefficient is:
[0144] ;
[0145] in, , For learnable parameters, This indicates the input feature dimension (64 in this example). This indicates the dimension of the hidden layer (128 in this embodiment).
[0146] The attention weights are obtained through Softmax normalization, expressed as follows:
[0147] ;
[0148] S403. Using K attention heads for parallel computation, the output of the kth attention head is:
[0149] ;
[0150] in, Represents the activation function of the exponential linear unit. This represents the parameter matrix of the k-th attention head;
[0151] After concatenating all attention head outputs and performing a linear transformation, the first result is obtained. The road representation of a layer is expressed as:
[0152] ;
[0153] After repeating L times, the final trajectory road topological semantic representation is obtained, expressed as:
[0154] ;
[0155] The final road topological semantic representation integrates road static attributes, topological connectivity, and real-world travel pattern semantics. A biprobabilistic guided graph attention mechanism is used, such as... Figure 3As shown.
[0156] Step S4 proposes a dual-probability-guided graph attention mechanism, which breaks through the limitation of traditional road representation methods that rely solely on static topological structures. By statistically analyzing transition probabilities and co-occurrence probabilities from real trajectory data, the model can simultaneously model drivers' high-frequency turning preferences at intersections (micro-decision) and stable co-occurrence patterns between consecutive road segments (macro-path). This design upgrades road representation learning from simple "structural encoding" to "behavioral semantic understanding," which not only significantly enhances the model's ability to characterize actual traffic patterns but also effectively filters out interference from noisy trajectories such as temporary detours through probabilistic priors. This results in outputting more generalizable, robust, and interpretable road semantic features, providing a solid semantic foundation for subsequent cross-modal trajectory analysis.
[0157] S5. Construct a multimodal semantic alignment mechanism for dynamic graph interaction, and generate a unified trajectory multimodal representation through global aggregation nodes;
[0158] S501. The GPS point sequence described in step S1, the enhanced grid representation sequence of semantics in step S3, and the final road topology semantic representation in step S4 are used to calculate the cross-modal association weights between the three modalities: GPS modal features (GPS), grid modal features (Grid), and road modal features (Road).
[0159] Road modal features are the set of semantic vectors of each road segment (or node) in the road network map. For any trajectory, the road sequence obtained by map matching ,from Extract the semantic vector sequence of the road segment corresponding to the trajectory by index. Trajectory-level representations of road network modes are obtained through the sequence readout module. The sequence reading module is implemented using average pooling or attention pooling. The average pooling expression is as follows:
[0160] ;
[0161] Attention pooling is:
[0162] ;
[0163] ;
[0164] in, Indicates attention weights. This represents a learnable scoring function;
[0165] Similarly, the GPS modal features and grid modal features are respectively aggregated through the sequence readout module to obtain the GPS modal trajectory-level representation. Grid Modal Trajectory Level Representation ,by , , As dynamic Figure 3 The initial features of each modality are used to calculate the cross-modal association weights, which guide the construction of dynamic edge weights between modalities, including: GPS-grid edge weights, grid-road edge weights, and road-GPS edge weights.
[0166] GPS-grid edge weights Through spatial coverage and time synchronization The weighted combination of the two sub-indices yields:
[0167] Spatial coverage represents the spatial concentration of GPS points within a grid. To assess the distribution concentration and integrity of GPS points within their assigned grid cells, first, the area of the two-dimensional convex hull of the trajectory point sequence is calculated. Then, the ratio of this area to the area of the grid cell is calculated, and weighted by considering the proportion of actual trajectory points within the grid. The expression is as follows:
[0168] ;
[0169] in, This indicates the indicator function, when the GPS point Located in the grid Internal time The value is 1 if it is 1, otherwise it is 0. This represents the area calculation function. This indicates the number of GPS points in the current window. The closer it is to 1, the more compact the distribution of GPS points within the grid and the more complete the coverage.
[0170] Time synchronization represents the synchronization between the access time pattern and the grid's historical time pattern. It quantifies the similarity between the timestamp distribution pattern of GPS points and the historical access time pattern of grid cells. The day is divided into several discrete time periods, and the distribution probability of the current GPS point in each time period is statistically analyzed. And the probability of the grid being accessed in each time period, learned from historical data. The Jensen-Shannon divergence (JSD) is used to measure the difference between two distributions and is converted into a similarity score, expressed as:
[0171] ;
[0172] JSD is a symmetric, bounded divergence measure that is more robust than Kullback-Leibler divergence. A higher JSD score indicates that the current trajectory's temporal pattern of visiting the grid is more consistent with historical norms.
[0173] The final dynamic weight of the GPS-grid edge is determined by spatial coverage. and time synchronization The two sub-indices are obtained by weighting them with learnable weights and then normalizing them using the Sigmoid function. The expression is as follows:
[0174] ;
[0175] in, This represents the Sigmoid chance function. , This represents learnable weight parameters that are optimized through training and are typically constrained to be... ;
[0176] Grid-roadside weights Spatial alignment Functional consistency and topological constraint strength The three sub-indicators are weighted and combined to obtain:
[0177] Spatial alignment represents the proportion of a road segment's geometric coverage length within a grid. It is calculated as the ratio of a road segment's geometric coverage length within the grid cells it traverses to the total length of the road. The expression is:
[0178] ;
[0179] Spatial alignment It reflects the degree of overlap between the road and the grid in geometric space;
[0180] Functional consistency refers to the functional consistency between the semantics of grid POIs and road attributes. It evaluates the degree of matching between the semantic functions of grid cells (derived from the POI distribution) and road attributes (such as road grade and speed limit), and converts the POI semantic vectors of the grid into a single vector. road attribute vector The cosine similarity is calculated using the following expression:
[0181] ;
[0182] Topological constraint strength represents the density of a grid being penetrated or connected by a road network. It measures the density of the current grid cell being penetrated or connected by a road network, calculates the number of all road segments that intersect with the grid cell, and divides it by the total number of road segments within a certain buffer zone around the grid (for normalization).
[0183] The final dynamic weight expression for the grid-road transition is:
[0184] ;
[0185] in, , , Represents the learnable weight parameters;
[0186] Road-GPS Side Weights The result is obtained by weighted synthesis of three sub-indicators: matching accuracy, motion rationality, and topological constraint satisfaction.
[0187] Matching accuracy This represents the projection accuracy of map matching. After projecting the GPS point sequence onto the road network using a map matching algorithm, the average Euclidean distance error between the projected points and the original GPS points is calculated. And convert it into a precision score.
[0188] ;
[0189] in, Indicates the scale parameter;
[0190] The rationality of movement includes the rationality of speed. and direction consistency Speed rationality indicates the rationality of GPS instantaneous speed and road segment speed limit. It counts the proportion of GPS point instantaneous speeds that exceed the current matching road segment speed limit. Directional consistency indicates the consistency of motion direction. It calculates the average cosine similarity between the GPS point motion direction vector and the matching road segment direction vector.
[0191] Topological constraint satisfaction It represents the topological connectivity of the matched path, checks whether the path matched on the map constitutes a connected path in the road network, and calculates the proportion of connected road segments to the total number of matched road segments.
[0192] The final dynamic weight expression for the road-GPS edge is:
[0193] ;
[0194] in, , , , Represents the learnable weight parameters;
[0195] S502. Construct a fully connected dynamic graph with three modalities as nodes and association weights as edges. A set of nodes, a trajectory-level representation vector of the modality corresponding to the node features, and a set of edges. Edge weight matrix ,in This represents the dynamic weights calculated earlier;
[0196] S503. Input the previously constructed dynamic graph into a K-layer graph attention network (GAT). Iterative cross-modal information propagation and feature alignment are performed through the multi-layer graph attention network to aggregate and generate a unified trajectory multimodal representation.
[0197] The initial characteristics of a three-modal node are defined as follows:
[0198] ;
[0199] For each layer, the node Update features The expression is:
[0200] ;
[0201] in, Represents a node The set of neighbors (including itself). Represents the learnable weight matrix. This represents the attention coefficient for fusing dynamic edge weights;
[0202] ;
[0203] ;
[0204] in, This represents a learnable attention vector. This represents a vector concatenation operation. This represents the corresponding dynamic edge weight. =1;
[0205] After K-layer graph attention propagation, the features of each modality node are updated as follows: Global average pooling is performed on the final features of the three modal nodes, and a unified multimodal aligned representation of the trajectory is generated through a linear projection layer. The expression is:
[0206] ;
[0207] in, , This represents the learnable parameters, which serve as input for subsequent similarity calculations.
[0208] Step S5 creatively constructs a decentralized dynamic graph interaction architecture. By calculating fine-grained association weights between multimodalities in real time (such as spatial coverage, functional consistency, motion rationality, etc.) and using a multi-layer graph attention network for peer-to-peer and iterative information propagation, it achieves adaptive alignment and collaborative enhancement of trimodal semantics. This breaks through the limitations of traditional fixed-weight fusion or star-shaped alignment, enabling the model to dynamically form the optimal interaction topology based on the spatiotemporal characteristics of the trajectory and data quality. This allows for more flexible, robust, and generalizable cross-modal trajectory representation learning under different scenarios and data conditions.
[0209] S6. Construct a joint loss function that includes local structure alignment loss, global contrastive learning loss and modality fusion gating regularization loss, and perform supervised training and optimization on the unified trajectory multimodal representation generated in step S5;
[0210] Calculate local structural alignment loss This loss aims to keep the trajectory similarity in the embedding space consistent with the local geometry based on traditional metrics; for a batch containing N trajectories, for any two trajectories and Calculate distances based on classical metrics such as SSPD, Hausdorff, or discrete Fréchet. It is converted into target similarity through exponential decay, and the expression is:
[0211] ;
[0212] in, The temperature coefficient is used to adjust the sensitivity of similarity and, within the embedding space, to calculate a unified representation of the two trajectories. and The cosine similarity between them is used as the predicted similarity, and the expression is:
[0213] ;
[0214] To avoid global The comparison calculation emphasizes the local structure for each trajectory. According to the target distance Select its K-nearest neighbors (K-NN) to form a local neighborhood. The local structural alignment loss is defined as the mean square error between the predicted similarity and the target similarity in the local neighborhood:
[0215] ;
[0216] in, This represents the set of trajectory indices in the current training batch;
[0217] Calculate the global contrastive learning loss This loss is designed to enhance the discriminative power of the representation across the global batch, bringing positive samples that are similar to the target trajectory closer together and pushing away dissimilar negative samples.
[0218] Positive and negative sample construction: for anchor point trajectories Its positive sample set Directly defined as local structural alignment loss The selected K-nearest neighbors (K-NN) form the local neighborhood. The remaining trajectories within the batch constitute the negative sample set. ;
[0219] The loss function, in the form of InfoNCE (Noise-Contrastive Estimation), is expressed as follows:
[0220] ;
[0221] in, Indicates the predicted cosine similarity. The temperature parameter represents the contrastive learning parameter, which is used to adjust the degree of attention given to difficult negative samples;
[0222] Calculate the modal gating regularization loss This loss is designed to constrain the multimodal fusion weights in dynamic graph interactions, improve the interpretability and generalization ability of the model, and avoid over-reliance on a single modality.
[0223] From the dynamic graph interaction module in step 5, extract the dynamic fusion weight vector for each trajectory used to fuse the three modalities of GPS, grid, and road when calculating the final unified representation. And satisfy ;
[0224] To encourage sparsity in the fusion weights (i.e., clearer multimodal decision-making) and prevent overfitting, a gating weight is applied. Sparse regularization and entropy regularization are expressed as follows:
[0225] ;
[0226] in, The first term represents the norm (sparse constraint), and the second term represents negative entropy (encouraging a more concentrated weight distribution). and This is the regularization intensity coefficient;
[0227] The local structure alignment loss, global contrastive learning loss, and modality fusion gating regularization loss are weighted and summed to form the final joint loss function, which is expressed as follows:
[0228] ;
[0229] in, Denotes the joint loss function. This represents the local structural alignment loss. This represents the global contrastive learning loss. This represents the modal gating regularization loss. , The hyperparameter representing the balancing contribution of the three loss factors;
[0230] Minimize the joint loss function using backpropagation. Simultaneously optimize all learnable parameters of the trajectory representation network and the dynamic fusion gating network.
[0231] Step S6 constructs a joint loss function with multi-granularity collaborative supervision. By organically combining local geometric alignment loss, global contrastive learning loss, and modal gating regularization loss, it achieves multi-level optimization from microstructure preservation to macro discriminative enhancement. It not only uses traditional trajectory metrics to guide the local geometric structure of the embedding space, but also improves the global discriminative ability of the representation through cross-batch contrastive learning. At the same time, it introduces a gating regularization term to optimize the multimodal fusion weights, thereby significantly improving the accuracy, robustness, and interpretability of trajectory similarity calculation while ensuring multimodal semantic consistency.
[0232] S7. Use the optimized model to extract the unified multimodal representation of the two trajectories to be compared and calculate the similarity. The similarity is used as the final similarity score of the two trajectories.
[0233] For the two trajectories to be compared and From the model trained in step 6, extract its unified multimodal representation optimized by the joint loss function, denoted as... ;
[0234] Calculate the representation vector and The cosine similarity between the two trajectories, expressed as a similarity measure in the semantic embedding space, is as follows:
[0235] ;
[0236] in, , This represents two trajectories to be compared. , Representing trajectories , The representation vector, Represents the dot product. Representing vectors Norm, similarity The range of values is The larger the value, the higher the semantic similarity of the trajectories;
[0237] To map similarity scores to a more intuitive (0, 1) interval, or to align them with the target scale during training, an adjustable temperature parameter is introduced. The scaling and offset of trajectory similarity are expressed as follows:
[0238] ;
[0239] in, Indicates temperature parameter, This step controls the sharpness of the score distribution; if omitted, the score is output directly. As the final score.
[0240] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement, characterized in that, Includes the following steps: S1. The original vehicle trajectory point sequence Preprocessing is performed to extract the spatiotemporal features of the GPS point sequence, a road network topology map is constructed based on OpenStreetMap, and the GPS point sequence is mapped into a structured road sequence through a map matching algorithm; S2. Based on the density constraints and geometric curvature constraints of vehicle trajectory points in each candidate grid cell, the grid resolution is dynamically adjusted through a three-dimensional spatiotemporal octree structure. The multi-level grid codes of the leaf grid nodes and parent nodes of each vehicle trajectory point are extracted. The geometric grid representation sequence of vehicle trajectory points is generated through a multi-scale gating fusion mechanism. S3. Obtain POI data of different categories within each grid cell and calculate the distribution density and functional weight of POI data. Construct the semantic feature vector of the grid cell and dynamically fuse the semantic feature vector with the features of corresponding points in the grid representation sequence to generate a semantically enhanced grid representation sequence. S4. A dual-probability-guided graph attention mechanism is adopted to statistically analyze the transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window from the structured road sequence as learnable prior knowledge. The final road topological semantic representation, which integrates static road attributes, topological connections and dynamic traffic patterns, is output through a multi-layer multi-head attention mechanism. S5. Construct a multimodal semantic alignment mechanism for dynamic graph interaction, and generate a unified trajectory multimodal representation through global aggregation nodes; S501. The GPS point sequence from step S1, the enhanced grid representation sequence of semantics from step S3, and the final road topology semantic representation from step S4 are used to calculate the cross-modal association weights between the three modalities: GPS modal features, grid modal features, and road modal features. The GPS modal trajectory-level representation, grid modal trajectory-level representation, and road modal trajectory-level representation are then aggregated through the sequence readout module and used as the initial features of the three modalities of the dynamic graph. Dynamic edge weights between modalities are constructed based on the cross-modal association weights. The sequence readout module employs average pooling and attention pooling. S502. Construct a fully connected dynamic graph with three modalities as nodes and associated weights as edges. Use a multi-layer graph attention network to perform iterative cross-modal information propagation and feature alignment, and aggregate to generate a unified trajectory multimodal representation. S6. Construct a joint loss function that includes local structure alignment loss, global contrastive learning loss and modality fusion gating regularization loss, and perform supervised training and optimization on the unified trajectory multimodal representation generated in step S5; S7. Using the optimized model, extract the unified multimodal representation of the two trajectories to be compared and calculate the similarity. The similarity is output as the final similarity score of the two trajectories.
2. The vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The preprocessing and map matching specifically include the following steps: S101. Clean the original vehicle trajectory point sequence For trajectories with fewer than 20 and more than 200 trajectory points, extract the GPS modal features of the vehicle trajectory. S102. Extracting the road network topology map from OpenStreetMap data , where the node set The set of edges represents the intersections and endpoints of roads. This represents a directed road segment connecting nodes. Each road segment's initial vector includes the road segment length, road type, number of lanes, and speed limit. All road segment initial vectors are stacked into a matrix. S103, The original vehicle trajectory point sequence Projected onto the road network topology map, a hidden Markov model is used for map matching. The state transition probability is determined by the topological connectivity and directional consistency between road segments, and the transmission probability is determined by the distance between the GPS point and the candidate road segment.
3. The vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The process of generating the final mesh representation sequence of vehicle trajectory points includes the following steps: S201. Map vehicle trajectory points to a normalized three-dimensional spatiotemporal coordinate system to construct a standardized trajectory point sequence. ; S202, Calculate the density constraint and geometric curvature constraint, and then apply the standardized trajectory point sequence... Mapped to a three-dimensional spacetime cube; The density constraint is obtained by counting the total number of trajectory points within a node; The ordered point sequence of a single trajectory within a grid cell is extracted and arranged, and the local curvature of the trajectory within the node is calculated. Then, the curvature of multiple trajectories within the node is aggregated across trajectories to obtain the geometric curvature constraint of the node. Grids with density constraints or geometric curvature constraints exceeding a preset threshold are divided into 8 three-dimensional small grids using an octree. S203. Calculate vehicle trajectory points through multi-level coding and micro-displacement. The leaf grid nodes and their parent nodes are identified, and the vehicle trajectory points are calculated. The relative positional deviation within the leaf network; S204. By using a multi-scale gating fusion mechanism, the leaf grid node features, parent node features, and micro displacement features are linearly fused to generate a geometric grid representation sequence of vehicle trajectory points.
4. The vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The generation of semantically enhanced mesh representation sequences specifically includes: S301, Based on each grid cell The distribution density of K types of POI data within the spatial range is statistically analyzed, and the distribution density is fused with the corresponding preset POI data functional weights to form a semantic feature vector. S302, Obtain each trajectory point POI semantic feature vector of the leaf node and the semantic feature vector of the parent node's POI Semantic fusion weights are calculated using a bilinear attention mechanism; The bilinear attention mechanism performs an outer product operation on the POI semantic feature vectors of the leaf node and the parent node where the trajectory point is located, and then calculates the fusion weight through a learnable weight matrix and activation function. The weighted fusion of the two semantic vectors is then added to the geometric grid representation sequence. S303. Multimodal fusion of the POI semantic feature vector of the leaf node where the trajectory point is located and the POI semantic feature vector of the parent node with the geometric semantic features, and combination of the semantic enhancement representations of all trajectory points to generate a semantic enhancement grid representation sequence.
5. The method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The road topology semantic representation for learning and generating the final trajectory is achieved using a dual-probability-guided graph attention mechanism. Specifically, this includes: S401. Obtain the initial feature vector corresponding to the structured road sequence by searching, construct the initial feature matrix of the road sequence of the current trajectory, and statistically analyze the transition probability between adjacent road segments and the co-occurrence probability of road segments within the sliding time window from historical road trajectory data. S402. Calculate the attention coefficients between adjacent road segments, obtain the attention weights through Softmax normalization, use K attention heads to calculate in parallel, concatenate all attention head outputs and perform linear transformation, repeat L times to obtain the final trajectory road topology semantic representation.
6. The method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The cross-modal correlation weights among the three modes—GPS modal features, grid modal features, and road modal features—include the following indices: GPS-grid edge weight, grid-road edge weight, and road-GPS edge weight. The GPS-grid edge weights are obtained by weighting two sub-indicators: spatial coverage and temporal synchronization. Spatial coverage represents the concentration of GPS points within the grid, and temporal synchronization represents the synchronization between the access time pattern and the grid's historical time pattern. The grid-road edge weight is obtained by weighted synthesis of three sub-indicators: spatial alignment, functional consistency, and topological constraint strength. The spatial alignment represents the proportion of geometric coverage length of road segments within the grid, the functional consistency represents the functional consistency between the grid POI semantics and the road attributes, and the topological constraint strength represents the density of the grid being penetrated or connected by the road network. The road-GPS edge weights are obtained by weighted synthesis of three sub-indicators: matching accuracy, motion rationality, and topological constraint satisfaction. The matching accuracy represents the projection accuracy of map matching. The motion rationality includes speed rationality and direction consistency. The speed rationality represents the rationality of GPS instantaneous speed and road segment speed limit. The direction consistency represents the consistency of motion direction. The topological constraint satisfaction represents the topological connectivity of the matching path.
7. The method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement according to claim 6, characterized in that, The attention coefficients of the multi-layer graph attention network are determined by the node feature similarity and the dynamic edge weights.
8. The vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The joint loss function is expressed as follows: in, Denotes the joint loss function. This represents the local structural alignment loss. This represents the global contrastive learning loss. This represents the modal gating regularization loss. , Hyperparameters representing the balance between the contributions of the three loss factors; Minimize the joint loss function using backpropagation. Simultaneously optimize all learnable parameters of the trajectory representation network and the dynamic fusion gating network.
9. The method for calculating vehicle trajectory similarity based on dynamic graph alignment and POI enhancement according to claim 1, characterized in that, The similarity between two trajectories to be compared is calculated using cosine similarity, expressed as: in, , This represents two trajectories to be compared. , Representing trajectories , The representation vector, Represents the dot product. Representing vectors Norm, similarity The range of values is The larger the value, the higher the semantic similarity of the trajectories.
10. The vehicle trajectory similarity calculation method based on dynamic graph alignment and POI enhancement according to claim 9, characterized in that, Introduce an adjustable temperature parameter The scaling and offset of trajectory similarity are expressed as follows: in, Indicates temperature parameter, Used to control the sharpness of the score distribution.
Citation Information
Patent Citations
Robot alarm processing method and system based on target detection algorithm and cloud platform
CN119418174A
Variable header and object payload
US20220282994A1