Road network constraint trajectory recovery method and device based on pre-training language model, and computer readable medium

By constructing explicit and implicit trajectory prompts based on a pre-trained language model, a trajectory embedding matrix is ​​generated, which solves the problem of recovering sparse trajectory data with low sampling rate. This method enables trajectory recovery under dynamic road conditions and improves the integrity and accuracy of trajectory data.

CN121564951APending Publication Date: 2026-02-24BEIJING JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511462238.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively recover complete trajectories from sparse trajectory data with low sampling rates, especially under conditions of missing trajectory points and dynamic roads, leading to inaccurate trajectory recovery.

Method used

A road network constraint trajectory recovery method based on a pre-trained language model is adopted. By constructing explicit and implicit trajectory prompts, a trajectory embedding matrix is ​​generated. Combining the sampling interval features and road condition features of sparse trajectories, a unified time interval is marked by inserting placeholders to generate preprocessed trajectories. Dense trajectories are then output through a multi-task decoder.

Benefits of technology

It achieves trajectory recovery under different intervals and dynamic road conditions, improves the integrity and accuracy of trajectory data, and enhances the model's ability to perceive the spatiotemporal correlation of trajectories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121564951A_ABST
    Figure CN121564951A_ABST
Patent Text Reader

Abstract

The invention provides a road network constraint trajectory recovery method and device based on a pre-training language model and a computer readable medium. The method comprises the following steps: constructing an explicit trajectory cue word based on a sampling interval feature and a movement feature of a sparse trajectory, and generating an explicit trajectory cue word embedding matrix; based on historical trajectory data of a predetermined geographic area, performing statistics on traffic flow of the spatial grid in each time interval to generate a road condition feature matrix as an implicit trajectory cue word; enabling the sparse trajectory to have a uniform target sampling interval by inserting placeholder marks, and generating a preprocessed sparse trajectory; a trajectory embedding matrix of the preprocessed sparse trajectory is generated, and embedding vectors of missing points of the preprocessed sparse trajectory are generated based on implicit trajectory cues; and based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, generating and outputting a predicted road section and a predicted movement ratio of each point in the dense trajectory, the target sampling interval being smaller than the sampling interval of the sparse trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the technical field of road network constraint trajectory recovery, specifically to a generalizable road network constraint trajectory recovery method, apparatus, electronic device, and computer-readable medium based on a pre-trained language model. Background Technology

[0002] With the widespread adoption of various positioning systems and mobile sensing devices, massive amounts of trajectory data are continuously generated and applied in many fields such as smart transportation, urban planning, logistics monitoring, and location-based services. However, due to limitations in device power consumption, signal quality, and storage costs, the actual collected trajectory data often has a low sampling rate. Therefore, it is necessary to perform trajectory recovery tasks to reconstruct complete trajectories from sparse trajectories with low sampling rates.

[0003] Therefore, a generalizable map matching trajectory recovery method based on a pre-trained language model is needed. Summary of the Invention

[0004] This disclosure provides a road network constrained trajectory recovery method based on a pre-trained language model that can recover trajectories at different intervals and effectively model road conditions or road conditions for missing trajectory points.

[0005] This disclosure also provides a road network constrained trajectory recovery device based on a pre-trained language model that can recover trajectories at different intervals and effectively model road conditions or road conditions of missing trajectory points.

[0006] The first aspect of this disclosure provides a road network constrained trajectory recovery method based on a pre-trained language model, comprising: constructing explicit trajectory cue words based on the sampling interval features and movement features of sparse trajectories, and generating an explicit trajectory cue word embedding matrix; generating a road condition feature matrix as implicit trajectory cue words by statistically analyzing traffic flow in spatial grids at various time intervals based on historical trajectory data of a predetermined geographical area; generating a preprocessed sparse trajectory by inserting placeholder markers to give the sparse trajectory a uniform target sampling interval; generating a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vectors of missing points in the preprocessed sparse trajectory are generated based on the implicit trajectory cue words; generating and outputting the predicted road segment and predicted movement ratio for each point in the dense trajectory based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory.

[0007] In an exemplary embodiment, the explicit trajectory cue words include a sampling interval cue word regarding sampling interval features and a motion feature cue word regarding motion features. The sampling interval cue word includes a task portion describing the task objective, a target portion defining the output format, and a content portion specifying the input sampling interval. The motion feature cue word includes a time portion providing the time of the sparse trajectory and a motion portion describing the motion features of the sparse trajectory.

[0008] In an exemplary embodiment, generating an explicit trajectory cue word embedding matrix includes: converting explicit trajectory cue words in text form into a lexical sequence; converting the lexical sequence into a word embedding vector sequence; and converting the word embedding vector sequence into an explicit trajectory cue word embedding matrix.

[0009] In an exemplary embodiment, generating a road condition feature matrix includes: dividing a predetermined geographical area into spatial grids; dividing time into multiple time intervals; calculating the traffic flow of each spatial grid in each time interval to generate a regional traffic flow matrix; and applying convolution to the regional traffic flow matrix to generate a road condition feature matrix representing road conditions.

[0010] In an exemplary embodiment, generating the trajectory embedding matrix of the preprocessed sparse trajectory includes: generating the embedding vector of the observation points of the preprocessed sparse trajectory based on the spatial coordinate encoding vector and the road network encoding vector of the observation points; generating the embedding vector of the missing points of the preprocessed sparse trajectory based on implicit trajectory prompts using observation points adjacent to the missing points; and generating the trajectory embedding matrix of the preprocessed sparse trajectory based on the embedding vector of the observation points and the embedding vector of the missing points.

[0011] In an exemplary embodiment, the latitude and longitude of the observation point are encoded using learnable Fourier features and then summed to generate a spatial coordinate encoding vector. The shortest distance between the observation point and each surrounding road segment is calculated, and the embedding vectors of each surrounding road segment are weighted and summed based on the shortest distance to generate a road network encoding vector. The shorter the shortest distance, the greater the weight.

