Traffic flow prediction method based on time-space trend perception information fusion

By introducing the time trend awareness module, the spatial trend awareness module and the space-time trend awareness information fusion module into the traffic flow prediction method, the problem that existing methods are difficult to capture dynamic correlation and trend characteristics is solved, and the accuracy of traffic flow prediction is significantly improved.

CN119832737APending Publication Date: 2025-04-15CHINA UNIV OF MINING & TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510009036.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods are difficult to effectively capture the dynamic correlation between sensors and the trend characteristics of traffic flow sequences in the time dimension, resulting in insufficient prediction performance.

Method used

A traffic flow prediction method based on the fusion of space-time trend-aware information is designed. The time and space characteristics are captured respectively through the temporal trend-aware module and the spatial trend-aware module, and the weighted fusion is carried out through the temporal trend-aware information fusion module to fully capture the temporal and spatial correlation of the traffic flow sequence.

Benefits of technology

By considering the trend characteristics of the traffic flow sequence, more dynamic characteristics of the time series are captured, and the accuracy and performance of traffic flow prediction are significantly improved through dynamic correlation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119832737A_ABST
    Figure CN119832737A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction method based on time-space trend perception information fusion, and belongs to the technical field of traffic prediction planning. The prediction method comprises the following steps: sequentially inputting preprocessed historical traffic sequences of a plurality of sensors into a high-dimensional spatio-temporal data embedding module, a time trend sensing module, a space trend sensing module, a spatio-temporal trend sensing information fusion module and a prediction module; high-dimensional space-time representation is extracted step by step, time features and space features with trend perception are captured, space-time information with trend perception is fused, and finally a flow sequence in future time is obtained. According to the method, the flow sequence is converted into the high-dimensional space-time representation, the space-time correlation modeling capability is improved, the trend of the flow is considered, the traffic flow space-time characteristics of trend perception can be captured, the space-time dependence of the traffic flow sequence is fully fused, and the prediction precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of traffic flow prediction in traffic prediction tasks, and in particular to a traffic flow prediction method based on spatiotemporal trend perception information fusion. Background Art

[0002] The task of traffic flow prediction is a complex spatiotemporal data mining problem. First, it is a multivariate time series prediction problem that requires predicting the traffic observation values ​​of multiple sensors at a certain moment in the future. At the same time, there are roads connecting the sensors throughout the city, forming a complex road network. The road connectivity between some sensors will affect each other's traffic flow. In order to solve the task of traffic flow prediction, it is necessary to design a deep network model to capture the spatial and temporal associations of traffic flow sequence data.

[0003] At present, the Spatial-Temporal Graph Neural Nets (STGNNs) model has shown good results in solving traffic flow prediction tasks. The Spatial-Temporal Graph Neural Network model combines the Graph Neural Network (GNN) and the time series network to capture the spatial and temporal associations in the traffic flow sequence. In capturing spatial associations, the Graph Neural Network utilizes the connection relationship between sensors, effectively utilizes the non-Euclidean structure, fuses the features of sensors in a message passing manner, and generates new sensor representations to capture spatial associations. The performance of the Graph Neural Network is highly related to the construction method of the neighbor matrix between nodes and the message passing method. However, most Graph Neural Networks directly use the connection relationship between sensors predefined in the road network, and do not capture the dynamic association relationship between sensors based on the traffic flow sequence data. In capturing temporal associations, time series networks such as Recurrent Neural Networks (RNN) can transmit the influence of the previous moment on the next moment, thereby capturing temporal associations. However, RNN suffers from the problems of time-consuming iterations and gradient vanishing, and encounters challenges in both model training and inference processes. Moreover, RNN does not take into account the trend characteristics of traffic flow sequences in the time dimension, such as the rising, plateau and falling periods of traffic flow, and therefore does not adequately capture the time-related characteristics of traffic flow sequence data. Summary of the invention

[0004] Technical problem: The purpose of the present invention is to overcome the deficiencies in the prior art and provide a traffic flow prediction method based on spatiotemporal trend perception information fusion, design a temporal trend perception module to use improved attention to capture the dynamic temporal correlation of the traffic flow sequence to obtain the temporal features of trend perception, and input the temporal features of trend perception into the spatial trend perception module to capture the dynamic correlation between sensors, obtain the trend perception matrix and use trend-aware graph convolution to aggregate the spatial trend features of the traffic sequence to obtain the spatial features of trend perception; finally, the spatial features of trend perception and the temporal features of trend perception are fused through the spatiotemporal trend perception information fusion module to fully capture the spatiotemporal correlation of the traffic flow sequence, thereby capturing the temporal trend perception features and spatial trend perception features of the traffic flow sequence, and weightedly fusion the temporal trend perception features and spatial trend perception features to effectively capture the complex spatiotemporal correlation of the traffic flow sequence, thereby improving the prediction performance of the traffic flow prediction task.

[0005] Technical solution: To achieve the above purpose, the present invention provides a traffic flow prediction method based on spatiotemporal trend perception information fusion, designs a traffic flow prediction model based on traffic flow sequence data in urban roads, performs data preprocessing, processes traffic flow data of multiple sensors installed in urban roads after preprocessing, extracts high-dimensional spatiotemporal representation, captures temporal features and spatial features with trend perception, and fuses trend perception spatiotemporal information, and finally predicts the traffic sequence of multiple sensors for a period of time in the future; the method comprises the following steps:

[0006] Step 1, prediction model: based on the traffic flow sequence data in urban roads, a traffic flow prediction model is designed, which includes a high-dimensional spatiotemporal data embedding module, a time trend perception module, a spatial trend perception module, a spatiotemporal trend perception information fusion module and a prediction module;

[0007] Step 2, data preprocessing: preprocess the traffic flow sequence data observed by sensors installed on urban roads and the connection relationship of each sensor to obtain a normalized traffic flow sequence and road network as the data set for training the traffic flow prediction model; use the sliding window segmentation method to divide the data set to obtain a sample set, and divide the sample set according to the proportion to obtain a training set, a validation set, and a test set;

[0008] Step 3: embedding high-dimensional spatiotemporal data; inputting the normalized traffic flow sequence and road network processed in step 2 into the high-dimensional spatiotemporal data embedding module, extracting and converting the information of the normalized traffic flow sequence and road network to obtain a high-dimensional spatiotemporal representation;

[0009] Step 4: Extracting time trend perception features: Input the high-dimensional spatiotemporal representation output from step 3 into the time trend perception module, capture the time trend perception features, and obtain time features with trend perception;

[0010] Step 5: Extracting spatial trend perception features: Inputting the high-dimensional spatiotemporal representation output from step 3 and the trend-aware temporal features output from step 4 into the spatial trend perception module to obtain trend-aware spatial features;

