A Transformer-based method for predicting highway train trajectories

CN122089178APending Publication Date: 2026-05-26BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIHANG UNIV
Filing Date
2026-01-12
Publication Date
2026-05-26

Smart Images

  • Figure CN122089178A_ABST
    Figure CN122089178A_ABST
Patent Text Reader

Abstract

This invention relates to the fields of autonomous driving and intelligent transportation technology, specifically to a Transformer-based method for predicting highway train trajectories. The method includes: acquiring the historical trajectories of each highway train and the lane centerlines of each lane in the current environment; acquiring historical trajectory vector sequences and lane centerline vector sequences; performing feature encoding and cross-attention mechanism processing on the historical trajectory vector sequences and lane centerline vector sequences respectively to obtain a first trajectory feature code and a lane feature code; performing lane feature code concatenation, self-attention mechanism, and position encoding processing on the first trajectory feature code to obtain a second trajectory feature code; performing feature fusion based on the second trajectory feature code and the lane feature code to obtain fused features; and performing classification and regression processing respectively to obtain multiple predicted trajectories and the probability of each predicted trajectory, which serve as the trajectory prediction result. This invention can improve the accuracy of highway train trajectory prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of autonomous driving and intelligent transportation technology, and specifically to a method for predicting highway train trajectories based on Transformer. Background Technology

[0002] In recent years, with the continuous growth of logistics and transportation demand and the ongoing upgrading of transportation modes, large-scale and intensive operations have become important trends in the development of trunk logistics. As heavy-duty transport vehicles, road trains, with their advantages of high transportation efficiency, strong loading capacity, and low operating costs, have been widely used in highways, port distribution, and large logistics parks, becoming an important tool for long-distance freight transport. With the increasing number of road trains, their safety, stability, and scheduling efficiency in road traffic have received increasing attention. To improve the intelligence level of logistics transportation systems and realize functions such as automatic fleet formation, route optimization, and safe driving assistance, it is urgent to accurately predict the travel trajectory of road trains.

[0003] Existing trajectory prediction methods are mostly rule-based designs. They predict the future trajectory of a vehicle based on the vehicle's kinematic reasoning of its historical state, predict the future trajectory of a single agent, and mostly output a single trajectory. Before the future arrives, the trajectory of other vehicles is unpredictable, and the uncertainty of the future trajectory of other vehicles cannot be accurately described by a single trajectory.

[0004] Currently, most trajectory prediction research still focuses on ordinary vehicles, lacking specialized modeling methods for road trains, which makes it difficult to meet their application needs in real-world logistics scenarios. Therefore, there is an urgent need to develop efficient and reliable trajectory prediction technologies tailored to the characteristics of road train transportation. Summary of the Invention

[0005] In view of the above problems, the present invention provides a Transformer-based method for predicting the trajectory of highway trains, which solves the technical problem of limited accuracy in predicting the trajectory of vehicles in the surrounding environment during the operation of highway trains.

[0006] This invention provides a Transformer-based method for predicting highway train trajectories, comprising the following steps: Step S1: Obtain the trajectory of each highway train before the current time and the center line of each lane in the current environment. Segment the trajectory and center line before the current time and extract the information to obtain the historical trajectory vector sequence and the center line vector sequence. Step S2: Perform feature encoding and cross-attention mechanism processing on the historical trajectory vector sequence and the lane centerline vector sequence respectively to obtain the first trajectory feature code and the lane feature code; Step S3: Construct a global interaction graph model based on the first trajectory feature encoding, and perform encoding processing to obtain the second trajectory feature encoding; Step S4: Perform Transformer feature fusion based on the second trajectory feature encoding and lane feature encoding to obtain fused features; Step S5: Classify and regress the fused features to obtain multiple future predicted trajectories and the probability of each future predicted trajectory, which are used as the trajectory prediction results.

[0007] Preferably, step S1 specifically includes: Step S1-1: Obtain the trajectory and lane centerline before the current time, and discretize the trajectory before the current time into an ordered sequence of state points containing multiple time steps. Each state point includes the kinematic state of the road train. Step S1-2: Discretize the lane centerline into multiple segments, each segment including attribute information; Steps S1-3: Establish a historical trajectory vector sequence from the ordered state point sequence, and establish a lane centerline vector sequence from each segment of attribute information.

