A vehicle car following behavior modeling method based on transformer-wgan

By learning the temporal dependencies of vehicle state sequence data using the Transformer-WGAN model and conducting adversarial training, the problem of inaccurate modeling of vehicle following behavior caused by missing preceding vehicle data is solved, thus improving the safety and efficiency of following vehicles.

CN115630683BActive Publication Date: 2026-02-27ZHEJIANG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211113362.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-14
Publication Date
2026-02-27
Estimated Expiration
2042-09-14

AI Technical Summary

Technical Problem

Existing deep learning-based methods for modeling vehicle following behavior cannot accurately predict the future state of a vehicle when data on the vehicle in front is missing, leading to a decrease in following safety and efficiency.

Method used

A vehicle car-following behavior modeling method based on Transformer-WGAN is adopted. The Transformer network is used to learn the temporal dependencies in the vehicle state sequence data, and the Generative Adversarial Network (WGAN) is used to make accurate predictions in the case of missing data. The adversarial training of the generator and discriminator is included to reduce the prediction error.

Benefits of technology

When data from the vehicle ahead is missing, it improves the prediction accuracy and robustness of vehicle following behavior modeling, thereby enhancing the safety and efficiency of following.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115630683B_ABST
    Figure CN115630683B_ABST
Patent Text Reader

Abstract

A vehicle following behavior modeling method based on Transform-WGAN, comprising the steps of: obtaining state sequence data of multiple groups of following vehicles and their preceding vehicles in a following scene, and preprocessing the data to conform to the data format of the model input; establishing a Transform network model, learning the complex time sequence dependency in the vehicle state sequence data in the following scene using a multi-head self-attention mechanism, and extracting the potential time features in the driving data; constructing a generative adversarial network WGAN, using time feature data to predict the future state of the vehicle in the following scene; taking the prediction result and the real result as the input of a discriminator composed of a full connection network, the purpose of the discriminator is to distinguish the prediction result from the real result, and judge the prediction result as false; after the adversarial training of the generator and the discriminator, it is difficult for the discriminator to judge the prediction result as false, so as to minimize the error between the prediction result and the real result, and realize accurate prediction of the future state of the vehicle in the following scene.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a vehicle car-following behavior modeling method based on a Transformer-WGAN, and belongs to the intelligent transportation field. BACKGROUND

[0002] Car-following behavior is a common micro driving behavior, which describes the interaction between two adjacent vehicles driving on a single lane that restricts overtaking, and the car-following behavior has an important influence on the operation efficiency of vehicles, road traffic rate and traffic flow stability. A vehicle car-following model aims to replicate the car-following behavior of a driver, and is a basic algorithm in a traffic simulation tool. Modeling the car-following behavior of vehicles can quantize the longitudinal interaction between car-following vehicles and enhance the safety of driving behavior.

[0003] With the rise of deep learning, more and more deep learning algorithms are applied to the automatic driving field. Real-time driving data of surrounding vehicles and the vehicle can be obtained through sensors of the vehicle. Unlike a vehicle car-following model based on kinematics, in a car-following model based on deep learning, the car-following behavior is learned from a large amount of car-following data of human drivers, that is, the data of a car-following vehicle and its preceding vehicle at a historical moment are input into the car-following model based on deep learning, and the state of the car-following vehicle at a future moment is output, so as to control the car-following vehicle.

[0004] The main methods for modeling the car-following behavior of vehicles at present include a full velocity difference model (FVD), an intelligent driving model (IDM), a long short-term memory model (LSTM) and a sequence-to-sequence model (Seq2seq). In the car-following model of vehicles based on deep learning, most of them predict the state of the vehicle at a future moment according to complete driving data of the car-following vehicle and its preceding vehicle, and do not consider the situation that the collected data of the preceding vehicle is missing due to damage of the sensor, thereby causing deviation of the control decision of the car-following vehicle, and causing rear-end danger or traffic shock. The application provides a vehicle car-following behavior modeling method based on a Transformer-WGAN, which models the car-following behavior of vehicles under the condition that the driving data of the preceding vehicle is missing, and improves the safety and efficiency of car-following. SUMMARY

[0005] The application aims to overcome the above-mentioned defects of the prior art, and provides a vehicle car-following behavior modeling method based on a Transformer-WGAN.

[0006] The application aims to provide a vehicle following behavior modeling method based on a Transformer-WGAN when the collected preceding vehicle data is missing, so as to improve the safety and efficiency of following a vehicle.

[0007] The technical scheme adopted by the application to solve the technical problem is:

[0008] The application provides a vehicle following behavior modeling method based on a Transformer-WGAN, which comprises the following steps.

[0009] The state sequence data of a plurality of following vehicles and preceding vehicles in a following scenario are acquired, and the data comprises the speed of the following vehicle, the acceleration of the following vehicle, the acceleration of the preceding vehicle, and the speed difference between the preceding vehicle and the following vehicle.

