Road network trajectory generation method based on sequence model and diffusion model

By combining the sequence model and diffusion model, using the transfer frequency graph and Transformer encoding, combining forward diffusion and reverse denoising processes, and using the course learning strategy, the existing trajectory generation methods are solved in consistency, regularity and diversity, and the synthesis trajectory similar to the real trajectory, following the moving mode and diversified trajectory is efficiently generated.

CN120299230APending Publication Date: 2025-07-11UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510329384.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The existing trajectory generation methods have shortcomings in consistency, regularity and diversity, and it is difficult to simultaneously meet the generation of synthetic trajectories similar to the real trajectory, following the trajectory motion pattern and having diversity.

Method used

Using a combination of sequence model and diffusion model, we use the combination of the transfer frequency map and the sections that the trajectory has passed by using Transformer to encode the trajectory before, combining forward diffusion and reverse denoising processes, and using course learning strategies to train the model to achieve trajectory generation.

Benefits of technology

The balance of generation consistency, regularity and diversity is achieved, the accuracy and efficiency of trajectory generation is improved, and the topology and movement patterns of the road network can be effectively captured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120299230A_ABST
    Figure CN120299230A_ABST
Patent Text Reader

Abstract

The invention discloses a road network trajectory generation method based on a sequence model and a diffusion model, and relates to the technical field of trajectory processing, and the method comprises the following steps: S1, collecting an original road trajectory, and processing the original road trajectory by using a sequence model to obtain the output of the sequence model; s2, taking the output of the sequence model as a guide condition, and performing recovery processing by using a diffusion model; and S3, after recovery processing, training the sequence model and the diffusion model, and determining a prediction result of the road prediction task by using the trained sequence model and diffusion model. According to the method, the sequence model and the diffusion model are combined through a conditional diffusion model structure, and the consistency, regularity and diversity of the generated trajectory can be met at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of trajectory processing, and in particular to a road network trajectory generation method based on a sequence model and a diffusion model. Background Art

[0002] With the popularization of GPS devices, the movements of vehicles and individuals can be easily recorded as trajectories. The massive trajectory data has promoted the realization of many important applications, such as urban traffic planning, vehicle navigation, and route recommendation. However, there are several challenges in obtaining real-world trajectories, including high data collection costs, privacy issues, and data ownership restrictions. Trajectory generation, as a solution to these challenges, creates synthetic and realistic trajectories based on real trajectory datasets. To serve downstream applications, synthetic trajectories need to be similar to real trajectories (i.e., consistency), follow the trajectory movement pattern (i.e., continuously pass through connected sections on the road network, called regularity), and be different from each other among the generated trajectories (i.e., diversity).

[0003] Existing trajectory generation methods can be classified into two categories according to their methodologies: multi-step generation methods and one-step generation methods. Multi-step generation methods utilize sequence models, such as long short-term memory networks (LSTMs) and Transformers, to generate trajectories in an autoregressive manner (i.e., generate one section at a time and repeat the process until the entire trajectory is generated). For example, SeqGAN uses the policy gradient algorithm to train LSTMs and generative adversarial networks (GANs). Traj-VAE uses LSTMs and variational autoencoders (VAEs) to learn trajectory representations and reconstruct trajectories. TS-TrajGen uses Transformers and two GANs to generate each trajectory from coarse to fine. While one-step generation methods directly generate a complete trajectory in one step. For example, TrajGAN uses a GAN based on a convolutional neural network (CNN) to generate virtual trajectory images and then converts them into trajectories. To fully utilize the advantages of diffusion models, DiffTraj and Diff-RNTraj integrate diffusion models into U-Net and WaveNet for trajectory generation.

[0004] The multi-step generation method performs excellently in terms of consistency and regularity. This is because sequence models are good at capturing the movement patterns of real trajectories along road segments. However, they have low diversity because based on these movement patterns, they may sample the same trajectories. In contrast, the one-step generation method using diffusion models has high diversity but low consistency and regularity. This is because diffusion models recover trajectories from random noise, so it is less likely to generate the same trajectories under different movement patterns. However, diffusion models cannot capture the sequential movement patterns of trajectories along road segments. To overcome the limitations of existing research, the present invention aims to design a trajectory generation method that aims to achieve consistency, regularity, and diversity simultaneously. Summary of the Invention

[0005] To solve the above problems, the present invention proposes a road network trajectory generation method based on sequence models and diffusion models. The beneficial effects of the above further solution are: In the present invention,

