A Destination Prediction Method and System Based on a Hierarchical Spatiotemporal Embedded Transformer Model

By using a hierarchical spatiotemporal embedding transformer model, combined with grid partitioning, spatiotemporal coding, and feature pyramid transformer, the problems of data sparsity and insufficient multi-scale feature extraction in neural network destination prediction are solved, and efficient destination prediction is achieved.

CN119646321BActive Publication Date: 2025-10-31YIYANG XINDA TIANMA ELECTRICAL EQUIP MFG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411470181.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-10-31
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

Existing neural network-based destination prediction methods face problems such as data sparsity, lack of temporal information, and insufficient multi-scale feature extraction, which affect the effective identification and analysis of trajectory features.

Method used

A hierarchical spatiotemporal embedding transformer model is adopted. Through coarse-grained and fine-grained grid partitioning, spatiotemporal coding, convolutional neural network, feature pyramid transformer and Transformer encoder, the spatiotemporal information of trajectory data is extracted to predict the probability distribution of candidate destinations.

Benefits of technology

It effectively captures complex spatiotemporal patterns in trajectory data, improves the accuracy and efficiency of destination prediction, solves the problems of data sparsity and insufficient multi-scale feature extraction, and realizes personalized travel destination prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646321B_ABST
    Figure CN119646321B_ABST
Patent Text Reader

Abstract

This invention discloses a destination prediction method and system based on a hierarchical spatiotemporal embedding transformer model. The invention includes: dividing a portion of the trajectory into a coarse-grained grid and spatiotemporally encoding it to obtain a coarse-grained spatiotemporal trajectory image representing the approximate direction of the trajectory; using a CNN to predict and extract the destination grid region; extracting GPS trajectory points; dividing the destination grid region into a fine-grained grid and spatiotemporally encoding it to obtain a refined destination region trajectory image; using a Feature Pyramid Transformer (FPT) to extract the motion features of the GPS trajectory points in the destination region; and using a fully connected network and a Softmax classifier to predict the probability of candidate destinations and determine the output candidate destination. This invention aims to extract spatiotemporal information from trajectory data to predict destinations, addressing the problems of data sparsity, missing temporal information, and insufficient multi-scale feature extraction faced by existing methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of location service computing and intelligent transportation technology, specifically to a destination prediction method and system based on a hierarchical spatiotemporal embedded transformer model. Background Technology

[0002] Vehicles equipped with in-vehicle mobile positioning devices generate massive amounts of GPS trajectory data covering residents' travel patterns. Mining this vehicle trajectory data to predict destinations can significantly expand location-based services. The implementation of these services not only enhances residents' travel experience but also provides valuable data support for traffic management, urban planning, and business activities.

[0003] Converting vehicle GPS trajectories into trajectory images and then using computer vision techniques such as Convolutional Neural Networks (CNNs) to extract spatial features to predict destinations is a significant method in destination prediction. This method transforms the vehicle's trajectory into an image, allowing the trajectory data to be effectively processed by deep learning models to identify the destination's location. This approach has attracted widespread attention due to its ability to intuitively reflect the spatial structure of the trajectory.

[0004] Currently, most research on destination prediction based on neural networks adopts two basic methods: time series analysis and spatial characteristic modeling. In terms of time series analysis, most methods serialize and model the trajectory points, and then use RNN-based networks to analyze their temporal context information to predict the destination. Although time series analysis can effectively analyze the changes of GPS trajectory points over time to predict the destination, especially with the addition of spatial embedding, it can further improve the prediction accuracy by mining the spatial background of GPS trajectory points, but such methods also face the problem of long-term dependence. Spatial characteristic modeling divides the experimental area into grids and maps the trajectory data to these grids to transform it into trajectory images. Then, image vision methods such as CNN are used to extract the spatial features of the trajectory images and predict the destination. However, spatial characteristic modeling faces the problems of data sparsity, lack of temporal sequence information and insufficient multi-scale feature extraction in practice. In summary, existing destination prediction methods based on neural networks face the following problems in practice: (1) Data sparsity of GPS trajectories. In the process of converting GPS trajectories into images, the experimental area must first be gridded, and then the trajectory points are mapped to the corresponding grids to finally form trajectory images. However, since the trajectory only covers a part of the area, a large area in the image is an unvisited zero-value background, resulting in data sparsity. This sparsity not only increases the computational burden and processing time, but may also obscure useful information about the trajectory, affecting the effective identification and analysis of trajectory features. (2) The problem of missing spatiotemporal information in trajectory images. The traditional method of mapping GPS trajectory to a grid to form a trajectory image marks the grid cells that the trajectory passes through as 1, and the grid cells that are not passed through as 0. This representation method can well show the direction of the trajectory, but it cannot reflect the temporal information of the trajectory points in the trajectory, such as the change of driving direction, thus limiting the ability to deeply analyze the dynamic behavior of the trajectory. (3) The problem of multi-scale representation of trajectory images. The standard CNN architecture is limited by the size of the receptive field of the convolutional kernel, tending to focus on and capture features at a specific scale, making it difficult to simultaneously take into account local details and global contextual information. This is particularly unfavorable for complex trajectory data, because the meaningful features of the trajectory may span multiple different spatial scales. Existing methods for extracting multi-scale features in the field of destination prediction also have the problems of fragmentation of features at different scales and the lack of independent expression of features at each scale. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a destination prediction method and system based on a hierarchical spatiotemporal embedded transformer model, which addresses the above-mentioned problems of the prior art. The present invention aims to extract spatiotemporal information from trajectory data to predict the destination and solve the problems of data sparsity, lack of temporal information and insufficient multi-scale feature extraction faced by the existing methods.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0007] A destination prediction method based on a hierarchical spatiotemporal embedded transformer model includes using a given partial trajectory and candidate destination set Destination prediction is performed using a trained hierarchical spatiotemporal embedding transformer model. This destination prediction includes: using a given partial trajectory... The corresponding region is divided into coarse-grained grids and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate trajectory direction. This coarse-grained spatiotemporal trajectory image is then used to predict the destination grid region using a convolutional neural network (CNN). GPS trajectory points in the destination region are extracted from the destination grid region, and this region is further divided into fine-grained grids and spatiotemporally encoded to obtain a refined destination region trajectory image. The refined destination region trajectory image is then used to extract the motion features of the GPS trajectory points in the destination region using a Feature Pyramid Transformer (FPT), which consists of a feature pyramid network, a feature mapping module, and a Transformer encoder. Finally, the motion features of the GPS trajectory points in the destination region are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier. Each candidate destination The probability is calculated, and the top 100 candidate destinations are returned as the prediction results.