[0010] A Transformer network model is established, and the multi-head self-attention mechanism in the Transformer network model is used to learn the complex time sequence dependency in the state sequence data of the vehicle in the following scenario, so as to extract the potential time features in the driving data.

[0011] A generative adversarial network WGAN is constructed, and the time feature data is used to realize the prediction of the future state of the vehicle in the following scenario.

[0012] In the existing deep learning-based vehicle following model, most of them predict the state of the vehicle at the future time according to the complete driving data of the following vehicle and its front vehicle, and do not consider the case that the driving data of the front vehicle collected due to sensor damage is missing, so the present application proposes a vehicle following behavior modeling method based on Transformer-WGAN. The present application uses the Transformer network model to learn the complex time sequence dependence relationship in the vehicle state sequence data in the following scene, and fully excavates the potential time features in the driving data; by constructing the generative adversarial network WGAN, after the adversarial training of the generator and the discriminator, the model realizes accurate prediction of the future state of the vehicle in the following scene under the condition that the driving data of the front vehicle is missing.

[0013] The beneficial effects of the present application are:

[0014] (1) The multi-head self-attention mechanism in the Transformer network is used to learn the complex time sequence dependence relationship in the vehicle state sequence data in the following scene, and fully excavate the potential time features in the driving data.

[0015] (2) Based on the time features, the powerful data generation capability of the generative adversarial network WGAN can effectively improve the prediction accuracy of the future state of the vehicle under the condition that the front vehicle data in the following scene is missing, and enhance the robustness of the model. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 is the structure diagram of the Transformer network model of the present application.

[0017] Figure 2 is the structure diagram of the Seq2seq network model of the present application.

[0018] Figure 3 is the structure diagram of the GRU unit of the present application.

[0019] Figure 4 is the structure diagram of the Transformer-WGAN network model of the present application.

[0020] Fig. 5 is a trajectory diagram of the real trajectory of the following vehicle and its front vehicle and the trajectory diagram of the model prediction under different missing rates according to an embodiment of the present application. Figure 5a is the real trajectory diagram of the front vehicle numbered 1314 and the following vehicle numbered 1326 and the trajectory diagram of the model prediction when the missing rate is 0%; Figure 5b is the real trajectory diagram of the front vehicle numbered 1314 and the following vehicle numbered 1326 and the trajectory diagram of the model prediction when the missing rate is 10%; Figure 5c is the real trajectory diagram of the front vehicle numbered 1314 and the following vehicle numbered 1326 and the trajectory diagram of the model prediction when the missing rate is 30%; Figure 5dis the trajectory graph of the real trajectory and the model-predicted trajectory of the leading vehicle No. 1314 and the car-following vehicle No. 1326 when the missing rate is 50%; Figure 5e is the trajectory graph of the real trajectory and the model-predicted trajectory of the leading vehicle No. 1314 and the car-following vehicle No. 1326 when the missing rate is 70%. DETAILED DESCRIPTION

[0021] The technical solutions of the present application are further described below with reference to the accompanying drawings.

[0022] Embodiment 1:

[0023] Reference Figures 1 to 4 :

[0024] A vehicle car-following behavior modeling method based on Transformer-WGAN includes the following steps:

[0025] Step 1: Obtain the state sequence data of multiple groups of car-following vehicles and their leading vehicles in a car-following scene, including the speed of the car-following vehicle, the acceleration of the car-following vehicle, the acceleration of the leading vehicle, the speed difference between the leading vehicle and the car-following vehicle, and the step of preprocessing the data to make it conform to the data format of the model input.

[0026] Step 1.1: Obtain the driving state sequence data of the jth group of car-following vehicles in the car-following scene.

[0027]

[0028] wherein j∈[1:N], N is the total number of groups of car-following vehicles obtained; s represents the car-following vehicle; X js (t) represents the driving state sequence data of the jth group of car-following vehicles obtained in the car-following scene; T represents the total time length of the jth group of car-following vehicle data sampled; v js (t+i) is the speed of the jth group of car-following vehicles at time t+i; a js (t+i) is the acceleration of the jth group of car-following vehicles at time t+i; p js (t+i) is the longitudinal position of the jth group of car-following vehicles at time t+i, wherein i∈[0:T].

[0029] Step 1.2: Obtain the driving state sequence data of the jth group of leading vehicles in the car-following scene.

[0030]

[0031] wherein j∈[1:N], N is the total number of groups of car-following vehicles obtained; l represents the leading vehicle; X jl (t) represents the driving state sequence data of the jth group of leading vehicles obtained in the car-following scene; T represents the total time length of the jth group of car-following vehicle data sampled; v jlv (t + i) is the speed of the jth group of preceding vehicles at t + i; a jl a (t + i) is the acceleration of the jth group of preceding vehicles at t + i; p jl p (t + i) is the longitudinal position of the jth group of preceding vehicles at t + i; where i ∈ [0: T].