[0006] The technical solution of the present invention is: A road network trajectory generation method based on sequence models and diffusion models includes the following steps:

[0007] S1. Collect the original road trajectories and process the original road trajectories using a sequence model to obtain the output of the sequence model;

[0008] S2. Use the output of the sequence model as a guiding condition and perform a recovery process using a diffusion model;

[0009] S3. After the recovery process, train the sequence model and the diffusion model, and use the trained sequence model and diffusion model to determine the prediction result of the road prediction task.

[0010] Further, S1 includes the following sub-steps:

[0011] S11. Collect the original road trajectories and generate continuous trajectory representations;

[0012] S12. According to the original road trajectories and the continuous trajectory representations, determine new input trajectories and generate new trajectory representations;

[0013] S13. Input the new trajectory representations into the sequence model to obtain the output of the sequence model.

[0014] Further, in S11, construct a transition frequency map and use the transition frequency map to generate continuous trajectory representations for the original road trajectories;

[0015] Transition Frequency Map The expression of

[0016] ;

[0017] In the formula, represents the set of urban road segments, and

[0018] represents the set of edges capturing the transfer frequencies between road segments. Furthermore, in S12, the expression for the new input trajectory

[0019] ;

[0020] In the formula, represents the starting road segment, represents the first element of the original road trajectory, represents the -th element of the original road trajectory, and

[0021] represents the number of elements in the original road trajectory.

[0022] ;

[0023] ;

[0024] ;

[0025] In the formula, represents the output of the sequence model, represents the unnormalized relationship weight between the -th and -th road segments in the trajectory, represents the representation of the -th road segment, represents the first learnable weight matrix, represents the second learnable weight matrix, represents the third learnable weight matrix, represents the position encoding at the -th position, represents the exponential function, represents the normalized relationship weight between the -th and -th road segments in the trajectory, represents the unnormalized relationship weight between the -th and -th road segments in the trajectory, represents the representation of the -th road segment, and

[0026] Further, in S2, the diffusion model includes a forward diffusion process and a reverse denoising process.

[0027] Further, the expression of the forward diffusion process is:

[0028] ;

[0029] ;

[0030] wherein, represents the distribution of the section representations after adding noise to each initial road section, represents the representation corresponding to the road section during the noise addition process from step 1 to steps, represents the initial representation of the road section in the trajectory, represents the total number of denoising steps, represents the section representation obtained by adding one more step of noise to the section representation corresponding to the step of noise addition, represents the distribution corresponding to the th forward noise addition step, represents the distribution corresponding to the th forward noise addition step, represents Gaussian noise, represents the change progress of the noise level added in the th forward step, represents the noise variance after being transformed by the identity matrix in the th step.

[0031] Further, the expression of the reverse denoising process is:

[0032] ;

[0033] ;

[0034] wherein, represents the distribution of the section representations at each step in the reverse denoising process, represents the distribution of the section representations obtained by continuing to denoise the section representation corresponding to the th step of denoising, represents the section representation after each step of denoising, represents the distribution of the fully noise-added section representations, represents the distribution corresponding to the th forward noise addition step, represents the denoising step number, represents the noise data, represents the total number of denoising steps, represents Gaussian noise, represents the mean predicted by the neural network of parameter ; represents the parameter variance predicted by the neural network of; represents the th forward noise addition step corresponding distribution, represents the identity matrix.

[0035] Furthermore, in S3, the loss function of the road prediction task is expressed as:

[0036] ;

[0037] ;

[0038] ;

[0039] ;

[0040] In the formula, represents the cross-entropy function, represents the noise level loss function, represents the sample level loss function, represents the weight, represents the trajectory length, represents the number of all road segments, represents whether the road segment generated in the th step is the true label, represents the th step, the probability that the generated road segment is the th road segment, represents the logarithmic function, represents the expected value under the simultaneous satisfaction of this time step, road segment representation, and noise distribution, represents the initial road segment representation distribution, represents the noise distribution, represents the neural network for predicting noise, represents cumulative noise since the th step, represents the output of the sequence model, represents the recovered road segment representation, represents the denoising step number.