[0008] Optionally, the given partial trajectory Coarse-grained grid division of the corresponding area refers to dividing the city into hierarchical levels. Using a given coarse-grained parameter m, the given partial trajectory The corresponding area is divided into The grid unit, wherein the fine-grained grid division of the destination grid area refers to the hierarchical division of the city. Using a given fine-grained parameter n, the given partial trajectory The corresponding area is divided into The grid cells, in which And n is greater than m.

[0009] Optionally, when obtaining a refined destination region trajectory image by performing fine-grained grid division and spatiotemporal coding on the destination grid region, the spatiotemporal coding function expression is:

[0010] ,

[0011] In the above formula, The mesh matrix obtained by fine-grained mesh generation for the destination mesh region The Middle OK The grid area of ​​the column, For the trajectory point number, Given a partial trajectory, For a given partial trajectory The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area middle.

[0012] Optionally, when predicting the destination grid region using a convolutional neural network (CNN) from a coarse-grained spatiotemporal trajectory image, the CNN prediction of the destination grid region includes: extracting spatial features from the coarse-grained spatiotemporal trajectory image through convolution and pooling operations, wherein the convolution operation uses multiple convolution kernels to identify local patterns in the image, and the pooling operation is used to reduce the spatial dimension of the feature map; the extracted spatial features are then fed into a fully connected layer for feature integration to form a higher-level abstract representation, and finally the destination grid region is predicted using a Softmax classifier.

[0013] Optionally, when obtaining a refined destination region trajectory image by performing fine-grained grid division and spatiotemporal coding on the destination grid region, the spatiotemporal coding function expression is:

[0014] ,

[0015] In the above formula, The mesh matrix obtained by fine-grained meshing of the destination mesh region. The Middle OK The grid area of ​​the column, For the trajectory point number, for The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area middle.

[0016] Optionally, the step of extracting motion features of GPS trajectory points in the destination area using the Feature Pyramid Transformer (FPT) from the refined destination area trajectory image includes: processing the refined destination area trajectory image through a Feature Pyramid Network. After multiple scaling convolutions, high-level feature maps at different levels are obtained; the highest-level high-level feature map is then... A new feature map is generated through the upsampling operation. Then from the new feature map Begin by taking any new feature map Upsampling, then combining with the next lower-level feature map The features obtained by adjusting the dimensions through 1×1 convolution are summed, and then a 3×3 convolutional layer is added to obtain the corresponding new feature map. Ultimately, feature maps at multiple scales are obtained. ~ Feature maps at multiple scales ~ Perform a flattening operation to convert it into a one-dimensional feature vector. , A multilayer perceptron is used to map these one-dimensional feature vectors to the same feature space to obtain input features composed of multiple feature vectors of the same size. The input features and position embeddings are added to obtain the input vector. The input vector is input to a Transformer encoder to extract the motion features of GPS trajectory points in the target area. The Transformer encoder includes a multi-head attention network, a normalization network, a first residual connection, and N cascaded feedforward network units. The input vector enters the multi-head attention network and the normalization network and serves as the first input of the first residual connection. The input vector also serves as the second input of the first residual connection. The output of the residual connection is input to the N cascaded feedforward network units to obtain the motion features of GPS trajectory points in the target area. The feedforward network unit includes a feedforward network, a normalization network, and a second residual connection connected in sequence. The input of the feedforward network unit passes through the feedforward network and the normalization network and serves as the first input of the second residual connection. The input of the feedforward network unit also serves as the second input of the second residual connection.

[0017] Optionally, the hierarchical spatiotemporal embedding transformer model further includes constructing a candidate destination set before performing destination prediction. Extract the endpoint location of each segment of the vehicle trajectory; use the Mean-Shift clustering algorithm to cluster the set of endpoint locations from all segments to obtain a set of candidate destinations. .

[0018] Furthermore, the present invention also provides a destination prediction system based on a hierarchical spatiotemporal embedded transformer model, comprising an interconnected microprocessor and a memory, wherein the microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model.

[0019] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program or instructions that are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model by a processor.

[0020] Furthermore, the present invention also provides a computer program product, including a computer program or instructions that are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model via a processor.

[0021] Compared with existing technologies, this invention has the following main advantages: To extract spatiotemporal information from trajectory data to predict destinations and address the problems of data sparsity, missing temporal information, and insufficient multi-scale feature extraction faced by existing methods, the hierarchical spatial embedding transformer of this invention combines hierarchical spatiotemporal image construction, spatiotemporal coding, and Feature Pyramid Transformer (FPT). This effectively captures the complex spatiotemporal patterns from trajectory data, providing strong support for predicting passengers' final destinations. In the output stage of the hierarchical spatiotemporal embedding transformer model, the neural network outputs the probability distribution of each candidate destination, thereby making the prediction of users' travel destinations more refined and personalized. Through extensive experimental verification on real datasets, the hierarchical spatiotemporal embedding transformer model of this invention demonstrates significant effectiveness in predicting passenger destinations, proving its advantages in accuracy and efficiency compared to traditional methods, while also maintaining good temporal performance. Attached Figure Description