[0011] Step 6, spatiotemporal trend perception information fusion: input the trend-aware time features output from step 4 and the trend-aware spatial features output from step 5 into the spatiotemporal trend perception information fusion module to dynamically calculate the fusion weights for weighted fusion to obtain the trend-aware spatiotemporal features;

[0012] Step 7, model training; input the trend-aware spatiotemporal features output from step 6 into the prediction module to obtain the preliminary prediction results of the model, design a loss function and use the model for iterative training while optimizing the learnable parameters of the model, use an evaluation function to evaluate the prediction performance of the traffic flow prediction model, and obtain a traffic flow prediction model based on spatiotemporal trend perception information fusion.

[0013] In step 2, the traffic flow sequence data observed by the sensors installed on the urban roads is the number of vehicles passing the current road counted by the sensors within 30 seconds; the method for obtaining the traffic flow sequence data is: the number of vehicles counted by each sensor is summarized every 5 minutes as the traffic flow data of one time step, and finally the traffic flow sequence data of all sensors is obtained X=(x1,...,x t ,...,x T )∈R T×N×C , where x t ∈R N×C is the traffic observation value of all sensor nodes at time step t; T is the total number of time steps of traffic flow sequence data; N is the total number of sensors; C is the dimension of the observed traffic flow data;

[0014] The preprocessing adopts a standardized normalization method to convert the traffic flow sequence data X into a standard normal distribution with a mean of 0 and a standard deviation of 1, and obtain the preprocessed traffic flow sequence The processing process is as follows:

[0015] μ=mean(X),

[0016] σ=variance(X),

[0017]

[0018] Where: mean(·) represents the mean operation, variance(·) represents the variance operation; μ is the mean value of X, σ is the variance of X; is the data in X, representing the flow observation value of node i at time step t; yes The result after normalization;

[0019] The connection relationship of the sensors is the distance relationship between the sensors installed on the urban roads. Specifically, the connection relationship between the two sensors is defined as (V i ,V j ,d ij ), where V i and V j represents the sensors i and j installed on the road, d ij Represents the distance between two sensors;

[0020] The construction of the road network is realized through the connection relationship between each sensor; the road network is a graph network structure G=(V,E,W), where V represents the set of sensors, |V|=N represents that there are N sensors in the road network, E represents the set of distances between sensors, W is the adjacency matrix between each sensor, indicating the connectivity between each sensor, and W is a 0-1 matrix, where 0 represents that two sensors are unreachable and 1 represents that two sensors are reachable.

[0021] In step 2, the sliding window segmentation method is used to divide the data set to obtain a sample set, and the sample set is divided according to the proportion to obtain a training set, a validation set, and a test set. The specific process is as follows:

[0022] The data set is a preprocessed traffic flow sequence and road network, which contains traffic flow sequence data observed by multiple sensors;

[0023] The sliding window segmentation method is to define a window with a length of window, window = history + future, where history represents the total number of time steps of the historical traffic sequence, and future represents the total number of time steps of the future traffic sequence; the sliding window is used to segment the traffic flow sequence data X = {X1, X2, ..., X T}∈R T×N×C Slide up once to get a sample X that contains both historical traffic sequence and future traffic sequence i ∈R window×N×C ; In this way, after sliding on the data set, we get all the sample sets U = {X1, X2, ..., X T-window+1}, the first history time steps of each sample As the input of the traffic flow prediction model, the last fulure time steps are taken as the true value Forecast results of traffic flow prediction models Make comparisons;

[0024] The said dividing the sample set according to proportion means dividing the sample set U into a training set, a validation set and a test set according to the ratio of M:N:K; the training set is used to train the traffic flow prediction model, the validation set is used to adjust the hyperparameters of the traffic flow prediction model, and the test set is used to evaluate the prediction performance of the traffic flow prediction model in unseen traffic flow sequences.

[0025] In step 3, the high-dimensional spatiotemporal data embedding module processes the preprocessed traffic flow sequence and road network, extracts historical high-dimensional flow representation, time features, spatial features and location information, and fuses these four features to obtain a high-dimensional spatiotemporal representation, where:

[0026] The preprocessed traffic flow sequence The dimension transformation is used to obtain the historical high-dimensional flow representation, which means using a linear layer to transform the preprocessed traffic flow sequence

[0027] Transform to high-dimensional latent space to get the historical high-dimensional flow representation X data ∈R T×N×C' , in order to obtain more representation information, the processing process is as follows:

[0028]

[0029] Where: W data represents the weights and b of the linear layer data The linear layer is represented by the bias term, which is a learnable parameter;

[0030] The method for extracting time features from the preprocessed traffic flow sequence is: converting the timestamp corresponding to the traffic flow sequence into its time proportion T in a day d and the proportion of time in a week T w , each of which passes through the day embedding linear layer and the week embedding linear layer to obtain the day embedding feature X d ∈R T×C' and Zhou embedding feature X w ∈R T×C' , the processing process is as follows:

[0031] X d =W d T d +b d

[0032] X w =W w T w +b w

[0033] Where: Wd is the weight of the linear layer of the sky embedding, b d is the bias term of the linear layer of the sky embedding, W w is the weight of the weekly embedding linear layer, and b w The bias terms of the linear layer of the weekly embedding are all learnable parameters;

[0034] The method for encoding the position information from the historical traffic sequence is: calculating the corresponding position code X according to the position of the traffic observation value in the sequence p ∈R T×C′ , the processing process is as follows:

[0035]

[0036] Where: pos represents the posth time step, d represents the dth element in the dimension C' of the high-dimensional spatiotemporal data embedding module;

[0037] The information extraction of the road network refers to extracting spatial features from the road network, and the steps are as follows:

[0038] First, the normalized Laplace matrix L is constructed according to the adjacency matrix W composed of all sensors in the road network G. The processing process is as follows:

[0039]

[0040] Where: I∈R N×N is the identity matrix, D∈R N×N is the degree matrix based on the adjacency matrix W. Since the adjacency matrix W is a symmetric matrix, D is a diagonal matrix, D ii =∑ j∈N w ij ;

[0041] Secondly, the normalized Laplace matrix L is decomposed and k smallest non-trivial eigenvectors are selected to form X k And use the linear layer to generate the spatial features X s ∈R T×C' , the processing process is as follows:

[0042] L=UΛU T

[0043] X k =[u1,u2,…,u k ]

[0044] X s =W k X k +b k

[0045] Where: Λ is a diagonal matrix, which is composed of the eigenvalues ​​λ of the normalized Laplace matrix L i Composed of; i is the non-zero eigenvalue λ of the normalized Laplacian matrix L i The corresponding eigenvector; W k is the weight of the linear layer and b k are the bias terms of the linear layer, which are all learnable parameters;

[0046] The fusion of the four features is to obtain the historical high-dimensional flow representation X data , time features (day embedding features X d and Zhou embedding feature X w ), spatial feature X s and positional encoding X p The output high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is obtained by adding emb ∈R T×N×C' For convenience, X emb Denoted as X, the processing process is as follows:

[0047] X=X data +X d +X w +X s +X p .

[0048] In step 4, the temporal trend perception module performs temporal trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module to capture the temporal characteristics of trend perception; the temporal trend perception module includes two layers of attention, namely, a local trend perception attention layer, a global trend perception attention layer and a fully connected layer, which capture various trend characteristics of the traffic flow sequence in turn for the high-dimensional spatiotemporal representation. The specific process is as follows:

[0049] The local trend perception attention layer includes a self-attention layer 1, a one-dimensional convolution layer 1 and a pooling layer 1; the high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is input into the self-attention layer 1 to obtain a local trend perception attention score Attention1, and then the local trend perception attention score Attention1 is sent to the one-dimensional convolution layer 1 and the pooling layer 1 to aggregate features and reduce dimensions to obtain a local trend perception feature The processing process is as follows:

[0050]

[0051]

[0052]

[0053] in: is the weight matrix of Q1, is the weight matrix of K1, is the weight matrix of V1, which are all learnable parameters; C' is the last dimension of Q1 and K1; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation;

[0054] The global trend perception attention layer includes a self-attention layer 2, a one-dimensional convolution layer 2 and a pooling layer 2; the local trend perception features The global trend perception score Attention2 is calculated by inputting it into the self-attention layer 2, and then the global trend perception score Attention2 is input into the one-dimensional convolution layer 2 and the pooling layer 2 to aggregate the features and reduce the dimension to obtain the global trend perception feature. The processing process is as follows:

[0055]

[0056]

[0057]

[0058] in: is the weight matrix of Q2, is the weight matrix of K2, is the weight matrix of V2, which are all learnable parameters; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation;

[0059] The fully connected layer is a global trend perception feature Linear transformation is performed to increase the dimension and the nonlinear time dependency is captured through the activation function. Finally, the trend-aware time feature Trend_T is obtained. The processing process is as follows:

[0060]

[0061] Among them: W3 is the weight of the fully connected layer, b3 is the bias term of the fully connected layer, both of which are learnable parameters; sigmoid represents the activation function of the fully connected layer.

[0062] In step 5, the spatial trend perception module performs spatial trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module to capture the spatial features of trend perception; the spatial trend perception module includes a trend perception graph information generation module and a trend perception graph convolution module, and the specific process is as follows:

[0063] The trend-aware graph information generation module includes a spatial trend-aware self-attention layer, and its processing process is as follows:

[0064] First, the time feature Trend_T with time trend awareness is causally convolved to obtain Q trend ,K trend and V trend , the processing process is as follows:

[0065] Q trend =Φ q *Trend_T,K trend =Φ k Trend_T,V trned =Φ v *Trend_T,

[0066] Where: Φ q It's Q trend The convolution kernel, Φ k It's K trend The convolution kernel, Φ v Yes V trend The convolution kernels are all learnable parameters;

[0067] Secondly, the obtained Q trend and K trend Perform dot product and use softmax function to normalize to get the attention score of trend perception between sensors, that is, trend perception matrix A trend , the processing process is as follows:

[0068] A trend =softma(Q trend K trend T )

[0069] The trend-aware graph convolution module is implemented using an approximate Chebyshev polynomial of order K; the high-dimensional spatiotemporal representation X and the trend-aware matrix A are trend Input into the K-order approximate Chebyshev polynomial, calculate the trend-aware spatial feature Trend_S, and the processing process is as follows:

[0070]

[0071] Where: θ k is a learnable parameter; T k (A trend ) is the form of approximate Chebyshev polynomial, and its recursive formula is T0(A trend )=1,T1(A trend )=A trend ,T n+1 (Atrend )=2A trend T n (A trend )-T n-1 (A trend ).

[0072] In step 6, the spatiotemporal trend perception information fusion module dynamically calculates the weights of the temporal features with trend perception and the spatial features with trend perception and performs weighted fusion. The specific process is as follows:

[0073] First, the trend-aware temporal feature Trend_T and the trend-aware spatial feature Trend_S are subjected to different linear transformations respectively, and the fusion weight λ is calculated by the sigmoid activation function. The processing process is as follows:

[0074] λ=sigmoid(Trend_SW λ,1 +Trend_TW λ,2 +b λ ),

[0075] Where: W λ,1 is the weight matrix of Trend_S, W λ,2 is the weight matrix of Trend_T, b λ is a bias term, which is a learnable parameter. The value of λ is between 0 and 1. The closer λ is to 1, the more the spatial trend characteristics of the traffic sequence will be favored during fusion. The closer λ is to 0, the greater the weight of the temporal trend characteristics of the traffic sequence will be.

[0076] Secondly, the weight λ of spatiotemporal feature fusion is used to perform weighted summation of the trend-aware temporal feature Trend_T and the trend-aware spatial feature Tredd_S to obtain the trend-aware spatiotemporal information X f , the processing process is as follows:

[0077] X f =λ⊙Trend_S+(1-λ)⊙Trend_T

[0078] Where: ⊙ represents the element-wise product.

[0079] In step 7, the prediction module uses trend-aware spatiotemporal information to predict the traffic flow sequence for multiple steps in the future. The specific process is as follows:

[0080] The prediction module includes a hidden state convolution layer and a prediction convolution layer, and the specific process is as follows:

[0081] First, the trend-aware spatiotemporal information X f Input to the hidden state convolution layer will be X f The dimension is mapped to a higher dimension hid to obtain the hidden state Xhid ∈R T×N×hid , the processing process is as follows:

[0082] X hid =Conv3(X f )

[0083] Where: Conv3(·) represents a 2D convolution operation;

[0084] Second, the hidden state X hid Input to the prediction convolution layer to obtain the prediction result that conforms to the shape of the future multi-step traffic sequence The processing process is as follows:

[0085]

[0086] Where: Conv4(·) represents a 2D convolution operation.

[0087] In step 7, the designed loss function is used to train and optimize the traffic flow prediction model, and finally the evaluation function is used to evaluate the traffic flow prediction model;

[0088] Design the loss function and use MAE mean absolute error to train the traffic flow prediction model. The calculation process is as follows:

[0089]

[0090] in: represents the true flow value of the jth sensor at the i-th time step, represents the flow prediction value of the jth sensor at the i-th time step;

[0091] The use of the loss function to train and optimize the traffic flow prediction model on the training set refers to: using the loss of the traffic prediction value and the real value of the traffic calculated by MAE, updating the training parameters of the model through back propagation, reducing the loss between the real value and the predicted value, so that the predicted value generated by the traffic flow prediction model converges to the real value; selecting the Adam optimizer to optimize the training process of the traffic flow prediction model; during the training process, using the model parameters after each iteration to test on the validation set, and saving the model parameters with the best prediction results;