[0041] The beneficial effects of the present invention are as follows: The present invention combines a sequence model and a diffusion model in a conditional diffusion model structure, which can simultaneously meet the consistency, regularity, and diversity of the generated trajectories. At the same time, the present invention adopts an effective method to train the model, including preparing high-quality road segment representations, learning the data distribution through the next road segment prediction task, and using the curriculum learning paradigm to accelerate model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 is a flowchart of a road network trajectory generation method based on a sequence model and a diffusion model;

[0043] Figure 2 is an effect diagram of curriculum learning;

[0044] Figure 3 is a trajectory diagram generated by a representative method on the Porto dataset;

[0045] Figure 4 is an impact diagram of the embedding dimension and the number of diffusion steps on the consistency index;

[0046] Figure 5 is an impact diagram of the difficulty level and the number of training rounds of curriculum learning on the consistency index;

[0047] Figure 6 is a downstream task diagram for trajectory anomaly detection. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] The following further describes the embodiments of the present invention with reference to the accompanying drawings.

[0049] As Figure 1 shown, the present invention provides a road network trajectory generation method based on a sequence model and a diffusion model, including the following steps:

[0050] S1. Collect the original road trajectories, and process the original road trajectories using a sequence model to obtain the output of the sequence model;

[0051] S2. Use the output of the sequence model as a guiding condition and perform restoration processing using a diffusion model;

[0052] S3. After the restoration processing, train the sequence model and the diffusion model, and use the trained sequence model and diffusion model to determine the prediction results of the road prediction task.

[0053] The present invention adopts a conditional diffusion structure, generates trajectories segment by segment like a sequence model, and combines the input of the diffusion model with the output of the sequence model when predicting the next segment based on the previously traversed segments. Specifically, the present invention uses a Transformer as the sequence model to encode the previously traversed segments of the trajectory. Different from the standard diffusion model that only takes random noise as input, the diffusion model of the present invention also uses the output of the Transformer when recovering the next segment. The idea is that the output of the Transformer can guide the diffusion model to follow the movement pattern of the trajectory (for example, tend to select segments that are connected to the previous segment on the road network), while still injecting randomness during the recovery process. In addition, in order to convert the discrete road trajectory into a continuous representation as the model input, the present invention adopts the Node2vec algorithm to learn the representation of road segments.

[0054] The present invention uses the trajectory reconstruction task to train the model, which includes the next segment prediction task and the denoising task. The next segment prediction task uses the cross-entropy loss function to encourage the Transformer and the diffusion model to work together to accurately predict the next segment of the trajectory. The present invention introduces a spatial bias to ensure that the diffusion model can only sample segments adjacent to the current segment. The denoising task uses the noise level loss function and the sample level loss function to train the diffusion model. The purpose of the noise level loss function is to minimize the difference between the artificially added noise and the noise estimated by the model, while the sample level loss function is to reduce the error between the original segment and the recovered segment representation. In addition, the present invention adopts a curriculum learning strategy to gradually increase the training difficulty from simple tasks to more challenging tasks to train the Seed, which accelerates the convergence of the model and enhances the model consistency performance.

[0055] In the embodiment of the present invention, S1 includes the following sub-steps:

[0056] S11. Collect the original road trajectory and generate a continuous trajectory representation;

[0057] S12. Determine a new input trajectory based on the original road trajectory and the continuous trajectory representation, and generate a new trajectory representation;

[0058] S13. Input the new trajectory representation into the sequence model to obtain the output of the sequence model.

[0059] In the embodiment of the present invention, in S11, construct a transition frequency map, and use the transition frequency map to generate a continuous trajectory representation for the original road trajectory;

[0060] Transition frequency map The expression of

[0061] ;

[0062] In the formula, represents the set of urban road segments, represents the set of edges capturing the transfer frequencies between road segments.

[0063] To fully utilize the advantages of the diffusion model, the discrete road segment trajectories must be transformed into continuous trajectory representations. To capture the topological structure of the road network, an attempt is made to use the Node2vec algorithm on the road network to learn the road segment embedding dictionary . However, the road network considers each pair of road segments as equally important (i.e., an unweighted graph), ignoring the user's preference for the transfer between these segments. To solve this problem, the present invention constructs a transfer frequency graph . In this way, the road segment embeddings learned based on not only retain the topological structure of the road network but also capture the transfer rules between road segments.

[0064] In the embodiment of the present invention, in S12, the expression of the new input trajectory is:

[0065] ;

[0066] In the formula, represents the starting road segment, represents the first element of the original road trajectory, represents the th element of the original road trajectory, represents the number of elements of the original road trajectory.