[0012] In an exemplary embodiment, the embedding vector of the missing point of the preprocessed sparse trajectory is generated by: determining the forward and backward observation points adjacent to the missing point; extracting the road condition vectors corresponding to the forward and backward observation points from the road condition feature matrix; performing a weighted average of the extracted road condition vectors based on the time interval between the missing point and the forward and backward observation points to generate the road condition vector of the missing point; and generating the embedding vector of the missing point based on the missing point's missing label vector, the road condition vector, and the encoding vector of the time interval.

[0013] In an exemplary embodiment, the method further includes: acquiring dense trajectories sampled at a first time interval; resampling sparse trajectories at multiple different second time intervals greater than the first time interval to generate multiple sparse trajectories as a joint training set; and training a pre-trained language model using the joint training set to fine-tune some parameters of the pre-trained language model.

[0014] The second aspect of this disclosure provides a road network constrained trajectory recovery device based on a pre-trained language model, comprising: an explicit trajectory cue word generation module configured to construct explicit trajectory cue words based on the sampling interval features and movement features of sparse trajectories, and generate an explicit trajectory cue word embedding matrix; an implicit trajectory cue word generation module configured to generate a road condition feature matrix based on historical trajectory data of a predetermined geographical area and statistically analyzing traffic flow in a spatial grid at various time intervals, serving as implicit trajectory cue words; a trajectory normalization module configured to generate a preprocessed sparse trajectory by inserting placeholder markers to give the sparse trajectory a uniform target sampling interval; a feature extraction module configured to generate a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vectors of missing points in the preprocessed sparse trajectory are generated based on the implicit trajectory cue words; and a trajectory processing module configured to generate and output the predicted road segment and predicted movement ratio for each point in the dense trajectory based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory.

[0015] A third aspect of this disclosure provides an electronic device including a processor and a memory, the memory being used to store a program that, when executed by the processor, performs the method described above.

[0016] A fourth aspect of this disclosure provides a computer-readable medium having a program stored thereon that, when executed by a processor, performs the method described above.

[0017] Based on the road network constrained trajectory recovery method disclosed herein using a pre-trained language model, the PLMTrajRec model is constructed using the PyTorch deep learning framework to address the problems of inconsistent sampling intervals and difficulty in obtaining road condition information for missing points in sparse trajectory data. This method innovatively proposes a dual-trajectory cue word mechanism. It encodes the trajectory's sampling interval and movement features into structured instructions through explicit trajectory cue words guided by sampling intervals and features, while simultaneously fusing dynamic road condition semantic information through implicit trajectory cue words guided by regional traffic flow.

[0018] This disclosure further designs a trajectory embedder that is aware of sampling intervals, which maps trajectories with different sampling intervals to a continuous representation space with a standard interval, effectively enhancing the model's ability to perceive the spatiotemporal correlation of different trajectories.

[0019] The trajectory encoder, based on a pre-trained architecture, employs a parameter freezing and local fine-tuning strategy to learn the trajectory's movement patterns while preserving the general knowledge of the language model. Finally, a multi-task decoder synchronously outputs the recovered, complete trajectory that conforms to road network constraints.

[0020] The above-disclosed technical solutions only need to achieve one of the aforementioned effects, and it is not required that each technical solution achieve all of the aforementioned technical effects.

[0021] Furthermore, the effects of this disclosure include not only those set forth herein, but also other effects that will be apparent to those skilled in the art upon reference to the claims, the specification, and the accompanying drawings. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart of a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure;

[0024] Figure 2 This is a framework diagram of a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure;

[0025] Figure 3 This is a schematic diagram of a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure;

[0026] Figure 4 This is a schematic diagram of sparse trajectory preprocessing in a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure;

[0027] Figure 5 This is a schematic diagram of trajectory point encoding for a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure;

[0028] Figure 6 This is a block diagram of a road network constraint trajectory recovery device based on a pre-trained language model according to an embodiment of the present disclosure;

[0029] Figure 7 A block diagram of an electronic device according to embodiments of the present disclosure; and

[0030] Figure 8 This is a block diagram of a computer-readable medium according to embodiments of the present disclosure. Detailed Implementation

[0031] The technical solutions in the embodiments of this disclosure will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments. Generally, the components of the embodiments of this disclosure described and shown in the accompanying drawings can be arranged and designed in various different configurations.

[0032] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In the description of this disclosure, the terms "first," "second," "third," "fourth," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0033] A trajectory can be defined as a sequence of locations with timestamps, mathematically denoted as τ = <p1,…,p ∣τ∣ >. Where p i =(lat i ,lng i ,t i ) represents the point located at time t by a satellite positioning system such as GPS. i The latitude and longitude coordinates of the trajectory are given, i∈{1,…,|τ|}, where |τ| represents the length of the trajectory. The sampling interval of the trajectory τ is defined as t. i -t i-1 (i≥2), this interval reflects the time frequency of trajectory data acquisition.

[0034] Road network constraints describe the limitations imposed on vehicles by the road network during their movement. Specifically, vehicle movement is typically strictly confined to the road network, preventing arbitrary movement outside of it. This constraint ensures the rationality and practical feasibility of the vehicle's trajectory.

[0035] The road network is modeled as a directed graph G = (V, E), where V is the set of nodes and E is the set of edges. Each node in the graph represents a road intersection and is associated with geographic coordinates (including latitude and longitude information), which provide the basis for locating the road network in geographic space. Each edge e ∈ E corresponds to a road segment connecting two intersections, defined by its starting node e.start ∈ V and ending node e.end ∈ V. This directed graph modeling method clearly represents the direction and connection relationships of each road segment in the road network.

[0036] Map matching trajectory: Using map matching algorithms, the trajectory τ can be projected onto the road network, thus obtaining a map matching trajectory τ. mThe role of map matching algorithms is to ensure τ m Each point in the map can be accurately aligned with a specific road, thus improving the fit between trajectory data and the road network. The map-matched trajectory is represented as τ. m = <q1,…,q ∣τm∣ >, where each point q j =(e j ,r j ,t j ) indicates that the vehicle is at time t j The location. Here, e j ∈E is the matched road segment, r j It is the moving ratio, used to represent the ratio along road segment e. j The ratio of the distance traveled to its total length helps to more accurately describe the vehicle's position on the road segment.