[0092] The use of the evaluation function to evaluate the traffic flow prediction model means that after the model training is completed, the optimal model parameters are used to infer the test set and the MSE mean square error loss and the MAPE mean absolute percentage loss are used to calculate the loss between the true value and the predicted value to test the prediction effect of the training model; the calculation process of MSE and MAPE is as follows:

[0093]

[0094]

[0095] in: represents the true flow value of the jth sensor at the i-th time step, represents the flow prediction value of the jth sensor at the ith time step.

[0096] Beneficial effect: Due to the adoption of the above technical solution, the present invention overcomes the shortcomings of the current traffic flow prediction method in capturing the dynamic correlation between sensors and capturing the trend characteristics of the traffic flow sequence in the time dimension. The traffic flow prediction method based on the fusion of spatiotemporal trend perception information takes into account that the traffic flow sequence has trend characteristics in both time and space, and designs a spatial trend perception module and a temporal trend perception module to capture the spatial characteristics and temporal characteristics of trend perception respectively, and performs spatiotemporal information fusion. The temporal characteristics of trend perception are input into the spatial trend perception module to capture the dynamic correlation between sensors, and the trend perception matrix is ​​obtained, and the spatial trend characteristics of the traffic sequence are aggregated using the trend perception graph convolution to obtain the spatial characteristics of trend perception; finally, the spatial characteristics of trend perception and the temporal characteristics of trend perception are fused through the spatiotemporal trend perception information fusion module to fully capture the spatiotemporal correlation of the traffic flow sequence, thereby capturing the temporal trend perception characteristics and spatial trend perception characteristics of the traffic flow sequence, and weightedly fusion of the temporal trend perception characteristics and the spatial trend perception characteristics, thereby effectively capturing the complex spatiotemporal correlation of the traffic flow sequence, and improving the prediction performance of the traffic flow prediction task. Compared with the existing traffic flow prediction models, the main advantages of the present invention are: by taking into account the trend of the traffic flow sequence, the trend characteristics of the traffic flow in the time dimension are captured, and more dynamic characteristics of the time series are captured; by designing a spatial trend perception module to construct a trend perception matrix to replace the predefined adjacency matrix, the dynamic correlation relationship between sensors is captured, and by fusing the spatial characteristics of trend perception and the temporal characteristics of trend perception, the trend characteristics of the traffic flow sequence are effectively captured, thereby improving the prediction accuracy of the traffic flow prediction task. BRIEF DESCRIPTION OF THE DRAWINGS

[0097] Figure 1 This is the overall structure diagram of the traffic flow prediction model based on spatiotemporal trend perception information fusion. DETAILED DESCRIPTION

[0098] An embodiment of the present invention is further described below in conjunction with the accompanying drawings:

[0099] The traffic flow prediction method based on spatiotemporal trend perception information fusion of the present invention designs a traffic flow prediction model based on traffic flow sequence data in urban roads, performs data preprocessing, and processes the traffic flow data of multiple sensors installed in urban roads after preprocessing, so as to extract high-dimensional spatiotemporal representation, capture temporal features and spatial features with trend perception, and fuse trend perception spatiotemporal information. Finally, the traffic sequence of multiple sensors for a period of time in the future is predicted; the specific steps are as follows:

[0100] Step 1, prediction model: based on the traffic flow sequence data in urban roads, a traffic flow prediction model is designed, which includes a high-dimensional spatiotemporal data embedding module, a time trend perception module, a spatial trend perception module, a spatiotemporal trend perception information fusion module and a prediction module;

[0101] Step 2, data preprocessing: preprocess the traffic flow sequence data observed by the sensors installed on the urban roads and the connection relationship of each sensor to obtain a normalized traffic flow sequence and road network as a data set for training the traffic flow prediction model; use the sliding window segmentation method to divide the data set to obtain a sample set, and divide the sample set according to the proportion to obtain a training set, a validation set and a test set; the traffic flow sequence data observed by the sensors installed on the urban roads is the number of vehicles passing through the current road counted by the sensor within 30 seconds; the method for obtaining the traffic flow sequence data is: summarize the number of vehicles counted by each sensor every 5 minutes as the traffic flow data of one time step, and finally obtain the traffic flow sequence data X = (x1,...,x t ,...,x T )∈R T×N×C , where x t ∈R N×C is the traffic observation value of all sensor nodes at time step t; T is the total number of time steps of traffic flow sequence data; N is the total number of sensors; C is the dimension of the observed traffic flow data;

[0102] The preprocessing adopts a standardized normalization method to convert the traffic flow sequence data X into a standard normal distribution with a mean of 0 and a standard deviation of 1, and obtain the preprocessed traffic flow sequence The processing process is as follows:

[0103] μ=mean(X),

[0104] σ=variance(X),

[0105]

[0106] Where: mean(·) represents the mean operation, variance(·) represents the variance operation; μ is the mean value of X, σ is the variance of X; is the data in X, representing the flow observation value of node i at time step t; yes The result after normalization;

[0107] The connection relationship of the sensors is the distance relationship between the sensors installed on the urban roads. Specifically, the connection relationship between the two sensors is defined as (V i ,V j ,d ij ), where V i and V j represents the sensors i and j installed on the road, d ij Represents the distance between two sensors;

[0108] The construction of the road network is realized through the connection relationship between each sensor; the road network is a graph network structure G=(V,E,W), where V represents the set of sensors, |V|=N represents that there are N sensors in the road network, E represents the set of distances between sensors, w is the adjacency matrix between each sensor, indicating the connectivity between each sensor, and w is a 0-1 matrix, where 0 represents that two sensors are unreachable and 1 represents that two sensors are reachable.

[0109] The sliding window segmentation method is used to divide the data set to obtain a sample set, and the sample set is divided according to the proportion to obtain a training set, a validation set, and a test set. The specific process is as follows:

[0110] The data set is a preprocessed traffic flow sequence and road network, and includes traffic flow sequence data observed by multiple sensors.

[0111] The sliding window segmentation method is to define a window with a length of window, window = history + future, where history represents the total number of time steps of the historical traffic sequence, and future represents the total number of time steps of the future traffic sequence; the sliding window is used to segment the traffic flow sequence data X = {X1, X2, ..., X T}∈R T×N×C Slide up once to get a sample X that contains both historical traffic sequence and future traffic sequence i ∈R window×N×C ; In this way, after sliding on the data set, we get all the sample sets U = {X1, X2, ..., X T-window+1}, the first history time steps of each sample As the input of the traffic flow prediction model, the next future time step is used as the true value Forecast results of traffic flow prediction models Make comparisons;

[0112] The said dividing the sample set according to proportion means dividing the sample set U into a training set, a validation set and a test set according to the ratio of M:N:K; the training set is used to train the traffic flow prediction model, the validation set is used to adjust the hyperparameters of the traffic flow prediction model, and the test set is used to evaluate the prediction performance of the traffic flow prediction model in unseen traffic flow sequences.

