A traffic flow prediction method and system based on directed graph spatiotemporal information embedding

Through the traffic flow prediction method of directed graph space-time information embedding, the encoder-decoder architecture and space-time-embedding attention network model are used to solve the problem of insufficient traffic feature capture of the entire road network under one-way traffic information, and more accurate traffic flow prediction and road network efficiency improvement are achieved.

CN118298634BActive Publication Date: 2025-08-19SOUTHEAST UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410462928.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-17
Publication Date
2025-08-19
Estimated Expiration
2044-04-17

AI Technical Summary

Technical Problem

The existing traffic prediction methods cannot effectively capture the traffic space-time characteristics of the entire road network when they can only obtain one-way traffic information, resulting in inaccuracy and inefficiency in traffic management and planning.

Method used

The traffic flow prediction method based on the embedding of spatiotemporal information on directed graphs is adopted, and the space-time embedded attention network model is used to combine static and dynamic spatial information and time period information to generate short-term traffic flow prediction results for the entire road network. The directed graph and graph convolutional layers are used to process traffic data, and the space-time attention memory block of bidirectional LSTM is designed to capture spatiotemporal features.

Benefits of technology

It has improved the ability of traffic management departments and individual drivers to deal with complex traffic environments, enhanced the traffic efficiency of road networks, provided more accurate traffic flow prediction, and supported real-time decision-making by intelligent traffic systems and management departments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118298634B_ABST
    Figure CN118298634B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of traffic management systems, and discloses a traffic flow prediction method and system based on the embedding of spatiotemporal information in a directed graph. Based on the road network structure of unidirectional traffic flow, a directed graph is constructed to enhance the model's ability to extract spatial features of traffic spatiotemporal data; static spatial information and dynamic spatial information based on the directed graph are embedded into traffic flow data to enhance the model's learning ability of road network spatial information; a spatiotemporal attention memory block with time period information embedding is designed to capture the spatiotemporal correlation of data. In the encoder stage, the spatiotemporal information embedding method and the spatiotemporal attention memory block connection design are used to extract traffic spatiotemporal data features; in the decoder stage, the fully convolutional UniRepLKNet‑S architecture is used to generate the final prediction results. The beneficial effects of the present invention are: it can better help traffic management departments and individual drivers cope with complex and changing traffic environments and improve road network traffic efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of traffic management systems, and relates to a traffic flow prediction method and system based on directed graph spatiotemporal information embedding. Background Art

[0002] Traffic forecasting is a crucial aspect of modern traffic management systems, playing a vital role in ensuring the smooth operation of road networks and improving the overall efficiency of urban transportation. At its core, traffic forecasting involves predicting future traffic conditions, including vehicle volume, speed, and congestion levels, based on historical traffic data, environmental factors, and real-time information. It underpins numerous traffic-related applications, including traffic signal optimization, route planning, incident management, and infrastructure planning. Accurately predicting traffic conditions enables traffic management authorities to proactively implement measures to alleviate congestion, minimize travel times, reduce emissions, and improve road user safety.

[0003] Traffic prediction methods based on spatiotemporal feature mining can capture spatiotemporal correlations within traffic systems and effectively perceive spatiotemporal dynamics within them, including traffic congestion and changes in traffic flow. This facilitates timely adjustments to traffic management strategies to address diverse traffic conditions. By capturing spatiotemporal features in data, traffic conditions can be monitored in real time and prediction results can be updated promptly, leading to a better understanding of the operating patterns and characteristics of the traffic system and providing a more scientific basis for traffic planning and management. This is crucial for traffic management departments and drivers, as it helps them make more timely and effective decisions, improve the efficiency and smoothness of the traffic system, and reduce traffic accidents and congestion. Mining spatiotemporal features of traffic data can also be applied to traffic signal optimization, route planning, public transportation scheduling, and other areas, offering broader application prospects. However, existing research often focuses on situations where traffic information for the entire road network is available, lacking research on situations where only partial traffic information is available (e.g., only one-way traffic information). However, in real-world applications, only one-way traffic information is often available. Summary of the Invention

[0004] The purpose of the present invention is to provide a traffic flow prediction method and system based on directed graph spatiotemporal information embedding, which can better help traffic management departments and individual drivers cope with complex and changing traffic environments and improve road network traffic efficiency.

[0005] In order to solve the above technical problems, the present invention is implemented by adopting the following technical solutions.

[0006] In a first aspect, the present invention provides a traffic flow prediction method based on spatiotemporal information embedding in a directed graph, comprising:

[0007] Collect real-time time series traffic data and input it into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and directed graphs for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network.

[0008] The training process of the spatiotemporal embedding attention network model is as follows:

[0009] Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set;

[0010] The spatiotemporal embedding attention network model is trained using the training set and setting initial hyperparameters, and the hyperparameters of the spatiotemporal embedding attention network model are adjusted using the validation set.