[0067] In the embodiment of the present invention, in S13, the expression of the sequence model is:

[0068] ;

[0069] ;

[0070] ;

[0071] In the formula, represents the output of the sequence model, represents the unnormalized relationship weight between the th road segment and the th road segment in the trajectory, represents the representation of the th road segment, represents the first learnable weight matrix, represents the second learnable weight matrix, represents the third learnable weight matrix, represents the positional encoding at the th position, represents the exponential function, represents the normalized relationship weight between the th road segment and the th road segment in the trajectory, represents the unnormalized relationship weight between the th road segment and the th road segment in the trajectory, represents the representation of the th road segment,

[0072] In the embodiment of the present invention, in S2, the diffusion model includes a forward diffusion process and a reverse denoising process.

[0073] Different from the standard diffusion model that processes the entire trajectory representation, the present invention applies it to individual road segment embeddings and operates in an autoregressive manner to enhance diversity during the generation process. The diffusion model mainly includes a forward diffusion process and a reverse denoising process. The forward process continuously adds Gaussian noise to the road segment embedding through steps, and the reverse process aims to recover the original road segment embedding from the noisy data.

[0074] In the embodiment of the present invention, the expression of the forward diffusion process is:

[0075] ;

[0076] ;

[0077] In the formula, represents the distribution of the road segment representation after adding noise to each initial road segment, represents the representation corresponding to the road segment during the noise addition process from step 1 to steps, represents the initial representation of the road segment in the trajectory, represents the total number of denoising steps, represents adding one more step of noise to the road segment representation corresponding to steps of noise addition to obtain the road segment representation, represents the th forward noise addition step corresponding distribution, represents the th forward noise addition step corresponding distribution, represents Gaussian noise, represents at the The change progress of the noise level added in each forward step, denotes the noise variance after transformation by the identity matrix in the th step.

[0078] In the embodiment of the present invention, the expression of the reverse denoising process is:

[0079] ;

[0080] ;

[0081] wherein, represents the road segment characterization distribution at each step in the reverse denoising process, represents the road segment characterization distribution obtained by continuously denoising the road segment characterization corresponding to the denoising in the th step, represents the road segment characterization after denoising at each step, represents the fully noise-added road segment characterization distribution, represents the distribution corresponding to the th forward noise-adding step, represents the denoising step number, represents the noise data, represents the total number of denoising steps, represents the Gaussian noise, represents the parameter predicted mean of the neural network, represents the parameter predicted variance of the neural network, represents the distribution corresponding to the th forward noise-adding step, represents the identity matrix.

[0082] In the embodiment of the present invention, in S3, the loss function of the road prediction task is expressed as:

[0083] ;

[0084] ;

[0085] ;

[0086] ;

[0087] wherein, represents the cross-entropy function, represents the noise level loss function, represents the sample level loss function, represents the weight, Denotes the trajectory length, Denotes the number of all road segments, Denotes whether the road segment generated at the th step is a true label, Denotes the th step, and the probability that the generated road segment at this step is the th road segment, Denotes the logarithmic function, Denotes the expected value under the simultaneous satisfaction of this time step, road segment representation, and noise distribution, Denotes the initial road segment representation distribution, Denotes the noise distribution, Denotes the neural network for predicting noise, Denotes the cumulative noise since the th step, Denotes the output of the sequence model, Denotes the restored road segment representation, Denotes the denoising step number.

[0088] In the embodiment of the present invention, the training process can be specifically described as follows: Initially, some trajectory samples are sampled from the trajectory dataset, and then the road segment representations pre-trained by the graph representation learning algorithm Node2vec are retrieved to obtain the representations of these trajectory samples. The forward noise addition process of the diffusion model will sample different degrees of noise for each trajectory, thereby adding noise to the road segment representations in each trajectory. The noise-free trajectory representation is input into the sequence model Transformer to obtain a condition, which will guide the diffusion model to predict the noise added in the previous step. Based on the predicted noise, the road segment representation of the original trajectory can be restored, and the restored error is used to train the sequence model and the diffusion model.