[0022] Figure 1 In this embodiment of the invention, a certain region is divided into three city tiers. The following is a schematic diagram of the hierarchical division.

[0023] Figure 2 This is a schematic diagram of the network structure of the hierarchical spatiotemporal embedded transformer model in an embodiment of the present invention.

[0024] Figure 3 This is a schematic diagram of the network structure of the Convolutional Neural Network (CNN) used in this embodiment of the invention.

[0025] Figure 4 This is a schematic diagram of the network structure of the feature pyramid in an embodiment of the present invention.

[0026] Figure 5 This is a schematic diagram of the network structure of the Transformer encoder in an embodiment of the present invention.

[0027] Figure 6 The accuracy rates obtained in the embodiments of the present invention are for different trajectory completion levels.

[0028] Figure 7 This refers to the mean absolute error (MAE) obtained under different trajectory completion levels in the embodiments of the present invention.

[0029] Figure 8 The response time is obtained under different trajectory completion degrees in the embodiments of the present invention.

[0030] Figure 9 This represents the accuracy of the ablation experiment obtained in the embodiments of the present invention.

[0031] Figure 10 The mean absolute error (MAE) of the ablation experiments obtained in the embodiments of the present invention is given.

[0032] Figure 11 The response time of the ablation experiment obtained in the embodiments of the present invention is denoted as .

[0033] Figure 12 This represents the accuracy obtained under different mesh division parameters in the embodiments of the present invention.

[0034] Figure 13 This refers to the mean absolute error (MAE) obtained under different grid partitioning parameters in the embodiments of the present invention.

[0035] Figure 14 The response time is obtained under different grid partitioning parameters in the embodiments of the present invention.

[0036] Figure 15 This represents the accuracy of the comparative experiments obtained in the embodiments of the present invention.

[0037] Figure 16 The mean absolute error (MAE) of the comparative experiments obtained in the embodiments of the present invention is given.

[0038] Figure 17 This refers to the response time of the comparative experiment obtained in the embodiments of the present invention. Detailed Implementation

[0039] This invention, based on a hierarchical spatiotemporal embedded transformer model, aims to extract spatiotemporal information from trajectory data to predict the destination, and addresses the problems of data sparsity, missing temporal information, and insufficient multi-scale feature extraction faced by existing methods. The overall destination prediction problem for a vehicle can be viewed as predicting the probability of the vehicle reaching each candidate destination. That is, given a partial trajectory... and candidate destination set Based on the given partial trajectory Predicting vehicle destinations Each candidate destination probability Then return the probability. The highest front kThere are 10 candidate destinations. The relevant concepts are defined as follows:

[0040] Definition 1: Trajectory. T It is the taxi from the boarding position Get off at the designated drop-off point The complete journey consists of a series of GPS track points. Track T It can be represented as ,in , Indicating the first position in the trajectory i Longitude of GPS track points ,latitude .

[0041] Definition 2: Partial Trajectory. A partial trajectory is the first part of the trajectory, specifically the section from the boarding position. Start, to the location currently recorded in the rental section. The end can be represented as .in p This represents the completion rate of the trajectory, with a numerical range from 0 to 100%.

[0042] Definition 3: Candidate Destination. A candidate destination is a set of clusters obtained by cluster analysis of drop-off locations across all taxi trajectories. Each cluster represents a group of drop-off locations with similar characteristics. A candidate destination can be represented as... ,in M This represents the number of clusters.

[0043] Definition 4: Hierarchical mesh element. A hierarchical mesh element divides the experimental region into... The grid cells, in which , This method of dividing cities into hierarchical levels allows for the subdivision of regions at different levels to accommodate spatial analysis needs at different scales. Figure 1 This section shows the hierarchical division of a specific region within the top three city tiers. The following is a schematic diagram of the hierarchical division, in which (a) (b) (c) .

[0044] like Figure 2 As shown, the destination prediction method based on the hierarchical spatiotemporal embedded transformer model in this embodiment includes predicting a given partial trajectory. and candidate destination set Destination prediction is performed using a trained hierarchical spatiotemporal embedding transformer model (referred to as HST-FPT in this embodiment). The destination prediction using the hierarchical spatiotemporal embedding transformer model includes: processing a given partial trajectory... The corresponding region is divided into coarse-grained grids and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate trajectory direction. This coarse-grained spatiotemporal trajectory image is then used to predict the destination grid region using a convolutional neural network (CNN). GPS trajectory points in the destination region are extracted from the destination grid region, and this region is further divided into fine-grained grids and spatiotemporally encoded to obtain a refined destination region trajectory image. The refined destination region trajectory image is then used to extract the motion features of the GPS trajectory points in the destination region using a Feature Pyramid Transformer (FPT), which consists of a feature pyramid network, a feature mapping module, and a Transformer encoder. Finally, the motion features of the GPS trajectory points in the destination region are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier. Each candidate destination The probability is calculated, and the top 100 candidate destinations are returned as the prediction results. See also: Figure 2 As can be seen, the hierarchical spatiotemporal embedding transformer model for destination prediction in this embodiment mainly consists of four stages: 1) constructing candidate destinations; 2) predicting destination grid regions; 3) extracting motion features of GPS trajectory points in the destination region; and 4) calculating the probability of each candidate destination. First, all drop-off locations are extracted from the trajectory data, and cluster analysis is performed on these locations to group similar drop-off locations, forming a representative set of candidate destinations. Secondly, the coarse-grained grid of the experimental area is spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the general direction of the trajectory. A CNN model is then used to predict the grid region where the destination is most likely to exist. Next, GPS trajectory points are extracted from the destination grid region, and this region is further divided into fine-grained grids and spatiotemporally encoded to obtain a refined destination region trajectory image. A feature pyramid network is then used to extract multi-scale features, and a Transformer encoder is used to dynamically weight the importance of features across different feature levels and locations, effectively integrating and refining key information to capture complex spatiotemporal patterns in the trajectory data. Finally, the extracted features are fused through a fully connected layer, and a Softmax classifier is used to output the probabilities of candidate destinations. The top k probabilities of candidate destinations are returned as the predicted destinations.