[0008] Preferably, the kinematic state of the highway train includes: starting point state information, ending point state information, and attribute features, wherein the attribute features include absolute time and agent type; The attribute information includes the starting point information of the lane centerline, the ending point information of the lane centerline, the attribute features of the lane centerline, and the information of the front drive node. The attribute features include length and width.

[0009] Preferably, step S2 specifically includes: Step S2-1: Use a multilayer perceptron to process the historical trajectory vector sequence and output the trajectory encoding vector; use a gated loop unit to process the lane centerline vector sequence and output the lane encoding vector. Step S2-2: Use the cross-attention mechanism to update the trajectory encoding vector and the lane encoding vector respectively to obtain the first trajectory feature encoding.

[0010] Preferably, in step S2-2, the expression for updating the trajectory encoding vector and the lane encoding vector is:

[0011]

[0012] in, These represent the trajectory encoding vectors respectively. The nth element and the lane coding vector One element, This indicates assignment. This represents the cross-attention mechanism.

[0013] Preferably, step S3 specifically includes: Step S3-1: Establish a global interaction graph, use the global interaction graph to perform global interaction on the first trajectory feature code and the lane feature code, and update the first trajectory feature code with the global interaction result; Step S3-2: Perform self-attention processing on the updated first trajectory feature code, and update the first trajectory feature code with the self-attention output result; Step S3-3: After updating the first trajectory feature code, concatenate the position code to obtain the second trajectory feature code.

[0014] Preferably, the calculation expression for the position code is:

[0015]

[0016] in, , These represent the position codes for even-numbered and odd-numbered positions, respectively. This indicates the position of a point on the trajectory within the entire trajectory. This represents the dimension of the corresponding trajectory point vector. The total dimension of the embedding.

[0017] Preferably, step S4 specifically includes: Step S4-1: Encode the second trajectory features using a multilayer perceptron to obtain the query vector; encode the lane features using a multilayer perceptron to obtain the key vector and value vector. Step S4-2: Calculate the cross attention from the query vector, key vector, and value vector, and perform weighted calculation and activation function processing on the cross attention to obtain the fused features.

[0018] Preferably, in step S4-2, the expression for cross-attention is:

[0019] in, Indicates cross attention. Represents the normalized exponential function, Represents the query vector. This represents the transpose of the key vector. Represents the key vector The dimension; The expression for the fused features is:

[0020] in, Indicates fusion features, For activation function, Represents a value vector.

[0021] Preferably, in step S5, the loss function expressions for the classification task and the regression task are:

[0022] in, Represents the total loss function. and These represent regression loss and classification loss, respectively. Indicates the percentage of contribution;

[0023] in, The total number of vehicles. For time index, For predicting trajectory index, To predict the total number of trajectories, For the index of the predicted time, To predict the length, express Total loss Indicates in The first moment Predicted trajectory, Indicates vehicle exist The true trajectory of time;

[0024] in The total number of vehicles. Indicates the index of the predicted trajectory for the optimal pattern. This indicates that the predicted trajectory index does not use the optimal mode. This indicates retrieving the maximum value. Indicates the first The first intelligent agent The probability of a predicted trajectory. These are the boundary values ​​for the design;

[0025] in, Indicates the index of the predicted trajectory for the optimal pattern. Indicates from Maximize optimization within the given trajectory. for The true trajectory of the future at any moment Representing the Predicted trajectory, This represents the average minimum displacement error between the actual trajectory and the predicted trajectory.

[0026] Compared with the prior art, the present invention has at least the following beneficial effects: (1) This invention constructs a trajectory representation method suitable for Transformer input by combining the kinematic model of a highway train. This method can capture the historical motion characteristics of the train more comprehensively and make full use of the information of the center lines of each lane to enrich the expression of the trajectory data. Based on this method, the future trajectory of the highway train can be predicted more accurately, improving the accuracy and practicality of trajectory prediction.

[0027] (2) In view of the complex interactions between multiple agents in the highway train operation environment, this invention introduces a cross-attention mechanism to effectively incorporate the implicit interaction relationships between multiple agents into the feature extraction process. By cross-modeling the historical trajectory vector sequence and the lane centerline vector sequence, the potential influence between multiple agents can be fully explored, thereby further improving the adaptability of trajectory prediction to complex traffic scenarios.