[0037] In the following description, embodiments will be described in conjunction with the accompanying drawings.

[0038] Figure 1 This is a flowchart of a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure. Figure 2 This is a framework diagram of a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure. Figure 3 This is a schematic diagram of a road network constraint trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure.

[0039] The first aspect of this disclosure provides a method for road network constrained trajectory recovery based on a pre-trained language model. For example... Figure 1 As shown, the road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of this disclosure includes: constructing explicit trajectory cue words based on the sampling interval features and movement features of sparse trajectories, and generating an explicit trajectory cue word embedding matrix (S1); generating a road condition feature matrix as implicit trajectory cue words by statistically analyzing the traffic flow of a spatial grid in each time interval based on historical trajectory data of a predetermined geographical area (S2); generating a preprocessed sparse trajectory by inserting placeholder markers to give the sparse trajectory a uniform target sampling interval (S3); generating a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vector of the missing points of the preprocessed sparse trajectory is generated based on the implicit trajectory cue words (S4); generating and outputting the predicted road segment and predicted movement ratio of each point in the dense trajectory based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory (S5).

[0040] The steps of the above method are not limited to being executed sequentially from S1 to S5. They can also be executed in multiple steps simultaneously or in a different order than the above steps.

[0041] Map matching trajectory recovery refers to the process of finding a sparse trajectory with a sampling interval of μ. The goal of map matching trajectory recovery is to reconstruct a dense map matching trajectory with a sampling interval of ∈. Where the sampling interval μ>∈. For example Figure 3 As shown, the goal of trajectory recovery is to recover a given sparse trajectory τ =<p1,p4,p7> To recover the corresponding dense trajectory τ m =<q1,…,q7> .

[0042] Figure 2 The dual-track suggestion module shown aims to empower pre-trained language models (PLMs) with the ability to recover trajectories at different intervals and effectively model road conditions for missing trajectory points. To achieve this goal, the module innovatively introduces a dual-track suggestion mechanism, encompassing explicit trajectory suggestions guided by time intervals and movement features, as well as implicit trajectory suggestions guided by regional traffic flow.

[0043] In an exemplary embodiment, the explicit trajectory cue words include a sampling interval cue word regarding sampling interval features and a motion feature cue word regarding motion features. The sampling interval cue word includes a task portion describing the task objective, a target portion defining the output format, and a content portion specifying the input sampling interval. The motion feature cue word includes a time portion providing the time of the sparse trajectory and a motion portion describing the motion features of the sparse trajectory.

[0044] These explicit trajectory cues, guided by time intervals and movement features, provide structured textual descriptions of the sampling intervals and movement characteristics of sparse trajectories. With these descriptions, PLMTrajRec can accurately identify different sampling intervals and effectively capture fundamental trajectory features.

[0045] The sampling interval prompts are designed with three parts: the <Task> section communicates the overall task to be performed to the PLM; the <Objective> section defines the required output format; and the <Content> section specifies the sampling interval, thereby guiding the PLM to perform efficient trajectory analysis. The movement characteristic prompts consist of two parts: the <Time> section provides the specific start and end times of the trajectory, helping the PLM understand the trajectory's duration and potential time patterns, such as morning or evening rush hours; and the <Movement> section supports the PLM inferring the trajectory's movement pattern.

[0046] In an exemplary embodiment, generating an explicit trajectory cue word embedding matrix includes: converting explicit trajectory cue words in text form into a lexical sequence; converting the lexical sequence into a word embedding vector sequence; and converting the word embedding vector sequence into an explicit trajectory cue word embedding matrix.

[0047] After obtaining the cues for each section, the dual-track cue module uses PLM's word segmentation and lexical embedding technology to convert the text into embedding vectors, and then concatenates these vectors to form the overall interval and feature-guided explicit track cue embedding matrix H. e .

[0048] Taking the dual-track prompting module as an example, assume there exists a sparse trajectory τ s = <p 1 ,p 2 ,p 3 ,…,p 5 The sampling interval is 2 minutes. To enable the pre-trained language model to recognize different intervals and capture movement features, this disclosure constructs two parts: explicit trajectory cues and implicit trajectory cues.

[0049] For example, for explicit hints, targeting τ s The following text prompts were constructed: <Task Section> explicitly states the goal is sparse trajectory recovery; <Objective Section> specifies the output format as "Road Segment + Mobility Rate"; <Content Section> indicates that the sampling interval of the input trajectory is 2 minutes, and the goal is to recover the trajectory in a format with a sampling interval of 1 minute; <Time Section> displays the trajectory start time as Saturday 08:00 and end time as Saturday 08:08; <Mobility Section> indicates the total time taken is 8 minutes and the distance traveled is 1 kilometer.

[0050] The output dimension is set to 64. After word segmentation by the word segmenter, word embedding operation in the embedding layer, pooling process in the pooling layer, and stacking step, the above text prompt is transformed into a vector embedding matrix H. e ∈R 5×64 This matrix encompasses structured instruction information in five aspects, which will be input into the PLM along with the trajectory data for processing.

[0051] Road conditions reflect the surrounding environment when an object moves. In the dual-track cue module, these conditions are represented as implicit track cue words, aiming to provide the necessary contextual information for the model to recover the trajectory. Specifically, the average road conditions for all regions and all time intervals are first calculated, and then the relevant information is extracted for each trajectory point.

[0052] In an exemplary embodiment, generating a road condition feature matrix includes: dividing a predetermined geographical area into spatial grids; dividing time into multiple time intervals; calculating the traffic flow of each spatial grid in each time interval to generate a regional traffic flow matrix; and applying convolution to the regional traffic flow matrix to generate a road condition feature matrix representing road conditions.

[0053] For example, this disclosure divides the target area into "I×J" spatial grids and divides a day into "T" time intervals. For each spatial grid, this disclosure counts the traffic flow or total number of vehicles passing through, thereby forming a regional traffic flow matrix RC∈R. I×J×T Each entry in the matrix represents the traffic flow in region (i,j) at time t.