[0032] To represent the situation of missing data of preceding vehicles due to sensor damage, a 0-1 mask matrix M jl (t) = {m jl (t + i)} i=[0:T] , where m jl (t + i) represents whether the jth group of preceding vehicle data value collected at t + i is missing, that is,

[0033]

[0034] The mask matrix M jl (t) randomly distributes a continuous |M jl (t) | × k 0s, representing the position of randomly missing data, where |M jl (t) | is the number of rows of the mask matrix, and k represents the proportion of randomly continuous missing data. Therefore, the actual acquired jth group of preceding vehicle state sequence data is:

[0035] X jl ′(t) = X jl (t) ⊙ M jl (t) (4)

[0036] where ⊙ represents matrix point multiplication.

[0037] Step 1.3: Preprocess the acquired driving data of N groups of car-following vehicles and their preceding vehicles in the car-following scene to make it conform to the data format of the model input.

[0038] Fuse the acquired driving data X js (t) of each group of car-following vehicles and the driving data X′ jl (t) of their preceding vehicles:

[0039]

[0040] where j ∈ [1: N], N is the total number of groups of car-following vehicles acquired; X merge j (t) represents the driving data of the jth group of car-following vehicles and their preceding vehicles; T represents the total duration of the jth group of car-following vehicle data sampled; v js v (t + i) is the speed of the jth group of car-following vehicles at t + i; a js a (t + i) is the acceleration of the jth group of car-following vehicles at t + i; a jl(t+i) is the acceleration of the jth group of preceding vehicles at time t+i; Δv j (t+i) = v jl (t+i) - v js (t+i), which represents the difference between the speed of the jth group of preceding vehicles at time t+i and the speed of the follower vehicle at time t+i, where i ∈ [0:T].

[0041] For the N groups of follower vehicles, the total set of driving data composed of the driving data of each group of follower vehicles and its preceding vehicles is X merge = [x1(t), x2(t), …, xN(t)]. merge 1 (t), X merge 2 (t), …, X merge j (t), …, X merge N (t)].

[0042] Step 1.4: The total set of fused driving data X merge is constructed into the form of data samples that meet the input of the model. Since the driver's decision usually depends on historical driving behavior and past traffic conditions, incorporating driving memory into the car-following model can better describe the characteristics of traffic flow. Therefore, the historical driving duration information of a seconds is considered to predict the state of the vehicle in the future b seconds. The model input sample x merge j (t) is constructed based on X i (t) is constructed based on X

[0043]

[0044] where x i (t) ∈ R ax4 .

[0045] The label corresponding to the single input sample x i (t) is the state of the vehicle in the future b seconds y i (t) is constructed based on X

[0046]

[0047] where y i (t) ∈ R bx4 .

[0048] Therefore, the total set of model input samples X = [x1(t), x2(t), …, xN(t)] is constructed based on X merge , and the total set of labels Y = [y1(t), y2(t), …, yN(t)] corresponding to it is constructed based on X i . n i .​n (t)], where n is the total number of samples.

[0049] Based on the total set of input samples X and the total set of corresponding labels Y, the training set and the test set are divided, and the division ratio is c:d, that is, c% of the samples in X and Y are used for model training, and d% of the samples are used for testing the performance of the model. To ensure that the model can be fully trained, the corresponding label of each input sample is complete during the model training process.

[0050] Step 2: Establish a Transformer network model, the structure of which is as shown in Figure 1 The step of using the multi-head self-attention mechanism in the Transformer network model to learn the complex time sequence dependence in the vehicle state sequence data in the following scene and extract the potential time features in the driving data.

[0051] For the total set of input samples X composed of vehicle state sequence data in the following scene, a Transformer network model is built, X is taken as the input of the Transformer network model, and the potential time features in the driving data are calculated. The calculation process is as follows:

[0052] Step 2.1: Use a fully connected network to encode the input sample x i (t) into d dimensions, that is:

[0053] x d (t) = f c (x i (t)) (8)

[0054] Where x d (t) ∈ R axd .

[0055] Step 2.2: Since the Transformer network model mainly relies on the self-attention mechanism to achieve excellent performance in sequence modeling tasks, based on the obtained encoded input sample x d (t), the calculation process of the multi-head self-attention mechanism in the Transformer model is as follows:

[0056] First, the encoded input sample x d (t) is obtained through three weight matrices to obtain the query matrix, key matrix and value matrix required for calculating the attention value, that is:

[0057] Q u (x d ) = W u,q · x d (t) (9)

[0058] K u (xd ) = W u,k · x d (t) (10)

[0059] V u (x d ) = W u,v · x d (t) (11)