[0089] The forward diffusion process randomly selects a noise level to process each road segment embedding and generate noisy data . However, when the noise level is large, the data will become overly noisy, masking useful information, making model training more difficult, slowing down the convergence speed, and having a negative impact on the model performance. To solve this problem, a curriculum learning paradigm is adopted, which indicates that at the initial stage of training, the model is more sensitive to noise and difficult samples, so it can benefit from a staged training method. Specifically, in the first round of training, the noise level is set to , and in the subsequent rounds of training, the noise level is gradually increased: , where , An adjustable parameter representing the increase rate of control difficulty. This method accelerates the convergence of the model by allowing the model to first learn basic sequence patterns under lower noise. More importantly, it improves the performance of the model by providing a solid foundation in the early stage of training. To visually demonstrate the effectiveness and efficiency of curriculum learning, the experimental results on the Porto and Shenzhen datasets are shown in Figure 2 . As Figure 2 shown, the dashed line (representing the model using curriculum learning) achieves full connectivity of the generated road trajectory faster than the solid line (representing the model not using curriculum learning). In addition, the model using curriculum learning shows better accuracy under the consistency metric.

[0090] In the invention embodiment, the model inference process is as follows: First, initialize a partially generated trajectory with , send this part of the trajectory into the Transformer to obtain the guiding condition of the diffusion model, then sample the noise data, and the diffusion model continuously removes the noise in the data based on the guiding condition, that is , calculate the recovered section representation , and calculate the corresponding section , add it to the trajectory to obtain a new trajectory, and then continuously repeat the above process until the trajectory meets the specified length to generate the final trajectory. Although the diffusion model is more efficient than methods using more complex architectures (for example, DiffTraj uses UNet and Diff-RNTraj uses WaveNet), the autoregressive generation process still requires multiple denoising steps to obtain a discrete road trajectory, which is still very time-consuming. To solve this problem, the present invention adopts a non-Markov diffusion process to achieve more efficient reverse calculation. Specifically, the present invention uses a skip-step method to sample every steps instead of sampling every 1 step, thus significantly reducing the number of sampling steps in the road trajectory generation process, that is, changing from sampling steps to sampling steps. Compared with the standard diffusion model, this method can generate samples with fewer steps. The inference process of the model can be specifically described as: Initially, initialize a partially generated trajectory with . Use the number of generation steps to indicate the length of the currently generated trajectory and determine whether it meets the conditions. During the generation process, the generated partial trajectory is used as a condition to guide the diffusion model to recover the possible next road segment and add it to the current trajectory. Specifically, first sample a Gaussian noise, and then input the noise-free trajectory representation into the sequence model Transformer to obtain a condition , which will guide the diffusion model to predict the noise added in the previous step. Based on the predicted noise, part of the noise can be continuously removed. Repeat After several steps of noise reduction, the road segment representation of the original trajectory is finally restored. The restored road segment representation is used to obtain the next possible road segment and add it to the generated trajectory. After meeting the trajectory length condition, the final generated trajectory can be obtained.

[0091] The effectiveness of the present invention is demonstrated below by combining the experimental results on three real-world datasets. Table 1 shows the statistical information of the three datasets. Each dataset contains original GPS trajectories, defined as a sequence of points arranged in chronological order, and each point includes latitude, longitude, and timestamp. Specifically, the Porto dataset contains the GPS trajectories of 442 taxis in Porto, Portugal, recorded from January 2013 to June 2014, with a sampling interval of once every 15 seconds. The Shenzhen dataset contains the trajectories of 11,100 taxis from Shenzhen, China, starting from October 22, 2013, with an average sampling interval of once every 15 seconds. The Chengdu dataset contains more than 1.4 billion trajectory points of approximately 14,000 taxis from Chengdu, China, collected from August 3 to August 30, 2014, with an average sampling interval of once every 30 seconds. In the experiment, a two-day subset of the Chengdu dataset is used. The road network of each dataset comes from OpenStreetMap, and a map matching algorithm is applied to convert the GPS trajectories into road trajectories. Each road trajectory with a length of m is divided into multiple sub-trajectories with a length of n, provided that m≥n; otherwise, the trajectory will be discarded. In addition, duplicate trajectories are also filtered. Finally, for each dataset, 80% of the trajectories are randomly selected for training, and the remaining 20% of the trajectories are used for testing.

[0092] Table 1

[0093]

[0094] The present invention considers the following eight representative methods as benchmarks, including the traditional method of generating random walks (Node2vec), the recurrent methods of training sequence models based on classical GAN and VAE frameworks (SeqGAN, SVAE, TrajVAE, MoveSim, and TS-TrajGen), and the holistic methods that utilize the powerful capabilities of diffusion models (DiffTraj and Diff-RNTraj).