[0054] Regarding implicit hints, taking a predetermined geographical area (e.g., a city area) as the entire study area, we can divide it into a grid of "I×J=20×20", where each spatial grid is a geographical unit. For each original point, such as a GPS point (containing longitude and latitude information), its grid (i,j) is determined using latitude and longitude indexing technology. For example, a point might be determined to fall in the grid at row 5 and column 10, i.e., (i=5,j=10). A 24-hour day is divided into 96 time periods, each lasting 15 minutes. The first time period is 00:00-00:15, the second is 00:15-00:30, and so on, with the 33rd time period being 08:00-08:15. For each GPS point's timestamp, it is categorized into the corresponding 15-minute time period t. For example, the timestamp 08:05:21 belongs to the 33rd time period (t=33). Thus, each GPS point has three labels: grid row number i, grid column number j, and time period number t.

[0055] For example, the number of vehicles passing through a certain area (i=5, j=10) during the time period 08:00–08:15 is 50. This value intuitively reflects the traffic flow activity level of this area during that time period. This disclosure obtains the regional traffic flow matrix RC∈R by statistically analyzing the traffic flow of all grids in each time period. 20×20×96 .

[0056] To capture spatiotemporal patterns, two-dimensional convolution is applied in the spatial dimension to capture local spatial patterns, such as identifying whether a certain area is a congestion hotspot or whether a certain road is a main road. One-dimensional convolution is applied in the temporal dimension, for example, to identify how traffic flow gradually increases and decreases during the morning rush hour. Through these operations, road condition features H representing road conditions are generated. rc ∈R I×J×T×F , where F is the number of output features used to describe the complex road condition state of each grid at each time point.

[0057] Road condition characteristics H rc By applying two-dimensional convolution (for the spatial dimension) and one-dimensional convolution (for the temporal dimension) respectively, the road condition feature matrix H is finally obtained. rc ∈R 20×20×96×64And use it as an implicit trajectory cue word.

[0058] In practical applications, raw sparse trajectories with missing points are often obtained. To enable subsequent learning models to process these trajectories more efficiently and accurately, they need to be converted into a regularized sequence so that each time point has a corresponding data representation. The key to this process is to unify all trajectories to the same target time interval and generate meaningful feature vectors for points with GPS records and points with missing GPS data, but this disclosure is not limited to GPS.

[0059] This disclosure standardizes all input trajectories to match the sampling interval of the target trajectory. Specifically, the following steps are taken: Time points are sequentially set from the start time to the end time of the trajectory, according to the target interval. At each set time point, the following judgment is made: if original GPS data exists at that time point, the corresponding data point is included in the sequence; if original GPS data does not exist at that time point, a placeholder marker '[m]' is inserted to indicate that this is a missing point. Through this processing method, a preprocessed sparse trajectory τ with a fixed interval ∈ is finally generated. ∈ Its length is The time points in this sequence are strictly equal in interval, but the content includes observation points (true points) and missing points.

[0060] The resulting sequence, after the above processing, exhibits strictly equal time intervals, and its content includes actual data points (observation points) and placeholder points indicating missing data. This regularization process enables the model to effectively process trajectory data and extract features within a unified time frame.

[0061] In an exemplary embodiment, generating the trajectory embedding matrix of the preprocessed sparse trajectory includes: generating the embedding vector of the observation points of the preprocessed sparse trajectory based on the spatial coordinate encoding vector of the observation points and the road network encoding vector; generating the embedding vector of the missing points of the preprocessed sparse trajectory based on implicit trajectory prompts using the observation points adjacent to the missing points; and generating the trajectory embedding matrix of the preprocessed sparse trajectory based on the embedding vector of the observation points and the embedding vector of the missing points.

[0062] The trajectory embedding matrix for generating the preprocessed sparse trajectory is created by extracting features from each point in the trajectory, thus generating a highly representative vector for each point. Given a preprocessed sparse trajectory τ... ∈ When extracting features from trajectory points, there are two different cases. Case 1 (observation point): trajectory point s∈τ ∈ Successfully observed, i.e. Make p kt = st. Case 2 (missing point): trajectory point s ∈ τ ∈ The location is missing, i.e., s = [m], but its timestamp st is known.

[0063] In an exemplary embodiment, the latitude and longitude of the observation point are encoded using learnable Fourier features and then summed to generate a spatial coordinate encoding vector. The shortest distance between the observation point and each surrounding road segment is calculated, and the embedding vectors of each surrounding road segment are weighted and summed based on the shortest distance to generate a road network encoding vector. The shorter the shortest distance, the greater the weight.

[0064] Figure 4 This is a schematic diagram of sparse trajectory preprocessing in a road network constrained trajectory recovery method based on a pre-trained language model according to an embodiment of the present disclosure. Figure 5 This is a schematic diagram of trajectory point encoding for a road network constrained trajectory recovery method based on a pre-trained language model, according to an embodiment of the present disclosure.

[0065] like Figure 5 As shown, the trajectory embedder may include a Fourier coding module, a road segment representation generation module, and a concatenation module. The road segment representation generation module receives trajectory point data *s* and road network data as input and outputs a road segment representation vector. The Fourier coding module processes the trajectory point data *s* and outputs a frequency domain feature vector. The concatenation module receives the outputs from the above two modules: the frequency domain feature vector from the Fourier coding module and the road segment representation vector from the road segment representation generation module. The concatenation module performs multimodal feature fusion, integrating the frequency domain features representing spatiotemporal dynamics with the road segment representation vector representing the road topology through vector concatenation, ultimately outputting an embedding vector *h*.

[0066] For trajectory point s in case 1, this disclosure comprehensively extracts features from its geographical location and road network environment, that is, it extracts spatial features by combining the continuous GPS coordinates of trajectory point s and its local road network context.