[0060] where · denotes the matrix cross product; Q u , K u , V u are the query, key and value functions of the u-th attention head, respectively; W u,q , W u,k , W u,v are the corresponding weight matrices.

[0061] Based on the query matrix, key matrix and value matrix obtained above, the attention Att(Q u , K u , V u ) of the u-th head in the multi-head self-attention is calculated as follows:

[0062]

[0063] where softmax is the normalized exponential function, d k is the dimension of the key vector.

[0064] Therefore, for all h heads of self-attention, the calculation is as follows:

[0065]

[0066] head u = Att u (Q u , K u , V u ) (14)

[0067] where f c is a fully connected layer that fuses the features extracted by the h heads of self-attention mechanism; head u is the u-th head of self-attention.

[0068] By calculating the self-attention between different time step embeddings, the representation information from different positions can be focused on, and the complex temporal dependency relationship in the driving data can be learned.

[0069] Step 2.3: Based on the features extracted by the h heads of self-attention mechanism, through residual connection and layer normalization, the model is accelerated to converge and prevent gradient vanishing in the training process, and the calculation process is as follows:

[0070] z" i (t) = LayerNorm(x d (t) + MultiHead(Qu, Ku, Vu); β) (15)

[0071] where β ∈ R is the parameter of layer normalization learning.

[0072] Step 2.4: Based on the output of step 2.3, the extracted time feature z i (t) is represented as follows:

[0073]

[0074] z i (t) = LayerNorm(z' i (t) + z" i (t); a) (17)

[0075] where z' i (t) is the output of the fully connected forward propagation layer; relu is the activation function, i.e. relu(x) = max(x, 0); is the weight matrix, a ∈ R is the parameter of layer normalization learning; z i (t) is the latent time feature extracted by the Transformer network model based on the input sample x i (t).

[0076] Therefore, based on the above process, for the total set of input samples X, the latent time feature extracted by the Transformer network model is Z = [z1(t), z2(t), …, z i (t), …, z n (t)].

[0077] Step 3: Constructing the generative adversarial network WGAN to realize the step of predicting the future state of the vehicle in the car-following scene using time feature data: the generative adversarial network WGAN mainly includes two parts: the generator and the discriminator. The Seq2Seq network model is used as the generator of the WGAN, the time feature data output by the Transformer network is used as the input of the Seq2Seq network, and the corresponding prediction result is calculated according to the current input; the prediction result and the true result are used as the input of the discriminator composed of a fully connected network, and the purpose of the discriminator is to distinguish the prediction result from the true result, and to judge the prediction result as false; after the adversarial training of the generator and the discriminator, it is difficult for the discriminator to judge the prediction result as false, so as to minimize the error between the prediction result and the true result, and realize the step of accurately predicting the future state of the vehicle in the car-following scene.

[0078] Step 3.1: Construct the generator part of the generative adversarial network WGAN as follows:

[0079] In the present application, the Seq2Seq network model is used as the generator part of the WGAN, and the Seq2Seq network is a model based on an encoding-decoding structure, in which the encoder and the decoder are GRU networks, and the model structure is as shown in Figure 2 .

[0080] The GRU network is a neural network used for processing sequence tasks, which can selectively retain historical information for calculation at the next time, and the GRU network is mainly composed of multiple memory units, and there are two gates in the memory unit for controlling the flow of information, which are the update gate s(t) and the reset gate r(t). The structure of the GRU unit is as shown in Figure 3 When the input sequence data z i (t) is input into the GRU network, the information propagation process in the memory unit is as follows:

[0081]

[0082]

[0083]

[0084]

[0085] where · represents matrix cross multiplication; and ⊙ represents matrix point multiplication; is the input of the current time step of the GRU network; W sh , W sx , W rh , W rx , W hh , W hx are weight matrices; b s , b r , b h are biases; σ represents the sigmoid activation function; tanh is the hyperbolic tangent activation function; h(t) is the output of the memory unit at time t, which contains past information h(t-1) and present information (candidate state) The update gate s(t) assigns importance, and the update gate s(t) controls the amount of information to be retained from the state h(t-1) at the last time and the amount of new information received from the candidate state at the current time h(t); the reset gate r(t) controls the amount of information of the last time state h(t-1) to be retained in the candidate state at the current time.

[0086] The GRU constantly absorbs new important information and discards irrelevant information in the above manner to capture the dependencies in the sequence data.

[0087] Therefore, in the Seq2Seq network model, for the input sample sequence z i (t), the input sample sequence z i (t) is first encoded into a fixed-length context information vector C by the encoder GRU network, and the encoding process is represented as follows:

[0088]

[0089] C = h(t + τ) (23)

[0090] wherein is the input of the current time step of the GRU network; h(t-1) is the state of the previous time step; h(t) is the state of the current time step; h(t+τ) is the state of the last time step in the input sequence, which is the encoded context information vector C, representing a summary of the input sequence information, and t+τ represents the last time step in the sequence z i (t).

[0091] After obtaining the context information vector C, the learned context information vector C is decoded by the decoder GRU network as the output of the Seq2Seq network model, i.e., the predicted future b-second vehicle state y i pred (t), and the decoding process is represented as follows:

[0092] p(y′(t+b)|y′(t+1),y′(t+2),...,y′(t+b-1);C)=GRU dec [y′(t+b-1),h(t+b-1),C] (24)

[0093] wherein the context information vector C is used as the initial state of the decoder; y′(t+b) is the output of the current time step; y′(t+b-1) is the output of the previous time step; h(t+b-1) is the state of the previous time step.

[0094] The essence of the Seq2seq network model is to learn the conditional distribution of one variable-length sequence as the condition of another sequence, which can be described as follows:

[0095]

[0096] That is, the Seq2seq network model is trained to maximize the conditional probability p(y′(t+1),y′(t+2),...,y′(t+b)|z i(t))}. Therefore, based on the above process, for the output of the Transformer network, i.e., the input sample Z containing the time feature, the final output of the Seq2seq network model is:

[0097] Y pred = [y1 pred (t),y2 pred (t),…,y i pred (t),…,y n pred (t)] (26)

[0098] wherein

[0099] Step 3.2: Construct the discriminator part of the generative adversarial network WGAN as follows:

[0100] In the present application, a fully connected network model with L d layers is used as the discriminator part of the WGAN, and the model calculation process is as follows:

[0101]

[0102]

[0103] wherein l = 1, 2, …, L D ; H l G is the feature extracted by the l-th fully connected network; and σ is a leakyrelu activation function, i.e.:

[0104]

[0105] wherein ε = 0.2; f c is the L D -th fully connected layer; W l G , b l G are the weight and bias parameters of the l-th layer that need to be trained; are the weight and bias parameters of the L D -th layer that need to be trained; is the output of the fully connected network.

[0106] Step 3.3: Define the loss function of the generative adversarial network WGAN, wherein the loss function of the generator is Loss G , and the loss function of the discriminator is Loss D , and is represented as follows:

[0107]

[0108]

[0109] After the adversarial training of the generator and the discriminator, the error between the predicted result y i pred (t) and the real result y i (t) is minimized, so as to achieve the purpose of accurately predicting the future state of the vehicle in the following scene.

[0110] Embodiment 2

[0111] Referring to FIG. 5:

[0112] One embodiment of the present application comprises the following steps:

[0113] (1) Select experimental data.

[0114] The experimental data set uses vehicle driving data collected on the eastbound I-80 highway in Emeryville, California, USA, which contains driving data information such as the position, speed, and acceleration of the vehicle. The data sampling interval is 0.1s, i.e., every 0.1s provides driving data information for each vehicle in the study area. The experiment selected 498 groups of following vehicles in the following scene, and the following time of each group of following vehicles was more than 30s.

[0115] (2) Parameter determination.

[0116] The experimental results of the present application are realized based on the pytorch environment; in order to simulate the situation of missing data of the preceding vehicle in the real scene due to sensor damage, the type of data missing is set to random continuous missing in time in the experiment, and the missing ratio k is set to the range of 0.0-0.7; considering the historical driving time information of a=5s to predict the vehicle state in the future b=1s; based on the obtained total input sample set X and the corresponding total label set Y of 498 groups of following vehicles in the following scene, the division ratio of the training set and the test set is 8:2, i.e., c=8, d=2; in the Transformer network model, the dimension d=32 of each input sample x i (t) encoding; the number of heads h=8 of self-attention; in the generative adversarial network WGAN, the composition of the discriminator is a fully connected network model of L d layer, L d =3, and the number of hidden units is 64, 32, and 16, respectively; the model training optimizer is the RMSprop optimizer.

[0117] (3) Experimental results.

[0118] The experiment of the present application aims to predict the driving state of the preceding vehicle and the following vehicle in the following scene for 1s, and the model is trained by the training set, and the prediction performance of the model is evaluated by the test set.

[0119] The mean square error is selected as the index of the prediction accuracy of the model, and the calculation formula is as follows:

[0120]

[0121] Wherein is the label corresponding to the i-th input sample; is the predicted value output by the model according to the i-th input sample; m is the total number of samples in the test data set.

[0122] Table 1 is the MSE between the predicted value and the label output by the model under different missing proportions.

[0123] Based on the obtained speed, acceleration, longitudinal position of the following vehicle, speed difference between the front vehicle and the following vehicle, acceleration of the front vehicle, longitudinal position of the front vehicle and other information in the following scene, based on the following calculation formula, that is:

[0124]