[0028] (3) This invention deeply integrates map information in the scene with trajectory features of multiple agents, and uses Transformer to achieve multimodal feature representation, and finally outputs the prediction results in the form of multiple possible predicted trajectories and their probabilities. This multimodal and probabilistic output method helps to better reflect the diversity and uncertainty of traffic behavior in the real physical world, and makes the trajectory prediction more in line with the actual traffic environment requirements. Attached Figure Description

[0029] The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of the invention.

[0030] Figure 1 The flowchart of the Transformer-based highway train trajectory prediction method provided by the present invention is shown.

[0031] Figure 2 The diagram shows the overall structure of the Transformer-based highway train trajectory prediction method provided by this invention.

[0032] Figure 3 This is a schematic diagram of the model design input provided by the present invention.

[0033] Figure 4 This is a schematic diagram of the Transformer-based encoding provided by the present invention.

[0034] Figure 5 This is a schematic diagram of feature fusion based on Transformer provided by the present invention.

[0035] Figure 6 This is a schematic diagram of the decoding output of the prediction results provided by the present invention. Detailed Implementation

[0036] To better understand the above-described objectives, features, and advantages of the present invention, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other. Furthermore, the present invention can be implemented in other ways different from those described herein; therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.

[0037] This invention provides a Transformer-based method for predicting the trajectory of highway trains. For the multi-agent interactions in the highway train operating environment, this invention introduces a cross-attention mechanism, incorporating the potential interaction relationships between multiple agents into the Transformer's feature extraction, thus fully exploring the mutual influence between the trajectories of multiple agents. Finally, this invention fully utilizes map information, outputting the trajectory predictions of multiple agents in a multimodal form along with their probabilities. This invention can predict the future trajectories of manned vehicles around highway trains, ensuring the safe operation of highway trains in scenarios such as highways and freight hubs, and is of great significance for realizing automated train formation.

[0038] To illustrate the effectiveness of the method proposed in this invention, the following detailed description of the above technical solution is provided through a specific embodiment, such as... Figure 1 As shown, this invention discloses a method for predicting highway train trajectories based on Transformer. Figure 2 The overall structure of the present invention is shown, and the specific implementation steps are as follows: Step S1: Obtain the trajectory of each highway train before the current time and the center line of each lane in the current environment. Segment the trajectory and center line before the current time and extract attribute information to obtain the historical trajectory vector sequence and the center line vector sequence. In this step, the present invention first obtains the historical trajectory information of the highway train and the specific geometric shape information of each lane.

[0039] In some embodiments, historical trajectory information can be collected through sensors on the onboard system of the highway train. For example, LiDAR, cameras, or high-precision global navigation satellite systems can be integrated to obtain the status information of the highway train within a historical time period, such as precise three-dimensional spatial position, speed, acceleration, orientation angle, and object type and size. The status data of all highway trains over a period of time can be recorded to form trajectory data.

[0040] In some embodiments, the specific geometry of all lanes can be obtained by loading high-precision maps, and information such as lane centerlines and lane widths of all lanes in the area surrounding the vehicle can be extracted as lane centerline data.

[0041] This invention establishes mathematical representations of historical trajectory vector sequences and lane centerline vector sequences, which are described in detail below.

[0042] This invention refers to traffic participants, i.e., road trains, as agents in the following description. First, a time series for recording the states of the agents is established, expressed as:

[0043] in, Indicates the current time, subsequence This indicates that it includes the current time. A historical moment, a subsequence express A future moment, in which Indicates that the index is At that moment, Indicates that the index is At that moment.

[0044] To extract the kinematic features of all agents in the environment, it is necessary to model the historical trajectories of the agents in the environment and the lane centerline of the target vehicle at each time point in the time series.

[0045] Specifically, for the first Each intelligent agent stores its historical trajectory as an ordered vector sequence. To represent. Among them, Indicates the first A smart agent arrive The historical trajectory vector sequence at each moment, They represent the first An intelligent agent in , as well as The kinematic state at any given moment. An intelligent agent in The kinematic state at time t is defined as .in, Indicates the first The starting state information of each agent Indicates the first Termination point state information of each agent Indicates the first The attributes and characteristics of an agent (such as absolute time, agent type, etc.).