[0011] The present invention pre-processes the collected historical one-way traffic data of the inspection stations and the historical road network information, so that the feature vectors of the one-way traffic data of each inspection station can be extracted and the hidden information of the road network can be captured. The hidden information of the road network includes a directed graph, a traffic delay penalty matrix and an external traffic flow matrix. The present invention builds a spatio-temporal embedded attention network model (STEAN, Spatio-Temporal EmbeddedAttention Network) based on the encoder-decoder architecture and the directed graph. The spatio-temporal embedded attention network model learns the hidden spatio-temporal features in the one-way traffic data of the inspection stations through the spatio-temporal embedded attention network model, and generates end-to-end multi-step short-term traffic flow prediction results for the entire road network.

[0012] In combination with the first aspect, further, the method for preprocessing the collected historical one-way traffic data of the inspection station and the historical road network information is:

[0013] The historical one-way traffic data of the inspection station is cleaned, the cleaned data is standardized, and the time window is divided according to a certain time step to obtain the time series traffic data, and then a time series traffic dataset consisting of a certain number of time series traffic data is obtained.

[0014] Time series traffic data Represents each detection station at each time step t i (in ), for the set Each element in F is the number of traffic status indicators, which include occupancy rate, flow rate, average vehicle speed, etc.

[0015] Process historical road network information into a directed graph Traffic Delay Penalty Matrix and the external traffic flow matrix ε, the directed graph Traffic Delay Penalty Matrix After being standardized with the external traffic flow matrix ε, it is used as the training set and validation set together with the time series dataset; is a set of N vertices in a directed graph, representing all detection points on the road network, n is the vertex number, v n is the nth detection point on the road network; For S from v in the directed graph i to v j The directed edge set represents the reachability relationship between the detection points on the road network (the reachability relationship represents a directional path.), i and j are both vertex numbers, i≠i; Represents S from v in a directed graph i to v j The number of reachable items, S represents the number of elements in the set Ψ; is the cost adjacency matrix, For v i to v j The travel cost weight is: Refers to due to v i to v j Traffic delays caused by intersections or ramps on the directed edges of Traffic flow outside the road network i to v j The influence of directed edges.

[0016] In combination with the first aspect, data cleaning further includes finding and filling missing values, and removing data noise and outliers.

[0017] In combination with the first aspect, further, the road network information includes the location coordinates of each detection point in the road network, the reachability relationship and distance between the detection points, and whether there is traffic flow inflow and outflow outside the road network on the path between the detection points.

[0018] In combination with the first aspect, further, the method for constructing the spatiotemporal embedding attention network model based on the encoder-decoder architecture and the directed graph is:

[0019] In the encoder stage, the time series traffic data obtained after preprocessing is processed by static spatial information embedding and dynamic spatial information embedding respectively; the traffic data after embedding is Input the spatio-temporal attention memory block (STAM Block, Spatio-Temporal Attention Memory Block) and get the output H (1) ;H (1) The residual connection is used to prevent the gradient from disappearing, and the static spatial information is embedded again to strengthen the capture and learning of spatial information by the spatiotemporal embedding attention network model, and obtain the input traffic data of the next spatiotemporal attention memory block. A total of l spatiotemporal attention memory blocks are connected in the above way to obtain the final encoder output H (l) , where l is a hyperparameter; the connection calculation process between adjacent spatiotemporal attention memory blocks in the encoder is:

[0020]

[0021] in, and is the input traffic data of the mth and m+1th spatiotemporal attention memory blocks, m=1,2,…,l,; W m and H is a learnable model parameter that realizes dimension transformation; (m) is the output of the mth spatiotemporal attention memory block; is the static spatial information embedding, l is a hyperparameter, and is the set value;

[0022] In the decoder stage, the feature H finally extracted by the encoder is (l) Input the UniRepLKNet-S architecture to generate multi-step short-term traffic flow prediction results for the entire road network.

[0023] In combination with the first aspect, further, in the spatiotemporal embedding attention network model, the static spatial information embedding process includes:

[0024] By calculating each The distance between the two sides is used to obtain the cost adjacency matrix representing the main travel costs. Considering intersections or ramps It will cause additional delays, thereby increasing the travel cost of the edge, so the traffic delay penalty matrix is introduced The traffic delay information represented in this paper is learned through a nonlinear fully connected layer and added to the main travel cost; the static spatial dependency is embedded through a convolutional layer; the static spatial information embedding is expressed as:

[0025]

[0026] in, is the static spatial information embedding without splicing processing, W c and bc are learnable model parameters, represents the convolution operation, and PF is a hyperparameter; and Represents different nonlinear transformation operations, expressed as follows (all nonlinear transformation operations mentioned below are applicable):

[0027] f(x)=ReLU(ωx+b)

[0028] Among them, ω and b are both learnable model parameters, and are different parameters in different nonlinear transformation operations; ReLU is a common activation function;

[0029] Will SE sta Splice into a vector It is used as the static spatial information embedding of the input spatiotemporal embedding attention network model:

[0030]

[0031] in, is the time step, Represents the static spatial information embedding of the input spatiotemporal embedding attention network model.

[0032] In combination with the first aspect, further, in the spatiotemporal embedding attention network, the dynamic spatial information embedding includes:

[0033] Will Traffic data of all vertices in the road network in time steps After static spatial information embedding processing; considering that the road network and one-way traffic flow information represented by the directed graph are not comprehensive, the external traffic flow will flow into and out of the constructed directed graph, and the external traffic flow matrix ε is used to represent the external traffic flow; After being fused with ε, it is input into the directed graph-based convolutional layer together with the adjacency matrix to learn the dynamic spatial information of each time step:

[0034] Will The external traffic flow matrix ε is spliced into

[0035]

[0036] in, express A tensor concatenated from the matrices ε is used as one of the input information of the dynamic spatial information embedding structure;

[0037] Traffic data to be entered Convert the feature dimension of Traffic data after nonlinear transformation Sum and then combine with external traffic flow to obtain

[0038]

[0039] in, is the input traffic information matrix of the graph convolution layer; f PF (·) and f dyn (·) represents different nonlinear transformation operations; next, Processing is performed through a directed graph-based convolutional layer;

[0040]

[0041] in, is the output of dynamic spatial information embedding; W (2) and W (1) is a learnable model parameter; σ is an activation function; is an adjacency matrix with self-connection, expressed as (A is the adjacency matrix, I is the identity matrix); yes The degree matrix of i and j are directed graphs The number of the vertex;

[0042] The input of the first spatiotemporal attention memory block is represented as

[0043]

[0044]

[0045] Among them, W O and O are learnable model hyperparameters.

[0046] In combination with the first aspect, further, in the spatiotemporal embedding attention network, the spatiotemporal attention memory block includes:

[0047] The spatiotemporal attention memory block proposes a spatiotemporal attention mechanism based on a bidirectional long short-term memory neural network (LSTM): the previous cell state output by the forward LSTM unit is and hidden state At the current time step t c Traffic data embedded with spatial information And the time period information is input into the spatiotemporal attention unit, where H is a hyperparameter. The spatiotemporal attention unit can learn the spatiotemporal correlation between each time step and output it As the current time step t c The input of the forward LSTM unit (the same applies to the reverse LSTM). The forward and reverse directions use independent spatiotemporal attention unit parameters and LSTM parameters and propagate in two different directions to capture the spatiotemporal features in the data. The structure of the spatiotemporal attention memory block is represented as:

[0048]

[0049] in, Indicates the positive spatiotemporal correlation between the previous time step and the current time step; is the previous cell state output by the forward LSTM unit, is the hidden state output by the forward LSTM unit, t c is the current time step, is the value at the current time step t c Traffic data embedded in spatial information, H is a hyperparameter; f Q (·) and f K (·) represents different nonlinear transformation operations; Refers to the concatenation operation of tensors; "*" refers to the inner product of matrices; Represents dimension conversion operation, adapted to matrix multiplication; (·) Τ Represents the matrix transpose operation; the M in the denominator is the size of the last dimension of the numerator of the fraction, M=N, The operation can effectively avoid the impact of excessive dimensions on numerical stability; Refers to the Softmax function acting on the last dimension, which is used to calculate the spatiotemporal correlation weight; It is TE out The tth vector c Elements, TE out It is the time period information embedding, which aims to enhance the model's ability to identify and learn the relative time of each time step in the period. It is calculated as follows:

[0050]

[0051] Among them, f TE (·) is a nonlinear transformation operation; represents the periodic information of each time step t, The calculation is as follows:

[0052]

[0053] where δ<·> and θ<·> represent the functions sin2π(·) and cos2π(·), respectively; (N) means that the dimension of each sine and cosine function is N; represents the time of day for the current time step, Indicates the day of the week for the current time step, that is: (T tod It depends on the statistical period of traffic data collected by each detection point. If the statistical period is 5 minutes, then T tod =24*60 / 5=288), TS dow =1,2,…,7.

[0054]

[0055]

[0056] Among them, f V (·) is a nonlinear transformation operation; Represents the spatiotemporal attention unit at t c The output of the time step, and the cell state of the previous time step and hidden state are input into the forward LSTM unit to obtain the current time step and KF is a hyperparameter;

[0057] The reverse structure is the same as the forward one; the hidden states of the LSTM unit output at each time step in both directions are concatenated into vectors and H f Represents the vector of hidden state concatenation output by the LSTM unit at each time step in the forward direction, H b Represents the concatenation of the hidden state output by the LSTM unit at each time step in the reverse direction; a gated fusion mechanism is designed to control the information weights of both directions as the output of the spatiotemporal attention memory block; where the gated Using a multi-layer perceptron we can calculate:

[0058]

[0059]

[0060] in, is the output of the spatiotemporal attention memory block; ⊙ refers to the element-wise product operation of the matrix; Sigmoid[·] refers to the Sigmoid function; f hf (·) and f hb (·) are different nonlinear transformation operations; W f 、W b and bfb are learnable model parameters.

[0061] In a second aspect, the present invention provides a traffic flow prediction system based on directed graph spatiotemporal information embedding, comprising:

[0062] A traffic data collection module configured to collect real-time time series traffic data;

[0063] The model prediction module is configured to input the collected real-time time series traffic data into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and a directed graph for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network;

[0064] The training process of the spatiotemporal embedding attention network model is as follows:

[0065] Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set;

[0066] The spatiotemporal embedding attention network model is trained using the training set and setting initial hyperparameters, and the hyperparameters of the spatiotemporal embedding attention network model are adjusted using the validation set.

[0067] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding.

[0068] In a fourth aspect, the present invention provides a computer device, comprising:

[0069] memory for storing computer programs;

[0070] A processor is used to execute the computer program to implement the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding.

[0071] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding.

[0072] Compared with the prior art, the present invention has the following beneficial effects:

[0073] (1) The present invention can better help traffic management departments and individual drivers cope with complex and changing traffic environments and improve road network traffic efficiency.

[0074] (2) The traffic flow prediction method of the present invention proposes a spatiotemporal embedding attention network for short-term traffic prediction: the relevant information and one-way traffic flow in the road network are abstracted into a directed graph, which solves the problem of being unable to obtain complete traffic statistics of all vehicles in the road network; through a method of embedding spatial (dynamic and static) information and time period information, the learning ability of the model is effectively enhanced; a spatiotemporal attention memory block based on the attention mechanism and bidirectional LSTM is designed to more effectively capture the spatiotemporal traffic data characteristics, and input the decoder to generate predictions.

[0075] (3) The traffic flow prediction method of the present invention realizes a new idea for predicting traffic spatiotemporal data when data collection is incomplete, provides a new perspective for time series prediction based on data spatiotemporal feature mining, strengthens the understanding of traffic spatiotemporal data and real-time traffic flow status by intelligent transportation systems and management departments, and provides support for application fields such as driving route planning and traffic signal control.

[0076] (4) The traffic flow prediction method of the present invention provides a new traffic flow prediction method for application fields such as intelligent transportation systems by designing an end-to-end traffic flow prediction model, thereby optimizing a series of traffic efficiency issues. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 This is a schematic diagram of the spatiotemporal embedding attention network architecture of an embodiment of the present invention;

[0078] Figure 2 This is a schematic diagram of a static spatial information embedding structure according to an embodiment of the present invention;

[0079] Figure 3 This is a schematic diagram of a dynamic spatial information embedding structure according to an embodiment of the present invention;

[0080] Figure 4 This is a schematic diagram of a spatial information embedding structure according to an embodiment of the present invention;

[0081] Figure 5 This is a schematic diagram of the spatiotemporal attention memory block structure of an embodiment of the present invention;

[0082] Figure 6 Schematic diagram of the spatiotemporal attention unit structure of an embodiment of the present invention. DETAILED DESCRIPTION

[0083] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0084] The term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. Additionally, the character " / " generally indicates an "or" relationship between the related objects.

[0085] Example 1

[0086] The traffic flow prediction method based on directed graph spatiotemporal information embedding proposed in the present invention includes the following steps:

[0087] Collect real-time time series traffic data and input it into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and directed graphs for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network.

[0088] Among them, the training process of the spatiotemporal embedding attention network model is:

[0089] Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set;

[0090] Use the training set and set initial hyperparameters to train the spatiotemporal embedding attention network model, and use the validation set to adjust the hyperparameters of the spatiotemporal embedding attention network model.

[0091] In a specific implementation of this embodiment, the method for preprocessing the collected historical one-way traffic data of the inspection station is: cleaning the historical one-way traffic data of the inspection station, standardizing the cleaned data, and dividing the time window according to a certain time step to obtain time series traffic data, and then obtaining a time series traffic data set composed of a certain number of time series traffic data.

[0092] Time series traffic data Represents each detection station at each time step t i (in ), for the set Each element in F is the number of traffic status indicators, which include occupancy rate, flow rate, average vehicle speed, etc.

[0093] In a specific implementation of this embodiment, the method for preprocessing the historical road network road information is: processing the historical road network road information into a directed graph Traffic Delay Penalty Matrix and the external traffic flow matrix ε, the directed graph Traffic Delay Penalty Matrix After being standardized with the external traffic flow matrix ε, it is used as the training set and validation set together with the time series dataset; is a set of N vertices in a directed graph, representing all detection points on the road network, n is the vertex number, v n is the nth detection point on the road network; For S from v in the directed graph i to v j The directed edge set represents the reachability relationship between the detection points on the road network (the reachability relationship represents a directional path.), i and j are both vertex numbers, i≠i; Represents S from v in a directed graph i to v j The number of reachable items, S represents the number of elements in the set Ψ; is the cost adjacency matrix, For v i to v j The travel cost weight is: Refers to due to v i to v j Traffic delays caused by intersections or ramps on the directed edges of Traffic flow outside the road network i to v j The influence of directed edges.

[0094] In this embodiment, a specific implementation method is as follows: Figure 1 As shown, Figure 1 The architecture of the spatiotemporal embedded attention network model based on the encoder-decoder architecture and the directed graph in this embodiment includes: the construction method of the spatiotemporal embedded attention network model is:

[0095] Encoder stage: The time series traffic data obtained after preprocessing Through static spatial information embedding and dynamic spatial information embedding respectively; the traffic data after embedding Input the spatio-temporal attention memory block (STAM Block, Spatio-Temporal Attention Memory Block) and get the output H (1) ;H (1)The residual connection is used to prevent the gradient from disappearing, and the static spatial information is embedded again to strengthen the capture and learning of spatial information by the spatiotemporal embedding attention network model, and obtain the input traffic data of the next spatiotemporal attention memory block. A total of l spatiotemporal attention memory blocks are connected in the above way to obtain the final encoder output H (l) .

[0096] The connection calculation process between adjacent spatiotemporal attention memory blocks in the encoder is:

[0097]

[0098] in, and is the input traffic data of the mth and m+1th spatiotemporal attention memory blocks, m=1,2,…,l,; W m and H is a learnable model parameter that realizes dimension transformation; (m) is the output of the mth spatiotemporal attention memory block; is the static spatial information embedding, l is a hyperparameter, and is the set value.

[0099] Decoder stage: The feature H extracted by the encoder (l) Input UniRepLKNet-S architecture (the specific construction method of UniRepLKNet-S architecture in this embodiment is the existing technology, see the paper "UniRepLKNet: Universal Perceptual Large-Kernel Convolutional Network for Audio, Video, Point Cloud, Time Series and Image Recognition" published on November 27, 2023 for details). UniRepLKNet-S architecture is divided into four stages, each stage consists of a combination of void convolution and large-kernel convolution, and each stage is connected by a certain number of downsampling convolution layers; the final traffic flow prediction result is generated by UniRepLKNet-S architecture Indicates that each detection station at each time step t r Predicted traffic status indicators, among which, represents the time step,

[0100] In a specific implementation of this embodiment, the cost adjacency matrix in the directed graph can be expressed as in It can be calculated by the following formula:

[0101]

[0102] In a specific implementation of this embodiment, the traffic delay penalty matrix and the external traffic flow matrix can be expressed as and in and It can be calculated by the following formula:

[0103]

[0104] Among them, the traffic delay penalty matrix It can be expressed as the transpose of the external traffic flow matrix ε.

[0105] In a specific implementation of this embodiment, the structure of static spatial information embedding in the spatiotemporal embedding attention network is as follows: Figure 2 As shown, the input cost adjacency matrix and the traffic delay penalty matrix Output

[0106] Static spatial information embedding processing includes:

[0107] By calculating each The distance between the two sides is used to obtain the cost adjacency matrix representing the main travel costs. Considering intersections or ramps It will cause additional delays, thereby increasing the travel cost of the edge, so the traffic delay penalty matrix is introduced The traffic delay information represented in this paper is learned through a nonlinear fully connected layer and added to the main travel cost; the static spatial dependency is embedded through a convolutional layer; the static spatial information embedding is expressed as:

[0108]

[0109] in, is the static spatial information embedding without splicing processing, W c and b c are learnable model parameters, represents the convolution operation, and PF is a hyperparameter; and Represents different nonlinear transformation operations, expressed as follows (all nonlinear transformation operations mentioned below are applicable):

[0110] f(x)=ReLU(ωx+b)

[0111] Among them, ω and b are both learnable model parameters, and are different parameters in different nonlinear transformation operations; ReLU is a common activation function;

[0112] Will SE sta Splice into a vector It is used as the static spatial information embedding of the input spatiotemporal embedding attention network model:

[0113]

[0114] in, is the time step, Represents the static spatial information embedding of the input spatiotemporal embedding attention network model.

[0115] In a specific implementation of this embodiment, the structure of dynamic spatial information embedding in the spatiotemporal embedding attention network is as follows: Figure 3 As shown, input preprocessed time series traffic data External traffic flow matrix ε and adjacency matrix information, output

[0116] Dynamic spatial information embedding includes:

[0117] Will Traffic data of all vertices in the road network in time steps After static spatial information embedding processing; considering that the road network and one-way traffic flow information represented by the directed graph are not comprehensive, the external traffic flow will flow into and out of the constructed directed graph, and the external traffic flow matrix ε is used to represent the external traffic flow; After being fused with ε, it is input into the directed graph-based convolutional layer together with the adjacency matrix to learn the dynamic spatial information of each time step:

[0118] Will The external traffic flow matrix ε is spliced into

[0119]

[0120] in, express A tensor concatenated from the matrices ε is used as one of the input information of the dynamic spatial information embedding structure;

[0121] Traffic data to be entered Convert the feature dimension of Traffic data after nonlinear transformation Sum and then combine with external traffic flow to obtain

[0122]

[0123] in, is the input traffic information matrix of the graph convolution layer; f PF (·) and f dy2(·) represents different nonlinear transformation operations; next, Processing is performed through a directed graph-based convolutional layer;

[0124]

[0125] in, is the output of dynamic spatial information embedding; W (2) and W (1) is a learnable model parameter; σ is an activation function; is an adjacency matrix with self-connection, expressed as (A is the adjacency matrix, I is the identity matrix); yes The degree matrix of i and j are directed graphs The number of the vertex in the .

[0126] In a specific implementation of this embodiment, the spatial information is embedded into the pre-processed time series traffic data in the spatiotemporal embedding attention network. The structure of Figure 4 As shown, the input of the first spatiotemporal attention memory block is obtained