[0125] Where Δt=0.1s; p t+1 is the position of the vehicle at t+1; p t is the position of the vehicle at t; v t is the speed of the vehicle at t; a t is the acceleration of the vehicle at t, the real trajectory and the model predicted trajectory of the front vehicle and the following vehicle in the following scene under different missing rates are drawn, taking the following vehicle No. 1326 as an example, and the front vehicle is No. 1314, as shown in Figure 5.

[0126] Table 1 is the MSE between the predicted value and the label output by the model under different missing proportions

[0127]

Claims

1. A method for modeling vehicle car-following behavior based on Transformer-WGAN, characterized in that... Includes the following steps: Step 1: Obtain multiple sets of state sequence data of the following car and the car in front in the car-following scenario. The data includes: the speed of the following car, the acceleration of the following car, the acceleration of the car in front, and the speed difference between the car in front and the following car. The data is preprocessed to conform to the data format of the model input. Step 2: Establish a Transformer network model and use the multi-head self-attention mechanism in the Transformer network model to learn the complex temporal dependencies in the vehicle state sequence data in the car-following scenario, and extract the potential temporal features in the driving data. Step 3: Constructing a Generative Adversarial Network (WGAN) to predict the future state of vehicles in car-following scenarios using temporal feature data. The WGAN mainly consists of two parts: a generator and a discriminator. A Seq2Seq network model is used as the generator of the WGAN, and the temporal feature data output from the Transformer network is used as the input to the Seq2Seq network. The corresponding prediction result is calculated based on the current input. The predicted result and the true result are used as input to a discriminator composed of a fully connected network. The discriminator's purpose is to distinguish between the predicted result and the true result, classifying the predicted result as false. After adversarial training between the generator and the discriminator, it becomes difficult for the discriminator to classify the predicted result as false, thus minimizing the error between the predicted result and the true result, and achieving the step of accurately predicting the future state of vehicles in car-following scenarios. Step 1 specifically includes: Step 1.1: Obtain the driving state sequence data of the j-th car-following vehicle in the car-following scenario; Where j∈[1:N], N is the total number of car-following vehicle groups obtained; s represents the car-following vehicle; X js (t) represents the driving state sequence data of the j-th car-following vehicle group acquired in the car-following scenario; T represents the total duration of the sampled car-following behavior data of the j-th group; v js (t+i) is the speed of the j-th group of following vehicles at time t+i; a js (t+i) is the acceleration of the j-th group of following vehicles at time t+i; p js (t+i) is the longitudinal position of the j-th group of following vehicles at time t+i, where i∈[0:T]; Step 1.2: Obtain the driving state sequence data of the j-th group of vehicles in the car-following scenario; Where j∈[1:N], N is the total number of car-following vehicle groups obtained; l represents the preceding vehicle; X jl (t) represents the driving state sequence data of the j-th preceding vehicle acquired in the car-following scenario; T represents the total duration of the sampled car-following behavior vehicle data of the j-th group; v jl (t+i) is the speed of the j-th vehicle in the preceding group at time t+i; a jl (t+i) is the acceleration of the j-th vehicle in front at time t+i; p jl (t+i) is the longitudinal position of the j-th vehicle in front at time t+i; where i∈[0:T]; To characterize the situation where the collected data of the preceding vehicle is missing due to sensor damage, a 0-1 mask matrix M is created. jl (t)={m jl (t+i)} i=[0:T] , where m jl (t+i) indicates whether the j-th group of preceding vehicle data collected at time t+i is missing, i.e. Mask matrix M jl The random distribution of |M in (t) is continuous jl (t)|×k zeros represent the positions of randomly missing data, where |M jl (t) represents the row number of the mask matrix, and k represents the proportion of randomly and continuously missing data; therefore, the actual obtained j-th group of the preceding vehicle state sequence data is: X jl ′(t)=X jl (t)⊙M jl (t) (4) Where ⊙ represents matrix dot product; Step 1.3: Preprocess the driving data of N sets of following vehicles and their preceding vehicles in the acquired car-following scenario to make them conform to the data format of the model input; The fusion of driving data X for each car following vehicle in the car-following scenario js (t) and the driving data X′ of the vehicle in front of it. jl (t): Where j∈[1:N], and N is the total number of car-following vehicle groups obtained; X merge j (t) represents the driving data of the j-th group of following vehicles and the vehicle in front of it, which are merged; T represents the total duration of the sampled j-th group of following vehicle data; v js (t+i) is the speed of the j-th group of following vehicles at time t+i; a js (t+i) is the acceleration of the j-th group of following vehicles at time t+i; a jl (t+i) is the acceleration of the j-th vehicle in front at time t+i; Δv j (t+i)=v jl (t+i)-v js (t+i) represents the difference between the speed of the j-th vehicle in front and the speed of the vehicle following it at time t+i, where i∈[0:T]; For the N groups of vehicles exhibiting car-following behavior, the total set of driving data fused from each group of car-following vehicles and the vehicle in front of it is X. merge =[X merge 1 (t),X merge 2 (t),…X merge j (t),…X merge N (t)]; Step 1.4: Combine the merged driving data set X merge The data samples are constructed in a format consistent with the model input. Since drivers' decisions typically rely on historical driving behavior and past traffic conditions, incorporating driving memory into the car-following model can better describe traffic flow characteristics. Therefore, historical driving time information of 'a' seconds is considered to predict the vehicle's state in the next 'b' seconds; where X is the basis for prediction. merge j (t) The model constructed for a single input sample x i (t) takes the following form: Where x i (t)∈R ax4 ; With a single input sample x i (t) corresponds to the label y, which represents the vehicle's state b seconds from now. i (t) takes the following form: Where y i (t)∈R bx4 ; Therefore, based on X merge The total set of input samples for the model is X = [x1(t), x2(t), ..., x i (t),…,x n The corresponding set of labels is Y = [y1(t), y2(t), ..., y(t)], and the total set of labels is Y = [y1(t), y2(t), ..., y(t)]. i (t),…,y n [(t)], where n is the total number of samples; based on the total set of input samples X and the corresponding total set of labels Y, the training set and the test set are divided in a ratio of c:d, that is, c% of the samples in X and Y are used for model training and d% of the samples are used for testing model performance; to ensure that the model can be fully trained, the labels corresponding to each input sample are complete during the model training process.

2. The vehicle following behavior modeling method based on Transformer-WGAN as described in claim 1, characterized in that: A Transformer network model is established, and the multi-head self-attention mechanism in the Transformer network model is used to learn the complex temporal dependencies in the vehicle state sequence data in the car-following scenario, and extract latent temporal features from the driving data. The process is as follows: Based on the total set of input samples X, a Transformer network model is built. X is used as the input to the Transformer network model to calculate the latent temporal features in the driving data, as shown below: Step 2.1: Use a fully connected layer to process the input sample x. i (t) is encoded in d dimensions, that is: x d (t)=f c (x i (t)) (8) Where x d (t)∈R axd ; Step 2.2: Since the Transformer network model mainly relies on the self-attention mechanism to achieve excellent performance in sequence modeling tasks, based on the obtained encoded input sample x... d (t), the calculation process of the multi-head self-attention mechanism in the Transformer model is as follows: First, the encoded input sample x d (t) The query matrix, key matrix, and value matrix required to calculate the attention value are obtained through three weight matrices, namely: Q u (x d )=W u,q ·x d (t) (9) K u (x d )=W u,k ·x d (t) (10) V u (x d )=W u,v ·x d (t) (11) Where · represents the matrix cross product; Q u K u V u These are the query, key, and value functions for the u-th attention head, respectively; W u,q W u,k W u,v These are the corresponding weight matrices; Based on the query matrix, key matrix, and value matrix obtained above, calculate the attention Att(Q) of the u-th head in the multi-head self-attention mechanism. u ,K u V u The calculation is as follows: Where softmax is the normalization exponential function, d k It is the dimension of the key vector; Therefore, for all h-head self-attention, the calculation is as follows: head u =To u (Q u ,K u ,V u ) (14) Where f c It is a fully connected layer that integrates features extracted by the head self-attention mechanism; head u It is the self-attention of the u-th head; By computing self-attention between embeddings at different time steps, we can focus on representational information from different locations and learn complex temporal dependencies in driving data. Step 2.3: Based on the features extracted using the h-head self-attention mechanism, residual connections and layer normalization are used to accelerate model convergence and prevent gradient vanishing during training. The calculation process is as follows: z″ i (t)=LayerNorm(x d (t)+MultiHead(Q u ,K u ,V u );β) (15) Where β∈R is the parameter of layer normalization learning; Step 2.4: Based on the output of Step 2.3, after passing through a fully connected forward propagation layer, residual connections, and layer normalization, the extracted temporal feature z is obtained. i (t) is represented as follows: z i (t)=LayerNorm(z i ′(t)+z i ″(t);α) (17) Where z i ′(t) is the output of the fully connected forward propagation layer; ReLU is the activation function, i.e., ReLU(x) = max(x,0); It is the weight matrix, α∈R are the parameters for layer normalization learning; z i (t) is the Transformer network model based on the input sample x. i (t) Extracted latent temporal features; Therefore, based on the above process, for the total set of input samples X, the latent temporal features extracted using the Transformer network model are Z = [z1(t), z2(t), ... z i (t),…z n (t)].

3. The vehicle following behavior modeling method based on Transformer-WGAN as described in claim 1, characterized in that: A Generative Adversarial Network (WGAN) is constructed to predict the future state of a vehicle in a car-following scenario using temporal feature data. The WGAN mainly consists of two parts: a generator and a discriminator. A Seq2Seq network model is used as the generator of the WGAN, and the temporal feature data output from the Transformer network is used as the input to the Seq2Seq network. The corresponding prediction result is calculated based on the current input. The predicted result and the true result are used as the input to a discriminator composed of a fully connected network. The purpose of the discriminator is to distinguish between the predicted result and the true result, classifying the predicted result as false. After adversarial training between the generator and the discriminator, the discriminator becomes less likely to determine that the prediction is false, thus minimizing the error between the prediction and the actual result. This enables the model to accurately predict the future state of a vehicle in a car-following scenario. The process is as follows: Step 3.1: Construct the generator part of the Generative Adversarial Network (WGAN), as shown below: Using a Seq2Seq network model as the generator part of WGAN, the Seq2Seq network is a network model based on an encoder-decoder structure, where both the encoder and decoder are GRU networks. A GRU network is a neural network used for processing sequence tasks; it selectively retains historical information for computation in the next time step. A GRU network mainly consists of multiple memory units, each with two gates controlling the flow of information: an update gate s(t) and a reset gate r(t). When the input sequence data z... i When (t) reaches the GRU network, the information propagation process within its memory cells is as follows: Where · represents matrix cross product; ⊙ represents matrix dot product; It is the input to the current time step of the GRU network; W sh W sx W rh W rx W hh W hx b is the weight matrix; s b r b h σ represents the bias; σ denotes the sigmoid activation function; tanh is the hyperbolic tangent activation function; h(t) is the output of the memory unit at time t, containing past information h(t-1) and present information candidate states. Importance is assigned by the update gate s(t). The update gate s(t) controls the amount of information that the current state h(t) should retain from the previous state h(t-1) and the information from the candidate states. The amount of new information received; the reset gate r(t) controls the candidate state at the current time. The amount of information about the previous state h(t-1) to be retained; The GRU network continuously absorbs new and important information and discards irrelevant information in order to capture dependencies in sequence data through the above methods. Therefore, in the Seq2Seq network model, for the input sample sequence z i (t), firstly, the input sample sequence z is processed by the encoder GRU network. i (t) is encoded as a fixed-length context information vector C, and the encoding process is as follows: C=h(t+τ) (23) in h(t-1) is the input of the GRU network at the current time step; h(t-1) is the state at the previous time step; h(t) is the state at the current time step; h(t+τ) is the state at the last time step in the input sample sequence, which serves as the encoded context information vector C, representing a summary of the input sequence information, and t+τ represents the sequence z. i The last time step in (t); After obtaining the context information vector C, the learned context information vector C is decoded by the decoder GRU network and used as the output of the Seq2Seq network model, that is, the predicted vehicle state y in the next b seconds. i pred (t), the decoding process is represented as follows: p(y′(t+b)|y′(t+1),y′(t+2),...,y′(t+b-1);C)=GRU dec [y′(t+b-1),h(t+b-1),C](24) The context information vector C serves as the initial state of the decoder; y′(t+b) is the output at the current time step. y′(t+b-1) is the output of the previous time step; h(t+b-1) is the state of the previous time step; The essence of a Seq2seq network model is to learn the conditional distribution of another sequence conditioned on a variable-length sequence, which can be described in the following form: That is, training a Seq2seq network model to maximize the conditional probability p(y′(t+1),y′(t+2),...,y′(t+b)|z during the decoding stage. i (t)); Therefore, based on the above process, for the output of the Transformer network, that is, the input sample Z containing time features, the final output of the Seq2seq network model is: Y pred =[y1 pred (t),y2 pred (t),…,y i pred (t),…,y n pred (t)] (26) in Step 3.2: Construct the discriminator part of the Generative Adversarial Network (WGAN), as shown below: Will have L d The fully connected network model of the layer is used as the discriminator part of WGAN. The model calculation process is as follows: Where l = 1, 2, ..., L D H l G σ is the feature extracted by the l-th fully connected network; σ is the Leaky Relu activation function, i.e.: Where ε = 0.2; f c It is the Lth D Fully connected layer; W l G b l G These are the weights and bias parameters that need to be trained in the l-th layer; It is the output layer, i.e., the Lth layer. D The weights and bias parameters that the layer needs to be trained; It is the output of a fully connected network; Step 3.3: Define the loss function for the Generative Adversarial Network (WGAN), denoted as Loss for the generator. G The loss function of the discriminator is Loss D , means as follows: After adversarial training between the generator and the discriminator, minimize the prediction result y. i pred (t) and the actual result y i The error between (t) is used to achieve the goal of accurately predicting the future state of the vehicle in the following scenario.

Citation Information

Patent Citations

  • An urban people flow prediction method based on a Seq2Seq generative adversarial network

    CN109902880A

  • Vehicle operation process fault diagnosis method and system based on multivariate time series data

    CN113485302A