[0046] In some embodiments, the acquired trajectory data can be segmented and attribute information extracted to generate a vectorized sequence usable by the model. For each historical trajectory of a road train, continuous trajectory records are sampled at a fixed time frequency, thereby discretizing the trajectory into an ordered sequence of state points containing multiple time steps. At each time step, the kinematic state of the road train is extracted and organized into a feature vector. This vector specifically contains the start and end state information of that time step, such as the position coordinates, velocity vector, and orientation angle of the starting point, and the position coordinates, velocity vector, and orientation angle of the ending point. In addition, the vector also contains the attribute information of the road train, such as a predefined agent type encoding (e.g., encoded as "road train").

[0047] Map features can be represented by lane centerlines. This invention uses lane centerlines as input, enabling the model to capture detailed lane information and thus accurately model the agent's behavioral intentions. Each lane centerline is pre-divided into... The segments are represented in vector form.

[0048] The first Each segment of the center line of a lane is represented as an ordered vector sequence. .

[0049] in, Indicates the first center line of lane arrive The lane centerline vector sequence of the segment, They represent the first The first, second, and third segments of the center line of each lane. The attribute information of the segment. Indicates the first The first lane center line The attribute information of a segment is defined as follows: .in, Indicates the first Information on the starting point of the center line of each lane. Indicates the first Information on the end point of the center line of each lane. Indicates the first The attributes of the center line of each lane (such as length, width, etc.). This refers to the predecessor node information, indicating the first... The node preceding the starting point of the center line of a lane is which segment of the center line of which lane.

[0050] In some embodiments, lane centerline data extracted from high-precision maps can be similarly segmented and vectorized. Each continuous lane centerline curve is discretized along its direction into N short, interconnected line segments. For each generated line segment, the system extracts its attribute information and constructs a feature vector. This vector contains the coordinates of the starting and ending points defining the geometry of the line segment, as well as features describing the inherent attributes of the lane, such as lane width. The vector also contains information indicating which lane centerline segment the current line segment originates from.

[0051] To ensure the stability of the input features relative to the agent's position, all coordinates generated in the historical trajectory vector sequence and lane centerline vector sequence need to be transformed into a Cartesian coordinate system with the vehicle's position as the origin before further processing.

[0052] In summary, the historical trajectory vector sequence of each highway train is obtained, expressed as:

[0053] in, The trajectory vector represents the historical trajectory vector sequence of each highway train. , They represent the first The and the first A sequence of historical trajectory vectors of an agent.

[0054] The sequence of lane centerline vectors for each lane is obtained, expressed as:

[0055] in, Let be the lane vector, representing the sequence of lane centerline vectors for each lane. , They represent the first Article and Section A sequence of lane centerline vectors for each lane.

[0056] Through the above steps, this invention extracts and models the time series features of the historical trajectory of highway trains and the center line of the lane, and can simultaneously utilize vehicle and lane information in the environment, ensuring the richness and completeness of the model input information.

[0057] Step S2: Perform feature encoding and cross-attention mechanism processing on the historical trajectory vector sequence and the lane centerline vector sequence respectively to obtain the first trajectory feature code and the lane feature code; like Figure 3 As shown, this invention relates to trajectory vectors and lane vectors Feature encoding and cross-attention mechanisms are applied separately, as detailed below.

[0058] For the historical trajectory vector sequence that characterizes the kinematic features of an agent, this invention uses a multi-layer perceptron (MLP) for processing.

[0059] Using MLP to process trajectory vectors The output trajectory encoding vector is .in, Represents the trajectory encoding vector. These represent the first and second digits of the trajectory encoding vector, respectively. One element, This represents the number of agents in a given scenario. , It means to take at will.

[0060] This invention uses a gated recurrent unit (GRU) network to encode the lane centerline vector sequence.

[0061] Using GRU to process lane vectors The output lane coding vector is .in, Represents the lane coding vector. These represent the lane coding vectors at the 1st, 2nd, and 3rd positions, respectively. One element, This indicates the number of lane segments in a given scenario. .

[0062] To achieve deep interaction and mutual enhancement between the agent and lane environment modalities, this invention provides a symmetric cross-attention mechanism for feature fusion. This mechanism enables trajectory features and lane features to perceive each other, thereby generating enhanced feature representations that incorporate contextual information from each other. The expression is as follows:

[0063]

[0064] in, These represent the trajectory encoding vectors respectively. The nth element and the lane coding vector One element, This indicates assignment. This represents the cross-attention mechanism.

[0065] Finally, the updated trajectory encoding vector and lane encoding vector are used as the first trajectory feature encoding and lane feature encoding, respectively.

[0066] Step S3: Construct a Global Interaction Graph (GIG) model based on the first trajectory feature encoding, and perform encoding processing to obtain the second trajectory feature encoding; for example... Figure 4 The GIG model described in this invention is demonstrated. After completing the cross-modal information fusion of trajectory features and lane features, in order to further accurately capture the dynamic interaction relationships between various agents in complex traffic environments, a self-attention mechanism and skip connections are further utilized to learn the interaction relationships between various agents, expressed as:

[0067]

[0068] in, Indicates splicing, This indicates self-attention processing.

[0069] By constructing a global interaction graph from the trajectory encoding vector and the lane encoding vector, updating the trajectory encoding vector with the output features, and then performing self-attention processing on the trajectory encoding vector, the interaction relationships between various agents can be learned.

[0070] Considering that the Transformer uses parallel input and cannot recognize the sequential order of trajectory sequences, positional encoding (PE) is added after the encoded trajectory features to provide temporal information of the input. The expression is as follows:

[0071]

[0072] in, , These represent the position codes for even-numbered and odd-numbered positions, respectively. This indicates the position of a point on the trajectory within the entire trajectory. This represents the dimension of the corresponding trajectory point vector. The total dimension of the embedding.

[0073] In summary, the final trajectory encoding vector is obtained:

[0074]

[0075] in, This indicates a splicing operation. express The corresponding position code.

[0076] The trajectory encoding vector updated by lane feature encoding concatenation, self-attention mechanism and position encoding is used as the second trajectory feature encoding.

[0077] Step S4: Perform Transformer feature fusion based on the second trajectory feature encoding and lane feature encoding to obtain fused features; like Figure 5 The example shown is for the trajectory encoding vector obtained in step S3. These features are encoded using a multi-layer perceptron (MLP) to obtain the query vector. .in It is a learnable query weight matrix.

[0078] For the lane coding vector obtained in step S3 These features are encoded using a multi-layer perceptron (MLP) to obtain key vectors. Value vector .in, It is a learnable key-weight matrix. It is a learnable value weight matrix.

[0079] This step uses a learnable query weight matrix. Perform a linear transformation to obtain the query vector. This query vector is used by the vehicle being predicted to send an "information query" to the environment based on its own motion state, implying its intention to explore the possibilities of future paths.

[0080] Through a learnable key weight matrix Lane feature coding Perform a linear transformation to obtain the key vector. Similarly, through a learnable value weight matrix Transform the lane feature code C to obtain the value vector. The key vector can be viewed as an "index label" for each lane line to its own attributes, used to respond to queries; while the value vector is the "actual information content" carried by the lane line, which is the basis for subsequent information aggregation.

[0081] Cross attention is defined as the predicted attention level of a vehicle to the center lines of surrounding lanes. :

[0082] in, Indicates cross attention. Represents the normalized exponential function, Represents the key vector Dimensions.

[0083] use Road constraint information can be weighted and fused into the features of the predicted vehicle, ultimately yielding a fused feature that includes both the vehicle's own motion information and the vehicle-to-vehicle interaction and road constraint information. The expression is as follows:

[0084] in, Indicates fusion features, This is the activation function.

[0085] Through the above steps, features are fused. It not only preserves the kinematic information of the predicted vehicle, but also incorporates key road topology and geometric constraints through an attention mechanism, providing high-quality, high-information-density input for subsequent trajectory decoding and prediction.

[0086] Step S5: Perform classification and regression tasks on the fused features to obtain multiple future predicted trajectories and the probability of each future predicted trajectory, which are used as the trajectory prediction results.

[0087] like Figure 6 As shown, the fused and updated vehicle feature code is obtained in step S4. Then, it is input into the multimodal trajectory prediction decoder. The multimodal trajectory decoder is divided into two parts: a classification head and a regression head.