[0067] Spatial coordinate encoding: The latitude and longitude of s are encoded using learnable Fourier features (LFF), which are mapped by the feature mapping function Φ(x) = W. Φ [cos(xW r )||sin(xW r The continuous spatial input is projected into an F-dimensional representation, where x ∈ s.lat, s.lon. x is the input value (latitude or longitude), Wr is a learnable weight matrix used to generate different frequencies, cos(xWr) and sin(xWr) are sine and cosine transforms of the generated frequencies, and || is the concatenation operation, joining the cosine and sine components. ΦThis is another learnable weight matrix that performs a linear transformation on the concatenated result, ultimately outputting an F-dimensional vector Φ(x). The latitude s.lat and longitude s.lon are encoded as described above, and then the two F-dimensional vectors are added together to obtain the location feature vector Φ(s.lat)+Φ(s.lon) representing the location features.

[0068] Road network coding: Considering the movement of vehicles within a road network, the relationship between trajectory points and their surrounding road segments is crucial. To measure the relationship between trajectory point s and road segment l, a function is defined based on the shortest distance between them, using function f(d) to convert the distance into a weight:

[0069]

[0070] Where d s,l κ is the shortest distance between s and road l, and κ is a hyperparameter. It is a distance threshold. If the distance d is less than the threshold... The weight is This is a Gaussian function; the closer the distance, the closer the weight is to 1; the farther the distance, the closer the weight is to 0. If the distance d is greater than a threshold... The weight is then 0 (ignoring road segments that are too far away). Each road segment has a randomly initialized embedding vector. Then, the road network feature vector representing the road network is obtained by weighted summation of the embedding vectors (randomly initialized vectors) of all road segments.

[0071] Feature fusion: This involves combining the spatial coordinate feature vector [Φ(s.lat)+Φ(s.lon)] (F-dimensional) with the road network feature vector. (Also F-dimensional) vectors are concatenated (||) to obtain a 2F-dimensional vector. Finally, this 2F-dimensional vector is transformed through a linear layer (W1 is the weight matrix, b1 is the bias vector), ultimately outputting an F-dimensional vector h. s This serves as the final representation of the point. The complete representation of the trajectory point s is obtained as follows:

[0072]

[0073] Where W1∈R F×2F b1∈R F It is a learnable parameter, and || is the join operation.

[0074] like Figure 4 As shown, the interval-aware trajectory embedder first embeds the sparse trajectory τ s Standardize to a target sampling interval ∈ = 1 minute. Assume τ s There are 9 trajectory points between 08:00 and 08:08, so τ is obtained.∈ = 1 ,s 2 ,…,s 9 >. If no trajectory is observed at a certain time point, a placeholder [m] is used, for example, τ. ∈ = <p 1 [m],p 2 [m],p 3 [m],p 4 [m],p 5 >

[0075] Case 1 (Observation point): For example, p 1 = (lat = 30.66, lon = 104.08, t = 08:00). This disclosure uses Learnable Fourier Features (LFF) to encode latitude and longitude Φ(x), and combines it with the shortest distance function f(d) with surrounding road segments. s,l Calculate the road relationship weights to obtain the road embedding vector. (Dimension 64). After concatenation, the final representation of this point is obtained by inputting it into a linear layer: The output is h s ∈R 64 This process achieves high-precision spatial coordinate information (through Fourier encoding), rich road network context information (through weighted road network embedding), and the optimal fusion of the two types of information (through learnable linear layers).

[0076] For missing points in the trajectory, embedding vectors are generated based on adjacent observation points and implicit trajectory cues. This approach fully utilizes existing observation information and the environmental information contained in the implicit trajectory cues to assign reasonable feature representations to missing points, thereby improving the entire trajectory embedding matrix generation process.

[0077] In an exemplary embodiment, the embedding vector of the missing point of the preprocessed sparse trajectory is generated by: determining the forward and backward observation points adjacent to the missing point; extracting the road condition vectors corresponding to the forward and backward observation points from the road condition feature matrix; performing a weighted average of the extracted road condition vectors based on the time interval between the missing point and the forward and backward observation points to generate the road condition vector of the missing point; and generating the embedding vector of the missing point based on the missing point's missing label vector, the road condition vector, and the encoding vector of the time interval.

[0078] ​For case 2, even if the location information of trajectory point s is unknown, the road condition features in the dual-track hints are used to represent the point, which is a missing point without GPS records. A fixed-size numerical representation (vector) containing contextual information is reasonably inferred and created. Since the road conditions at a specific location may be affected by the surrounding environmental state propagated in the spatiotemporal dimension, this disclosure proposes a road condition propagation mechanism to infer the road conditions at the missing location.

[0079] Using the pre-calculated global road condition feature matrix H rc (This is part of the "implicit hints"). This matrix can be queried using [latitude index, longitude index, time index] to retrieve traffic features (e.g., a 64-dimensional vector) for any location within any time period (e.g., 15 minutes).

[0080] First, determine the nearest forward observation s in the time dimension to the missing point s. f and backward observation point s b .

[0081] The forward observation point s is found using the index mapping function π. f and backward observation point s b Latitude, longitude and timestamp in H rc The corresponding position in the matrix.

[0082] Subsequently, s is obtained through the following methods f and s b Road conditions at the location:

[0083]

[0084] Where π lat (·), π lng (·) and π t (·) is the index mapping function, which maps latitude, longitude and time to the corresponding matrix indices respectively.

[0085] Next, calculate the relationship between point s and point s. f s b Time interval: △t f =st-s f .t and △t b =st-s b Based on this, the road conditions at point s are calculated using the following weighted formula:

[0086]

[0087] The weights depend on the time interval; the closer the observation is to the missing point, the greater the influence of its road conditions on the missing point. -△tIt is a decay function. The larger the time interval Δt, the greater the weight e. -△t The smaller.

[0088] Furthermore, this disclosure pertains to the time interval Δt f and △t b Encoding is performed to quantize the relative position of point s. The final feature representation of point s is:

[0089]

[0090] Where m∈R F For a learnable vector representing the missing location, FC(·):R 2 →R F This is a fully connected layer that describes the relative temporal position of a missing point with respect to its anchor point. This represents the inferred road conditions at that point. After linear layer mapping, the final overall trajectory representation is obtained.

[0091] Case 2 (Missing Point): For example, s 2 = [m], t = 08:01. This disclosure uses the "road condition transfer mechanism" to infer the characteristics of this point. First, find the nearest forward observation point s_f = p 1 (08:00) and the nearest backward observation point s_b=p 2 (08:02), then from the road condition feature H rc Extract s f With s b Road conditions characteristics and Next, calculate the time interval Δt. f =1min, Δt b =1min; Based on the weighted formula, the road condition characteristics of the missing points are obtained:

[0092]

[0093] Concatenate the missing point marker vector m∈R 64 Time coding FC(△t) f ||△t b )∈R 64 as well as After linear layer mapping, h is finally obtained. s ∈R 64 .

[0094] Finally, all 9 points obtained 64-dimensional embeddings: H∈R 9×64 .

[0095] Leveraging the powerful capabilities of a pre-trained language model (PLM), this paper performs a deep understanding of the trajectory representation that incorporates all information, ultimately predicting the road segment and movement speed of each trajectory point. To enhance the model's ability to understand trajectory features, this disclosure introduces K reference tokens E. w ∈R K×F These reference tokens are used to connect the pre-trained language model with the trajectory. They are designed to capture global semantic information about the trajectory.

[0096] Extracting Local Motion Patterns (One-Dimensional Convolution): Given a trajectory embedding H, this disclosure first applies a one-dimensional convolutional neural network to aggregate neighboring information and capture local motion patterns, i.e., H' = Conv1d(H). The convolutional kernel slides along the time dimension, aggregating information from several adjacent points. The vector of each point contains not only its own information but also information from its preceding and following neighboring points, enhancing the local context.

[0097] Capturing global semantic information: Introducing the reference token E w During training, the model can learn to make these tokens represent some global semantics of the trajectory, such as "high-speed cruising," "urban congestion," or "waiting at an intersection." Next, the trajectory embedding H' and the reference token E are calculated. w Self-attention between them to capture global semantic information H″; where H′ serves as the query, E w Simultaneously serving as both keys and values, each point in the trajectory is made aware of these global semantic concepts. This process injects abstract global information (captured by reference tokens) into each point in time of the trajectory. Now, each point's vector contains not only local information but also the global semantic information of the entire trajectory.

[0098] Then, the explicit instruction information is integrated: H″ and explicit trajectory cues are embedded in H. e The data are then spliced ​​together to form the final trajectory representation Z.

[0099] Finally, position encoding is added and fed into the PLM encoder. This disclosure integrates the Transformer position encoding PE into each element of Z and feeds this enhanced representation into the PLM encoder to encode the trajectory, resulting in the final fine-coded representation.

[0100] The system predicts road segments and mobility rates, then outputs the prediction results. It uses an MLP (Multilayer Perceptron) and a Softmax layer to output a probability distribution across all possible road segments. For example, an output dimension of 50 indicates the percentage probability that the model predicts a point is in road segment 1, road segment 2, ..., road segment 50. The prediction with the highest probability is ultimately taken. This is then processed through another MLP and a sigmoid layer, outputting a value between 0 and 1. It can be understood as a normalized value of the moving speed (for example, 0 represents standing still, and 1 represents the maximum speed).

[0101] The PLM trajectory encoder first applies a one-dimensional convolution to H, outputting a 64-dimensional output, resulting in H'∈R. 9×64 Then introduce K = 4 reference tokens E w ∈R 4×64 By calculating H' and E w Self-attention yields the global representation H”∈R 9×64 Next, embed the "H" and the explicit prompt into the H. e By concatenation, we obtain Z∈R 9×(64+64) =R 9×128 After fusing the positional encoding, input it into a PLM encoder (such as BERT, with the hidden dimension set to 128), and output Z∈R. 9×128 Finally, the road segment prediction for each point is obtained through softmax. The shift ratio is obtained through MLP+sigmoid.

[0102] To enable PLMTrajRec to effectively recover sparse trajectories with different sampling intervals, this disclosure implements a comprehensive joint training strategy.

[0103] In an exemplary embodiment, the method further includes: acquiring dense trajectories sampled at a first time interval; resampling the dense trajectories at multiple different second time intervals greater than the first time interval to generate multiple sparse trajectories as a joint training set; and training a pre-trained language model using the joint training set to fine-tune some parameters of the pre-trained language model.

[0104] For example, for each dense trajectory τ, this disclosure resamples it at different intervals (e.g., 1 minute, 2 minutes, 5 minutes, 10 minutes). Resampling is essentially "thinning"; for instance, sampling at 5-minute intervals means only keeping the point generated every 5 minutes, discarding all points in between, simulating the effect of the device sampling once every 5 minutes. For each dense trajectory τ, all sparse trajectories generated at 1-minute intervals are grouped together at M different time intervals to form dataset T1. All sparse trajectories generated at 2-minute intervals are grouped together to form dataset T2. This process continues, generating M sparsification variants, resulting in M ​​different sparse datasets T1, ..., T1. M These datasets will be merged into a single unified training dataset. In each training round, the model randomly draws data from this mixed set, which may contain data at 1-minute, 5-minute, and 10-minute intervals, etc. This allows the model to achieve balanced performance under different sampling rates.

[0105] As described above, M trajectories with different sparsity levels can be obtained from a dense trajectory. Subsequently, this disclosure fine-tunes the model on various sparse trajectory datasets to further improve the trajectory recovery performance at specific sampling intervals.

[0106] This disclosure employs multi-task learning to simultaneously optimize segment restoration and mobility ratio restoration. For segment restoration, a cross-entropy loss function is used; while for mobility ratio restoration, a mean squared error loss function is employed. A weighting factor λ balances these two objectives to ensure optimal performance in both tasks.

[0107] like Figure 2 As shown, the entire system begins with dual-source input drive. On one hand, sparse trajectories are fed into an interval-aware trajectory encoder. This encoder first performs trajectory interval unification, standardizing irregular inputs into sequences with fixed target intervals by inserting placeholder markers. Subsequently, trajectory feature extraction is performed, generating an embedding vector for each point in the sequence: for observation points, features are directly calculated by combining their GPS coordinates with the road network context; for missing points, implicit trajectory cue words are relied upon—this cue word is an offline road condition feature matrix generated by deep feature extraction of road conditions and regional traffic information from historical trajectory sets—and its features are inferred using interval feature guidance (such as traffic condition transmission mechanisms). Finally, the features of all points are combined into a trajectory embedding matrix. On the other hand, explicit trajectory cue words, which are text instructions (containing a structured description composed of interval cue words (task, target, content) and feature cue words (time, movement), are fed into a word segmenter, converted into a word sequence, and then converted into a numerical vector through an embedding layer. Finally, they are pooled and stacked to form an explicit trajectory cue word embedding matrix.

[0108] Subsequently, the trajectory embedding matrix and the explicit trajectory cue word embedding matrix are fed together into the core computation unit—the pre-trained language model + LoRA module. Here, the explicit cue word embedding, as a high-level instruction, is fused with the trajectory embedding matrix. Computation is performed within the frozen pre-trained language model backbone, where the attention and feedforward layers are stabilized through residual connections and normalization. Adaptive fine-tuning for new tasks is achieved solely through trainable low-rank adapters (LoRAs) injected into these layers, preserving the model's original large number of parameters as frozen layers. This module ultimately outputs a deep-encoded, finely encoded representation.

[0109] Finally, this refined encoded representation is fed into the output layer for final transformation, producing the output embedding. This output embedding, containing the model's understanding of the recovered trajectory, will be sent to the downstream task head (not explicitly shown in the diagram) to simultaneously perform multi-task decoding: predicting the sequence of road segments that conform to road network constraints through a classification head, and predicting the movement ratio sequence through a regression head, thereby generating a complete and dense recovered trajectory.

[0110] Figure 6 This is a block diagram of a road network constraint trajectory recovery device based on a pre-trained language model according to an embodiment of the present disclosure. Figure 6 As shown, a second aspect of this disclosure provides a road network constrained trajectory recovery device 400 based on a pre-trained language model, comprising: an explicit trajectory prompt word generation module 401, configured to construct explicit trajectory prompt words based on the sampling interval features and movement features of a sparse trajectory, and generate an explicit trajectory prompt word embedding matrix; an implicit trajectory prompt word generation module 402, configured to generate a road condition feature matrix based on historical trajectory data of a predetermined geographical area and statistically analyze traffic flow in a spatial grid at various time intervals, serving as implicit trajectory prompt words; a trajectory standardization module 403, configured to generate a preprocessed sparse trajectory by inserting placeholder markers to give the sparse trajectory a uniform target sampling interval; a feature extraction module 404, configured to generate a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vectors of missing points in the preprocessed sparse trajectory are generated based on the implicit trajectory prompt words; and a trajectory processing module 405, configured to generate and output the predicted road segment and predicted movement ratio for each point in the preprocessed sparse trajectory based on the trajectory embedding matrix and the explicit trajectory prompt word embedding matrix, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory.

[0111] In the description of the first aspect of this disclosure, the various method steps involved in the technical solution of this disclosure have been described in detail. Therefore, the above description can be applied to a map matching trajectory recovery device 400 based on a pre-trained language model in the second aspect of this disclosure. Accordingly, the description will not be repeated here.

[0112] This disclosure also provides an electronic device, which includes a memory and a processor. The memory stores a program, and the processor is configured to acquire the program and, when executing the program, execute the above-described road network constraint trajectory recovery method based on a pre-trained language model.

[0113] Figure 7 This is a block diagram of an electronic device implementing a road network constraint trajectory recovery method based on a pre-trained language model, according to some embodiments of this disclosure. Figure 7 As shown, the road network constraint trajectory recovery method based on a pre-trained language model in the above embodiments can be achieved through... Figure 7The electronic device shown is used to implement this, and the electronic device includes at least one processor, memory, and at least one I / O interface.

[0114] The processor can be a general-purpose central processing unit (CPU) and a graphics processing unit (GPU), or an application-specific integrated circuit (ASIC). Memory can include at least one of volatile memory and non-volatile memory. Memory can be read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; it can be random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; it can also be electrically erasable programmable read-only memory (EEPROM), read-only optical disc (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disks or other magnetic storage devices, or any other medium capable of carrying or storing a desired program having an instruction or data structure form and accessible by a computer, but is not limited thereto. Memory can exist independently and be connected to the processor via an address bus, data bus, and control bus. Memory can also be integrated with the processor.

[0115] The memory stores programs that execute the scheme of this disclosure and is controlled by a processor. The processor executes the programs stored in the memory. The programs may include one or more software modules. The road network constraint trajectory recovery method based on a pre-trained language model in the above embodiments can be implemented by a processor and one or more software modules in the program in the memory. However, this disclosure is not limited thereto. The road network constraint trajectory recovery method based on a pre-trained language model in the above embodiments can also be implemented by circuitry.

[0116] I / O interfaces connect to input devices such as mice, microphones, keyboards, and touchscreens, as well as output devices such as speakers, printers, and monitors. I / O interfaces can also use transceivers or similar devices to communicate with other devices or communication networks such as Ethernet, Radio Access Networks (RAN), and Wireless Local Area Networks (WLAN).

[0117] As an exemplary embodiment, an electronic device may include a plurality of processors, each of which may be a single-core processor or a multi-core processor. As used herein, a processor may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0118] The aforementioned electronic device can be a general-purpose computer device or a special-purpose computer device. In specific implementations, the computer device can be a desktop computer, laptop computer, network server, PDA, mobile phone, tablet computer, wireless terminal device, communication device (e.g., access point, router, gateway, etc.), or embedded device. The embodiments of this disclosure do not limit the type of computer device, as long as it has a processor and memory.

[0119] It should be understood that Figure 7 The illustrated electronic device is merely one example of this disclosure, and the electronic devices of this disclosure may also include elements or components not shown in the examples above. For example, some electronic devices also include display units such as displays, some electronic devices also include human-computer interaction elements such as buttons and keyboards, and some electronic devices also include various sensors, such as gesture sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, grip sensors, proximity sensors, color sensors, infrared (IR) sensors, biometric sensors, temperature sensors, humidity sensors, illuminance sensors, etc. Any electronic device capable of executing a computer-readable program in its memory to implement the methods or at least some steps of the methods described in this disclosure may be considered an electronic device covered by this disclosure.

[0120] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented in software, in hardware, or in a combination of software and necessary hardware. Therefore, as... Figure 8 As shown, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-transitory computer-readable storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.) or on a network, including several commands to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the above-described methods according to the embodiments of this disclosure.

[0121] Software products may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media include, but are not limited to: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0122] This disclosure also provides a computer-readable storage medium storing a program that, when executed by a processor, implements the above-described method for road network constraint trajectory recovery based on a pre-trained language model. Figure 8 This is a block diagram illustrating a computer-readable medium according to embodiments of the present disclosure.