[0045] 1) Construction of candidate destinations.

[0046] To extract passengers' potential destinations from trajectory data, this embodiment further includes constructing a candidate destination set before the hierarchical spatiotemporal embedding transformer model performs destination prediction. Extract the endpoint location of each segment of the vehicle trajectory; use the Mean-Shift clustering algorithm to cluster the set of endpoint locations from all segments to obtain a set of candidate destinations. Mean-Shift clustering is a method that finds high-density regions in a dataset through iterative updates. The core of Mean-Shift is to calculate the offset mean vector between the current target point and the local maxima of the current probability density, and then move the target point along the direction of this offset mean vector until the optimal condition is met. Its functional expression is shown below:

[0047] ,

[0048] In the above formula, For Mean-Shift vectors, This represents the number of destination locations for the trajectory within the bandwidth range. The kernel function used to estimate the density of the dataset, For points within the bandwidth range, With the center point, To calculate the bandwidth range, For point The Mean-Shift clustering algorithm first determines a starting point when it begins iteration; this can be any point in the set of endpoints. Next, it calculates the current offset mean vector, which represents the offset from the starting point to a local maximum of probability density in its surrounding area. This offset points to a region with higher density in the endpoint cloud. Subsequently, the starting point moves to the current target point according to the guidance of the current offset mean vector. After completing this round of iteration, the current target point is used as the new starting point, thus beginning the next round of iteration. Through this iterative process, the Mean-Shift algorithm continuously updates the position of the current target point, gradually moving it towards the region with the highest data point density until a local density maximum is found. This point is the candidate destination, effectively representing geographically similar endpoints. The candidate destinations obtained through Mean-Shift clustering serve as labels for the vehicle trajectory data. This approach simplifies the problem, prevents overfitting, and reduces the complexity of the problem.

[0049] 2) Predict the destination grid area.

[0050] To predict the destination grid region, the entire experimental area is first divided into a coarse-grained grid. Then, a spatiotemporal coding technique is used to map a portion of the trajectory to its corresponding grid region, converting it into a trajectory image. Next, a CNN model is used to extract spatiotemporal features from the trajectory image to predict the grid region where the destination is located. In this embodiment, a given portion of the trajectory... Coarse-grained grid division of the corresponding area refers to dividing the city into hierarchical levels. Using a given coarse-grained parameter m, the given partial trajectory The corresponding area is divided into The grid unit, wherein the fine-grained grid division of the destination grid area refers to the hierarchical division of the city. Using a given fine-grained parameter n, the given partial trajectory The corresponding area is divided into The grid cells, in which And n is greater than m. In this embodiment, when the destination grid region is divided into fine-grained grids and spatiotemporally encoded to obtain a refined destination region trajectory image, the function expression of the spatiotemporal encoding is:

[0051] ,

[0052] In the above formula, The mesh matrix obtained by fine-grained mesh generation for the destination mesh region The Middle OK The grid area of ​​the column, For the trajectory point number, Given a partial trajectory, for The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area In the middle. When all trajectory points are mapped to the grid matrix. Then, it is converted into a trajectory image for subsequent prediction. The most significant feature of spatiotemporal coding is that it is based on trajectory points. exist The sequence position is used to adjust the encoded value in the grid. When the trajectory is converted into an image, the corresponding encoded value is converted into the gray value of the image, so that the trajectory image can intuitively reflect the spatiotemporal evolution of the trajectory through the changing gray values.

[0053] After generating the trajectory image, a convolutional neural network (CNN) is used to extract its spatial features to predict the destination. The specific working mechanism is as follows: Figure 3As shown, in this embodiment, when using a convolutional neural network (CNN) to predict the destination grid region from a coarse-grained spatiotemporal trajectory image, the CNN prediction of the destination grid region includes: extracting spatial features from the coarse-grained spatiotemporal trajectory image through convolution and pooling operations. The convolution operation uses multiple convolution kernels to identify local patterns in the image, and the pooling operation is used to reduce the spatial dimension of the feature map to enhance the robustness of the model. The combined effect of convolution and pooling operations can extract key spatial features from the trajectory image. The extracted spatial features are then fed into a fully connected layer for feature integration. The extracted spatial features are then fed into a fully connected layer for feature integration to form a higher-level abstract representation. Finally, a Softmax classifier is used to predict the destination grid region. The fully connected layer is responsible for combining the extracted features to form a higher-level abstract representation to better capture complex patterns in the trajectory data. Finally, a Softmax classifier is used to predict the region where the destination is most likely to exist.

[0054] 3) Extract the motion features of GPS trajectory points in the destination area.