[0088] The classification head consists of two sets of multi-layer sensing mechanisms. The classification head is used to predict and output the coordinates of future trajectory points, i.e., the output:

[0089] in, They represent the first The first intelligent agent The predicted trajectory vector, the first The first intelligent agent The first predicted trajectory vector, the second agent's first predicted trajectory vector, and the... The first intelligent agent The predicted trajectory vector, the first The first intelligent agent A predicted trajectory vector.

[0090] The predicted trajectory vector contains the coordinates of all spatiotemporal trajectory points required to construct a complete trajectory. These coordinates can be extracted sequentially. The elements of the equivectors form an ordered sequence of coordinate points. This ultimately yields a complete time-series vector. The first intelligent agent A predicted trajectory.

[0091] The regression head also consists of two sets of multilayer sensing mechanisms. The regression head is used to calculate the probability of each trajectory, i.e., the output:

[0092] in, They represent the first The first intelligent agent The probability of the predicted trajectory, the first The first intelligent agent The probability of the first predicted trajectory, the probability of the second agent predicting the first trajectory, and the probability of the third predicted trajectory. The first intelligent agent The probability of the predicted trajectory, the first The first intelligent agent The probability of a predicted trajectory.

[0093] This invention defines the loss functions for two types of tasks: regression and classification, and the overall loss function. For regression loss and classification loss The weighted sum of the two is:

[0094] in, Represents the total loss function. and These represent regression loss and classification loss, respectively. Indicates the proportion of contribution. , which is to balance the contribution ratio of classification loss and regression loss in the total loss function.

[0095] For the calculation of regression loss, we choose to represent it as absolute error loss, that is:

[0096] in, The total number of vehicles. For time index, For predicting trajectory index, To predict the total number of trajectories, For the index of the predicted time, To predict the length, express Total loss , for The Middle One element, )for loss, Indicates in The first moment Predicted trajectory, Indicates in vehicle exist The true trajectory of time.

[0097] For classification loss, the maximum marginal loss is used, i.e.:

[0098] in The total number of vehicles. Indicates the optimal mode. This indicates that the predicted trajectory index does not use the optimal mode. This indicates retrieving the maximum value. Indicates the first The first intelligent agent The probability of a predicted trajectory. These are the boundary values ​​for the design.

[0099] For the target vehicle generated Choose the trajectory with the minimum average displacement error. The corresponding trajectory is the index of the predicted trajectory of the best mode. ,Right now

[0100] in, Indicates the index of the predicted trajectory for the optimal pattern. Indicates from Maximize optimization within the given trajectory. for The true trajectory of the future at any moment Representing the Predicted trajectory, This represents the average minimum displacement error between the actual trajectory and the predicted trajectory.

[0101] In some embodiments, the present invention trains the entire Transformer network such that the total loss function is optimized. With the goal of minimizing, error backpropagation is performed by iteratively updating network weights. When the total loss function... The iteration stops when the value is less than the preset value or the preset number of iterations is reached, thus completing the training of the Transformer network.

[0102] While the specific embodiments of the present invention depict actions or steps in a particular order, this should be understood as requiring such actions or steps to be performed in the shown specific order or sequential order, or requiring all illustrated actions or steps to be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations. The above descriptions are merely preferred embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention.

[0103] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for predicting highway train trajectories based on Transformer, characterized in that, Includes the following steps: Step S1: Obtain the trajectory of each highway train before the current time and the center line of each lane in the current environment. Segment the trajectory and center line before the current time and extract the information to obtain the historical trajectory vector sequence and the center line vector sequence. Step S2: Perform feature encoding and cross-attention mechanism processing on the historical trajectory vector sequence and the lane centerline vector sequence respectively to obtain the first trajectory feature code and the lane feature code; Step S3: Construct a global interaction graph model based on the first trajectory feature encoding, and perform encoding processing to obtain the second trajectory feature encoding; Step S4: Perform Transformer feature fusion based on the second trajectory feature encoding and lane feature encoding to obtain fused features; Step S5: Perform regression and classification processing on the fused features respectively to obtain multiple future predicted trajectories and the probability of each future predicted trajectory, which are used as the trajectory prediction results.