[0123] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying a readable program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can send, propagate, or transmit a program for use by or in connection with a command execution system, apparatus, or device. The program contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, or any suitable combination thereof.

[0124] Programs for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. Programs can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to external computing devices (e.g., via the Internet using an Internet service provider).

[0125] The aforementioned computer-readable medium carries one or more programs (e.g., computer-executable programs) that, when executed by one or more devices, cause the computer-readable medium to implement the methods of this disclosure.

[0126] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles used, and is not intended to limit the scope of the claimed disclosure, but only to illustrate preferred embodiments of this disclosure. Those skilled in the art should understand that the scope of the invention involved in this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalent features without departing from the inventive concept. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

Claims

1. A method for road network constrained trajectory recovery based on a pre-trained language model, characterized in that, include: Explicit trajectory cue words are constructed based on the sampling interval features and movement features of sparse trajectories, and an explicit trajectory cue word embedding matrix is ​​generated. Based on historical trajectory data of a predetermined geographical area, traffic flow in the spatial grid at various time intervals is statistically analyzed to generate a road condition feature matrix, which serves as implicit trajectory prompts. By inserting placeholder markers, the sparse trajectories are given a uniform target sampling interval, thus generating preprocessed sparse trajectories. Generate a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vector of the missing points of the preprocessed sparse trajectory is generated based on the implicit trajectory cue words; Based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, the predicted road segment and predicted movement ratio of each point in the dense trajectory are generated and output, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory.