[0055] After predicting the destination area, the first step is to determine the extent of that area, and then... Extract GPS track points within this range to construct the destination area track. The destination region is then divided into a fine-grained grid and converted into a destination region image using spatiotemporal coding. Multi-scale feature information is then extracted and integrated using a Feature Pyramid Transformer (FPT).

[0056] In this embodiment, when obtaining a refined destination region trajectory image by performing fine-grained grid division and spatiotemporal coding on the destination grid region, the destination region is first divided into fine-grained grid units, corresponding to city division levels. = n That is, division , Grid cells Then, when performing spatiotemporal coding to obtain a refined trajectory image of the destination region, the functional expression of the spatiotemporal coding is:

[0057] ,

[0058] In the above formula, The mesh matrix obtained by fine-grained meshing of the destination mesh region. The Middle OK The grid area of ​​the column, For the trajectory point number, for The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area In the middle. When all trajectory points are mapped to Then, it is converted into a destination region image for subsequent multi-scale feature extraction.

[0059] Next, the Feature Pyramid Transformer (FPT) extracts multi-scale feature information of the trajectory from the destination region image and integrates it. The FPT mainly consists of three parts: a feature pyramid network for extracting multi-scale features from the trajectory image, a feature map for unifying the input dimension, and a Transformer encoder for integrating multi-scale information. In this embodiment, extracting motion features of GPS trajectory points in the destination region from the refined destination region trajectory image using the FPT includes:

[0060] The destination region trajectory image is refined using a feature pyramid network. After multiple scaling convolutions, high-level feature maps at different levels are obtained; the highest-level high-level feature map is then... A new feature map is generated through the upsampling operation. Then from the new feature map Begin by taking any new feature map Upsampling, then combining with the next lower-level feature map The features obtained by adjusting the dimensions through 1×1 convolution are summed, and then a 3×3 convolutional layer is added to obtain the corresponding new feature map. Ultimately, feature maps at multiple scales are obtained. ~ ; Figure 4 This is a schematic diagram of the feature pyramid network structure in this embodiment. The feature pyramid network is mainly divided into three parts: bottom-up path, top-down path, and lateral connections. A series of feature maps at different scales are generated through these methods. The extraction of each feature map not only includes local information at that scale but also achieves interaction with feature maps at upper and lower levels, thus realizing effective fusion of semantic information at different scales. This design allows the feature extraction process to consider the target's performance at different scales simultaneously, not only accurately identifying targets at various scales but also integrating target information at different scales, avoiding information silos, and enhancing the representational power of features. Its specific workflow is as follows: First, the input image is scaled by a certain factor through the bottom-up path and convolution is performed to extract relevant features and construct feature maps at different scales. In this embodiment, n=4. Figure 4 In the input image ( The transformed trajectory image is obtained through multiple scaling and convolution processes. This represents feature information at different levels. Then, the obtained high-level feature maps are expanded and downsampled using a top-down path to recover the details from the high-level feature maps generated by the bottom-up path. Figure 4 In the middle, from the highest level feature map To begin, a new feature map is generated through an upsampling operation. Subsequently With the next lower-level feature map Generate horizontal links This process continues down to the lowest level of feature maps. Lateral connections are used to combine the feature maps generated by the top-down path. Feature map of bottom-up path Combined. See details. Figure 4 The combination method is to combine feature maps. Expand to The same dimensions are used, and then the dimensions are adjusted using a 1×1 convolution. Finally, the two are added together. Then, to further reduce the confusion caused by upsampling and feature fusion, a 3×3 convolutional layer is added for sampling. Ultimately obtained These correspond to feature maps at low, medium, and high scales, respectively.

[0061] Feature maps of multiple scales ~ The feature maps are flattened to form one-dimensional feature vectors. A multilayer perceptron is then used to map these one-dimensional feature vectors to the same feature space, resulting in multiple feature vectors of the same size as the input features. The input features and positional embeddings are then added to obtain the input vector. A feature pyramid network successfully extracts feature maps at high, medium, and low scales. The size differences between these feature maps pose a challenge to the subsequent fusion of cross-scale information in the Transformer encoder. To ensure the Transformer encoder can effectively integrate these feature information at different scales, appropriate processing measures must be taken to map the feature maps of each scale to the same size. To achieve this goal, this study adopts the following steps: First, the feature maps at each scale are flattened, converting the multi-dimensional feature maps into one-dimensional feature vectors. Next, a multilayer perceptron is used to map these one-dimensional feature vectors to the same size, allowing the feature vector dimension to be adjusted while maintaining the feature representation capability. In this way, feature maps of different scales are mapped to the same feature space, providing a unified data format for the Transformer encoder. After feature mapping, multi-scale feature maps are combined into feature vectors of the same size. These feature vectors carry multi-scale feature information extracted from the destination region image. Then, a Transformer encoder is used to integrate the multi-scale information and capture the complex spatiotemporal motion information of the trajectory. In this embodiment, the input features and the location embedding are added together to obtain the model's input vector. The calculation function expression for the location embedding is:

[0062] ,

[0063] ,

[0064] in, To encode the components of the position in even-numbered dimensions, Encode the components of the position in odd-numbered dimensions. This indicates the position of the current input feature within the overall input features. d represents the dimension of the position embedding, which is consistent with the dimension of the input. 2i represents an even dimension, and 2i+1 represents an odd dimension (2i≤d, 2i+1≤d).