2. The method for predicting highway train trajectories based on Transformer according to claim 1, characterized in that, Step S1 specifically includes: Step S1-1: Obtain the trajectory and lane centerline before the current time, and discretize the trajectory before the current time into an ordered sequence of state points containing multiple time steps. Each state point includes the kinematic state of the road train. Step S1-2: Discretize the lane centerline into multiple segments, each segment including attribute information; Steps S1-3: Establish a historical trajectory vector sequence from the ordered state point sequence, and establish a lane centerline vector sequence from each segment of attribute information.

3. The method for predicting highway train trajectories based on Transformer according to claim 2, characterized in that, The kinematic state of the highway train includes: starting point state information, ending point state information, and attribute features, wherein the attribute features include absolute time and agent type. The attribute information includes the starting point information of the lane centerline, the ending point information of the lane centerline, the attribute features of the lane centerline, and the information of the front drive node. The attribute features include length and width.

4. The method for predicting highway train trajectories based on Transformer according to claim 3, characterized in that, Step S2 specifically includes: Step S2-1: Use a multilayer perceptron to process the historical trajectory vector sequence and output the trajectory encoding vector; use a gated loop unit to process the lane centerline vector sequence and output the lane encoding vector. Step S2-2: Use the cross-attention mechanism to update the trajectory encoding vector and the lane encoding vector respectively to obtain the first trajectory feature encoding.

5. The method for predicting highway train trajectories based on Transformer according to claim 4, characterized in that, In step S2-2, the expression for updating the trajectory encoding vector and the lane encoding vector is: in, These represent the trajectory encoding vectors respectively. The nth element and the lane coding vector One element, This indicates assignment. This represents the cross-attention mechanism.

6. The method for predicting highway train trajectories based on Transformer according to claim 5, characterized in that, Step S3 specifically includes: Step S3-1: Establish a global interaction graph, use the global interaction graph to perform global interaction on the first trajectory feature code and the lane feature code, and update the first trajectory feature code with the global interaction result; Step S3-2: Perform self-attention processing on the updated first trajectory feature code, and update the first trajectory feature code with the self-attention output result; Step S3-3: After updating the first trajectory feature code, concatenate the position code to obtain the second trajectory feature code.

7. The method for predicting highway train trajectories based on Transformer according to claim 6, characterized in that, The calculation expression for the position code is: in, , These represent the position codes for even-numbered and odd-numbered positions, respectively. This indicates the position of a point on the trajectory within the entire trajectory. This represents the dimension of the corresponding trajectory point vector. The total dimension of the embedding.

8. The method for predicting highway train trajectories based on Transformer according to claim 7, characterized in that, Step S4 specifically includes: Step S4-1: Encode the second trajectory features using a multilayer perceptron to obtain the query vector; encode the lane features using a multilayer perceptron to obtain the key vector and value vector. Step S4-2: Calculate the cross attention from the query vector, key vector, and value vector, and perform weighted calculation and activation function processing on the cross attention to obtain the fused features.

9. The method for predicting highway train trajectories based on Transformer according to claim 8, characterized in that, In step S4-2, the expression for cross-attention is: in, Indicates cross attention. Represents the normalized exponential function, Represents the query vector. This represents the transpose of the key vector. Represents the key vector The dimension; The expression for the fused features is: in, Indicates fusion features, For activation function, Represents a value vector.

10. The method for predicting highway train trajectories based on Transformer according to claim 9, characterized in that, In step S5, the loss function expressions for the classification task and the regression task are: in, Represents the total loss function. and These represent regression loss and classification loss, respectively. Indicates the percentage of contribution; in, The total number of vehicles. For time index, For predicting trajectory index, To predict the total number of trajectories, For the index of the predicted time, To predict the length, express Total loss Indicates in The first moment Predicted trajectory, Indicates vehicle exist The true trajectory of time; in The total number of vehicles. Indicates the index of the predicted trajectory for the optimal pattern. This indicates that the predicted trajectory index does not use the optimal mode. This indicates retrieving the maximum value. Indicates the first The first intelligent agent The probability of a predicted trajectory. These are the boundary values ​​for the design; in, Indicates the index of the predicted trajectory for the optimal pattern. Indicates from Maximize optimization within the given trajectory. for The true trajectory of the future at any moment Representing the Predicted trajectory, This represents the average minimum displacement error between the actual trajectory and the predicted trajectory.