[0127] The input of the first spatiotemporal attention memory block is represented as

[0128]

[0129] Among them, W O and O are learnable model hyperparameters.

[0130] In a specific implementation of this embodiment, the spatiotemporal attention memory block structure in the spatiotemporal embedded attention network is as follows: Figure 5 As shown, the forward spatiotemporal attention unit structure in the spatiotemporal attention memory block is as follows Figure 6 As shown, the previous cell state output by the forward LSTM unit is and hidden state At the current time step t c Traffic data embedded with spatial information And the time period information is transformed through different nonlinear fully connected layers and input into the spatiotemporal attention unit, where H is a hyperparameter, output As the current time step t c The input of the forward LSTM unit.

[0131] The spatiotemporal attention unit can learn the spatiotemporal correlation between each time step and output it As the current time step tc The input of the forward LSTM unit (the same applies to the reverse LSTM). The forward and reverse directions use independent spatiotemporal attention unit parameters and LSTM parameters and propagate in two different directions to capture the spatiotemporal features in the data. The structure of the spatiotemporal attention memory block is represented as:

[0132]

[0133] in, Indicates the positive spatiotemporal correlation between the previous time step and the current time step; is the previous cell state output by the forward LSTM unit, is the hidden state output by the forward LSTM unit, t c is the current time step, is the value at the current time step t c Traffic data embedded in spatial information, H is a hyperparameter; f Q (·) and f K (·) represents different nonlinear transformation operations; Refers to the concatenation operation of tensors; "*" refers to the inner product of matrices; Represents dimension conversion operation, adapted to matrix multiplication; (·) Τ Represents the matrix transpose operation; the M in the denominator is the size of the last dimension of the numerator of the fraction, M=N, The operation can effectively avoid the impact of excessive dimensions on numerical stability; Refers to the Softmax function acting on the last dimension, which is used to calculate the spatiotemporal correlation weight; It is TE out The tth vector c Elements, TE out It is the time period information embedding, which aims to enhance the model's ability to identify and learn the relative time of each time step in the period. It is calculated as follows:

[0134]

[0135] Among them, f TE (·) is a nonlinear transformation operation; represents the periodic information of each time step t, The calculation is as follows:

[0136]

[0137] where δ<·> and θ<·> represent the functions sin2π(·) and cos2π(·), respectively; (N) means that the dimension of each sine and cosine function is N; represents the time of day for the current time step, Indicates the day of the week for the current time step, that is: (T tod It depends on the statistical period of traffic data collected by each detection point. If the statistical period is 5 minutes, then T tod =24*60 / 5=288), TS dow =1,2,…,7.

[0138]

[0139]

[0140] Among them, f V (·) is a nonlinear transformation operation; Represents the spatiotemporal attention unit at t c The output of the time step, and the cell state of the previous time step and hidden state are input into the forward LSTM unit to obtain the current time step and KF is a hyperparameter;

[0141] The reverse structure is the same as the forward one; the hidden states of the LSTM unit output at each time step in both directions are concatenated into vectors and H f Represents the vector of hidden state concatenation output by the LSTM unit at each time step in the forward direction, H b Represents the concatenation of the hidden state output by the LSTM unit at each time step in the reverse direction; a gated fusion mechanism is designed to control the information weights of both directions as the output of the spatiotemporal attention memory block; where the gated Using a multi-layer perceptron we can calculate:

[0142]

[0143]

[0144] in, is the output of the spatiotemporal attention memory block; ⊙ refers to the element-wise product operation of the matrix; Sigmoid[·] refers to the Sigmoid function; f hf (·) and f hb (·) are different nonlinear transformation operations; W f 、W b and b fb are learnable model parameters.

[0145] In a specific implementation of this embodiment, the present invention selects the Adam algorithm to optimize the weights of all model parameters of the spatiotemporal embedding attention network.

[0146] In one specific implementation of this embodiment, the present invention adopts a piecewise constant decay learning rate setting strategy when training the spatiotemporal embedding attention network: define the iteration number interval, set different learning rate constant values in the corresponding interval, set the initial learning rate to a large value, and then reduce it after a certain number of iterations. Set the total number of iterations to 100, the initial learning rate to 0.001 (when the iteration batch is 0-15), and adjust the learning rate to 0.0001 when the iteration batch is 15-50, and adjust the learning rate to 0.00001 when the iteration batch is 50-100.

[0147] Example 2

[0148] Based on the same inventive concept as Example 1, this example introduces a traffic flow prediction system based on directed graph spatiotemporal information embedding, including:

[0149] A traffic data collection module configured to collect real-time time series traffic data;

[0150] The model prediction module is configured to input the collected real-time time series traffic data into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and a directed graph for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network;

[0151] Among them, the training process of the spatiotemporal embedding attention network model is:

[0152] Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set;

[0153] The spatiotemporal embedding attention network model is trained using the training set and setting initial hyperparameters, and the hyperparameters of the spatiotemporal embedding attention network model are adjusted using the validation set.

[0154] Example 3