[0113] Step 3, high-dimensional spatiotemporal data embedding: input the normalized traffic flow sequence and road network processed in step 2 into the high-dimensional spatiotemporal data embedding module, extract and convert the normalized traffic flow sequence and road network to obtain a high-dimensional spatiotemporal representation; the high-dimensional spatiotemporal data embedding module processes the pre-processed traffic flow sequence and road network, extracts historical high-dimensional flow representation, time features, spatial features and location information, and fuses these four features to obtain a high-dimensional spatiotemporal representation, wherein:

[0114] The preprocessed traffic flow sequence The dimension transformation is used to obtain the historical high-dimensional flow representation, which means using a linear layer to transform the preprocessed traffic flow sequence Transform to high-dimensional latent space to get the historical high-dimensional flow representation X data ∈R T×M×C' , in order to obtain more representation information, the processing process is as follows:

[0115]

[0116] Where: W data represents the weights and b of the linear layer data The linear layer is represented by the bias term, which is a learnable parameter;

[0117] The method for extracting time features from the preprocessed traffic flow sequence is: converting the timestamp corresponding to the traffic flow sequence into its time proportion T in a day d and the proportion of time in a week T w , each of which passes through the day embedding linear layer and the week embedding linear layer to obtain the day embedding feature X d ∈R T×C' and Zhou embedding feature X w ∈R T×C' , the processing process is as follows:

[0118] X d =W d T d +bd

[0119]

[0120] Where: W d is the weight of the linear layer of the sky embedding, b d is the bias term of the linear layer of the sky embedding, W w is the weight of the weekly embedding linear layer, and b w The bias terms of the linear layer of the weekly embedding are all learnable parameters;

[0121] The method for encoding the position information from the historical traffic sequence is: calculating the corresponding position code X according to the position of the traffic observation value in the sequence p ∈R T×C′ , the processing process is as follows:

[0122]

[0123] Where: pos represents the posth time step, d represents the dth element in the dimension C' of the high-dimensional spatiotemporal data embedding module;

[0124] The information extraction of the road network refers to extracting spatial features from the road network, and the steps are as follows:

[0125] First, the normalized Laplace matrix L is constructed according to the adjacency matrix W composed of all sensors in the road network G. The processing process is as follows:

[0126]

[0127] Where: I∈R N×N is the identity matrix, D∈R N×N is the degree matrix based on the adjacency matrix W. Since the adjacency matrix W is a symmetric matrix, D is a diagonal matrix, D ii =∑ j∈N w ij ;

[0128] Secondly, the normalized Laplace matrix L is decomposed and k smallest non-trivial eigenvectors are selected to form X k And use the linear layer to generate the spatial features X s ∈R T×C' , the processing process is as follows:

[0129]

[0130] X k =[u1,u2,…,u k ]

[0131] X s =W kX k +b k

[0132] Where: Λ is a diagonal matrix, which is composed of the eigenvalues ​​λ of the normalized Laplace matrix L i Composed of; i is the non-zero eigenvalue λ of the normalized Laplacian matrix L i The corresponding eigenvector; W k is the weight of the linear layer and b k are the bias terms of the linear layer, which are all learnable parameters;

[0133] The fusion of the four features is to obtain the historical high-dimensional flow representation X data , time features (day embedding features X d and Zhou embedding feature X w ), spatial feature X s and positional encoding X p The output high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is obtained by adding emb ∈R T×N×C' For convenience, X emb Denoted as X, the processing process is as follows:

[0134] X=X data +X d +X w +X s +X p .

[0135] Step 4, extracting time trend perception features; inputting the high-dimensional spatiotemporal representation output from step 3 into the time trend perception module, capturing the time trend perception features, and obtaining time features with trend perception; the time trend perception module performs temporal trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module, and captures the time features of trend perception; the time trend perception module includes two layers of attention, namely, a local trend perception attention layer, a global trend perception attention layer, and a fully connected layer, which capture various trend features of the traffic flow sequence in turn for the high-dimensional spatiotemporal representation, and the specific process is as follows:

[0136] The local trend perception attention layer includes a self-attention layer 1, a one-dimensional convolution layer 1 and a pooling layer 1; the high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is input into the self-attention layer 1 to obtain a local trend perception attention score Attention1, and then the local trend perception attention score Attention1 is sent to the one-dimensional convolution layer 1 and the pooling layer 1 to aggregate features and reduce dimensions to obtain a local trend perception feature The processing process is as follows:

[0137]

[0138]

[0139]

[0140] in: is the weight matrix of Q1, is the weight matrix of K1, is the weight matrix of V1, which are all learnable parameters; C' is the last dimension of Q1 and K1; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation;

[0141] The global trend perception attention layer includes a self-attention layer 2, a one-dimensional convolution layer 2 and a pooling layer 2; the local trend perception features The global trend perception score Attention2 is calculated by inputting it into the self-attention layer 2, and then the global trend perception score Attention2 is input into the one-dimensional convolution layer 2 and the pooling layer 2 to aggregate the features and reduce the dimension to obtain the global trend perception feature. The processing process is as follows:

[0142]

[0143]

[0144]

[0145] in: is the weight matrix of Q2, is the weight matrix of K2, is the weight matrix of V2, which are all learnable parameters; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation;

[0146] The fully connected layer is a global trend perception feature Linear transformation is performed to increase the dimension and the nonlinear time dependency is captured through the activation function. Finally, the trend-aware time feature Trend_T is obtained. The processing process is as follows:

[0147]

[0148] Among them: W3 is the weight of the fully connected layer, b3 is the bias term of the fully connected layer, both of which are learnable parameters; sigmoid represents the activation function of the fully connected layer.

[0149] Step 5, spatial trend perception feature extraction; the high-dimensional spatiotemporal representation output from step 3 and the trend-aware time features output from step 4 are input into the spatial trend perception module to obtain trend-aware spatial features; the spatial trend perception module performs spatial trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module to capture trend-aware spatial features; the spatial trend perception module includes a trend-aware graph information generation module and a trend-aware graph convolution module, and the specific process is as follows:

[0150] The trend-aware graph information generation module includes a spatial trend-aware self-attention layer, and its processing process is as follows:

[0151] First, the time feature Trend_T with time trend awareness is causally convolved to obtain Q trend ,K trend and V trend , the processing process is as follows:

[0152] Q trend =Φ q *Trend_T,K trend =Φ k Trend_T,V trned =Φ v *Trend_T,

[0153] Where: Φ q It's Q trend The convolution kernel, Φ k It's K trend The convolution kernel, Φ v Yes V trend The convolution kernels are all learnable parameters;

[0154] Secondly, the obtained Q trend and K trend Perform dot product and use softmax function to normalize to get the attention score of trend perception between sensors, that is, trend perception matrix A trend , the processing process is as follows:

[0155] A trend =softma(Q trend K trend T )