[0065] The input vector is fed into the Transformer encoder to extract motion features of GPS trajectory points in the target area, such as... Figure 5As shown, the Transformer encoder in this embodiment includes a multi-head attention network, a normalization network, a first residual connection, and N cascaded feedforward network units. The input vector enters the multi-head attention network and the normalization network, serving as the first input to the first residual connection. The input vector also serves as the second input to the first residual connection. The output of the residual connection is input to the N cascaded feedforward network units to obtain the motion characteristics of GPS trajectory points in the target area. Each feedforward network unit includes a feedforward network, a normalization network, and a second residual connection connected in sequence. The input of each feedforward network unit passes through the feedforward network and the normalization network, serving as the first input to the second residual connection. The input of each feedforward network unit also serves as the second input to the second residual connection. When the input vector enters the Transformer encoder, it first enters the multi-head attention network. The multi-head attention network calculates three projection matrices Q, K, and V based on the input vector, representing the query, key, and value of the input vector, respectively. The function expression is:

[0066] ,

[0067] in, The column counts of the query matrix Q and the key matrix K represent the dimensions of the input vector. Multi-head attention uses different learning projections to compute multiple attention functions to improve the model's representational power. After the attention layer, feature information is further processed through a normalization network and residual connections. The normalization network helps stabilize the training process, and the output of the normalized network, combined with the input of the multi-head attention network, forms a residual connection that helps alleviate the vanishing gradient problem. Next, a feedforward network processes the output of the first residual connection to increase the model's expressive power. Similarly, a normalization network is added after the feedforward network, and the normalized output is combined with the input data of the feedforward neural network to form another residual connection. Through this structure, the Transformer encoder can not only capture long-range dependencies in the input data, but also effectively alleviate the vanishing gradient problem through residual connections, and ensure that the output of each layer has similar distribution characteristics through normalization, thereby effectively capturing the spatiotemporal patterns of the trajectory.

[0068] 4) Calculate the probability of each candidate destination.

[0069] A fully connected layer and a softmax classifier are used to fuse the spatiotemporal information of the extracted trajectories, and in this embodiment, the final candidate destination probability distribution is output. This allows us to obtain the... The probability that each candidate destination is the actual destination. Ultimately, it can be returned. The largest candidate destination is used as the final output. .

[0070] In this embodiment, the hierarchical spatiotemporal embedding transformer model HST-FPT uses cross-entropy as the loss function during training. Cross-entropy is typically used to calculate the distance between the predicted probability distribution and the true probability distribution in a softmax classifier. The function expression is as follows:

[0071] ,

[0072] In the above formula, For loss function, The number of trajectory data points trained in the same batch. For the i-th real destination, It is the candidate destination with the highest predicted probability value.

[0073] To verify the destination prediction method based on the hierarchical spatiotemporal embedded transformer model in this embodiment, the experimental data used in this embodiment comes from the real trajectory dataset in the Kaggle-ECML / PKDD competition. This dataset provides trajectory data of 442 taxis in Porto, Portugal, for one year (July 1, 2013 - June 30, 2014). The training set contains more than 1.7 million data points, each corresponding to a complete trip, including nine attributes: trip identifier, service request identifier, phone number identifier, customer service request method identifier, taxi stand identifier, vehicle ID, timestamp, date type identifier, GPS data completion identifier, and taxi trajectory. This paper randomly selects 50,000 data points from the training set as sample data and divides them into training, validation, and test sets in a 6:2:2 ratio. The hardware platform used in this experiment is an AMD Ryzen 75800H with 16GB of memory. The software configuration is as follows: Windows 10 operating system, Anaconda3 resource management, PyCharm IDE, PyTorch 1.12.1 deep learning framework, and Python language development.

[0074] To better evaluate the model's performance, this paper selects accuracy, mean absolute error (MAE), and response time as evaluation metrics. During testing, the model outputs the top k destinations by probability as labels for candidate destinations. A prediction is considered successful if the labels of the output k candidate destinations contain the labels of the test data. Accuracy measures the success rate of outputting the k destinations on the test data, and its calculation function is as follows:

[0075] ,

[0076] In the above formula, For accuracy, This indicates the number of successful predictions during model testing. This represents the total number of data points in the test set. The Mean Absolute Error (MAE) represents the average of the absolute values ​​of the distance errors between the top-ranked candidate destination and the actual destination. It typically provides an accurate reflection of the deviation between the predicted and actual values. Its calculation function is expressed as follows:

[0077] ,

[0078] ,

[0079] ,

[0080] in, To calculate the distance deviation between the time destination and the predicted destination using Haversine distance calculation, For the Earth's radius, , These represent the latitude and longitude of the destination. Response time is the time from data input to model execution and the output of the prediction result, reflecting the model's time performance and the use of computing resources.

[0081] I. Model performance under different trajectory completion levels.

[0082] In real-world taxi driving scenarios, as the taxi travels further, the trajectory completion rate increases, providing more information and leading to more accurate destination predictions. To verify this, this experiment adjusts the trajectory completion rate parameter. p The size of the variable was used to simulate predicting the destination of a taxi based on the collected GPS trajectory. The corresponding experimental results are shown in Table 1 and... Figure 6 , Figure 7 and Figure 8 As shown.

[0083] Table 1: Comparison of model performance under different trajectory completion levels

[0084]

[0085] Through Table 1 and Figure 6 The experimental results show that, with the increase of trajectory completeness, under the same k-value, the prediction accuracy increases, while the MAE decreases, and the response time remains relatively unchanged. This indicates that the completeness of the trajectory has a significant impact on the performance of the destination prediction task. The higher the trajectory completeness, the more complete the sequence information the model can receive, thus enabling it to predict the taxi's destination more accurately. This finding aligns with the intuition that more data provides more information, helping to improve prediction accuracy.

[0086] II. Ablation Experiment.

[0087] To deeply explore the impacts of hierarchical strategies, spatio-temporal encoding, and multi-scale information on model performance, this study carefully designed a set of comparative experiments, and the experimental settings are shown in Table 2.