[0095] The main performance metrics for road trajectory generation include consistency, regularity, and diversity. Consistency measures the distribution difference between the synthetic trajectory and the real trajectory. Regularity measures the percentage of synthetic trajectories that maintain connectivity. Diversity measures the proportion of unique synthetic trajectories. For consistency, five metrics are used, namely spatial range distribution, position distribution, density distribution, road segment distribution, and road frequency distribution, and a lower value indicates better consistency. Regularity is measured by two connectivity metrics, namely full connectivity and partial connectivity, and a higher value indicates better regularity. Diversity is quantified by one metric, namely the percentage of unique trajectories in the generated trajectories, and a higher value indicates greater diversity.

[0096] The present invention uses default parameters and the Adam optimizer with a learning rate of 0.0001. The embedding dimension, the number of training epochs for curriculum learning, and the difficulty level are set as follows: 256, 50, and 3 for the Porto dataset; 128, 60, and 5 for the Shenzhen dataset; 256, 3, and 5 for the Chengdu dataset. Additionally, the number of diffusion steps is set to 500, and a linear schedule is adopted to adjust the variance schedule, with a minimum noise level of 0.0001 and a maximum noise level of 0.05.

[0097] Table 2 shows the experimental results on the Porto, Shenzhen, and Chengdu datasets. Based on these results, the following observations and analyses are made: First, the results from the Porto, Shenzhen, and Chengdu datasets indicate that the method of the present invention significantly outperforms all other state-of-the-art baseline methods in all consistency evaluation metrics. Specifically, on the Porto dataset, the method of the present invention outperforms the second-best method in terms of Radius, Location, Density, Flow, and G-rank by 91.76%, 9.09%, 30.77%, 84.00%, and 63.19% respectively. Additionally, the average improvements of the method of the present invention on the Shenzhen and Chengdu datasets are 53.06% and 42.86% respectively. Second, compared with other methods, the method of the present invention achieves a good balance between regularity and diversity. This can be attributed to several key factors: 1) By explicitly considering road connectivity and using the output of the Transformer as the condition for the diffusion model, the method of the present invention effectively captures important movement patterns and ensures the diversity of the generated trajectories. 2) The pre-trained road segment embedding dictionary and the curriculum learning paradigm help to alleviate the training difficulties and thus improve the model performance. Overall, these findings clearly demonstrate the superiority of the method of the present invention. Third, the traditional method Node2vec maintains movement regularity but fails to capture the real travel patterns, resulting in a large deviation from the original trajectories. Recursive methods, such as SeqGAN and TS-TrajGen, demonstrate better regularity than the holistic methods and outperform them in most consistency evaluation metrics. These advantages can be attributed to their ability to capture important movement patterns between road segments in an autoregressive manner. However, compared with the holistic methods, they have lower diversity because this generation method may lead to deterministic outputs when given the same partial trajectories, thus generating the same trajectories.

[0098] Table 2

[0099]

[0100] In addition, to visually show how the method of the present invention outperforms the baseline methods, the present invention plots the trajectory distributions generated by the present invention and four representative baseline methods (SeqGAN, TrajVAE, MoveSim, and TS-TrajGen) on the Porto dataset. These baseline methods are selected because they can effectively capture regularity. Since the holistic methods DiffTraj and Diff-RNTraj have poor regularity, their results are omitted. The number of road trajectories generated by all methods, including the method of the present invention, is the same as that of the real test dataset. As Figure 3As shown, the results indicate that all the generated trajectories accurately reflect the topological structure of the road network. Specifically, the trajectories generated by MoveSim and TrajVAE are aligned with the road network, capturing regularity but lacking diversity, which limits their ability to fully represent the original dataset. In contrast, SeqGAN and TS-TrajGen have better diversity and can capture more features of the dataset, but with lower regularity, resulting in incoherent generated trajectories. Notably, the method of the present invention clearly presents the geographical density in the generated trajectories, showing better results compared to the real test trajectories.