[0156] The trend-aware graph convolution module is implemented using an approximate Chebyshev polynomial of order K; the high-dimensional spatiotemporal representation X and the trend-aware matrix A are trend Input into the K-order approximate Chebyshev polynomial, calculate the trend-aware spatial feature Trend_S, and the processing process is as follows:

[0157]

[0158] Where: θ k is a learnable parameter; T k (A trend ) is the form of approximate Chebyshev polynomial, and its recursive formula is T0(A trend )=1,T1(A trend )=A trend ,T n+1 (A trend )=2A trend T n (A trend )-T n-1 (A trend ).

[0159] Step 6, spatiotemporal trend perception information fusion; input the trend-aware time features output from step 4 and the trend-aware spatial features output from step 5 into the spatiotemporal trend perception information fusion module to dynamically calculate the fusion weights for weighted fusion to obtain the trend-aware spatiotemporal features; the spatiotemporal trend perception information fusion module dynamically calculates the weights of the trend-aware time features and the trend-aware spatial features and performs weighted fusion, and the specific process is as follows:

[0160] First, the trend-aware temporal feature Trend_T and the trend-aware spatial feature Trend_S are subjected to different linear transformations respectively, and the fusion weight λ is calculated by the sigmoid activation function. The processing process is as follows:

[0161] λ=sigmoid(Trend_SW λ,1 +Trend_TW λ,2 +b λ ),

[0162] Where: W λ,1 is the weight matrix of Trend_S, W λ,2 is the weight matrix of Trend_T, b λ is a bias term, which is a learnable parameter. The value of λ is between 0 and 1. The closer λ is to 1, the more the spatial trend characteristics of the traffic sequence will be favored during fusion. The closer λ is to 0, the greater the weight of the temporal trend characteristics of the traffic sequence will be.

[0163] Secondly, the weight λ of spatiotemporal feature fusion is used to perform weighted summation of the trend-aware temporal feature Trend_T and the trend-aware spatial feature Trend_S to obtain the trend-aware spatiotemporal information X f , the processing process is as follows:

[0164] X f=λ⊙Trend_S+(1-λ)⊙Trend_T

[0165] Where: ⊙ represents the element-wise product.

[0166] Step 7, model training; input the trend-aware spatiotemporal features output from step 6 into the prediction module to obtain the model's preliminary prediction results, design a loss function and use the model for iterative training while optimizing the model's learnable parameters, use an evaluation function to evaluate the prediction performance of the traffic flow prediction model, and obtain a traffic flow prediction model based on spatiotemporal trend-aware information fusion. The prediction module uses trend-aware spatiotemporal information to predict future multi-step traffic flow sequences, and the specific process is as follows:

[0167] The prediction module includes a hidden state convolution layer and a prediction convolution layer, and the specific process is as follows:

[0168] First, the trend-aware spatiotemporal information X f Input to the hidden state convolution layer will be X f The dimension is mapped to a higher dimension hid to obtain the hidden state X hid ∈R T×N×hid , the processing process is as follows:

[0169] X hid =Conv3(X f )

[0170] Where: Conv3(·) represents a 2D convolution operation;

[0171] Second, the hidden state X hid Input to the prediction convolution layer to obtain the prediction result that conforms to the shape of the future multi-step traffic sequence The processing process is as follows:

[0172]

[0173] Where: Conv4(·) represents a 2D convolution operation.

[0174] In step 7, the designed loss function is used to train and optimize the traffic flow prediction model, and finally the evaluation function is used to evaluate the traffic flow prediction model;

[0175] Design the loss function and use MAE mean absolute error to train the traffic flow prediction model. The calculation process is as follows:

[0176]

[0177] in: represents the true flow value of the jth sensor at the i-th time step, represents the flow prediction value of the jth sensor at the i-th time step;

[0178] The use of the loss function to train and optimize the traffic flow prediction model on the training set refers to: using the loss of the traffic prediction value and the real value of the traffic calculated by MAE, updating the training parameters of the model through back propagation, reducing the loss between the real value and the predicted value, so that the predicted value generated by the traffic flow prediction model converges to the real value; selecting the Adam optimizer to optimize the training process of the traffic flow prediction model; during the training process, using the model parameters after each iteration to test on the validation set, and saving the model parameters with the best prediction results;

[0179] The use of the evaluation function to evaluate the traffic flow prediction model means that after the model training is completed, the optimal model parameters are used to infer the test set and the MSE mean square error loss and the MAPE mean absolute percentage loss are used to calculate the loss between the true value and the predicted value to test the prediction effect of the training model; the calculation process of MSE and MAPE is as follows:

[0180]

[0181]

[0182] in: represents the true flow value of the kth sensor at the ith time step, represents the flow prediction value of the jth sensor at the ith time step.

Claims

1. A traffic flow prediction method based on spatiotemporal trend perception information fusion, characterized by: Design a traffic flow prediction model based on the traffic flow sequence data in urban roads, perform data preprocessing, process the traffic flow data of multiple sensors installed in urban roads after preprocessing, extract high-dimensional spatiotemporal representation, capture temporal and spatial features with trend perception, and integrate trend-aware spatiotemporal information. Finally, predict the traffic sequence of multiple sensors for a period of time in the future; including the following steps: Step 1, prediction model: based on the traffic flow sequence data in urban roads, a traffic flow prediction model is designed, which includes a high-dimensional spatiotemporal data embedding module, a time trend perception module, a spatial trend perception module, a spatiotemporal trend perception information fusion module and a prediction module; Step 2: Data preprocessing: preprocess the traffic flow sequence data observed by sensors installed on urban roads and the connection relationship between each sensor to obtain the normalized traffic flow sequence and road network as the data set for training the traffic flow prediction model; Use the sliding window segmentation method to divide the data set to obtain a sample set, and divide the sample set according to the proportion to obtain a training set, a validation set, and a test set; Step 3: embedding high-dimensional spatiotemporal data; inputting the normalized traffic flow sequence and road network processed in step 2 into the high-dimensional spatiotemporal data embedding module, extracting and converting the information of the normalized traffic flow sequence and road network to obtain a high-dimensional spatiotemporal representation; Step 4: Time trend aware feature extraction; The high-dimensional spatiotemporal representation output from step 3 is input into the time trend perception module to capture the time trend perception features and obtain trend-aware time features; Step 5: Extract spatial trend perception features; The high-dimensional spatiotemporal representation output from step 3 and the trend-aware temporal features output from step 4 are input into the spatial trend-aware module to obtain trend-aware spatial features; Step 6, spatiotemporal trend perception information fusion: input the trend-aware time features output from step 4 and the trend-aware spatial features output from step 5 into the spatiotemporal trend perception information fusion module to dynamically calculate the fusion weights for weighted fusion to obtain the trend-aware spatiotemporal features; Step 7, model training; input the trend-aware spatiotemporal features output from step 6 into the prediction module to obtain the preliminary prediction results of the model, design a loss function and use the model for iterative training while optimizing the learnable parameters of the model, use an evaluation function to evaluate the prediction performance of the traffic flow prediction model, and obtain a traffic flow prediction model based on spatiotemporal trend perception information fusion.

2. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized by: In step 2, the traffic flow sequence data observed by the sensors installed on the urban roads is the number of vehicles passing through the current road counted by the sensors within 30 seconds; the method for obtaining the traffic flow sequence data is: the number of vehicles counted by each sensor is summarized every 5 minutes as the traffic flow data of one time step, and finally the traffic flow sequence data of all sensors is obtained X=(x1,...,x t ,...,x T )∈R T×N×C , where x t ∈R N×C is the traffic observation value of all sensor nodes at time step t; T is the total number of time steps of traffic flow sequence data; N is the total number of sensors; C is the dimension of the observed traffic flow data; The preprocessing adopts a standardized normalization method to convert the traffic flow sequence data X into a standard normal distribution with a mean of 0 and a standard deviation of 1, and obtain the preprocessed traffic flow sequence The processing process is as follows: μ=mean(X), σ=variance(X), Where: mean(·) represents the mean operation, variance(·) represents the variance operation; μ is the mean value of X, σ is the variance of X; is the data in X, representing the flow observation value of node i at time step t; yes The result after normalization; The connection relationship of the sensors is the distance relationship between the sensors installed on the urban roads. Specifically, the connection relationship between the two sensors is defined as (V i , V j , d ij ), where V i and V j represents the sensors i and j installed on the road, d ij Represents the distance between two sensors; The construction of the road network is realized through the connection relationship between each sensor; the road network is a graph network structure G=(V, E, W), wherein V represents the set of sensors, |V|=N represents that there are N sensors in the road network, W represents the set of distances between sensors, W is the adjacency matrix between each sensor, representing the connectivity between each sensor, and W is a 0-1 matrix, wherein 0 represents that two sensors are unreachable, and 1 represents that two sensors are reachable.

3. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized by: In step 2, the sliding window segmentation method is used to divide the data set to obtain a sample set, and the sample set is divided according to the proportion to obtain a training set, a validation set, and a test set. The specific process is as follows: The data set is a preprocessed traffic flow sequence and road network, which contains traffic flow sequence data observed by multiple sensors; The sliding window segmentation method is to define a window with a length of window, window = history + future, where history represents the total number of time steps of the historical traffic sequence, and future represents the total number of time steps of the future traffic sequence; use the sliding window to segment the traffic flow sequence data X = {X1, X2, ..., X T }∈R T×N×C Slide up once to get a sample X that contains both historical traffic sequence and future traffic sequence i ∈R window×N×C ; In this way, after sliding on the data set, we get all the sample sets U = {X1, X2, ..., X T-window+1 }, the first history time steps of each sample As the input of the traffic flow prediction model, the next future time step is used as the true value Forecast results of traffic flow prediction models Make comparisons; The said dividing the sample set according to proportion means dividing the sample set U into a training set, a validation set and a test set according to the ratio of M:N:K; the training set is used to train the traffic flow prediction model, the validation set is used to adjust the hyperparameters of the traffic flow prediction model, and the test set is used to evaluate the prediction performance of the traffic flow prediction model in unseen traffic flow sequences.

4. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized by: In step 3, the high-dimensional spatiotemporal data embedding module processes the preprocessed traffic flow sequence and road network, extracts historical high-dimensional flow representation, time features, spatial features and location information, and fuses these four features to obtain a high-dimensional spatiotemporal representation, where: The preprocessed traffic flow sequence The dimension transformation is used to obtain the historical high-dimensional flow representation, which means using a linear layer to transform the preprocessed traffic flow sequence Transform to high-dimensional latent space to get the historical high-dimensional flow representation X data ∈R T×N×C′ , in order to obtain more representation information, the processing process is as follows: Where: W data represents the weights and b of the linear layer data The linear layer is represented by the bias term, which is a learnable parameter; The method for extracting time features from the preprocessed traffic flow sequence is: converting the timestamp corresponding to the traffic flow sequence into its time proportion T in a day d and the proportion of time in a week T w , each of which passes through the day embedding linear layer and the week embedding linear layer to obtain the day embedding feature X d ∈R T×C′ and Zhou embedding feature X w ∈R T×C′ , the processing process is as follows: X d =W d T d +b d X w =W w T w +b w Where: W d is the weight of the linear layer of the sky embedding, b d is the bias term of the linear layer of the sky embedding, W w is the weight of the weekly embedding linear layer, and b w The bias terms of the linear layer of the weekly embedding are all learnable parameters; The method for encoding the position information from the historical traffic sequence is: calculating the corresponding position code X according to the position of the traffic observation value in the sequence p ∈R T×C′ , the processing process is as follows: Where: pos represents the posth time step, d represents the dth element in the dimension C′ of the high-dimensional spatiotemporal data embedding module; The information extraction of the road network refers to extracting spatial features from the road network, and the steps are as follows: First, the normalized Laplace matrix L is constructed based on the adjacency matrix W composed of all sensors in the road network G. The processing process is as follows: Where: I∈R N×N is the identity matrix, D∈R N×N is the degree matrix based on the adjacency matrix W. Since the adjacency matrix W is a symmetric matrix, D is a diagonal matrix, D ii =∑ j∈N w ij ; Secondly, the normalized Laplace matrix L is decomposed and k smallest non-trivial eigenvectors are selected to form X k And use the linear layer to generate the spatial features X s ∈R T×C′ , the processing process is as follows: L=UΛU T X k =[u1,u2,...,u k ] X s =W k X k +b k Where: Λ is a diagonal matrix, which is composed of the eigenvalues ​​λ of the normalized Laplace matrix L i Composed of; i is the non-zero eigenvalue λ of the normalized Laplacian matrix L i The corresponding eigenvector; W k is the weight of the linear layer and b k are the bias terms of the linear layer, which are all learnable parameters; The fusion of the four features is to obtain the historical high-dimensional flow representation X data , time features (day embedding features X d and Zhou embedding feature X w ), spatial feature X s and positional encoding X p The output high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is obtained by adding emb ∈R T×N×C′ For convenience, X emb Denoted as X, the processing process is as follows: X=X data +X d +X w +X s +X p 。 5. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized by: In step 4, the temporal trend perception module performs temporal trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module to capture the temporal characteristics of trend perception; The temporal trend perception module consists of two layers of attention, namely the local trend perception attention layer, the global trend perception attention layer and a fully connected layer, which successively capture the various trend characteristics of the traffic flow sequence for the high-dimensional spatiotemporal representation. The specific process is as follows: The local trend perception attention layer includes a self-attention layer 1, a one-dimensional convolution layer 1 and a pooling layer 1; the high-dimensional spatiotemporal representation X of the high-dimensional spatiotemporal data embedding module is input into the self-attention layer 1 to obtain a local trend perception attention score Attention1, and then the local trend perception attention score Attention1 is sent to the one-dimensional convolution layer 1 and the pooling layer 1 to aggregate features and reduce dimensions to obtain a local trend perception feature The processing process is as follows: in: is the weight matrix of Q1, is the weight matrix of K1, is the weight matrix of V1, which are all learnable parameters; C′ is the last dimension of Q1 and K1; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation; The global trend perception attention layer includes a self-attention layer 2, a one-dimensional convolution layer 2 and a pooling layer 2; the local trend perception features The global trend perception score Attention2 is calculated by inputting it into the self-attention layer 2, and then the global trend perception score Attention2 is input into the one-dimensional convolution layer 2 and the pooling layer 2 to aggregate the features and reduce the dimension to obtain the global trend perception feature. The processing process is as follows: in: is the weight matrix of Q2, is the weight matrix of K2, is the weight matrix of V2, which are all learnable parameters; Conv1d(·) represents a one-dimensional convolution operation; MaxPool(·) represents a maximum pooling operation; The fully connected layer is a global trend perception feature Linear transformation is performed to increase the dimension and the nonlinear time dependency is captured through the activation function. Finally, the trend-aware time feature Trend_T is obtained. The processing process is as follows: Among them: W3 is the weight of the fully connected layer, b3 is the bias term of the fully connected layer, both of which are learnable parameters; sigmoid represents the activation function of the fully connected layer.

6. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized in that: In step 5, the spatial trend perception module performs spatial trend perception modeling on the high-dimensional spatiotemporal representation of the high-dimensional spatiotemporal data embedding module to capture the spatial characteristics of trend perception; The spatial trend perception module includes a trend perception graph information generation module and a trend perception graph convolution module. The specific process is as follows: The trend-aware graph information generation module includes a spatial trend-aware self-attention layer, and its processing process is as follows: First, the time feature Trend_T with time trend awareness is causally convolved to obtain Q trend , K trend and V trend , the processing process is as follows: Q trend =Φ q *Trend_T,K trend =Φ k *Trend_T,V trend =Φ v *Trend_T, Where: Φ q It's Q trend The convolution kernel, Φ k It's K trend The convolution kernel, Φ v Yes V trend The convolution kernels are all learnable parameters; Secondly, the obtained Q trend and K trend Perform dot product and use softmax function to normalize to get the attention score of trend perception between sensors, that is, trend perception matrix A trend , the processing process is as follows: A trend =Softmax(Q trend K trend T ) The trend-aware graph convolution module is implemented using an approximate Chebyshev polynomial of order K; the high-dimensional spatiotemporal representation X and the trend-aware matrix A are trend Input into the K-order approximate Chebyshev polynomial, calculate the trend-aware spatial feature Trend_S, and the processing process is as follows: Where: θ k is a learnable parameter; T k (A trend ) is the form of approximate Chebyshev polynomial, and its recursive formula is T0(A trend )=1,T1(A trend )=A trend , T n+1 (A trend )=2A trend T n (A trend )-T n-1 (A trend ).

7. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized in that: In step 6, the spatiotemporal trend perception information fusion module dynamically calculates the weights of the temporal features with trend perception and the spatial features with trend perception and performs weighted fusion. The specific process is as follows: First, the trend-aware temporal feature Trend_T and the trend-aware spatial feature Trend_S are subjected to different linear transformations respectively, and the fusion weight λ is calculated by the sigmoid activation function. The processing process is as follows: λ=sigmoid(Trend_SW λ,1 +Trend_TW λ,2 +b λ ), Where: W λ,1 is the weight matrix of Trend_S, W λ,2 is the weight matrix of Trend_T, b λ is a bias term, which is a learnable parameter. The value of λ is between 0 and 1. The closer λ is to 1, the more the spatial trend characteristics of the traffic sequence will be favored during fusion. The closer λ is to 0, the greater the weight of the temporal trend characteristics of the traffic sequence will be. Secondly, the weight λ of spatiotemporal feature fusion is used to perform weighted summation of the trend-aware temporal feature Trend_T and the trend-aware spatial feature Trend_S to obtain the trend-aware spatiotemporal information X f , the processing process is as follows: X f =λ⊙Trend_S+(1-λ)⊙Trend_T Where: ⊙ represents the element-wise product.

8. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized in that: In step 7, the prediction module uses trend-aware spatiotemporal information to predict the traffic flow sequence for multiple steps in the future. The specific process is as follows: The prediction module includes a hidden state convolution layer and a prediction convolution layer, and the specific process is as follows: First, the trend-aware spatiotemporal information X f Input to the hidden state convolution layer will be X f The dimension is mapped to a higher dimension hid to obtain the hidden state X hid ∈R T×N×hid , the processing process is as follows: X hid =Conv3(X f ) Where: Conv3(·) represents a 2D convolution operation; Second, the hidden state X hid Input to the prediction convolution layer to obtain the prediction result that conforms to the shape of the future multi-step traffic sequence The processing process is as follows: Where: Conv4(·) represents a 2D convolution operation.

9. The traffic flow prediction method based on spatiotemporal trend perception information fusion according to claim 1 is characterized by: In step 7, the designed loss function is used to train and optimize the traffic flow prediction model, and finally the evaluation function is used to evaluate the traffic flow prediction model; Design the loss function and use MAE mean absolute error to train the traffic flow prediction model. The calculation process is as follows: in: represents the true flow value of the jth sensor at the i-th time step, represents the flow prediction value of the jth sensor at the i-th time step; The use of the loss function to train and optimize the traffic flow prediction model on the training set refers to: using the loss of the traffic prediction value and the real value of the traffic calculated by MAE, updating the training parameters of the model through back propagation, reducing the loss between the real value and the predicted value, so that the predicted value generated by the traffic flow prediction model converges to the real value; selecting the Adam optimizer to optimize the training process of the traffic flow prediction model; during the training process, using the model parameters after each iteration to test on the validation set, and saving the model parameters with the best prediction results; The use of the evaluation function to evaluate the traffic flow prediction model means that after the model training is completed, the optimal model parameters are used to infer the test set and the MSE mean square error loss and the MAPE mean absolute percentage loss are used to calculate the loss between the true value and the predicted value to test the prediction effect of the training model; the calculation process of MSE and MAPE is as follows: in: represents the true flow value of the jth sensor at the i-th time step, represents the flow prediction value of the jth sensor at the ith time step.

Citation Information

Cited By

  • Real-time aviation flow prediction method based on aviation situation awareness

    CN120636208A

  • Intelligent traffic flow prediction method based on multi-source data fusion

    CN121352153A

  • Warehouse-in flow prediction method and device based on multi-scale time sequence attention mechanism

    CN122596362A