[0155] Based on the same inventive concept as other embodiments, this embodiment introduces a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding are implemented.

[0156] Example 4

[0157] Based on the same inventive concept as other embodiments, this embodiment introduces a computer device, including: a memory for storing a computer program; a processor for executing the computer program to implement the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding.

[0158] Example 5

[0159] Based on the same inventive concept as other embodiments, this embodiment introduces a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the above-mentioned traffic flow prediction method based on directed graph spatiotemporal information embedding are implemented.

[0160] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0161] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0162] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0164] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which are all protected by the present invention.

Claims

1. A traffic flow prediction method based on spatiotemporal information embedding in directed graphs, characterized by: include: Collect real-time time series traffic data and input it into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and directed graphs for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network. The training process of the spatiotemporal embedding attention network model is as follows: Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set; Using the training set and setting initial hyperparameters to train the spatiotemporal embedding attention network model, and adjusting the hyperparameters of the spatiotemporal embedding attention network model through the validation set; The method for preprocessing the collected historical one-way traffic data and historical road network information of the inspection station is as follows: The historical one-way traffic data of the inspection station is cleaned, the cleaned data is standardized, and the time series traffic data is obtained by dividing the time window according to a certain time step, thereby obtaining a time series traffic dataset; Process historical road network information into a directed graph Traffic Delay Penalty Matrix and the external traffic flow matrix ε, the directed graph Traffic Delay Penalty Matrix After being standardized with the external traffic flow matrix ε, it is used as the training set and validation set together with the time series traffic dataset; is a set of N vertices in a directed graph, representing all detection points on the road network, n is the vertex number, v n is the nth detection point on the road network; For S from v in the directed graph i to v j The directed edge set represents the reachability relationship between detection points on the road network, i and j are both vertex numbers, i≠j; Represents S from v in a directed graph i to v j The number of reachable items, S represents the number of elements in the set Ψ; is the cost adjacency matrix, For v i to v j The travel cost weight is: Refers to due to v i to v j Traffic delays caused by intersections or ramps on the directed edges of Traffic flow outside the road network i to v j The influence of directed edges.

2. The traffic flow prediction method based on directed graph spatiotemporal information embedding according to claim 1 is characterized in that: The method for constructing the spatiotemporal embedding attention network model based on the encoder-decoder architecture and directed graph is as follows: In the encoder stage, the time series traffic data obtained after preprocessing is processed by static spatial information embedding and dynamic spatial information embedding respectively; the traffic data after embedding is Input the spatiotemporal attention memory block and get the output H (1) ;H (1) The residual connection is used to prevent the gradient from disappearing, and the static spatial information is embedded again to obtain the input time series traffic data of the next spatiotemporal attention memory block. There are l spatiotemporal attention memory blocks connected in the same way to get the final encoder output H (l) , where l is a hyperparameter; the connection calculation process between adjacent spatiotemporal attention memory blocks in the encoder is: in, and is the input traffic data of the mth and m+1th spatiotemporal attention memory blocks, m=1,2,…,l; W m and H is a learnable model parameter that realizes dimension transformation; (m) is the output of the mth spatiotemporal attention memory block; Embedding static spatial information; In the decoder stage, the feature H finally extracted by the encoder is (l) Input the UniRepLKNet-S architecture to generate multi-step short-term traffic flow prediction results for the entire road network.

3. The traffic flow prediction method based on directed graph spatiotemporal information embedding according to claim 2 is characterized in that: In the spatiotemporal embedding attention network model, the static spatial information embedding process includes: By calculating each distance, and obtain the cost adjacency matrix Introduced traffic delay penalty matrix Static spatial information embedding is expressed as: in, is the static spatial information embedding without splicing processing, W c and b c are learnable model parameters, represents the convolution operation, PF is the hyperparameter; and Represents different nonlinear transformation operations, expressed as follows: f(x)=ReLU(ωx+b) Among them, ω and b are both learnable model parameters, and are different parameters in different nonlinear transformation operations; ReLU is an activation function; Will SE sta Splice into a vector It is used as the static spatial information embedding of the input spatiotemporal embedding attention network model: in, is the time step, Represents the static spatial information embedding of the input spatiotemporal embedding attention network model.

4. The traffic flow prediction method based on directed graph spatiotemporal information embedding according to claim 2 is characterized in that: In the spatiotemporal embedding attention network, the dynamic spatial information embedding includes: Will The external traffic flow matrix ε is spliced into in, express A tensor concatenated from the matrices ε is used as one of the input information of the dynamic spatial information embedding structure; The input time series traffic data Convert the feature dimension of Time series traffic data after nonlinear transformation Sum and then combine with external traffic flow to obtain in, is the input traffic information matrix of the graph convolution layer; f PF (·) and f dyn (·) represents different nonlinear transformation operations; next, Processing is performed through a directed graph-based convolutional layer; in, is the output of dynamic spatial information embedding; W (2) and W (1) is a learnable model parameter; σ is an activation function; is an adjacency matrix with self-connection, expressed as A is the adjacency matrix, I is the identity matrix; yes The degree matrix of i and j are directed graphs The number of the vertex; The input of the first spatiotemporal attention memory block is represented as Among them, W O and O are learnable model hyperparameters.