[0101] The present invention also conducts experimental analysis on the influence of four key hyperparameters on the Porto and Shenzhen datasets: the embedding dimension , the number of diffusion steps , the difficulty level of curriculum learning, and the number of training epochs. Figure 4 Shows the influence of the embedding dimension and the number of diffusion steps. Specifically, as can be seen from the Figure 4 left curve, as the embedding dimension increases, the consistency improves and eventually stabilizes. This indicates that a larger dimension may be able to fully represent the topological structure of the road network. Therefore, for the Porto and Shenzhen datasets, the dimensions of 256 and 128 are selected. As can be seen from the Figure 4 right curve, as the number of diffusion steps increases, the consistency improves; however, further increasing the number of diffusion steps may have a negative impact on the curriculum learning process, resulting in ineffective model training. Additionally, as Figure 5 shown, the consistency first decreases and then increases. This behavior occurs because both of these parameters affect the curriculum learning process. Too few training epochs or a low difficulty level will cause the model to mainly encounter easy samples, while too many training epochs or a high difficulty level will cause the model to encounter many difficult samples, both of which will hinder effective training.

[0102] Table 3 compares the average training and testing times of the present invention and five representative methods on the Porto and Chengdu datasets, including GAN-based methods (SeqGAN, MoveSim, TS-TrajGen), VAE-based methods (TrajVAE), and diffusion model-based methods (DiffTraj). In the training phase, the present invention calculates the average time per trajectory by dividing the total time by the number of trajectories. In the testing phase, the average time to generate a single trajectory is calculated. GAN-based methods need to iteratively generate synthetic trajectories to train the discriminator, so they consume more time compared to the VAE-based method TrajVAE. MoveSim and TS-TrajGen take more time than SeqGAN because MoveSim adopts matrix multiplication operations similar to GNNs, and TS-TrajGen uses the A* algorithm for road segment search. Although DiffTraj generates trajectories in a single step, its complex model design makes it less efficient than TrajVAE. In contrast, although Seed generates trajectories step by step, its simple diffusion model based on MLP significantly reduces the time consumption. In summary, the results show that the training and testing times of the present invention are moderate and ranked in the middle among the benchmark methods.

[0103] Table 3

[0104]

[0105] The next location prediction task aims to predict the next location in a movement trajectory by mining movement patterns. This task can be used to evaluate whether there are real movement patterns in the generated trajectories. Specifically, a gated recurrent unit (GRU) is used as the prediction model, and the hit rate (HR) is used as the accuracy metric. An equal number of trajectories are randomly sampled from the training set and the test set to train the model, and its accuracy is evaluated on the test set, which can be regarded as an upper limit. Then, the model is trained using the trajectories generated by various benchmark methods, and its accuracy is evaluated on the same test set. As shown in Table 4, the accuracy of the present invention is close to that of the real training set, indicating that more movement patterns are captured in the generated trajectories. In addition, the accuracy of most benchmark methods on the Porto dataset is higher than that on the Shenzhen dataset because of the greater sparsity of the Shenzhen dataset.

[0106] Table 4

[0107]

[0108] Another downstream task is trajectory anomaly detection. Trajectory anomaly detection is another key task in trajectory mining, aiming to identify trajectories that deviate significantly from the normal pattern. This task requires high-quality trajectories to accurately capture the characteristics of normal trajectories and effectively distinguish abnormal trajectories. Specifically, GM-VSAE is used as the detection model, 5% of abnormal trajectories are randomly generated, and PR-AUC is used as the evaluation metric. To construct abnormal trajectories, a parameter is used to control the proportion of road segments whose order needs to be changed in the original trajectory. For example, a parameter setting of 0.1 means that 10% of the road segments in the trajectory will change their order. In the experiment, the parameter is set to 0.2 and the official implementation of GM-VSAE is followed. The road segment embedding dimension is set to 128, and the hidden layer sizes of both the encoder and decoder are set to 512. The number of Gaussian components is set to 10. As Figure 6 shown, the model trained with the trajectories generated by the present invention performs the best, indicating that the characteristics of normal trajectories are effectively captured.

[0109] Those of ordinary skill in the art will realize that the embodiments described herein are for helping readers understand the principles of the present invention, and it should be understood that the protection scope of the present invention is not limited to such specific statements and embodiments. Those of ordinary skill in the art can make various other specific deformations and combinations that do not depart from the essence of the present invention based on the technical revelations disclosed in the present invention, and these deformations and combinations are still within the protection scope of the present invention.

Claims

1. A road network trajectory generation method based on sequence model and diffusion model, characterized in that, Including the following steps: S1. Collect the original road trajectory, and process the original road trajectory using a sequence model to obtain the output of the sequence model; S2. Use the output of the sequence model as a guiding condition and perform restoration processing using a diffusion model; S3. After the restoration processing, train the sequence model and the diffusion model, and use the trained sequence model and diffusion model to determine the prediction result of the road prediction task.