[0088] Table 2: Ablation model settings

[0089]

[0090] Then the experiments were conducted under the condition that the trajectory completion degree p = 70%. Specific experimental results are shown in Table 3, as well as Figure 9 , Figure 10 and Figure 11 as shown.

[0091] Table 3: Ablation experiments

[0092]

[0093] By analyzing the results shown in Table 3 and Figure 9 , Figure 10 and Figure 11 as shown, it can be clearly found that: (1) The ablation model ① without using the hierarchical strategy still has good accuracy performance, but it is still lower than the HST-FPT model, and the response time increases significantly. This is because without using the hierarchical strategy, the model processes the trajectory images transformed from dividing the entire experimental area into grids, and the sparsity caused by a large number of zero-value backgrounds increases the computational burden and affects the effective recognition and analysis of trajectory features. (2) The ablation model ② does not use spatio-temporal encoding and uses the traditional method of constructing trajectory images, resulting in the loss of temporal information and reducing the prediction accuracy. (3) The ablation model ③ does not extract multi-scale information but only extracts single-scale information. This reduces the time consumption of information extraction but greatly reduces the accuracy performance.

[0094] III. Experimental analysis of hierarchical grid division parameters.

[0095] To explore the impact of grid division parameters on experimental results, this study set a series of grid division parameters for experiments under the condition that the trajectory completion degree p = 70%. At the beginning of the experiment, the research results of existing technologies were borrowed, that is, when the urban division level of the entire experimental area is, the experimental results are the best. On this basis, the experiment further explored the impact of hierarchical grid division parameters on model performance. That is, the first grid division level m and the second grid division level n satisfy m + n = 7 and m < n. The experimental results are shown in Table 4, as well as Figure 12 , Figure 13 and Figure 14 as shown.

[0096] Table 4: Comparison of grid division parameter settings

[0097]

[0098] For Table 4, and Figure 12 , Figure 13 and Figure 14 The analysis clearly shows that the model exhibits the best accuracy performance when m=1 and n=6, while the time performance is better when m=2, n=5 and m=3, n=4, although their accuracy performance declines significantly. Therefore, a mesh parameter setting of m=1 and n=6 was chosen as the parameter setting for the entire model.

[0099] IV. Comparative Experiment

[0100] To evaluate the performance of the hierarchical spatiotemporal embedded transformer model HST-FPT, this embodiment compares it with baseline models such as CNN, T-CONV, CNN-LSTM, BiLSTM+Attention, and STAN-LSTM, and focuses on trajectory completion. p =70% Experiments were conducted under the following conditions for comparison. CNN converted trajectory data into trajectory images and extracted spatial features for destination prediction. T-CONV converted trajectory data into trajectory images, extracted spatial information at different scales, and performed information enhancement for destination prediction. CNN-LSTM converted trajectory data into trajectory images, first using CNN to extract spatial features, and then using LSTM to extract contextual information for destination prediction. BiLSTM+Attention used two GPS embedding methods to represent the geographical proximity and multi-scale spatial aspects of the trajectory as two embedding sequences, and then used the BiLSTM+Attention mechanism to further mine motion features for destination prediction. STAN-LSTM used the Geohash algorithm to divide the trajectory data into a grid and perform one-hot encoding, then reduced the dimensionality to a low-dimensional embedding vector containing geographical topological relationships, and then used an LSTM network with self-attention to mine the feature information to predict the destination. The experimental results of the above two comparative experiments are shown in Table 5. Figure 15 , Figure 16 and Figure 17 As shown.

[0101] Table 5: Performance Comparison of Models

[0102]

[0103] By analyzing Table 5, and Figure 15 , Figure 16 and Figure 17In-depth analysis of the data reveals that the Hierarchical Spatiotemporal Embedded Transformer (HST-FPT) model significantly improves accuracy and MAE compared to all baseline models. In terms of temporal performance, HST-FPT outperforms all methods except CNN, while the CNN model exhibits the worst accuracy performance. This demonstrates that the HST-FPT model in this embodiment demonstrates superior performance compared to these baseline models in processing trajectory data and capturing taxi motion features.

[0104] In summary, this embodiment's destination prediction method based on a hierarchical spatiotemporal embedding transformer model combines hierarchical spatiotemporal image construction, spatiotemporal coding, and Feature Pyramid Transformer (FPT). This effectively captures complex spatiotemporal patterns from trajectory data, providing strong support for predicting passengers' final destinations. In the model's output phase, the neural network outputs the probability distribution of each candidate destination, making user destination prediction more refined and personalized. Extensive experimental validation on real-world datasets demonstrates the significant effectiveness of this method in predicting passenger destinations, proving its advantages in accuracy and efficiency over traditional methods, while also achieving good time performance.

[0105] Furthermore, this embodiment also provides a destination prediction system based on a hierarchical spatiotemporal embedded transformer model, including a microprocessor and a memory interconnected, wherein the microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model.

[0106] Furthermore, this embodiment also provides a computer-readable storage medium storing a computer program or instructions that are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model by a processor.

[0107] Furthermore, this embodiment also provides a computer program product, including a computer program or instructions that are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model via a processor.