5. The traffic flow prediction method based on directed graph spatiotemporal information embedding according to claim 4 is characterized in that: In the spatiotemporal embedding attention network, the spatiotemporal attention memory block includes: The structure of the spatiotemporal attention memory block is represented as: in, Indicates the positive spatiotemporal correlation between the previous time step and the current time step; is the previous cell state output by the forward LSTM unit, is the hidden state output by the forward LSTM unit, t c is the current time step, is the value at the current time step t c Traffic data embedded in spatial information, H is a hyperparameter; f Q (·) and f K (·) represents different nonlinear transformation operations; Refers to the concatenation operation of tensors; "*" refers to the inner product of matrices; Represents dimension conversion operation, adapted to matrix multiplication; (·) Τ Represents the matrix transpose operation; the M in the denominator is the size of the last dimension of the numerator of the fraction, M=N, The operation can effectively avoid the impact of excessive dimension on numerical stability; sm d-1 [·] refers to the Softmax function acting on the last dimension; It is TE out The tth vector c Elements, TE out It is the time period information embedding, which is calculated as follows: Among them, f TE (·) is a nonlinear transformation operation; represents the periodic information of each time step t, The calculation is as follows: Among them, δ<·> and Represent the functions sin2π(·) and cos2π(·), respectively; (N) means that the dimension of each sine and cosine function is N; represents the time of day for the current time step, Indicates the day of the week for the current time step, that is: T tod Indicates the count of statistical cycles in a day; Among them, f V (·) is a nonlinear transformation operation; Represents the spatiotemporal attention unit at t c The output of the time step, and the cell state of the previous time step and hidden state are input into the forward LSTM unit to obtain the current time step and KF is a hyperparameter; The reverse structure is the same as the forward one; the hidden states of the LSTM unit output at each time step in both directions are concatenated into vectors and H f Represents the vector of hidden state concatenation output by the LSTM unit at each time step in the forward direction, H b Represents the concatenation of the hidden state output by the LSTM unit at each time step in the reverse direction; a gated fusion mechanism is designed to control the information weights of both directions as the output of the spatiotemporal attention memory block; where the gated Using a multi-layer perceptron we can calculate: in, is the output of the spatiotemporal attention memory block; ⊙ refers to the element-wise product operation of the matrix; Sigmoid[·] refers to the Sigmoid function; f hf (·) and f hb (·) are different nonlinear transformation operations; W f 、W b and b fb are learnable model parameters.

6. A traffic flow prediction system based on spatiotemporal information embedding in directed graphs, characterized by: include: A traffic data collection module configured to collect real-time time series traffic data; The model prediction module is configured to input the collected real-time time series traffic data into a pre-trained spatiotemporal embedding attention network model based on an encoder-decoder architecture and a directed graph for prediction, generating end-to-end multi-step short-term traffic flow prediction results for the entire road network; The training process of the spatiotemporal embedding attention network model is as follows: Collect historical one-way traffic data and historical road network information of the inspection stations on each road in the road network, and pre-process the collected historical one-way traffic data and historical road network information to obtain a training set and a validation set; Using the training set and setting initial hyperparameters to train the spatiotemporal embedding attention network model, and adjusting the hyperparameters of the spatiotemporal embedding attention network model through the validation set; The method for preprocessing the collected historical one-way traffic data and historical road network information of the inspection station is as follows: The historical one-way traffic data of the inspection station is cleaned, the cleaned data is standardized, and the time series traffic data is obtained by dividing the time window according to a certain time step, thereby obtaining a time series traffic dataset; Process historical road network information into a directed graph Traffic Delay Penalty Matrix and the external traffic flow matrix ε, the directed graph Traffic Delay Penalty Matrix After being standardized with the external traffic flow matrix ε, it is used as the training set and validation set together with the time series traffic dataset; is a set of N vertices in a directed graph, representing all detection points on the road network, n is the vertex number, v n is the nth detection point on the road network; For S from v in the directed graph i to v j The directed edge set represents the reachability relationship between detection points on the road network, i and j are both vertex numbers, i≠j; Represents S from v in a directed graph i to v j The number of reachable items, S represents the number of elements in the set Ψ; is the cost adjacency matrix, For v i to v j The travel cost weight is: Refers to due to v i to v j Traffic delays caused by intersections or ramps on the directed edges of Traffic flow outside the road network i to v j The influence of directed edges.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the traffic flow prediction method based on directed graph spatiotemporal information embedding according to any one of claims 1 to 5 are implemented.

8. A computer device, characterized in that: include: memory for storing computer programs; A processor is used to execute the computer program to implement the steps of the traffic flow prediction method based on directed graph spatiotemporal information embedding according to any one of claims 1 to 5.

9. A computer program product comprising a computer program, characterized in that: When the computer program is executed by a processor, the steps of the traffic flow prediction method based on directed graph spatiotemporal information embedding according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Traffic flow prediction model construction method and prediction method based on adaptive dynamic graph

    CN116187555A