2. The method for generating road network trajectories based on sequence models and diffusion models according to claim 1, wherein, The S1 includes the following sub-steps: S11. Collect the original road trajectory and generate a continuous trajectory representation; S12. Determine a new input trajectory based on the original road trajectory and the continuous trajectory representation, and generate a new trajectory representation; S13. Input the new trajectory representation into the sequence model to obtain the output of the sequence model.

3. The method for generating road network trajectories based on sequence models and diffusion models according to claim 2, wherein, In the S11, construct a transition frequency map, and use the transition frequency map to generate a continuous trajectory representation for the original road trajectory; The transfer frequency diagram has the following expression: ; In the formula, represents the set of urban road segments, represents the set of edges capturing the transfer frequencies between road segments.

4. The method for generating road network trajectories based on sequence models and diffusion models according to claim 2, wherein In the above S12, the new input trajectory has the following expression: ; In the formula, represents the start road segment, represents the first element of the original road trajectory, represents the th element, represents the number of elements of the original road trajectory.

5. The method for generating road network trajectories based on sequence models and diffusion models according to claim 2, wherein, In the S13, the expression of the sequence model is: ; ; ; Wherein, represents the output of the sequence model, represents the th and th unnormalized relationship weights between road segments in the trajectory, represents the representation of the th road segment, represents the first learnable weight matrix, represents the second learnable weight matrix, represents the third learnable weight matrix, represents the position encoding of the th position, represents the exponential function, represents the th and th normalized relationship weights between road segments in the trajectory, represents the th and th unnormalized relationship weights between road segments in the trajectory, represents the representation of the th road segment, represents the dimension of the representation.

6. The method for generating road network trajectories based on a sequence model and a diffusion model according to claim 1, wherein, In the S2, the diffusion model includes a forward diffusion process and a reverse denoising process.

7. The method for generating road network trajectories based on sequence models and diffusion models according to claim 6, characterized in that, The expression of the forward diffusion process is: ; ; In the formula, represents the distribution of the road segment characterization after adding noise to each initial road segment, represents the characterization corresponding to the road segment during the noise addition process from step 1 to steps, represents the initial characterization of the road segment in the trajectory, represents the total number of denoising steps, represents adding one more step of noise to the road segment characterization corresponding to steps of noise addition to obtain the road segment characterization, represents the distribution corresponding to the th forward noise addition step, represents the distribution corresponding to the th forward noise addition step, represents Gaussian noise, represents the change progress of the noise level added in the th forward step, represents the noise variance after being transformed by the identity matrix in the th step.

8. The method for generating road network trajectories based on sequence models and diffusion models according to claim 6, wherein, The expression of the reverse denoising process is: ; ; In the formula, represents the road segment representation distribution at each step in the reverse denoising process, represents the road segment representation distribution obtained by continuing to denoise the road segment representation corresponding to the -th step of denoising, represents the road segment representation after each step of denoising, represents the completely noise-added road segment representation distribution, represents the distribution corresponding to the -th forward noise-adding step, represents the denoising step number, represents the noise data, represents the total number of denoising steps, represents Gaussian noise, represents the mean predicted by the neural network for the parameter , represents the variance predicted by the neural network for the parameter , represents the distribution corresponding to the -th forward noise-adding step, represents the identity matrix.

9. The method for generating road network trajectories based on a sequence model and a diffusion model according to claim 1, characterized in that In the above S3, the loss function of the road prediction task has the following expression: ; ; ; ; wherein, represents the cross - entropy function, represents the noise - level loss function, represents the sample - level loss function, represents the weight, represents the trajectory length, represents the number of all road segments, represents the whether the road segment generated at the th step is a true label, represents the probability that the road segment generated at the th step is the th road segment, represents the natural logarithm function, represents the expected value under the condition of simultaneously satisfying the time step, road - segment representation, and noise distribution, represents the initial road - segment representation distribution, represents the noise distribution, represents the accumulated noise since the th step, represents the initial representation of the road segment in the trajectory, represents the output of the sequence model, represents the denoising step number.

Citation Information

Cited By

  • Road network track generation method and device and storage medium

    CN122088570A

  • A road network trajectory generation method and device and a storage medium

    CN122088570B