2. The method according to claim 1, characterized in that, The explicit trajectory cue words include sampling interval cue words related to the sampling interval feature and movement feature cue words related to the movement feature. The sampling interval prompt includes a task section describing the task objective, a target section defining the output format, and a content section specifying the input sampling interval. The motion feature cue includes a time portion that provides the sparse trajectory and a motion portion that describes the sparse trajectory.

3. The method according to claim 2, characterized in that, Generating an explicit trajectory cue word embedding matrix includes: Convert the explicit trajectory cue words in text form into a sequence of lexical units; Convert the word sequence into a word embedding vector sequence; The word embedding vector sequence is converted into the explicit trajectory cue word embedding matrix.

4. The method according to claim 1, characterized in that, Generating the road condition feature matrix includes: The predetermined geographical area is divided into multiple spatial grids; Divide time into multiple time intervals; A regional traffic matrix is ​​generated by statistically analyzing the traffic flow of each spatial grid within each time interval. Convolution is applied to the regional traffic matrix to generate the road condition feature matrix representing road conditions.

5. The method according to claim 4, characterized in that, Generating the trajectory embedding matrix of the preprocessed sparse trajectory includes: Based on the spatial coordinate encoding vector of the observation points of the preprocessed sparse trajectory and the road network encoding vector, the embedding vector of the observation points of the preprocessed sparse trajectory is generated. Using observation points adjacent to the missing points, an embedding vector for the missing points of the preprocessed sparse trajectory is generated based on the implicit trajectory cue words; and The trajectory embedding matrix of the preprocessed sparse trajectory is generated based on the embedding vectors of the observation points and the embedding vectors of the missing points.

