Destination prediction method and system based on hierarchical space-time embedded transformer model
By adopting a hierarchical spatiotemporal embedded transformer model in destination prediction, combining grid division, spatiotemporal encoding and feature pyramid transformer FPT, the problems of sparse data and insufficient multi-scale feature extraction in the existing methods are solved, and more efficient and accurate destination prediction is achieved.
Patent Information
- Application Number
- CN202411470181.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-21
AI Technical Summary
Existing neural network-based destination prediction methods face problems such as sparse data, missing time information and insufficient multi-scale feature extraction, resulting in poor prediction accuracy and efficiency.
Using a method based on a hierarchical spatiotemporal embedding transformer model, the spatiotemporal information and multi-scale features in the trajectory data are extracted through coarse-grained and fine-grained grid division, spatiotemporal coding and feature pyramid transformer FPT, and the destination prediction is performed in combination with a convolutional neural network and a Transformer encoder.
It effectively solves the problems of sparse data, missing time information and insufficient multi-scale feature extraction, improves the accuracy and efficiency of destination prediction, and provides more refined and personalized travel destination prediction.
Smart Images

Figure CN119646321A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of location service computing and intelligent transportation technology, and in particular to a destination prediction method and system based on a hierarchical spatiotemporal embedding transformer model. Background Art
[0002] Vehicles equipped with onboard mobile positioning devices generate a large amount of Global Positioning System (GPS) trajectory data covering residents' travel patterns. Predicting destinations by mining vehicle trajectory data can greatly expand location-based services. The implementation of these services not only improves residents' travel experience, but also provides valuable data support for traffic scheduling, urban planning and commercial activities.
[0003] Converting vehicle GPS trajectories into trajectory images and using computer vision technologies such as convolutional neural networks (CNNs) to extract spatial features to predict the destination is an important method in the field of destination prediction. This method converts the vehicle's driving trajectory into an image so that the trajectory data can be effectively processed by the deep learning model and the location of the destination can be identified. This method has attracted widespread attention because it can intuitively reflect the spatial structure of the trajectory.
[0004] At present, most of the research on destination prediction based on neural networks adopts two basic methods: time series analysis method and spatial feature modeling method. In terms of time series analysis method, 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 the time series analysis method can well analyze the changes of GPS trajectory points over time to predict the destination, especially the method of adding spatial embedding can further improve the prediction accuracy by mining the spatial background of GPS trajectory points, such methods also face the problem of long-term dependence. The spatial feature modeling method divides the experimental area into grids, maps the trajectory data to these grids and converts them into trajectory images, and then uses image vision methods such as CNN to extract the spatial features of the trajectory images and predict the destination. However, the spatial feature modeling method faces the problems of data sparsity, missing temporal sequence information and insufficient multi-scale feature extraction in practice. In summary, the 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 must be mapped to the corresponding grids to finally form a trajectory image. However, since the trajectory only covers part of the area, a large number of areas in the image are unvisited zero-value backgrounds, resulting in sparse data. This sparsity not only increases the computational burden and processing time, but also may mask the useful information of 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 trajectories to grids to form trajectory images will mark 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 changes in the driving direction, thereby 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 convolution kernel receptive field and tends to focus on and capture features of 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. However, the existing methods for extracting multi-scale features in the field of destination prediction have the problem of splitting features of different scales and lacking independent expression of features of each scale. Summary of the invention
[0005] Technical problem to be solved by the present invention: In view of the above-mentioned problems of the prior art, a destination prediction method and system based on a hierarchical spatiotemporal embedding transformer model are provided. The present invention aims to extract spatiotemporal information from trajectory data to predict the destination, and solve the problems of data sparsity, missing temporal information and insufficient multi-scale feature extraction faced by existing methods.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: A destination prediction method based on hierarchical spatiotemporal embedding transformer model, which includes and a set of candidate destinations The destination prediction is performed using the trained hierarchical spatiotemporal embedding transformer model, which includes: transforming a given partial trajectory into The corresponding area is coarse-grained gridded and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate direction of the trajectory, and the coarse-grained spatiotemporal trajectory image is predicted by a convolutional neural network (CNN) to obtain a destination grid area; GPS trajectory points in the destination area are extracted according to the destination grid area, and the destination grid area is fine-grained gridded and spatiotemporally encoded to obtain a refined destination area trajectory image; the refined destination area trajectory image is used to extract the motion features of the GPS trajectory points in the destination area using a feature pyramid transformer (FPT), and the feature pyramid transformer (FPT) is composed of a feature pyramid network, a feature mapping module, and a Transformer encoder; the motion features of the GPS trajectory points in the destination area are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier Each candidate destination The probability of returning the specified number of candidate destinations ranked before the probability is output as the prediction result.
[0007] Optionally, the given partial trajectory The corresponding area is divided into coarse-grained grids, which means dividing the city into levels. Use the given coarse-grained parameter m to transform the given partial trajectory The corresponding area is divided into The grid unit of the destination grid area is divided into fine-grained grids, which means dividing the city into levels Use the given fine-grained parameter n to transform the given partial trajectory The corresponding area is divided into The grid cells are , and n is greater than m.
[0008] Optionally, when the destination grid area is divided into fine-grained grids and space-time encoded to obtain a refined destination area trajectory image, the function expression of the space-time encoding is: , In the above formula, The grid matrix obtained by fine-grained grid division for the destination grid area Middle OK The grid area of the column, is the trajectory point number, For a given partial trajectory, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area middle.
[0009] Optionally, when the coarse-grained spatiotemporal trajectory image is predicted using a convolutional neural network (CNN) to obtain a destination grid area, the convolutional neural network (CNN) predicts the destination grid area including: 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 sent to a fully connected layer for feature integration to form a higher-level abstract representation, and finally the destination grid area is predicted using a Softmax classifier.
[0010] Optionally, when the destination grid area is divided into fine-grained grids and space-time encoded to obtain a refined destination area trajectory image, the function expression of the space-time encoding is: , In the above formula, The grid matrix obtained by dividing the destination grid area into fine-grained grids Middle OK The grid area of the column, is the trajectory point number, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area middle.
[0011] Optionally, extracting the motion features of GPS track points in the destination area from the refined destination area track image using a feature pyramid transformer FPT comprises: extracting the motion features of GPS track points in the destination area from the refined destination area track image 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 Generate a new feature map through upsampling operation , and then from the new feature map To begin, any new feature map Upsample and combine with the next lower level feature map The features obtained after adjusting the dimension through 1×1 convolution are added, and then a 3×3 convolution layer is added to obtain the corresponding new feature map , and finally obtain feature maps of multiple scales ~ ; Feature maps of multiple scales ~ A flattening operation is performed to convert the one-dimensional feature vectors into one-dimensional feature vectors, and a multi-layer perceptron is used to size-map the 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 embedding are added to obtain an input vector; the input vector is input into a Transformer encoder to extract the motion features of the GPS track points in the destination area, and the Transformer encoder includes a multi-head attention network, a normalization network, a first residual connection, and N cascaded feedforward network units. After the input vector enters the multi-head attention network and the normalization network, it is used as the first input of the first residual connection, and the input vector is also used as the second input of the first residual connection. The output of the residual connection is input into N cascaded feedforward network units to obtain the motion features of the GPS track points in the destination area, and 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 as the first input of the second residual connection, and the input of the feedforward network unit is also used as the second input of the second residual connection.
[0012] Optionally, the hierarchical spatiotemporal embedding transformer model further comprises constructing a candidate destination set before performing destination prediction :Extract the destination position of each trip in the vehicle trajectory; use the mean-shift clustering algorithm Mean-Shift to cluster the destination position set consisting of the destination positions of all trips to obtain the candidate destination set .
[0013] In addition, the present invention also provides a destination prediction system based on a hierarchical spatiotemporal embedding transformer model, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model.
[0014] In addition, the present invention also provides a computer-readable storage medium, which stores a computer program or instruction, and the computer program or instruction is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model through a processor.
[0015] In addition, the present invention also provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model through a processor.
[0016] Compared with the prior art, the present invention mainly has the following advantages: in order to extract spatiotemporal information from trajectory data to predict the destination, and to solve the problems of data sparsity, missing temporal information and insufficient multi-scale feature extraction faced by the existing methods, the hierarchical spatial embedding transformer of the present invention combines hierarchical spatiotemporal image construction, spatiotemporal encoding and feature pyramid transformer FPT, which can effectively capture its complex spatiotemporal patterns from trajectory data and provide strong support for predicting the final destination of passengers. In the output stage of the hierarchical spatiotemporal embedding transformer model, the neural network outputs the probability distribution of each candidate destination, so that the user's travel destination prediction becomes more refined and personalized. Through a large number of experimental verifications on actual data sets, the hierarchical spatiotemporal embedding transformer model of the present invention has shown significant effectiveness in predicting passenger destinations, proving its advantages in accuracy and efficiency over traditional methods, while also taking into account good time performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The hierarchical division of a certain area in the first three layers of cities in the embodiment of the present invention The following is a schematic diagram of the hierarchical division.
[0018] Figure 2 Schematic diagram of the network structure of the hierarchical spatiotemporal embedding transformer model in an embodiment of the present invention.
[0019] Figure 3 Schematic diagram of the network structure of the convolutional neural network CNN used in the embodiment of the present invention.
[0020] Figure 4 Schematic diagram of the network structure of the feature pyramid in an embodiment of the present invention.
[0021] Figure 5 Schematic diagram of the network structure of the Transformer encoder in an embodiment of the present invention.
[0022] Figure 6 is the accuracy rate under different trajectory completion degrees obtained in the embodiment of the present invention.
[0023] Figure 7 It is the mean absolute error MAE under different trajectory completion degrees obtained in the embodiment of the present invention.
[0024] Figure 8 , which are the response times under different trajectory completion degrees obtained in the embodiments of the present invention.
[0025] Fig. 9 is the accuracy of the ablation experiment obtained in the embodiment of the present invention.
[0026] Fig.10 is the mean absolute error MAE of the ablation experiment obtained in the embodiment of the present invention.
[0027] Fig.11 is the response time of the ablation experiment obtained in the embodiment of the present invention.
[0028] Fig.12 It is the accuracy under different grid division parameters obtained in the embodiment of the present invention.
[0029] Fig.13 It is the mean absolute error MAE under different grid division parameters obtained in the embodiment of the present invention.
[0030] Fig.14 Response time under different grid division parameters obtained in the embodiment of the present invention.
[0031] Fig.15 It is the accuracy of the comparative experiment obtained in the embodiment of the present invention.
[0032] Fig.16 It is the mean absolute error MAE of the comparative experiment obtained in the embodiment of the present invention.
[0033] Fig.17 It is the response time of the comparative experiment obtained in the embodiment of the present invention. DETAILED DESCRIPTION
[0034] The destination prediction method and system based on the hierarchical spatiotemporal embedding transformer model of the present invention aims to extract spatiotemporal information from trajectory data to predict the destination, and solve the problems of data sparsity, missing temporal information and insufficient multi-scale feature extraction faced by existing methods. The destination prediction problem of the entire vehicle can be regarded as a problem of predicting the probability of the vehicle to each candidate destination. That is, for a given partial trajectory and a set of candidate destinations , according to the given partial trajectory Predicted vehicle driving to candidate destination set Each candidate destination Probability , and then returns the probability The highest front k candidate destinations. The definitions of relevant concepts are as follows: Definition 1: Trajectory. Trajectory T The taxi picks up from the To the drop-off location A complete itinerary, consisting of a series of GPS track points.T It can be expressed as ,in , Indicates the trajectory i Longitude of GPS track point ,latitude .
[0035] Definition 2: Partial trajectory. A partial trajectory is the first part of the trajectory, i.e., from the boarding position Start, to rent the current recorded position The end can be expressed as .in p Expressed as the completion of the trajectory, the value ranges from 0-100%.
[0036] Definition 3: Candidate destination. The candidate destination is a set of clusters obtained by clustering the drop-off locations of all taxi trajectories. Each cluster represents a set of drop-off locations with similar characteristics. The candidate destination can be expressed as ,in M is the number of clusters.
[0037] Definition 4: Hierarchical grid unit. The hierarchical grid unit divides the experimental area into The grid cells are , The city is divided into different levels. This method allows the area to be subdivided at different levels to meet the needs of spatial analysis at different scales. Figure 1 The following table shows the classification of a region in the first three layers of cities. Schematic diagram of layered division under the following conditions, where (a) , (b) , (c) .
[0038] like Figure 2 As shown, the destination prediction method based on the hierarchical spatiotemporal embedding transformer model in this embodiment includes: and a set of candidate destinations The destination prediction is performed using the trained hierarchical spatiotemporal embedding transformer model (referred to as HST-FPT in this embodiment). The destination prediction performed by the hierarchical spatiotemporal embedding transformer model includes: The corresponding area is coarse-grained gridded and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate direction of the trajectory, and the coarse-grained spatiotemporal trajectory image is predicted by a convolutional neural network (CNN) to obtain a destination grid area; GPS trajectory points in the destination area are extracted according to the destination grid area, and the destination grid area is fine-grained gridded and spatiotemporally encoded to obtain a refined destination area trajectory image; the refined destination area trajectory image is used to extract the motion features of the GPS trajectory points in the destination area using a feature pyramid transformer (FPT), and the feature pyramid transformer (FPT) is composed of a feature pyramid network, a feature mapping module, and a Transformer encoder; the motion features of the GPS trajectory points in the destination area are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier Each candidate destination The probability of returning the specified number of candidate destinations ranked before the probability is used as the prediction result output. Figure 2 It can be seen that the hierarchical spatiotemporal embedding transformer model in this embodiment has four main stages for destination prediction: 1) construction of candidate destinations; 2) prediction of destination grid area; 3) extraction of motion features of GPS trajectory points in the destination area; 4) calculation of the probability of each candidate destination. First, all the drop-off locations are extracted from the trajectory data, and cluster analysis is performed on these locations to group similar drop-off locations to form a representative set of candidate destinations. . Secondly, the coarse-grained grid and spatiotemporal encoding of the experimental area are performed to obtain a coarse-grained spatiotemporal trajectory image representing the general direction of the trajectory, and the CNN model is used to predict the grid area where the destination is most likely to exist. Next, the existing GPS trajectory points are extracted from the destination grid area, and the area is fine-grained gridded and spatiotemporally encoded to obtain a refined trajectory image of the destination area. The feature pyramid network is then used to extract multi-scale features, and then the Transformer encoder part is used to dynamically weight the importance of features across different feature levels and positions, effectively integrating and refining key information, and capturing complex spatiotemporal patterns in trajectory data. Finally, the extracted features are fused through a fully connected layer, and the Softmax classifier is used to output the probability of the candidate destination, and the candidate destinations ranked in the top k in probability are returned as predicted destinations.
[0039] 1) Construction of candidate destinations.
[0040] In order to extract the potential destination of passengers from the trajectory data, the hierarchical spatiotemporal embedding transformer model in this embodiment also includes constructing a candidate destination set before performing destination prediction. :Extract the destination position of each trip in the vehicle trajectory; use the mean-shift clustering algorithm Mean-Shift to cluster the destination position set consisting of the destination positions of all trips to obtain the candidate destination set The mean shift clustering algorithm Mean-Shift is a method for finding high-density areas in a data set through iterative updates. The core of the mean shift clustering algorithm Mean-Shift is to calculate the offset mean vector between the current target point and the current local maximum of the probability density, and move the target point along the direction of the offset mean vector until the optimal condition is met. Its function expression is shown in the following formula: , In the above formula, is the Mean-Shift vector, is the number of trajectory destinations within the bandwidth, is the kernel function for estimating the density of the data set, is a point within the bandwidth, is the center point, To calculate the bandwidth range, For point . When the mean shift clustering algorithm Mean-Shift starts to iterate, it first determines a starting point, which can be any point in the destination set. Then, the current offset mean vector is calculated, which represents the offset from the starting point to the local maximum of the probability density around it. This offset points to the area with higher density in the destination point 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 to start the next round of iteration. Through this iterative process, the mean shift clustering algorithm Mean-Shift continuously updates the position of the current target point, so that it gradually moves to the area with the highest data point density until a local density maximum point is found. This point is the candidate destination, which effectively represents geographically similar destinations. The candidate destinations obtained by clustering the mean shift clustering algorithm Mean-Shift are used as labels for vehicle trajectory data. Such processing can simplify the problem, prevent overfitting, and reduce the complexity of the problem.
[0041] 2) Predict the destination grid area.
[0042] In order to predict the destination grid area, the entire experimental area is first divided into coarse-grained grids, and then the spatiotemporal coding technology is used to map the partial trajectory to the corresponding grid area and convert it into a trajectory image. Then the CNN model is used to extract the spatiotemporal features in the trajectory image to predict the grid area where the destination is located. The corresponding area is divided into coarse-grained grids, which means dividing the city into levels. Use the given coarse-grained parameter m to transform the given partial trajectory The corresponding area is divided into The grid unit of the destination grid area is divided into fine-grained grids, which means dividing the city into levels Use the given fine-grained parameter n to transform the given partial trajectory The corresponding area is divided into The grid cells are , and n is greater than m. In this embodiment, when the destination grid area is fine-grained and space-time encoded to obtain a refined destination area trajectory image, the function expression of the space-time encoding is: , In the above formula, The grid matrix obtained by fine-grained grid division for the destination grid area Middle OK The grid area of the column, is the trajectory point number, For a given partial trajectory, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area When all trajectory points are mapped to the grid matrix After that, it is converted into a trajectory image for subsequent prediction. The biggest feature of spatiotemporal coding is that it is based on the trajectory points. exist The encoding value in the grid is adjusted according to the sequential position. When the trajectory is converted into an image, the corresponding encoding value is converted into the grayscale value of the image, so that the trajectory image can intuitively reflect the spatiotemporal evolution of the trajectory through the changing grayscale.
[0043] After the trajectory image is generated, the convolutional neural network (CNN) is used to extract its spatial features and predict the destination. The specific working mechanism is as follows: Figure 3As shown, in this embodiment, when the coarse-grained spatiotemporal trajectory image is used to predict the destination grid area using the convolutional neural network CNN, the convolutional neural network CNN predicts the destination grid area including: 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 to enhance the robustness of the model. The convolution and pooling operations work together to extract key spatial features in the trajectory image, and the extracted spatial features are then sent to the fully connected layer for feature integration; the extracted spatial features are then sent to the fully connected layer for feature integration to form a higher level of abstract representation, and finally the destination grid area is predicted using the Softmax classifier. The fully connected layer is responsible for combining the extracted features to form a higher level of abstract representation in order to better capture the complex patterns in the trajectory data, and finally the Softmax classifier is used to predict the area where the destination is most likely to exist.
[0044] 3) Extract the motion features of GPS trajectory points in the destination area.
[0045] After predicting the destination area, first determine the scope of the area and Extract GPS track points within the range to form the destination area track The destination area is then divided into fine-grained grids and converted into a destination area image using spatiotemporal encoding. The feature pyramid transformer FPT is then used to extract and integrate multi-scale feature information from it.
[0046] In this embodiment, when the destination grid area is fine-grained and space-time encoded to obtain a refined destination area trajectory image, the destination area is first divided into fine-grained grid units, and the corresponding city division level = n , that is, divide , The grid cell , and then perform spatiotemporal coding to obtain a refined destination area trajectory image. The function expression of the spatiotemporal coding is: , In the above formula, The grid matrix obtained by dividing the destination grid area into fine-grained grids Middle OK The grid area of the column, is the trajectory point number, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area When all trajectory points are mapped to Afterwards, it is converted into a destination area image for subsequent multi-scale feature extraction.
[0047] Then, the feature pyramid transformer FPT extracts the multi-scale feature information of the trajectory from the destination area image and integrates it. The feature pyramid transformer FPT mainly consists of three parts, namely, a feature pyramid network that extracts multi-scale features from the trajectory image, a feature map for unifying the input dimension, and a Transformer encoder that integrates multi-scale information. In this embodiment, the refined destination area trajectory image is used to extract the motion features of the GPS trajectory points in the destination area using the feature pyramid transformer FPT, including: The refined destination area trajectory image is transformed through the feature pyramid network After multiple scaling convolutions, high-level feature maps at different levels are obtained; the highest-level high-level feature map Generate a new feature map through upsampling operation , and then from the new feature map To begin, any new feature map Upsample and combine with the next lower level feature map The features obtained after adjusting the dimension through 1×1 convolution are added, and then a 3×3 convolution layer is added to obtain the corresponding new feature map , and finally obtain feature maps of multiple scales ~ ; Figure 4 The network structure diagram of the feature pyramid network in this embodiment is as follows. The feature pyramid network is mainly divided into three main parts: a bottom-up path, a top-down path, and lateral connections. A series of feature maps of different scales are generated in these ways. The extraction of each feature map not only contains the local information at that scale, but also interacts with the feature maps of the upper and lower levels, thereby achieving effective fusion of semantic information at different scales. This design enables the feature extraction process to simultaneously take into account the performance of targets at different scales. It not only accurately identifies targets of each scale, but also integrates target information at different scales, avoids the phenomenon of information islands, and enhances the representation ability of features. The specific workflow is as follows: First, the input image is scaled by a certain multiple through a bottom-up path, and convolution is performed to extract relevant features to 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 convolutions , represented as feature information at different levels. Then, the high-level feature map obtained is expanded and downsampled through the top-down path to restore the details in the high-level feature map generated by the bottom-up path. Figure 4 In the example, from the highest level feature map First, a new feature map is generated by upsampling operation , then With the next lower level feature map Generate horizontal links , and this process continues until the lowest level feature map . Lateral connections are used to connect feature maps produced by the top-down pathway Feature graph with bottom-up path See Figure 4 The combination method is to combine the feature map Expand to The same size is then adjusted by a 1×1 convolution, and the two are finally added together. Afterwards, in order to further reduce the confusion caused by upsampling and feature fusion, a 3×3 convolution layer is added to obtain Finally, we get They correspond to low-scale, medium-scale, and high-scale feature maps respectively.
[0048] Feature maps of multiple scales ~ The feature maps are converted into one-dimensional feature vectors by flattening. The multi-layer perceptron is used to map the size of these one-dimensional feature vectors to the same feature space to obtain input features consisting of multiple feature vectors of the same size. The input features and position embeddings are added to obtain the input vector. The feature maps of three different scales, high, medium and low, are successfully extracted through the feature pyramid network. These feature maps differ in size, which poses a challenge to the subsequent Transformer encoder to fuse cross-scale information. In order to ensure that the Transformer encoder can effectively integrate the feature information of these different scales, corresponding processing measures must be taken to map the feature maps of each scale to the same size. To achieve this goal, this study takes the following steps: First, the feature maps of each scale are flattened to convert the multi-dimensional feature maps into one-dimensional feature vectors. Next, the multi-layer perceptron is used to map the size of these one-dimensional feature vectors, so that the dimension of the feature vector can 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, the multi-scale feature map is composed of feature vectors of the same size. These feature vectors carry the multi-scale feature information extracted from the destination area image. Then the Transformer encoder is used to integrate the multi-scale information to capture the complex spatiotemporal motion information of the trajectory. In this embodiment, the input feature and position embedding are added to obtain the input vector of the model. The calculation function expression of the position embedding is: , , in, is the position encoding component in the even dimension, is the position encoding component in odd dimensions, It represents the position of the current input feature in the overall input feature, 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).
[0049] The input vector is fed into the Transformer encoder to extract the motion features of the GPS track points in the destination area, such as Figure 5As shown, the Transformer encoder in this embodiment includes a multi-head attention network, a normalized network, a first residual connection, and N cascaded feedforward network units. The input vector enters the multi-head attention network and the normalized network 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 into N cascaded feedforward network units to obtain the motion characteristics of the GPS trajectory points in the destination area. The feedforward network unit includes a feedforward network, a normalized network, and a second residual connection connected in sequence. The input of the feedforward network unit passes through the feedforward network and the normalized network 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. The input vector enters the Transformer encoder and first enters the multi-head attention network. The multi-head attention network calculates three projection matrices Q, K, and V according to the input vector, which represent the query, key, and value of the input vector respectively. The function expression is: , in, Represents the number of columns of the query matrix Q and the key matrix K, and is also the dimension of the input vector. Multi-head attention uses different learning projections to calculate multiple attention functions to improve the representation ability of the model. After the attention layer, the feature information is further processed through the normalization network and residual connection. The normalization network helps stabilize the training process. The residual connection formed by the output of the normalized network and the input of the multi-head attention network helps to alleviate the gradient vanishing problem. Next, the data output by the first residual connection is processed through a feedforward network to increase the expressive power of the model. Similarly, a normalization network is added after the feedforward network, and the normalized output is connected to the input data of the feedforward neural network to form another residual connection. Through this structure, the Transformer encoder can not only capture the long-distance dependencies in the input data, but also effectively alleviate the gradient vanishing problem through residual connections, and ensure that the output of each layer has similar distribution characteristics through normalization, thereby effectively capturing the spatiotemporal pattern of the trajectory.
[0050] 4) Calculate the probability of each candidate destination.
[0051] A fully connected layer and a Softmax classifier are used to fuse the temporal and spatial information of the extracted trajectory and output the final candidate destination probability distribution in this embodiment. The probability that a candidate destination is the true destination , and eventually can return The maximum candidate destination is the final output .
[0052] In this embodiment, the hierarchical spatiotemporal embedding transformer model HST-FPT uses cross entropy as the loss function during training. It is usually used to calculate the distance between the predicted probability distribution and the true probability distribution in the softmax classifier. The function expression is as follows: , In the above formula, is the loss function, is the number of trajectory data trained in the same batch, is the i-th real destination, It is the candidate destination with the largest predicted probability value.
[0053] In order to verify the destination prediction method based on the hierarchical spatiotemporal embedding transformer model in this embodiment, the experimental data used in this embodiment comes from the real trajectory data set in the Kaggle-ECML / PKDD competition. The data set provides the trajectory data of 442 taxis in Porto, Portugal for one year (2013 / 07 / 01-2014 / 06 / 30). The training set contains more than 1.7 million data, each of which corresponds to a complete trip, including a trip identifier, a request service identifier, a phone number identifier, a customer request service method identifier, a phone number identifier, a taxi station identifier, a vehicle ID, a timestamp, a date type identifier, a GPS data completion identifier, and a taxi trajectory. This paper randomly selects 50,000 data from the training set as sample data, and divides the training set, validation set, and test set according to a ratio of 6:2:2. The hardware platform used in this experiment is: AMD Ryzen 75800H, with a memory of 16G. The software configuration is: Windows 10 operating system, Anaconda3 resource management, Pycharm IDE, Pytorch 1.12.1 deep learning framework, Python language development.
[0054] In order to better evaluate the performance of the model, this paper uses accuracy, mean absolute error (MAE) and response time as evaluation indicators. During the test, the model outputs the top k destinations with the highest probability as the labels of the candidate destinations. If the labels of the k candidate destinations output include the labels of the test data, the prediction is considered successful. The accuracy rate measures the success rate of the test data output of k destinations. The calculation function expression is as follows: , In the above formula, is the accuracy, Indicates the number of successful predictions during model testing, Represents the total number of test set data. The mean absolute error (MAE) represents the average of the absolute values of the distance error between the candidate destination with the highest probability and the actual destination. It can usually accurately reflect the deviation between the predicted value and the actual value. Its calculation function expression is as follows: , , , in, To calculate the distance deviation between the time destination and the predicted destination using Haversine distance, is the radius of the Earth, , Represent the latitude and longitude of the destination point respectively. Response time refers to the time from data input to the model to output of the prediction result during the model operation, which reflects the model time performance and the use of computing resources.
[0055] 1. Model performance under different trajectory completion levels.
[0056] In a real taxi driving scenario, as the taxi travels further, the trajectory becomes more complete, which can provide more information and make the predicted destination more accurate. To verify this point, this experiment adjusts the trajectory completion parameter p The size of is used to simulate the prediction of the taxi destination based on the collected GPS trajectory. The corresponding experimental results are shown in Table 1 and Figure 6 , Figure 7 and Figure 8 shown.
[0057] Table 1: Comparison of model performance at different trajectory completion levels
[0058] Through Table 1 and Figure 6 The experimental results show that with the improvement of trajectory completion, under the same k value, the prediction accuracy shows an upward trend, MAE shows a downward trend, and the response time does not change much. This shows that the completeness of the trajectory has a significant impact on the performance of the destination prediction task. The higher the trajectory completion, the more complete the sequence information that the model can receive, so that it can more accurately predict the destination of the taxi. This finding is consistent with the intuition that more data provides more information and helps to improve the accuracy of the prediction.
[0059] 2. Ablation experiment.
[0060] In order to deeply explore the impact of hierarchical strategies, spatiotemporal coding, 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.
[0061] Table 2: Ablation Model Settings
[0062] Then experiments were conducted under the condition that the trajectory completion degree p = 70%. The specific experimental results are shown in Table 3, as well as Fig. 9 、 Fig.10 and Fig.11 as shown.
[0063] Table 3: Ablation Experiment
[0064] By analyzing the results shown in Table 3 and Fig. 9 、 Fig.10 and Fig.11 as shown, it can be clearly found that: (1) For ablation model ①, even without using the hierarchical strategy, it still has relatively good precision 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, affecting the effective recognition and analysis of trajectory features. (2) For ablation model ②, without using spatio - temporal encoding and using the traditional method to construct trajectory images, the lack of temporal information reduces the prediction accuracy. (3) For ablation model ③, without extracting multi - scale information and only extracting single - scale information, this reduces the time consumption of information extraction, but greatly reduces the precision performance.
[0065] III. Experimental Analysis of Hierarchical Grid Division Parameters
[0066] To explore the influence of grid division parameters on the 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 referred to, that is, when the urban division level of the entire experimental area is [specific level], the experimental results are the best. On this basis, the experiment further explored the influence of hierarchical grid division parameters on the model performance. That is, the first - level grid division m and the second - level grid division n satisfy m + n = 7 and m < n. The experimental results are shown in Table 4, as well as Fig.12 、 Fig.13 and Fig.14 as shown.
[0067] Table 4: Comparison of Grid Division Parameter Settings
[0068] Regarding Table 4, as well as Fig.12 、 Fig.13 and Fig.14It can be clearly seen from the analysis shown that when m=1, n=6, the model has the best accuracy performance, and m=2, n=5 and m=3, n=4 have better performance, and their accuracy performance has declined sharply. Based on this, the grid parameter setting of m=1, n=6 is selected as the parameter setting of the entire model.
[0069] 4. Comparative Experiment In order to test the performance of the hierarchical spatiotemporal embedding transformer model HST-FPT, this example selects baseline models such as CNN, T-CONV, CNN-LSTM, BiLSTM+Attention and STAN-LSTM for comparison, and all of them are compared in trajectory completion. p =70% Experiments were conducted under different conditions for comparative experiments. Among them, CNN converts trajectory data into trajectory images and extracts spatial features of the trajectory for destination prediction. T-CONV converts trajectory data into trajectory images, extracts spatial information at different scales, and performs information enhancement to predict the destination. CNN-LSTM converts trajectory data into trajectory images, first extracts spatial features of the trajectory by CNN and then extracts contextual information of the trajectory by LSTM for destination prediction. BiLSTM+Attention uses two GPS embedding methods to represent the geographic proximity and multi-scale space of the trajectory as two embedding sequences, and uses the BiLSTM+Attention mechanism to further mine motion features to predict the destination. STAN-LSTM uses the Geohash algorithm to divide the trajectory data into a grid and perform one-hot encoding, then reduces the dimension into a low-dimensional embedding vector containing geographic topological relationships, and then uses an LSTM network with a self-attention mechanism to mine the feature information to predict the destination. The experimental results of the above two comparative experiments are shown in Table 5, and Fig.15 , Fig.16 and Fig.17 shown.
[0070] Table 5: Comparison of model performance
[0071] By comparing Table 5, and Fig.15 , Fig.16 and Fig.17Through in-depth analysis of the data in , it can be found that the hierarchical spatiotemporal embedding transformer model HST-FPT has significantly improved accuracy and MAE compared with all baseline models. In terms of time performance, the hierarchical spatiotemporal embedding transformer model HST-FPT is better than other methods except the CNN method, while the accuracy performance of the CNN model is the worst. This shows that the hierarchical spatiotemporal embedding transformer model HST-FPT of this embodiment has more outstanding performance than these baseline models in processing trajectory data and capturing taxi motion characteristics.
[0072] In summary, the destination prediction method based on the hierarchical spatiotemporal embedding transformer model of this embodiment combines hierarchical spatiotemporal image construction, spatiotemporal encoding and feature pyramid transformer FPT, which can effectively capture the complex spatiotemporal patterns from the trajectory data, and provide strong support for predicting the final destination of the passenger. In the output stage of the model, the neural network outputs the probability distribution of each candidate destination, so that the user's travel destination prediction becomes more refined and personalized. Through a large number of experimental verifications on actual data sets, the model of the method of this embodiment has shown significant effectiveness in predicting passenger destinations, proving its advantages in accuracy and efficiency over traditional methods, while also taking into account good time performance.
[0073] In addition, this embodiment also provides a destination prediction system based on a hierarchical spatiotemporal embedding transformer model, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model.
[0074] In addition, this embodiment also provides a computer-readable storage medium, which stores a computer program or instruction, and the computer program or instruction is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model through a processor.
[0075] In addition, this embodiment also provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model through a processor.
[0076] Those skilled in the art should understand that the technical solutions provided by the embodiments of the present application may be in the form of methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0077] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A destination prediction method based on hierarchical spatiotemporal embedding transformer model, characterized in that: Includes the given partial trajectory and a set of candidate destinations The destination prediction is performed using the trained hierarchical spatiotemporal embedding transformer model, which includes: transforming a given partial trajectory into The corresponding area is coarse-grained gridded and spatiotemporally encoded to obtain a coarse-grained spatiotemporal trajectory image representing the approximate direction of the trajectory, and the coarse-grained spatiotemporal trajectory image is predicted by a convolutional neural network (CNN) to obtain a destination grid area; GPS trajectory points in the destination area are extracted according to the destination grid area, and the destination grid area is fine-grained gridded and spatiotemporally encoded to obtain a refined destination area trajectory image; the refined destination area trajectory image is used to extract the motion features of the GPS trajectory points in the destination area using a feature pyramid transformer (FPT), and the feature pyramid transformer (FPT) is composed of a feature pyramid network, a feature mapping module, and a Transformer encoder; the motion features of the GPS trajectory points in the destination area are used to predict a given set of candidate destinations using a fully connected network and a Softmax classifier Each candidate destination The probability of returning the specified number of candidate destinations ranked before the probability is output as the prediction result.
2. The destination prediction method based on the hierarchical spatiotemporal embedding transformer model according to claim 1 is characterized in that: The given partial trajectory The corresponding area is divided into coarse-grained grids, which means dividing the city into levels. Use the given coarse-grained parameter m to transform the given partial trajectory The corresponding area is divided into The grid unit of the destination grid area is divided into fine-grained grids, which means dividing the city into levels Use the given fine-grained parameter n to transform the given partial trajectory The corresponding area is divided into The grid cells are , and n is greater than m.
3. The destination prediction method based on the hierarchical spatiotemporal embedding transformer model according to claim 1, characterized in that: When the destination grid area is divided into fine-grained grids and space-time encoded to obtain a refined destination area trajectory image, the function expression of the space-time encoding is: , In the above formula, The grid matrix obtained by fine-grained grid division for the destination grid area Middle OK The grid area of the column, is the trajectory point number, For a given partial trajectory, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area middle.
4. The destination prediction method based on the hierarchical spatiotemporal embedding transformer model according to claim 1, characterized in that: When the coarse-grained spatiotemporal trajectory image is predicted using a convolutional neural network (CNN) to obtain a destination grid area, the convolutional neural network (CNN) predicts the destination grid area including: 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 sent to a fully connected layer for feature integration to form a higher-level abstract representation, and finally the destination grid area is predicted using a Softmax classifier.
5. The destination prediction method based on the hierarchical spatiotemporal embedding transformer model according to claim 1, characterized in that: When the destination grid area is divided into fine-grained grids and space-time encoded to obtain a refined destination area trajectory image, the function expression of the space-time encoding is: , In the above formula, The grid matrix obtained by dividing the destination grid area into fine-grained grids Middle OK The grid area of the column, is the trajectory point number, for The number of trajectory points in For the Track points, " is AND logic, express In the grid area middle.
6. The destination prediction method based on hierarchical spatiotemporal embedding transformer model according to claim 1, characterized in that: The method of extracting the motion features of GPS track points in the destination area from the refined destination area track image using the feature pyramid transformer FPT comprises: extracting the motion features of GPS track points in the destination area from the refined destination area track image using the feature pyramid network After multiple scaling convolutions, high-level feature maps at different levels are obtained; the highest-level high-level feature map Generate a new feature map through upsampling operation , and then from the new feature map To begin, any new feature map Upsample and combine with the next lower level feature map The features obtained after adjusting the dimension through 1×1 convolution are added, and then a 3×3 convolution layer is added to obtain the corresponding new feature map , and finally obtain feature maps of multiple scales ~ ; Feature maps of multiple scales ~ A flattening operation is performed to convert the one-dimensional feature vectors into one-dimensional feature vectors, and a multi-layer perceptron is used to size-map the 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 embedding are added to obtain an input vector; the input vector is input into a Transformer encoder to extract the motion features of the GPS track points in the destination area, and the Transformer encoder includes a multi-head attention network, a normalization network, a first residual connection, and N cascaded feedforward network units. After the input vector enters the multi-head attention network and the normalization network, it is used as the first input of the first residual connection, and the input vector is also used as the second input of the first residual connection. The output of the residual connection is input into N cascaded feedforward network units to obtain the motion features of the GPS track points in the destination area, and 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 as the first input of the second residual connection, and the input of the feedforward network unit is also used as the second input of the second residual connection.
7. The destination prediction method based on hierarchical spatiotemporal embedding transformer model according to claim 1, characterized in that: The hierarchical spatiotemporal embedding transformer model also includes constructing a candidate destination set before performing destination prediction :Extract the destination position of each trip in the vehicle trajectory; use the mean-shift clustering algorithm Mean-Shift to cluster the destination position set consisting of the destination positions of all trips to obtain the candidate destination set .
8. A destination prediction system based on a hierarchical spatiotemporal embedding transformer model, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model as described in any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program or instruction stored therein, characterized in that: The computer program or instruction is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model described in any one of claims 1 to 7 through a processor.
10. A computer program product comprising a computer program or instructions, characterized in that The computer program or instruction is programmed or configured to execute the destination prediction method based on the hierarchical spatiotemporal embedding transformer model described in any one of claims 1 to 7 through a processor.
Citation Information
Patent Citations
Vehicle track destination prediction method considering space-time semantics and driving state
CN113204718A
Trajectory prediction method based on fusion inverse reinforcement learning
CN114445465A
Online car-hailing demand prediction method and device, equipment and storage medium
CN117077928A
Puddle occupancy grid for autonomous vehicles
US20220185313A1