Training method and device of road trajectory generation model and computer equipment
By acquiring and processing sample data of road network structure maps and historical trajectory routes, and utilizing coding strategies and model adjustment techniques, the problem of low accuracy in trajectory generation in existing technologies has been solved, achieving high-precision road trajectory prediction.
Patent Information
- Application Number
- CN202611146738.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-11-03
AI Technical Summary
Existing technologies cannot accurately output continuous GPS point trajectories when generating road trajectories, resulting in low generation accuracy and a lack of location modeling mechanisms within road segments.
By acquiring the road network structure map and historical trajectory routes of the target area, converting them into sample data, generating coded representation information using a trajectory sequence coding strategy, and making predictions using an initial road trajectory generation model, the model is adjusted by combining prediction deviation information to ensure that trajectory points are determined by road geometry and the proportion of the traveled road, avoiding deviations and achieving fine-grained location modeling.
It improves the accuracy of trajectory and road generation, eliminates errors introduced by map matching post-processing, ensures the accuracy of model training, and can comprehensively improve the accuracy of trajectory prediction.
Smart Images

Figure CN123030951A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of spatiotemporal trajectory data processing technology, and in particular to a training method, apparatus and computer equipment for a road trajectory generation model. Background Technology
[0002] GPS trajectory data is a core data foundation for characterizing the spatiotemporal behavior of moving objects, and is widely used in tasks such as urban traffic analysis, travel behavior research, route selection modeling, traffic condition assessment, and location prediction. High-quality trajectory data can accurately reflect the spatial location changes and temporal evolution patterns during movement, and is an important support for data-driven traffic research and applications. With the development of urban sensing and location service technologies, the acquisition and sharing of real trajectory data faces multiple limitations: on the one hand, real trajectory data suffers from privacy sensitivities, limited acquisition channels, unstable data quality, positioning noise, and missing segments, making it difficult for researchers to obtain large-scale, shareable, and reproducible high-quality datasets; on the other hand, synthetic trajectory generation technology is gradually becoming an important way to solve the data shortage problem.
[0003] Traditional trajectory data generation methods typically use a road-level generation framework based on a sequential navigation decision-making process. This framework progressively selects the next road segment based on road topology and navigation semantics, generating a structurally valid road sequence. However, the output remains at the discrete road segment level, lacking a location modeling mechanism within road segments. It cannot directly output continuous GPS point trajectories under road constraints, resulting in low accuracy in generating trajectory roads. Summary of the Invention
[0004] Therefore, it is necessary to provide a training method, apparatus, computer equipment, computer-readable storage medium, and computer program product for a road trajectory generation model to address the aforementioned technical problems.
[0005] Firstly, this application provides a training method for a road trajectory generation model, including:
[0006] Obtain the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route;
[0007] Based on the road network structure diagram and sample data of each real route, the coded representation information of each real route is generated through a trajectory sequence coding strategy, and based on the coded representation information of each real route, the predicted trajectory data of each real route is generated through an initial road trajectory generation model.
[0008] Based on the sample data of each real route and the predicted trajectory data of each route, the prediction deviation information of the initial road trajectory generation model is identified, and the initial road trajectory generation model is adjusted based on the prediction deviation information to obtain the road trajectory generation model.
[0009] Optionally, converting the historical trajectory routes into sample data of each real route includes:
[0010] The historical trajectory route is broken down into trajectory route data of each real route. For each real route, trajectory point matching is performed on the road network structure map based on the real route to obtain the road trajectory sequence corresponding to the real route and the trajectory timestamp sequence corresponding to the real route.
[0011] Based on the road trajectory sequence, the percentage sequence of travel roads corresponding to the actual route is calculated using a road data algorithm;
[0012] Based on the road trajectory sequence corresponding to the real route, the trajectory timestamp sequence corresponding to the real route, and the travel road percentage sequence corresponding to the real route, a trajectory triplet sequence of the real route is constructed, and the trajectory triplet sequence is used as sample data of the real route.
[0013] Optionally, the step of generating encoded representation information for each of the real routes based on the road network structure map and sample data of each of the real routes, using a trajectory sequence encoding strategy, includes:
[0014] For each real route, based on the road trajectory sequence corresponding to the real route, a road-level coding representation of the real route is generated using a road-level coding strategy;
[0015] In the road network structure map, the traffic functional area to which the actual route belongs is queried, and the road network structure map of the traffic functional area is processed by regional coding to obtain the regional coding representation corresponding to the actual route;
[0016] The road code representation corresponding to the real route and the area code representation corresponding to the real route are fused together to obtain the code representation information of the real route.
[0017] Optionally, the step of generating predicted trajectory data for each of the real routes based on the encoded representation information of each of the real routes, through an initial road trajectory generation model, includes:
[0018] In the encoded representation information of each of the real routes, the sub-encoded representation information corresponding to the starting point is filtered out;
[0019] Based on the sub-encoded representation information of the starting point, a sequence of predicted trajectory triples for the actual route is generated through the initial road trajectory generation model.
[0020] The predicted trajectory triplet sequence is used as the predicted trajectory data of the actual route.
[0021] Optionally, identifying the prediction bias information of the initial road trajectory generation model based on the sample data of each of the real routes and the predicted trajectory data includes:
[0022] For each real route, based on the sample data of the real route and the predicted trajectory data, the prediction deviation data of the initial road trajectory generation model in each objective is calculated using a multi-objective loss function;
[0023] Based on the prediction deviation data of each target corresponding to each predicted trajectory data, a total loss function corresponding to each predicted trajectory data is constructed, and the total loss function corresponding to all predicted trajectory data is used as the prediction deviation information of the initial road trajectory generation model.
[0024] Optionally, adjusting the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model includes:
[0025] Based on the total loss function corresponding to each predicted trajectory data, the target model parameters for training the initial road trajectory generation model are adjusted to obtain the new target model parameters for the initial road trajectory generation model.
[0026] Based on the new target model parameters of the initial road trajectory generation model, the road trajectory generation model is obtained by adjusting all model parameters of the initial road trajectory generation model through a backpropagation strategy.
[0027] Secondly, this application also provides a training device for a road trajectory generation model, comprising:
[0028] The acquisition module is used to acquire the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route;
[0029] The generation module is used to generate coded representation information of each real route based on the road network structure map and sample data of each real route, through a trajectory sequence coding strategy, and generate predicted trajectory data of each real route based on the coded representation information of each real route through an initial road trajectory generation model.
[0030] The training module is used to identify the prediction deviation information of the initial road trajectory generation model based on the sample data of each of the real routes and the predicted trajectory data of each of the real routes, and to adjust the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model.
[0031] Optionally, the acquisition module is specifically used for:
[0032] The historical trajectory route is broken down into trajectory route data of each real route. For each real route, trajectory point matching is performed on the road network structure map based on the real route to obtain the road trajectory sequence corresponding to the real route and the trajectory timestamp sequence corresponding to the real route.
[0033] Based on the road trajectory sequence, the percentage sequence of travel roads corresponding to the actual route is calculated using a road data algorithm;
[0034] Based on the road trajectory sequence corresponding to the real route, the trajectory timestamp sequence corresponding to the real route, and the travel road percentage sequence corresponding to the real route, a trajectory triplet sequence of the real route is constructed, and the trajectory triplet sequence is used as sample data of the real route.
[0035] Optionally, the generation module is specifically used for:
[0036] For each real route, based on the road trajectory sequence corresponding to the real route, a road-level coding representation of the real route is generated using a road-level coding strategy;
[0037] In the road network structure map, the traffic functional area to which the actual route belongs is queried, and the road network structure map of the traffic functional area is processed by regional coding to obtain the regional coding representation corresponding to the actual route;
[0038] The road code representation corresponding to the real route and the area code representation corresponding to the real route are fused together to obtain the code representation information of the real route.
[0039] Optionally, the generation module is specifically used for:
[0040] In the encoded representation information of each of the real routes, the sub-encoded representation information corresponding to the starting point is filtered out;
[0041] Based on the sub-encoded representation information of the starting point, a sequence of predicted trajectory triples for the actual route is generated through the initial road trajectory generation model.
[0042] The predicted trajectory triplet sequence is used as the predicted trajectory data of the actual route.
[0043] Optionally, the training module is specifically used for:
[0044] For each real route, based on the sample data of the real route and the predicted trajectory data, the prediction deviation data of the initial road trajectory generation model in each objective is calculated using a multi-objective loss function;
[0045] Based on the prediction deviation data of each target corresponding to each predicted trajectory data, a total loss function corresponding to each predicted trajectory data is constructed, and the total loss function corresponding to all predicted trajectory data is used as the prediction deviation information of the initial road trajectory generation model.
[0046] Optionally, the training module is specifically used for:
[0047] Based on the total loss function corresponding to each predicted trajectory data, the target model parameters for training the initial road trajectory generation model are adjusted to obtain the new target model parameters for the initial road trajectory generation model.
[0048] Based on the new target model parameters of the initial road trajectory generation model, the road trajectory generation model is obtained by adjusting all model parameters of the initial road trajectory generation model through a backpropagation strategy.
[0049] Thirdly, this application provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in any one of the first aspects.
[0050] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in any one of the first aspects.
[0051] Fifthly, this application provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method described in any one of the first aspects.
[0052] The aforementioned training method, apparatus, and computer equipment for the road trajectory generation model acquire a road network structure map of the target area and historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route. Based on the road network structure map and the sample data of each real route, an encoded representation information of each real route is generated through a trajectory sequence encoding strategy. Based on the encoded representation information of each real route, predicted trajectory data of each real route is generated through an initial road trajectory generation model. Based on the sample data of each real route and the predicted trajectory data, the prediction deviation information of the initial road trajectory generation model is identified, and the initial road trajectory generation model is adjusted based on the prediction deviation information to obtain the road trajectory generation model. This scheme, by converting historical trajectory routes of the target area into sample data of each real route, wherein each sample data is a triplet representation information of the proportion of road segments and traveling roads, embeds road network constraints into the generation process. Each trajectory point is determined by road geometry and the proportion of traveling roads, fundamentally avoiding the problem of trajectory points deviating from the road, eliminating the need for additional map matching post-processing, and eliminating the secondary error introduced by post-processing. Secondly, this scheme uses a trajectory sequence encoding strategy to achieve fine-grained location modeling within road segments by measuring the proportion of continuously traveling roads, while ensuring the connectivity of road topology. Finally, when adjusting the model, this scheme incorporates deviation data analysis of different targets, thereby comprehensively adjusting the deviations of various parts of the model from multiple perspectives, ensuring the accuracy of model training, and enabling trajectory prediction based on this model to comprehensively improve the accuracy of trajectory road generation. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a flowchart illustrating the training method of a road trajectory generation model in one embodiment;
[0055] Figure 2 This is a flowchart illustrating a training example of a road trajectory generation model in one embodiment;
[0056] Figure 3 This is a structural block diagram of a training device for a road trajectory generation model in one embodiment;
[0057] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0059] The training method for the road trajectory generation model provided in this application embodiment can be applied to a road trajectory generation model training system. This system can be applied to a terminal, which can be, but is not limited to, various personal computers, laptops, mid-range computers, etc. Specifically, the terminal converts historical trajectory routes of the target area into sample data of each real route. Each sample data point is represented by a triplet of road segment and travel road percentage information, thus embedding road network constraints into the generation process. Each trajectory point is jointly determined by road geometry and travel road percentage, fundamentally avoiding the problem of trajectory points deviating from the road. No additional map matching post-processing is required, eliminating secondary errors introduced by post-processing. Secondly, this scheme uses a trajectory sequence encoding strategy to achieve fine-grained position modeling within road segments by continuously calculating the travel road percentage, while ensuring road topological connectivity. Finally, when adjusting the model, this scheme incorporates deviation data analysis of different targets, thereby comprehensively adjusting the deviations of various parts of the model from multiple angles, ensuring the accuracy of model training, and enabling trajectory prediction based on this model to comprehensively improve the accuracy of trajectory road generation.
[0060] In one exemplary embodiment, such as Figure 1 As shown, a training method for a road trajectory generation model is provided. Taking the application of this method to a terminal as an example, the method includes the following steps S101 to S103. Wherein:
[0061] Step S101: Obtain the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route.
[0062] In this embodiment, in response to the information upload operation by the staff, the terminal obtains a road network structure map of the target area selected by the user. This target area can be a city commercial center area, a city ring road area, or a multi-road intersection area. The road network structure map is a planar road distribution map mainly containing the user's travel routes within the target area. Then, the terminal extracts the trajectory data of each real route within a preset time period from the historical trajectory database, as historical trajectory routes. This historical trajectory database stores actual trajectory data of multiple routes recorded in different areas. Each route is a real route, and each actual trajectory data point is the actual user's travel trajectory corresponding to that route. Each actual trajectory data point includes the timestamp of each trajectory point, the travel distance of each trajectory point on the road segment, the ratio of the distance to the road segment length (i.e., the proportion of the traveled road), and the location information of each trajectory point. Next, the terminal constructs a triplet from the sum of the timestamps, the proportion of the traveled road, and the location information of the actual trajectory data, and arranges them according to the trajectory order to obtain sample data. The specific construction process will be explained in detail later.
[0063] Step S102: Based on the road network structure map and sample data of each real route, generate the coded representation information of each real route through the trajectory sequence coding strategy, and generate the predicted trajectory data of each real route through the initial road trajectory generation model based on the coded representation information of each real route.
[0064] In this embodiment, the terminal generates coded representation information for each real route based on the road network structure map and sample data of each real route through a trajectory sequence coding strategy. Based on this coded representation information, the terminal generates predicted trajectory data for each real route through an initial road trajectory generation model. The trajectory sequence coding strategy includes road-level coding and region-level coding. Road-level coding enables the model to understand the structural role and traffic characteristics of different road segments within the local road network, while region-level coding enables the model to simultaneously possess local path decision-making capabilities and global destination guidance capabilities. The specific coding process will be explained in detail later. The initial road trajectory generation model is the model constructed in this solution for generating road trajectory routes. This model includes a road network coding module, a trajectory coding module, and a navigator. The road network coding module implements both road-level and region-level coding. The trajectory coding module integrates the coded representation information obtained from the above coding and, according to the order of trajectory points, sequentially generates trajectory information for the next trajectory point, including the timestamp of the trajectory point, the proportion of the traveled road, and location information. This navigator is used to compare and filter the aforementioned road data, selecting the best road data suitable for the next trajectory point as the target road data for that trajectory point, thereby obtaining the overall predicted trajectory data step by step.
[0065] Step S103: Based on the sample data of each real route and the predicted trajectory data, identify the prediction deviation information of the initial road trajectory generation model, and adjust the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model.
[0066] In this embodiment, the terminal identifies the prediction deviation information of the initial road trajectory generation model based on sample data of each real route and each predicted trajectory data. Based on this prediction deviation information, the terminal adjusts the initial road trajectory generation model to obtain the final road trajectory generation model. The prediction deviation information is the total loss function obtained by summarizing the deviation information of each objective for each predicted trajectory data. These objectives include, but are not limited to, road selection classification loss, time increment regression loss, and travel road proportion regression loss. The above loss calculation formula will be explained in detail later. The adjustment process involves first adjusting the corresponding model parameters in the initial road trajectory generation model based on the prediction deviation information, and then adjusting all model parameters through backpropagation technology. The specific adjustment process will be explained in detail later.
[0067] Based on the above scheme, historical trajectory routes in the target area are transformed into sample data of each real route. Each sample data point is represented by a triplet of road segment and travel road percentages, thus embedding road network constraints into the generation process. Each trajectory point is determined by both road geometry and travel road percentage, fundamentally avoiding the problem of trajectory points deviating from the road. This eliminates the need for additional map matching post-processing and removes secondary errors introduced by post-processing. Secondly, this scheme uses a trajectory sequence encoding strategy to achieve fine-grained location modeling within road segments by continuously calculating the travel road percentage, while ensuring road topological connectivity. Finally, when adjusting the model, this scheme incorporates deviation data analysis for different targets, comprehensively adjusting the deviations of various parts of the model from multiple perspectives. This ensures the accuracy of model training, enabling trajectory prediction based on this model to comprehensively improve the accuracy of trajectory road generation.
[0068] Optionally, the historical trajectory routes are transformed into sample data for each real route, including: splitting the historical trajectory routes into trajectory route data for each real route, and for each real route, performing trajectory point matching in the road network structure map based on the real route to obtain the road trajectory sequence and the trajectory timestamp sequence corresponding to the real route; calculating the travel road percentage sequence corresponding to the real route using a road data algorithm based on the road trajectory sequence, the trajectory timestamp sequence, and the travel road percentage sequence corresponding to the real route to construct the trajectory triplet sequence of the real route, and using the trajectory triplet sequence as sample data for the real route.
[0069] In this embodiment, the terminal breaks down the historical trajectory route into trajectory route data for each real route. For each real route, it performs trajectory point matching in the road network structure map based on the real route to obtain the road trajectory sequence and the trajectory timestamp sequence corresponding to the real route. Then, based on the road trajectory sequence, the terminal calculates the travel road percentage sequence corresponding to the real route using a road data algorithm. Specifically, the terminal breaks down the above road trajectory sequence into road segments corresponding to each trajectory point. Then, based on the polygonal geometric sequence of the road segment and the total length Ls, the terminal calculates the ratio of the cumulative length along the road arc length direction of the trajectory point to the total length, obtaining the normalized travel road percentage ri, i.e., the road percentage sequence of each trajectory point. Finally, the terminal arranges the road percentage sequences of each trajectory point according to the order of the trajectory points to obtain the travel road percentage sequence.
[0070] Finally, the terminal constructs a sequence of trajectory triplets for the real route based on the road trajectory sequence, the trajectory timestamp sequence, and the percentage of traveled roads corresponding to the real route. This sequence of trajectory triplets is then used as sample data for the real route. The triplets are constructed using the formula (road segment - percentage of traveled roads - timestamp), with the specific formula as follows:
[0071] gt=(si,ri,ti)
[0072] In the above formula, si: the directed road segment to which the i-th trajectory point belongs, ensuring that the point is always in a legal road network structure; ri: the relative proportion of the i-th trajectory point on the road segment to which it belongs, a scalar with a value range of [0,1], representing the normalized position along the road arc length direction; ti: the timestamp corresponding to the i-th trajectory point, characterizing the temporal evolution and dynamic behavior of the trajectory.
[0073] For any road segment *s*, let its geometry be represented by a polyline point sequence *Ps={(xk,yk)}k=1Ks*, with a total arc length of *Ls*. Given the proportion of the traveled road *r*, the corresponding GPS coordinates are obtained by interpolating the arc length along the road polyline:
[0074] p(s,r)=Interp(Ps,r⋅Ls)
[0075] Interp(⋅) is a linear interpolation function along the polygonal line based on the cumulative arc length. Since the coordinates are entirely determined by the road geometry and the proportion of the road being traveled, the generated trajectory points are strictly located on the road segment, thus eliminating the problem of deviating from the road.
[0076] Based on the above scheme, by transforming the trajectory data of each real route into triples, the road network constraints are embedded in the generation process. Each trajectory point is determined by the road geometry and the proportion of the traveling road, which fundamentally avoids the problem of trajectory points deviating from the road. No additional map matching post-processing is required, and the secondary error introduced by post-processing is eliminated.
[0077] Optionally, based on the road network structure map and sample data of each real route, the coded representation information of each real route is generated through a trajectory sequence coding strategy. This includes: for each real route, generating a road coded representation corresponding to the real route based on the road trajectory sequence corresponding to the real route through a road-level coding strategy; querying the traffic functional area to which the real route belongs in the road network structure map, and performing regional coding processing on the road network structure map of the traffic functional area to obtain the regional coded representation corresponding to the real route; and fusing the road coded representation corresponding to the real route and the regional coded representation corresponding to the real route to obtain the coded representation information of the real route.
[0078] In this embodiment, for each real route, the terminal generates a road-coded representation based on the road trajectory sequence corresponding to the real route using a road-level coding strategy. Specifically, the road coding strategy is implemented as follows: the terminal abstracts each directed road segment in the urban road network as a graph node. If two road segments satisfy the connectivity relationship of the travel direction at the intersection, a directed edge is constructed between the corresponding nodes to form a road-level topology graph. Then, the terminal uses a graph attention network (GATv2) to learn features from the road graph. Through a multi-head attention mechanism, it aggregates the neighborhood information of each node, captures semantic attributes such as road connectivity, navigation directionality, local topology, road level, and speed limit, and outputs a fixed-dimensional road-level embedding vector eroad.
[0079] Then, the terminal queries the traffic functional area to which the actual route belongs in the road network structure map, and performs regional encoding processing on the road network structure map of the traffic functional area to obtain the regional encoded representation of the actual route. Each traffic functional area is a region divided according to speed and mode of travel, such as expressway areas, national highway areas, and provincial highway areas. The regional encoding process involves the terminal constructing a traffic flow adjacency matrix between regions based on the location information of the road trajectory sequence of the actual route within that traffic functional area, representing the travel correlation strength between different regions. Then, the terminal uses a graph convolutional network (GCN) to extract features from the regional adjacency matrix, obtaining a region-level embedding vector ezone.
[0080] Finally, the terminal fuses the road-encoded representations and region-encoded representations corresponding to the real route to obtain the coded representation information of the real route. This fusion process involves concatenating the road-level coded representations of the road segments corresponding to each trajectory point with the proportion of the traveled road at each trajectory point to obtain a proportionally enhanced road-level representation. The terminal then fuses the proportionally enhanced road-level representation with the region-encoded representation of the corresponding area using a gating fusion unit to obtain a point-level spatial representation. Next, the terminal performs Fourier encoding on the temporal information of the trajectory points to obtain temporal features. The terminal fuses the point-level spatial representation with the temporal features and arranges them into a trajectory sequence in chronological order. This sequence is then input into a Transformer with a decoder-only structure for sequence modeling. Combined with relative position encoding based on road distance and time interval, the terminal outputs a trajectory context coded representation (i.e., coded representation information). The relative position encoding is calculated based on the difference between the shortest path distance and the time interval between any two trajectory points in the trajectory sequence. Encoding the distance and time features and incorporating them into the Transformer's self-attention calculation enhances the spatiotemporal continuity modeling of the trajectory.
[0081] Specifically, during click feature fusion, for the i-th trajectory point in the real route:
[0082] 1. Scale Enhancement: The road-level embedding eiroad corresponding to the point is concatenated with the proportion of the traveled road ri to obtain a scale-enhanced road-level representation, enabling the encoding to distinguish different locations on the same road segment.
[0083] e~iroad=[eiroad;ri]
[0084] 2. Gated fusion: The scaled-up road-level representation and the region-level representation of the area to which the point belongs are embedded into the eizone input gated fusion unit to adaptively fuse local and global spatial features.
[0085] αi=σ(MLP([e~iroad;eizone]))
[0086] eispatial=e~iroad+αi⋅eizone
[0087] Where σ is the Sigmoid activation function, MLP is a two-layer multilayer perceptron, αi is the gating weight used to control the fusion strength of region-level features, and eispatial is the point-level spatial representation after fusion.
[0088] 3. Time encoding: Fourier encoding is used to encode the timestamp ti to capture the daily and weekly time patterns of travel, and obtain the time feature eitime.
[0089] 4. Point-level representation: The spatial representation is concatenated with the temporal features to obtain the final point-level feature eipoint=[eispatial;eitime].
[0090] Based on the above scheme, the dual-layer spatial coding takes into account both local topological features and macro-functional correlations, the destination-oriented navigation mechanism matches real travel behavior, and combined with time dynamic modeling, the generated trajectory is highly consistent with real data in terms of spatial distribution, speed characteristics, and travel patterns.
[0091] Optionally, based on the encoded representation information of each real route, a predicted trajectory data for each real route is generated through an initial road trajectory generation model, including: filtering the sub-encoded representation information corresponding to the starting point from the encoded representation information of each real route; generating a sequence of predicted trajectory triples for the real route through the initial road trajectory generation model based on the sub-encoded representation information of the starting point; and using the sequence of predicted trajectory triples as the predicted trajectory data for the real route.
[0092] In this embodiment, the terminal filters the sub-encoding representation information corresponding to the starting point from the encoding representation information of each real route. Specifically, the sub-encoding representation information corresponding to the starting point is the sub-encoding representation information corresponding to the trajectory point that is ranked first among the trajectory points in the aforementioned encoding representation information.
[0093] Then, based on the sub-encoded representation information of the starting point, the terminal generates a sequence of predicted trajectory triples for the real route through an initial road trajectory generation model. Finally, the terminal uses the sequence of predicted trajectory triples as the predicted trajectory data for the real route. Based on the road segment to which the sub-encoded representation information of the starting point belongs, the terminal filters out a set of all reachable next candidate road segments according to the directed connectivity of the road map, ensuring topological legality in the candidate space and avoiding illegal transfers. Next, for each candidate road segment c, the terminal extracts its geometric features from the target destination region, including the Euclidean distance from the endpoint of the candidate road segment to the target point, directional deviation, road level, etc. Then, the terminal fuses the trajectory context query vector qi, the embedded representation of the target destination region, the road-level embedding of the candidate road segment, and the geometric features, and calculates the transfer score ℓi+1(c) of the candidate road segment through an additive attention mechanism. After normalization using the Softmax function, the transfer probability of each candidate road segment is obtained. This mechanism ensures that the generated path, while satisfying local connectivity, moves towards the target destination as a whole, conforming to the destination-oriented behavior characteristics of real human travel. For each candidate road segment, the terminal fuses the trajectory context query vector with the candidate road segment features, inputs it into a multilayer perceptron (MLP), and outputs the next step's time increment prediction value Δti+1. Time increment prediction ensures the continuity and reasonableness of the trajectory's time dimension, and can simulate the differences in driving speeds under different road segments and traffic conditions. Next, for each candidate road segment c, the terminal concatenates the query vector qi with the transition score ℓi+1(c) of that candidate road segment, inputs it into a lightweight multilayer perceptron, and outputs the predicted proportion of travel on that candidate road segment after passing through a sigmoid activation function.
[0094] ri+1(c)=σ(MLP([qi;ℓi+1(c)]))
[0095] The above-mentioned prediction of the proportion of travel routes relies on historical trajectory context, target travel intention and local road segment transfer preferences to ensure the rationality of the distribution of generated points on the path and the continuity of movement.
[0096] Based on the above scheme, while ensuring the connectivity of the road topology, fine-grained location modeling within road segments is achieved through continuous location ratios. This can directly output high-precision continuous GPS point trajectories, thereby improving the accuracy of fine-grained traffic analysis at the road segment level.
[0097] Optionally, based on the sample data of each real route and the predicted trajectory data, the prediction bias information of the initial road trajectory generation model is identified, including: for each real route, based on the sample data of the real route and the predicted trajectory data, the prediction bias data of the initial road trajectory generation model in each objective is calculated through a multi-objective loss function; based on the prediction bias data of each objective corresponding to each predicted trajectory data, a total loss function corresponding to each predicted trajectory data is constructed, and the total loss function corresponding to all predicted trajectory data is used as the prediction bias information of the initial road trajectory generation model.
[0098] In this embodiment, for each real route, the terminal calculates the prediction bias data of the initial road trajectory generation model for each objective based on the sample data of the real route and the predicted trajectory data, using a multi-objective loss function. Specifically, the road selection classification loss Lroad uses cross-entropy loss to supervise the classification prediction of the next road segment; the time increment regression loss Ltime uses mean squared error (MSE) loss to supervise the regression prediction of the time increment; and the position ratio regression loss Lratio uses mean squared error loss to supervise the prediction of the position ratio within the road segment. The calculation formula is as follows:
[0099] Lratio=N1∑i=1N∥r^i+1−ri+1∥22
[0100] Where N is the total number of trajectory points in the training samples, r^i+1 is the proportion of predicted positions, and ri+1 is the true label.
[0101] Then, based on the prediction deviation data of each target corresponding to each predicted trajectory data, the terminal constructs a total loss function for each predicted trajectory data, and uses the total loss function corresponding to all predicted trajectory data as the prediction deviation information of the initial road trajectory generation model. This total loss function is in the form of a weighted summation:
[0102] Ltotal=λ1Lroad+λ2Ltime+λ3Lratio
[0103] Where λ1, λ2, and λ3 are hyperparameter weights, which can be adjusted according to task requirements.
[0104] Based on the above scheme, by conducting deviation analysis from different target perspectives and then obtaining the total loss function, the accuracy and comprehensiveness of identifying model prediction deviations are improved.
[0105] Optionally, based on the prediction bias information, the initial road trajectory generation model is adjusted to obtain the road trajectory generation model, including: adjusting the target model parameters of the initial road trajectory generation model based on the total loss function corresponding to each predicted trajectory data to obtain the new target model parameters of the initial road trajectory generation model; and adjusting all model parameters of the initial road trajectory generation model through a backpropagation strategy based on the new target model parameters of the initial road trajectory generation model to obtain the road trajectory generation model.
[0106] In this embodiment, the terminal adjusts the target model parameters of the initial road trajectory generation model based on the total loss function corresponding to each predicted trajectory data, obtaining new target model parameters for the initial road trajectory generation model. The adjustment of these target model parameters employs the Adam optimizer for parameter updates, resulting in new target model parameters based on the initial road trajectory generation model. Finally, the terminal adjusts all model parameters of the initial road trajectory generation model using a backpropagation strategy, obtaining the road trajectory generation model. This backpropagation strategy is a method for adaptively adjusting model parameters based on backpropagation technology.
[0107] Based on the above scheme, the model is optimized by an optimizer and then global model optimization is performed by backpropagation, which effectively improves the model training efficiency while ensuring the accuracy of model training.
[0108] This application also provides a training example of a road trajectory generation model, such as... Figure 2 As shown, the specific processing procedure includes the following steps:
[0109] Step S201: Obtain the road network structure map of the target area and the historical trajectory route of the target area.
[0110] Step S202: The historical trajectory route is split into trajectory route data of each real route, and for each real route, trajectory point matching is performed in the road network structure map based on the real route to obtain the road trajectory sequence corresponding to the real route and the trajectory timestamp sequence corresponding to the real route.
[0111] Step S203: Based on the road trajectory sequence, calculate the sequence of the proportion of traveled roads corresponding to the actual route using a road data algorithm.
[0112] Step S204: Based on the road trajectory sequence corresponding to the real route, the trajectory timestamp sequence corresponding to the real route, and the travel road percentage sequence corresponding to the real route, construct the trajectory triplet sequence of the real route, and use the trajectory triplet sequence as sample data of the real route.
[0113] Step S205: For each real route, based on the road trajectory sequence corresponding to the real route, generate the road code representation corresponding to the real route through a road-level coding strategy.
[0114] Step S206: In the road network structure map, query the traffic functional area to which the actual route belongs, and perform area coding processing on the road network structure map of the traffic functional area to obtain the area code representation corresponding to the actual route.
[0115] Step S207: The road code representation corresponding to the real route and the area code representation corresponding to the real route are fused to obtain the code representation information of the real route.
[0116] Step S208: In the encoding representation information of each real route, filter the sub-encoding representation information corresponding to the starting point.
[0117] Step S209: Based on the sub-encoding representation information of the starting point, generate a sequence of predicted trajectory triplets of the real route through the initial road trajectory generation model.
[0118] Step S210: Use the predicted trajectory triplet sequence as the predicted trajectory data of the actual route.
[0119] Step S211: For each real route, based on the sample data of the real route and the predicted trajectory data, calculate the prediction deviation data of the initial road trajectory generation model for each objective using a multi-objective loss function.
[0120] Step S212: Based on the prediction deviation data of each target corresponding to each predicted trajectory data, construct the total loss function corresponding to each predicted trajectory data, and use the total loss function corresponding to all predicted trajectory data as the prediction deviation information of the initial road trajectory generation model.
[0121] Step S213: Based on the total loss function corresponding to each predicted trajectory data, adjust the target model parameters of the initial road trajectory generation model to obtain the new target model parameters of the initial road trajectory generation model.
[0122] Step S214: Based on the new target model parameters of the initial road trajectory generation model, adjust all model parameters of the initial road trajectory generation model through a backpropagation strategy to obtain the road trajectory generation model.
[0123] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0124] Based on the same inventive concept, this application also provides a training device for a road trajectory generation model to implement the training method for the road trajectory generation model described above. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more road trajectory generation model training device embodiments provided below can be found in the limitations of the road trajectory generation model training method described above, and will not be repeated here.
[0125] In one exemplary embodiment, such as Figure 3 As shown, a training device for a road trajectory generation model is provided, comprising: an acquisition module 310, a generation module 320, and a training module 330, wherein:
[0126] The acquisition module 310 is used to acquire the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route;
[0127] The generation module 320 is used to generate coded representation information of each real route based on the road network structure map and sample data of each real route, through a trajectory sequence coding strategy, and generate predicted trajectory data of each real route based on the coded representation information of each real route through an initial road trajectory generation model.
[0128] The training module 330 is used to identify the prediction deviation information of the initial road trajectory generation model based on the sample data of each of the real routes and the predicted trajectory data of each of the real routes, and to adjust the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model.
[0129] Optionally, the acquisition module 310 is specifically used for:
[0130] The historical trajectory route is broken down into trajectory route data of each real route. For each real route, trajectory point matching is performed on the road network structure map based on the real route to obtain the road trajectory sequence corresponding to the real route and the trajectory timestamp sequence corresponding to the real route.
[0131] Based on the road trajectory sequence, the percentage sequence of travel roads corresponding to the actual route is calculated using a road data algorithm;
[0132] Based on the road trajectory sequence corresponding to the real route, the trajectory timestamp sequence corresponding to the real route, and the travel road percentage sequence corresponding to the real route, a trajectory triplet sequence of the real route is constructed, and the trajectory triplet sequence is used as sample data of the real route.
[0133] Optionally, the generation module 320 is specifically used for:
[0134] For each real route, based on the road trajectory sequence corresponding to the real route, a road-level coding representation of the real route is generated using a road-level coding strategy;
[0135] In the road network structure map, the traffic functional area to which the actual route belongs is queried, and the road network structure map of the traffic functional area is processed by regional coding to obtain the regional coding representation corresponding to the actual route;
[0136] The road code representation corresponding to the real route and the area code representation corresponding to the real route are fused together to obtain the code representation information of the real route.
[0137] Optionally, the generation module 320 is specifically used for:
[0138] In the encoded representation information of each of the real routes, the sub-encoded representation information corresponding to the starting point is filtered out;
[0139] Based on the sub-encoded representation information of the starting point, a sequence of predicted trajectory triples for the actual route is generated through the initial road trajectory generation model.
[0140] The predicted trajectory triplet sequence is used as the predicted trajectory data of the actual route.
[0141] Optionally, the training module 330 is specifically used for:
[0142] For each real route, based on the sample data of the real route and the predicted trajectory data, the prediction deviation data of the initial road trajectory generation model in each objective is calculated using a multi-objective loss function;
[0143] Based on the prediction deviation data of each target corresponding to each predicted trajectory data, a total loss function corresponding to each predicted trajectory data is constructed, and the total loss function corresponding to all predicted trajectory data is used as the prediction deviation information of the initial road trajectory generation model.
[0144] Optionally, the training module 330 is specifically used for:
[0145] Based on the total loss function corresponding to each predicted trajectory data, the target model parameters for training the initial road trajectory generation model are adjusted to obtain the new target model parameters for the initial road trajectory generation model.
[0146] Based on the new target model parameters of the initial road trajectory generation model, the road trajectory generation model is obtained by adjusting all model parameters of the initial road trajectory generation model through a backpropagation strategy.
[0147] Each module in the training device for the aforementioned road trajectory generation model can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0148] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a training method for a road trajectory generation model. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0149] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0150] In one exemplary embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement steps of a training method for a road trajectory generation model.
[0151] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program being executed by a processor to implement the steps of a training method for a road trajectory generation model.
[0152] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of a training method for a road trajectory generation model.
[0153] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0154] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0155] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A training method for a road trajectory generation model, characterized in that, The method includes: Obtain the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route; Based on the road network structure diagram and sample data of each real route, the coded representation information of each real route is generated through a trajectory sequence coding strategy, and based on the coded representation information of each real route, the predicted trajectory data of each real route is generated through an initial road trajectory generation model. Based on the sample data of each real route and the predicted trajectory data of each route, the prediction deviation information of the initial road trajectory generation model is identified, and the initial road trajectory generation model is adjusted based on the prediction deviation information to obtain the road trajectory generation model.
2. The method according to claim 1, characterized in that, The process of converting the historical trajectory routes into sample data for each real route includes: The historical trajectory route is broken down into trajectory route data of each real route. For each real route, trajectory point matching is performed on the road network structure map based on the real route to obtain the road trajectory sequence corresponding to the real route and the trajectory timestamp sequence corresponding to the real route. Based on the road trajectory sequence, the percentage sequence of travel roads corresponding to the actual route is calculated using a road data algorithm; Based on the road trajectory sequence corresponding to the real route, the trajectory timestamp sequence corresponding to the real route, and the travel road percentage sequence corresponding to the real route, a trajectory triplet sequence of the real route is constructed, and the trajectory triplet sequence is used as sample data of the real route.
3. The method according to claim 2, characterized in that, Based on the road network structure map and sample data of each of the real routes, the coded representation information of each of the real routes is generated through a trajectory sequence coding strategy, including: For each real route, based on the road trajectory sequence corresponding to the real route, a road-level coding representation of the real route is generated using a road-level coding strategy; In the road network structure map, the traffic functional area to which the actual route belongs is queried, and the road network structure map of the traffic functional area is processed by regional coding to obtain the regional coding representation corresponding to the actual route; The road code representation corresponding to the real route and the area code representation corresponding to the real route are fused together to obtain the code representation information of the real route.
4. The method according to claim 1, characterized in that, The process of generating predicted trajectory data for each of the real routes based on the encoded representation information of each real route, through an initial road trajectory generation model, includes: In the encoded representation information of each of the real routes, the sub-encoded representation information corresponding to the starting point is filtered out; Based on the sub-encoded representation information of the starting point, a sequence of predicted trajectory triples for the actual route is generated through the initial road trajectory generation model. The predicted trajectory triplet sequence is used as the predicted trajectory data of the actual route.
5. The method according to claim 1, characterized in that, The process of identifying prediction bias information of the initial road trajectory generation model based on sample data of each of the real routes and predicted trajectory data includes: For each real route, based on the sample data of the real route and the predicted trajectory data, the prediction deviation data of the initial road trajectory generation model in each objective is calculated using a multi-objective loss function; Based on the prediction deviation data of each target corresponding to each predicted trajectory data, a total loss function corresponding to each predicted trajectory data is constructed, and the total loss function corresponding to all predicted trajectory data is used as the prediction deviation information of the initial road trajectory generation model.
6. The method according to claim 5, characterized in that, The step of adjusting the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model includes: Based on the total loss function corresponding to each predicted trajectory data, the target model parameters for training the initial road trajectory generation model are adjusted to obtain the new target model parameters for the initial road trajectory generation model. Based on the new target model parameters of the initial road trajectory generation model, the road trajectory generation model is obtained by adjusting all model parameters of the initial road trajectory generation model through a backpropagation strategy.
7. A training device for a road trajectory generation model, characterized in that, The device includes: The acquisition module is used to acquire the road network structure map of the target area and the historical trajectory routes of the target area, and convert the historical trajectory routes into sample data of each real route; The generation module is used to generate coded representation information of each real route based on the road network structure map and sample data of each real route, through a trajectory sequence coding strategy, and generate predicted trajectory data of each real route based on the coded representation information of each real route through an initial road trajectory generation model. The training module is used to identify the prediction deviation information of the initial road trajectory generation model based on the sample data of each of the real routes and the predicted trajectory data of each of the real routes, and to adjust the initial road trajectory generation model based on the prediction deviation information to obtain the road trajectory generation model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