[0108] Those skilled in the art will understand that the technical solutions provided by the embodiments of this application may be in the form of a method, system, or computer program product. Therefore, this application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application may take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create an implementation for the process. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. A destination prediction method based on a hierarchical spatiotemporal embedded transformer model, characterized in that, Including a given partial trajectory and candidate destination set Destination prediction is performed using a trained hierarchical spatiotemporal embedding transformer model. This destination prediction includes: using a given partial trajectory... The corresponding region is divided into coarse-grained grids and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate trajectory direction. This coarse-grained spatiotemporal trajectory image is then used to predict the destination grid region using a convolutional neural network (CNN). GPS trajectory points in the destination region are extracted from the destination grid region, and this region is further divided into fine-grained grids and spatiotemporally encoded to obtain a refined destination region trajectory image. The refined destination region trajectory image is then used to extract the motion features of the GPS trajectory points in the destination region using a Feature Pyramid Transformer (FPT), which consists of a feature pyramid network, a feature mapping module, and a Transformer encoder. Finally, the motion features of the GPS trajectory points in the destination region are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier. Each candidate destination The probability is calculated, and the top 100 candidate destinations are returned as the prediction results. The given partial trajectory Coarse-grained grid division of the corresponding area refers to dividing the city into hierarchical levels. Using a given coarse-grained parameter m, the given partial trajectory The corresponding area is divided into The grid unit, wherein the fine-grained grid division of the destination grid area refers to the hierarchical division of the city. Using a given fine-grained parameter n, the given partial trajectory The corresponding area is divided into The grid cells, in which And n is greater than m; When predicting the destination grid region using a convolutional neural network (CNN) from a coarse-grained spatiotemporal trajectory image, the CNN prediction of the destination grid region includes: extracting spatial features from the coarse-grained spatiotemporal trajectory image through convolution and pooling operations, wherein the convolution operation uses multiple convolution kernels to identify local patterns in the image, and the pooling operation is used to reduce the spatial dimension of the feature map; the extracted spatial features are then fed into a fully connected layer for feature integration to form a higher-level abstract representation, and finally the destination grid region is predicted using a Softmax classifier.

2. The destination prediction method based on a hierarchical spatiotemporal embedded transformer model according to claim 1, characterized in that, When obtaining a refined destination region trajectory image by performing fine-grained grid division and spatiotemporal coding on the destination grid region, the function expression for the spatiotemporal coding is: , In the above formula, The mesh matrix obtained by fine-grained mesh generation for the destination mesh region The Middle OK The grid area of ​​the column, For the trajectory point number, Given a partial trajectory, For a given partial trajectory The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area middle.

3. The destination prediction method based on a hierarchical spatiotemporal embedded transformer model according to claim 1, characterized in that, When obtaining a refined destination region trajectory image by performing fine-grained grid division and spatiotemporal coding on the destination grid region, the function expression for the spatiotemporal coding is: , In the above formula, The mesh matrix obtained by fine-grained meshing of the destination mesh region. The Middle OK The grid area of ​​the column, For the trajectory point number, for The number of trajectory points in the data. For the first A trajectory point, "For logic, express In the grid area Among them To start from a given partial trajectory The destination area trajectory is formed by GPS trajectory points extracted from the destination area.

4. The destination prediction method based on a hierarchical spatiotemporal embedded transformer model according to claim 1, characterized in that, The step of extracting motion features of GPS trajectory points in the destination area using a Feature Pyramid Transformer (FPT) from a refined destination area trajectory image includes: processing the refined destination area trajectory image through a Feature Pyramid Network. After multiple scaling convolutions, high-level feature maps at different levels are obtained; the highest-level high-level feature map is then... A new feature map is generated through the upsampling operation. Then from the new feature map Begin by taking any new feature map Upsampling, then combining with the next lower-level feature map The features obtained by adjusting the dimensions through 1×1 convolution are summed, and then a 3×3 convolutional layer is added to obtain the corresponding new feature map. Ultimately, feature maps at multiple scales are obtained. ~ Feature maps at multiple scales ~ The feature vectors are flattened and converted into one-dimensional feature vectors. A multilayer perceptron is then used to map these one-dimensional feature vectors to the same feature space, resulting in multiple feature vectors of the same size as the input feature. The input feature and the position embedding are added together to obtain the input vector. This input vector is then fed into a Transformer encoder to extract the motion features of GPS trajectory points in the target area. The Transformer encoder includes a multi-head attention network, a normalization network, a first residual connection, and N cascaded feedforward network units. The input vector, after passing through the multi-head attention network and the normalization network, serves as the first input to the first residual connection. The input vector also serves as the second input to the first residual connection. The output of the residual connection is fed into the N cascaded feedforward network units to obtain the motion features of GPS trajectory points in the target area. Each feedforward network unit includes a feedforward network, a normalization network, and a second residual connection connected in sequence. The input of each feedforward network unit passes through the feedforward network and the normalization network to serve as the first input to the second residual connection. The input of each feedforward network unit also serves as the second input to the second residual connection.

5. The destination prediction method based on a hierarchical spatiotemporal embedded transformer model according to claim 1, characterized in that, Before performing destination prediction, the hierarchical spatiotemporal embedded transformer model also includes constructing a candidate destination set. Extract the endpoint location of each segment of the vehicle trajectory; use the Mean-Shift clustering algorithm to cluster the set of endpoint locations from all segments to obtain a set of candidate destinations. .

6. A destination prediction system based on a hierarchical spatiotemporal embedded transformer model, comprising interconnected microprocessors and a memory, characterized in that, The microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model as described in any one of claims 1 to 5.

7. A computer-readable storage medium storing a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model as described in any one of claims 1 to 5 via a processor.

8. A computer program product, comprising a computer program or instructions, characterized in that, The computer program or instructions are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedded transformer model as described in any one of claims 1 to 5 via a processor.

Citation Information

Patent Citations

  • Vehicle track destination prediction method considering space-time semantics and driving state

    CN113204718A

  • Online car-hailing demand prediction method and device, equipment and storage medium

    CN117077928A