A vehicle trajectory recovery method for road segment level data loss
By combining Node2Vec and diffusion encoders, the trajectory is reconstructed using road network data, which solves the problem of poor recovery effect of sparse trajectory data, realizes high-quality trajectory data generation, and supports urban intelligent computing.
Patent Information
- Application Number
- CN202511604805.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-11-05
AI Technical Summary
Existing trajectory recovery methods are not ideal when faced with sparse and incomplete trajectory data. Generative methods are susceptible to training instability or loss of trajectory details, while non-generative methods perform poorly in complex trajectory patterns.
By acquiring vehicle trajectory data and road network data, the Node2Vec algorithm is used to represent road segment features. Combined with a diffusion encoder and co-occurrence matrix, a trajectory reconstruction model is constructed. The diffusion model's gradual denoising mechanism and global topology-aware loss function are used to achieve vectorized hybrid representation and recovery of the trajectory.
It significantly improves the quality of trajectory recovery, and the generated trajectory data is highly consistent with the actual road network, providing high-quality and complete trajectory data to support urban intelligent computing.
Smart Images

Figure CN121071433B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent transportation, and in particular to a method for vehicle trajectory recovery when road segment-level data is missing. Background Technology
[0002] With the acceleration of urbanization and the rapid development of autonomous driving technology, vehicle trajectory data is experiencing explosive growth. This data contains rich spatiotemporal information and human travel patterns, which is of great value for many location-based service applications in urban intelligent computing, such as traffic flow prediction and intelligent navigation system optimization. However, trajectory data often suffers from incompleteness due to low sampling rates and signal blockage, severely impacting its effectiveness in downstream tasks. Therefore, how to recover a complete trajectory that conforms to user patterns from incomplete and sparse trajectory data has become a critical problem that urgently needs to be solved.
[0003] Existing trajectory recovery methods can be broadly categorized into non-generative and generative methods. Non-generative methods primarily fill in missing points through interpolation and other techniques. For example, linear interpolation assumes the trajectory moves in a straight line between missing road segments, while temporal interpolation calculates location information based on timestamp changes. These methods are computationally simple and easy to implement, but when faced with complex trajectory patterns (such as sudden turns or stops), the recovery results are often less than ideal because such trajectory patterns are too rare in historical data. Generative methods, on the other hand, recover trajectories by learning trajectory distributions. Early generative methods, such as Markov models, generate trajectories based on state transition probabilities, but due to the simplification of model assumptions, the generated results are not realistic enough.
[0004] In recent years, deep learning methods such as Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs) have been introduced into the field of trajectory recovery, significantly improving recovery performance. GANs use adversarial training to make the generated trajectories gradually approximate the real trajectory distribution, while VAEs achieve recovery by encoding and decoding trajectories in the latent space. However, these methods still have shortcomings when dealing with sparse trajectories: GANs are susceptible to training instability, while VAEs may lose details of the generated trajectory due to excessive compression of the latent space. Summary of the Invention
[0005] The purpose of this invention is to provide a vehicle trajectory recovery method for situations where road segment-level data is missing, in order to solve the problem of poor recovery effect in existing trajectory recovery methods.
[0006] The above-mentioned objective of this application is achieved through the following technical solution:
[0007] S1: Acquire vehicle trajectory data and corresponding city road network data and process them to obtain a training dataset;
[0008] S2: Aggregate information on the road segments where the trajectory points in the vehicle trajectory data are located, and combine the Node2Vec algorithm to obtain a multi-dimensional vector representation of the hybrid trajectory;
[0009] S3: Based on the multidimensional vector representation, the noise distribution of the mixed trajectory data is obtained by using the forward noise addition process of the diffusion encoder;
[0010] S4: Obtain the co-occurrence matrix of the road segment, and combine it with the noise distribution of the mixed trajectory data to obtain the reconstructed mixed trajectory data;
[0011] S5: The reconstructed hybrid trajectory data is segmented along the channel, similarity is calculated and sorted, and the mobility representation is reshaped to obtain the recovered trajectory data points.
[0012] Optionally, step S1 includes:
[0013] Vehicle trajectory data is filtered and uniformly sampled to a fixed length;
[0014] The MTrajRec algorithm is used to map vehicle trajectory data onto road network data, perform map matching, and obtain test data.
[0015] The test data is masked to obtain the training dataset.
[0016] Optionally, step S2 includes:
[0017] S21: Based on the frequency of vehicle traversal through road segments, obtain a trajectory connectivity graph based on road segments, defined as follows: ,in It is a set of nodes representing road segments. It is an edge set representing the switching frequency between road segments;
[0018] S22: Obtain the trajectory connectivity graph using the Node2Vec algorithm. 3D road segment vector;
[0019] S23: Pass 3D road segment vector, calculate the movement rate of each trajectory point, and in The scaling factor within the range is calculated using the following formula:
[0020]
[0021] in Represents trajectory vector The first of all rows Column elements; Indicates the mobility rate;
[0022] S24: Concatenate the road segment vector with the mobility rate to form... A multidimensional vector is obtained, which is the multidimensional vector representation of the mixed trajectory.
[0023] Optionally, step S3 includes:
[0024] Based on the forward noise addition process of the diffusion encoder, the original vectorized multidimensional vector representation is transformed into a noisy vectorized hybrid trajectory. This process is defined as a Markov chain as follows:
[0025]
[0026] in, It is the original trajectory. It is a noisy trajectory. Represents the forward diffusion process;
[0027] Based on the forward diffusion process and its Gaussian distribution, a Markov chain is defined as:
[0028]
[0029] in, Represents the identity matrix; This represents the level of noise added during each forward diffusion process; The Gaussian distribution representing the forward diffusion process.
[0030] Optionally, step S4 includes:
[0031] S41: Based on the frequency of co-occurrence of two road segments within a preset time period, determine the co-occurrence matrix of road segments in the entire training dataset. For example, in the formula:
[0032]
[0033] in, Indicates road segment and road section The number of times they appear together; It is an index variable used to iterate through all road segments. Indicates road segment The sum of the number of times it co-occurs with all other road segments;
[0034] S42: Using the noise distribution and co-occurrence matrix of the mixed trajectory data as conditional information, the denoised data distribution is obtained, as shown in the formula:
[0035]
[0036] in and They represent the first and second denoising network estimates, respectively. The mean and variance of the steps;
[0037] Based on the denoised data distribution, the reconstructed hybrid trajectory data is determined.
[0038] Optionally, step S5 includes:
[0039] The reconstructed hybrid trajectory data is segmented along the channel;
[0040] The mixed trajectory data after channel segmentation and the above The similarity calculation and most similarity sorting of the road segment vectors are performed as follows:
[0041]
[0042]
[0043] in, Represents the similarity score. Initial characterization of the representative road segment; This represents the road segment data after channel segmentation. represent The shape and data type, here Represents the number of time steps. Indicates the total number of road segments; This represents the sorted mixed trajectory data; Indicates time At that time, road section The degree of matching with the target trajectory; This indicates the parameter corresponding to the maximum value;
[0044] The mobility after channel segmentation is reshaped, as shown in the formula:
[0045]
[0046] in, This represents the denoised trajectory vector; This represents the reshaped mobility rate.
[0047] An electronic device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to enable the electronic device to perform a vehicle trajectory recovery method for road segment-level data loss.
[0048] A computer-readable storage medium storing instructions that, when executed, perform a vehicle trajectory recovery method for road segment-level data loss.
[0049] The beneficial effects of the technical solution provided in this application are:
[0050] This invention utilizes road network constraints to transform sampled point trajectory data into discrete road segment data and continuous mobility rates, preserving both road network and sequence information. By constructing a road segment connectivity graph and employing the Node2vec algorithm for deep learning of road segment feature representations, a vectorized hybrid representation of the trajectory is achieved. During the recovery process, a co-occurrence matrix is introduced to accurately capture the spatiotemporal correlation between trajectories, and the asymptotic denoising mechanism of a diffusion model is used to gradually refine the recovery of missing trajectory segments. Simultaneously, a global topology-aware loss function is used to constrain the generated trajectory, ensuring it strictly conforms to the real road network structure. Ultimately, this invention achieves the transformation from incomplete and sparse trajectory data to complete, coherent trajectory data that highly matches the actual road network, significantly improving the quality of trajectory recovery and providing high-quality, complete trajectory data for trajectory data analysis tasks in urban intelligent computing. Attached Figure Description
[0051] The present application will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:
[0052] Figure 1 This is a step diagram of an embodiment of this application;
[0053] Figure 2 This is a schematic diagram of the framework in the embodiments of this application;
[0054] Figure 3 This is a schematic diagram of the mobility calculation method in the embodiments of this application;
[0055] Figure 4 This is a schematic diagram of the denoising network in the embodiments of this application;
[0056] Figure 5 This is a schematic diagram of the electronic device structure in the embodiments of this application. Detailed Implementation
[0057] To provide a clearer understanding of the technical features, objectives, and effects of this application, the specific embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0058] The embodiments of this application provide a method for vehicle trajectory recovery when road segment-level data is missing.
[0059] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the steps of a vehicle trajectory recovery method for missing road segment-level data in an embodiment of this application, including:
[0060] S1: Acquire vehicle trajectory data and corresponding city road network data and process them to obtain a training dataset;
[0061] S2: Aggregate information on the road segments where the trajectory points in the vehicle trajectory data are located, and combine the Node2Vec algorithm to obtain a multi-dimensional vector representation of the hybrid trajectory;
[0062] S3: Based on the multidimensional vector representation, the noise distribution of the mixed trajectory data is obtained by using the forward noise addition process of the diffusion encoder;
[0063] S4: Obtain the co-occurrence matrix of the road segment, and combine it with the noise distribution of the mixed trajectory data to obtain the reconstructed mixed trajectory data;
[0064] S5: The reconstructed hybrid trajectory data is segmented along the channel, similarity is calculated and sorted, and the mobility representation is reshaped to obtain the recovered trajectory data points.
[0065] Specifically, Figure 2 This is a schematic diagram of the algorithm model framework.
[0066] Step S1 includes:
[0067] Vehicle trajectory data is filtered and uniformly sampled to a fixed length;
[0068] The MTrajRec algorithm is used to map vehicle trajectory data onto road network data, perform map matching, and obtain test data.
[0069] The test data is masked to obtain the training dataset.
[0070] As one example, to ensure data stability and reliability, the collected taxi trajectory data was filtered, removing trajectories shorter than 120 characters. The remaining trajectory samples were then uniformly sampled to a fixed length of 200 characters, giving the data a consistent granularity in the spatial dimension, facilitating subsequent model processing and analysis. Next, road network information (road network data) was downloaded from the OpenStreetMap website using the OSMnx tool, and the MTrajRec algorithm was used to map GPS points (trajectory points) onto these road networks, achieving a tight integration of trajectory data and road network structure. To simulate trajectory loss under low sampling rate data, the test data was randomly masked at a rate of 25%, resulting in preprocessed data for model training and testing.
[0071] Step S2 includes:
[0072] S21: Based on the frequency of vehicle traversal through road segments, obtain a trajectory connectivity graph based on road segments, defined as follows: ,in It is a set of nodes representing road segments. It is an edge set representing the switching frequency between road segments;
[0073] S22: Obtain the trajectory connectivity graph using the Node2Vec algorithm. 3D road segment vector;
[0074] S23: Pass 3D road segment vector, calculate the movement rate of each trajectory point, and in The scaling factor within the range is calculated using the following formula:
[0075]
[0076] in Represents trajectory vector The first of all rows Column elements; Indicates the mobility rate;
[0077] S24: Concatenate the road segment vector with the mobility rate to form... A multidimensional vector is obtained, which is the multidimensional vector representation of the mixed trajectory.
[0078] As one example, such as Figure 3 As shown, the movement rate value for each trajectory point is calculated. Assuming the vehicle is traveling on a road segment, the movement rate is the ratio of the distance the vehicle has traveled on that segment to the total length of the segment. Specifically, when the vehicle starts moving from the beginning of the segment, the movement rate is 0; when the vehicle reaches the end of the segment, the movement rate is 1. At any position on the segment, the movement rate can be calculated by dividing the distance between the vehicle's current position and the beginning of the segment by the total length of the segment. For example, Figure 3 Points in and Located in the road sections The corresponding movement rate at different positions on the map and These represent the proportion of the distance a vehicle has traveled on that road segment relative to the total length. In this way, the movement rate dynamically reflects the vehicle's specific location and progress on the road segment.
[0079] Step S3 includes:
[0080] Based on the forward noise addition process of the diffusion encoder, the original vectorized multidimensional vector representation is transformed into a noisy vectorized hybrid trajectory. This process is defined as a Markov chain as follows:
[0081]
[0082] in, It is the original trajectory. It is a noisy trajectory. Represents the forward diffusion process;
[0083] Based on the forward diffusion process and its Gaussian distribution, a Markov chain is defined as:
[0084]
[0085] in, Represents the identity matrix; This represents the level of noise added during each forward diffusion process; The Gaussian distribution representing the forward diffusion process.
[0086] As one example, This is gradually increased to control the level of noise added in each forward step. Because Since each step is fixed, the simplification of the Gaussian process can be used to derive the given... of The distribution at each step is as follows:
[0087]
[0088] in, , ;
[0089] The following methods can be used to directly calculate using reparameterization techniques. ,as follows:
[0090]
[0091] in, , representing random noise that follows a Gaussian distribution. After multiple iterations of forward diffusion, the vectorized mixed trajectory of the noise in the final step follows a standard Gaussian distribution.
[0092] Step S4 includes:
[0093] S41: Based on the frequency of co-occurrence of two road segments within a preset time period, determine the co-occurrence matrix of road segments in the entire training dataset. For example, in the formula:
[0094]
[0095] in, Indicates road segment and road section The number of times they appear together; It is an index variable used to iterate through all road segments. Indicates road segment The sum of the number of times it co-occurs with all other road segments;
[0096] S42: Using the noise distribution and co-occurrence matrix of the mixed trajectory data as conditional information, the denoised data distribution is obtained, as shown in the formula:
[0097]
[0098] in and They represent the first and second denoising network estimates, respectively. The mean and variance of the steps;
[0099] Based on the denoised data distribution, the reconstructed hybrid trajectory data is determined.
[0100] As one embodiment, reference Figure 4 This invention uses parameters A denoising network is used to predict the mean and variance. The denoising network architecture used in this invention combines a U-Net structure with a road segment co-occurrence matrix cue. Generally, the denoising network consists of two modules: downsampling and upsampling, and a conditional module. Both the downsampling and upsampling modules consist of multiple stacked ResNet blocks, where each ResNet block contains a series of group normalization, non-linear activation, and 1D-CNN layers.
[0101] The input to the condition module is the co-occurrence matrix of road segments; if the road segment... and If road segments frequently appear simultaneously in large-scale trajectory data, they can be considered to be spatially and temporally continuous, representing geographically proximate areas. Therefore, the co-occurrence relationships of road segments extracted from a large number of trajectories can reflect the co-occurrence patterns of related trajectories within a certain timeframe. Extracting the global spatial dependencies of missing road segments from co-occurrence relationships allows the model to extract relationships between trajectories. If a missing road segment is encountered, the model can apply the road segments traversed by other trajectories to reconstruct the trajectory.
[0102] The co-occurrence matrix is flattened and passed through a fully connected layer as a cue for the denoising network. Then, an attention module is integrated into the denoising network, consisting of two ResNet blocks and an attention layer. The ResNet blocks do not contain additional downsampling / upsampling operations. The complete inverse denoising process can be described as follows:
[0103]
[0104] in It follows a standard Gaussian distribution, therefore it can be obtained through The reverse denoising process of the step predicts a noise-free vectorized trajectory representation under road network constraints in continuous space. .
[0105] Step S5 includes:
[0106] The reconstructed hybrid trajectory data is segmented along the channel;
[0107] The mixed trajectory data after channel segmentation and the above The similarity calculation and most similarity sorting of the road segment vectors are performed as follows:
[0108]
[0109]
[0110] in, Represents the similarity score. Initial characterization of the representative road segment; This represents the road segment data after channel segmentation. represent The shape and data type, here Represents the number of time steps. Indicates the total number of road segments; This represents the sorted mixed trajectory data; Indicates time At that time, road section The degree of matching with the target trajectory; This indicates the parameter corresponding to the maximum value;
[0111] The mobility after channel segmentation is reshaped, as shown in the formula:
[0112]
[0113] in, This represents the denoised trajectory vector; This represents the reshaped mobility rate.
[0114] As an example, the computational model in this instance is based on PyTorch. The physical environment in which the experiment was run was Ubuntu 20.04, trained using a single NVIDIA RTX 3080 GPU and CUDA 12.0, and the Adam optimizer was used to achieve 30 epochs and a batch size of 256.
[0115] This application also discloses an electronic device. (See reference...) Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. The electronic device 500 may include: at least one processor 501, at least one network interface 504, a user interface 503, a memory 505, and at least one communication bus 502.
[0116] The communication bus 502 is used to enable communication between these components.
[0117] The user interface 503 may include a display screen, and optionally, the user interface 503 may also include a standard wired interface or a wireless interface.
[0118] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).
[0119] This application also discloses a computer-readable storage medium storing multiple instructions adapted for loading by a processor to execute the above-described method for vehicle trajectory recovery in the event of missing road segment data.
[0120] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure.
[0121] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.
Claims
1. A method for vehicle trajectory recovery addressing missing road segment-level data, characterized in that, The method includes the following steps: S1: Acquire vehicle trajectory data and corresponding city road network data and process them to obtain a training dataset; S2: Aggregate information on the road segments where the trajectory points in the vehicle trajectory data are located, and combine the Node2Vec algorithm to obtain a multi-dimensional vector representation of the hybrid trajectory; Step S2 includes: S21: Based on the frequency of vehicle traversal through road segments, obtain a trajectory connectivity graph based on road segments, defined as follows: ,in It is a set of nodes representing road segments. It is an edge set representing the switching frequency between road segments; S22: Obtain the trajectory connectivity graph using the Node2Vec algorithm. 3D road segment vector; S23: Pass 3D road segment vector, calculate the movement rate of each trajectory point, and in The scaling factor within the range is calculated using the following formula: in Represents trajectory vector The first of all rows Column elements; Indicates the mobility rate; S24: Concatenate the road segment vector with the mobility rate to form A multidimensional vector is used to obtain a multidimensional vector representation of the mixed trajectory; S3: Based on the multidimensional vector representation, the noise distribution of the mixed trajectory data is obtained by using the forward noise addition process of the diffusion encoder; S4: Obtain the co-occurrence matrix of the road segment, and combine it with the noise distribution of the mixed trajectory data to obtain the reconstructed mixed trajectory data; S5: The reconstructed hybrid trajectory data is segmented along the channel, similarity is calculated and sorted, and the movement rate representation is reshaped to obtain the recovered trajectory data points; Step S5 includes: The reconstructed hybrid trajectory data is segmented along the channel; The mixed trajectory data after channel segmentation and the above The similarity calculation and most similarity sorting of the road segment vectors are performed as follows: in, Represents the similarity score. Initial characterization of the representative road segment; This represents the road segment data after channel segmentation. represent The shape and data type, here Represents the number of time steps. Indicates the total number of road segments; This represents the sorted mixed trajectory data; Indicates time At that time, road section The degree of matching with the target trajectory; This indicates the parameter corresponding to the maximum value; The mobility after channel segmentation is reshaped, as shown in the formula: in, This represents the denoised trajectory vector; This represents the reshaped mobility rate.
2. The vehicle trajectory recovery method for missing road segment-level data as described in claim 1, characterized in that, Step S1 includes: Vehicle trajectory data is filtered and uniformly sampled to a fixed length; The MTrajRec algorithm is used to map vehicle trajectory data onto road network data, perform map matching, and obtain test data. The test data is masked to obtain the training dataset.
3. The vehicle trajectory recovery method for missing road segment-level data as described in claim 1, characterized in that, Step S3 includes: Based on the forward noise addition process of the diffusion encoder, the original vectorized multidimensional vector representation is transformed into a noisy vectorized hybrid trajectory. This process is defined as a Markov chain as follows: in, It is the original trajectory; It is a noisy trajectory; Represents the forward diffusion process; Based on the forward diffusion process and its Gaussian distribution, a Markov chain is defined as: in, Represents the identity matrix; This represents the level of noise added during each forward diffusion process; The Gaussian distribution representing the forward diffusion process.
4. The vehicle trajectory recovery method for missing road segment-level data as described in claim 3, characterized in that, Step S4 includes: S41: Based on the frequency of co-occurrence of two road segments within a preset time period, determine the co-occurrence matrix of road segments in the entire training dataset. For example, in the formula: in, Indicates road segment and road section The number of times they appear together; It is an index variable used to iterate through all road segments. Indicates road segment The sum of the number of times it co-occurs with all other road segments; S42: Using the noise distribution and co-occurrence matrix of the mixed trajectory data as conditional information, the denoised data distribution is obtained, as shown in the formula: in and They represent the first and second denoising values estimated by the denoising network, respectively. The mean and variance of the steps; Based on the denoised data distribution, the reconstructed hybrid trajectory data is determined.
5. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, perform the method as described in any one of claims 1-4.