6. The method according to claim 5, characterized in that, The latitude and longitude of the observation point are encoded using learnable Fourier features, and then summed to generate the spatial coordinate encoding vector. The shortest distance between the observation point and each surrounding road segment is calculated, and the embedding vectors of each surrounding road segment are weighted and summed based on the shortest distance to generate the road network encoding vector, wherein the shorter the shortest distance, the greater the weight.

7. The method according to claim 6, characterized in that, Generate the embedding vector of the missing points of the preprocessed sparse trajectory: Determine the forward and backward observation points adjacent to the missing point; From the road condition feature matrix, extract the road condition vectors corresponding to the forward observation point and the backward observation point; Based on the time interval between the missing point and the forward and backward observation points, the extracted road condition vectors are weighted and averaged to generate the road condition vector of the missing point. The embedding vector of the missing point is generated based on the missing point's missing marker vector, the road condition vector, and the encoding vector of the time interval.

8. The method according to claim 1, characterized in that, The method further includes: Obtain the dense trajectory sampled at the first time interval; Multiple sparse trajectories are generated by resampling the dense trajectory at various different second time intervals longer than the first time interval, and these trajectories serve as a joint training set; and The pre-trained language model is trained using the joint training set to fine-tune some parameters of the pre-trained language model.

9. A road network constrained trajectory recovery device based on a pre-trained language model, characterized in that, include: The explicit trajectory cue word generation module is configured to construct explicit trajectory cue words based on the sampling interval features and movement features of sparse trajectories, and generate an explicit trajectory cue word embedding matrix. The implicit trajectory prompt word generation module is configured to generate a road condition feature matrix based on historical trajectory data of a predetermined geographical area and statistically analyze the traffic flow of a spatial grid in each time interval, which serves as the implicit trajectory prompt word. The trajectory standardization module is configured to generate preprocessed sparse trajectories by inserting placeholder markers to give the sparse trajectories a uniform target sampling interval. The feature extraction module is configured to generate a trajectory embedding matrix of the preprocessed sparse trajectory, wherein the embedding vector of the missing points of the preprocessed sparse trajectory is generated based on the implicit trajectory cue words; The trajectory processing module is configured to generate and output the predicted road segment and predicted movement ratio for each point in the dense trajectory based on the trajectory embedding matrix and the explicit trajectory cue word embedding matrix, wherein the target sampling interval is smaller than the sampling interval of the sparse trajectory.

10. A computer-readable medium storing a program that, when executed by a processor, performs the method as described in any one of claims 1-8.