Traffic flow prediction method, device and storage medium

By constructing static graphs and dynamic graphs, and updating node and edge information using graph neural networks and recurrent neural networks, the problem of low accuracy in traffic flow prediction in the existing technology is solved, and more accurate space-time relationship capture and traffic flow prediction are achieved.

CN119940662BActive Publication Date: 2025-06-06NANJING UNIV OF INFORMATION SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510429284.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-06-06
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

The accuracy of traffic flow prediction in the prior art is low, especially in capturing complex implicit spatiotemporal relationships in data.

Method used

By constructing static graphs and dynamic graphs, the graph neural network is combined with recurrent neural networks, update node information and edge information, capture the spatiotemporal relationships in historical traffic flow data, and make predictions through the time convolution prediction module.

Benefits of technology

It improves the accuracy of traffic flow prediction, can more effectively capture complex spatiotemporal relationships in the data, and shows excellent timing prediction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940662B_ABST
    Figure CN119940662B_ABST
Patent Text Reader

Abstract

The present invention discloses a traffic flow prediction method, device and storage medium, belonging to the technical field of traffic flow prediction. The method comprises obtaining the historical traffic flow of a station within a set period, obtaining the historical traffic flow without abnormality after preprocessing; inputting the historical traffic flow without abnormality into a trained traffic flow prediction model, and obtaining the traffic flow prediction result of the station within the period to be predicted. The present invention updates the node information and edge information in the static graph and the dynamic graph through the node update module and the edge update module. The dynamic graph takes into account the change of nodes over time. The above means are used to capture the complex implicit spatiotemporal relationship in the input historical traffic flow data, thereby improving the accuracy of traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a traffic flow prediction method, device and storage medium, and belongs to the technical field of traffic flow prediction. Background Art

[0002] Time series prediction is an important research direction in the field of computer and artificial intelligence, which aims to predict the value or trend of a certain point in the future based on historical data. Time series prediction is widely present in all aspects of life, and there are time series prediction tasks in many fields such as finance, transportation, energy and meteorology. In recent years, with the emergence of new detection equipment and the improvement of computer performance, the application effect of deep learning in various fields is better than traditional methods. The research and application of time series prediction technology has also developed rapidly. More and more researchers have begun to use deep learning time series prediction models to predict traffic flow.

[0003] In the prediction of traffic flow, researchers began to use graph neural networks, integrating graph convolution and recurrent neural networks, using graph neural networks to extract spatial features of data, and using recurrent neural networks to extract temporal features of data. However, the performance of the method of constructing spatiotemporal graphs depends largely on the quality of predefined graphs. Graph structures predefined as prior knowledge often ignore the dynamic relationships in the data and lack the ability to model dynamic spatiotemporal information, which limits the performance of graph neural networks. Therefore, the traditional time series prediction model can capture both the temporal characteristics of the sequence and the spatial characteristics of the data for simple nonlinear time series relationships, but it has problems with untimely prediction and inaccurate prediction of space for real traffic flow prediction in real life.

[0004] In summary, the existing technology for predicting traffic flow still has the problem of low accuracy. Summary of the invention

[0005] The purpose of the present invention is to provide a traffic flow prediction method, device and storage medium to solve the problem of low accuracy in the prior art.

[0006] To achieve the above objectives, the present invention is implemented by adopting the following technical solutions:

[0007] In a first aspect, the present invention provides a traffic flow prediction method, comprising:

[0008] Obtain the historical traffic flow of the station within the set period, and obtain the historical traffic flow without abnormalities after preprocessing;

[0009] The historical traffic flow without abnormalities is input into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station in the predicted period. The traffic flow prediction model includes:

[0010] A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station;

[0011] Node update module, updates the node information in static graph and dynamic graph;

[0012] The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; wherein the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix;

[0013] The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result.

[0014] Furthermore, the preprocessing includes completing the missing data of historical traffic flow by the following method:

[0015] According to the difference of historical traffic flow before and after the missing data, the missing data is supplemented to obtain the historical traffic flow without abnormalities.

[0016] Furthermore, the construction of a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the site includes:

[0017] A station that monitors traffic flow is used as a node in the traffic flow graph, the historical traffic flow of the node is used as the node information, and the correlation between two stations is used as the edge in the traffic flow graph to construct the traffic flow graph;

[0018] Map the nodes in the traffic flow graph to node embedding vectors through station indexes;

[0019] The static correlation between nodes is calculated by the following formula:

[0020] ;

[0021] in, represents the node embedding vector of the ith node, represents the node embedding vector of the jth node, represents the static correlation between the i-th node and the j-th node, Relu represents the Relu activation function, Softmax represents the Softmax function, and the superscript T represents the transpose;

[0022] Construct a static adjacency matrix based on the static correlation between nodes ; Among them, the static adjacency matrix The i-th row and j-th column of ;

[0023] Replace the edges in the traffic flow graph with the corresponding static correlations in the static adjacency matrix to obtain a static graph;

[0024] The dynamic correlation between nodes is calculated by the following formula:

[0025] ;

[0026] ;

[0027] ;

[0028] ;

[0029] ;

[0030] ;

[0031] in, , , , , , and is the set weight matrix, Z represents the node embedding vector of all nodes, X represents the historical traffic flow of the node, represents the final node state output at the current time step, z represents the update gate weight coefficient, r represents the reset gate weight coefficient, h represents the new state candidate value at the current time step, tanh represents the tanh function, sigmoid represents the sigmoid function, represents the final node state of the i-th node, represents the final node state of the jth node, represents the size of the spatial dimension, represents the intermediate dynamic correlation between the i-th node and the j-th node, Represents the dynamic correlation between the i-th node and the j-th node;

[0032] According to the dynamic correlation between nodes, the third dynamic adjacency matrix is ​​constructed ; Among them, the third dynamic adjacency matrix The i-th row and j-th column of ;

[0033] The edges in the traffic flow graph are replaced with the corresponding dynamic correlations in the third dynamic adjacency matrix to obtain a dynamic graph.

[0034] Furthermore, the node update module is an improved temporal graph convolutional network, which includes a graph convolutional network and a gated recurrent unit. The graph convolutional network updates the spatial relationship of the node information in the static graph and the dynamic graph based on the input historical traffic flow, and the gated recurrent unit updates the temporal relationship of the node information in the static graph and the dynamic graph to obtain updated node information.

[0035] The expression of the graph convolutional network is:

[0036] ;

[0037] ;

[0038] Among them, X K represents the historical traffic flow of each node within the set time step K, represents the static adjacency matrix, represents the third dynamic adjacency matrix, Indicates the static node information after the spatial relationship is updated. Represents the dynamic node information after the spatial relationship is updated, GCN represents the graph convolutional network, and Relu represents the Relu function;

[0039] The expression of the gated recurrent unit is:

[0040] ;

[0041] in, Represents the updated node information, and GRU represents the gated recurrent unit.

[0042] Further, the edge update module includes a hypernetwork, a bidirectional graph convolution loop, a dynamic filter and a similarity loop;

[0043] The hypernetwork is used to generate an initial hidden state;

[0044] The bidirectional graph convolution loop is used to update the historical traffic flow and hidden state according to the input hidden state, adjacency matrix J and updated node information;

[0045] The dynamic filter is used to generate two dynamic filter tensors according to the updated historical traffic flow, and to generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors;

[0046] The similarity loop is used to update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix.

[0047] Furthermore, the static adjacency matrix is ​​updated in the edge update module through the following loop:

[0048] ;

[0049] ;

[0050] ;

[0051] ;

[0052] ;

[0053] ;

[0054] ;

[0055] in, represents the historical traffic flow of the node in the mth cycle, Indicates the updated node information. Represents a serial operation, and is a hyperparameter that controls the weights of different components, and Respectively represent the hidden states of the mth and m+1th cycles, represents the static adjacency matrix of the mth cycle. When m=1, is the static adjacency matrix of the input edge update module, GCN represents graph convolutional network, Represents the reverse static adjacency matrix of the mth cycle, which is Transpose, the superscript T indicates transposition, is a cyclic graph convolution operation, represents the first dynamic filter tensor of the mth cycle, represents the second dynamic filter tensor of the mth cycle, represents the first dynamic adjacency matrix, represents the second dynamic adjacency matrix, represents the Hadamard product, Z represents the node embedding vector of all nodes, Represents the static adjacency matrix output after completing the mth cycle;

[0056] Execute the above loop until the number of loops reaches the preset number, output the static adjacency matrix of the last loop, and obtain the updated static adjacency matrix ;

[0057] In the edge update module, the third dynamic adjacency matrix is ​​updated using the following formula:

[0058] ;

[0059] ;

[0060] ;

[0061] ;

[0062] ;

[0063] ;

[0064] ;

[0065] in, represents the third dynamic adjacency matrix of the mth cycle. When m=1, is the third dynamic adjacency matrix of the input edge update module, Represents the third dynamic adjacency matrix output after completing the mth cycle;

[0066] Execute the above loop until the number of loops reaches the preset number, output the third dynamic adjacency matrix of the last loop, and obtain the updated third dynamic adjacency matrix .

[0067] Furthermore, the temporal convolution prediction module includes a convolution expansion layer, a temporal convolution layer and a graph convolution prediction layer;

[0068] The expression of the convolution expansion layer is:

[0069] ;

[0070] Among them, * represents the convolution operation, represents the historical traffic flow of the ith node, represents the output of the first layer of the dilated convolutional layer, represents a filter of size 1×2, represents a filter of size 1×3, represents a filter of size 1×6, represents a filter of size 1×7, and concat represents the concat function;

[0071] The expression of the temporal convolutional layer is:

[0072] ;

[0073] in, represents the Hadamard product, Represents the node information within the prediction time step L, represents the output of the last layer of the dilated convolutional layer, tanh represents the tanh function, and sigmoid represents the sigmoid function;

[0074] The expression of the graph convolution prediction layer is:

[0075] ;

[0076] in, represents the updated static adjacency matrix, represents the updated third dynamic adjacency matrix, GCN represents graph convolutional network, Represents the traffic flow prediction result.

[0077] Furthermore, the loss function used in the training of the traffic flow prediction model is the SmoothL1Loss loss function, and the expression of the SmoothL1Loss loss function is:

[0078] ;

[0079] in, represents the value of the SmoothL1Loss loss function, y represents the true value of traffic flow, and ŷ represents the predicted result of traffic flow.

[0080] In a second aspect, the present invention provides a traffic flow prediction device, comprising:

[0081] The historical traffic flow acquisition module is configured to: acquire the historical traffic flow of the station within a set period of time, and obtain the historical traffic flow without abnormalities after preprocessing;

[0082] The future traffic flow prediction module is configured to: input the historical traffic flow without abnormalities into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station within the prediction period;

[0083] Wherein, the traffic flow prediction model includes:

[0084] A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station;

[0085] Node update module, updates the node information in static graph and dynamic graph;

[0086] The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; wherein the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix;

[0087] The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result.

[0088] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which, when executed by a processor, implements the steps of the traffic flow prediction method described in any one of the first aspects.

[0089] Compared with the prior art, the beneficial effects achieved by the present invention are:

[0090] The present invention provides a traffic flow prediction method, device and storage medium, which updates the node information and edge information (static adjacency matrix and third dynamic adjacency matrix) in the static graph and the dynamic graph through the node update module and the edge update module. The dynamic graph takes into account the change of nodes over time. The above means capture the complex implicit spatiotemporal relationship in the input historical traffic flow data (a data containing time series information), thereby improving the accuracy of traffic flow prediction.

[0091] And the time convolution prediction modules of different time scales are used to capture the spatiotemporal dependencies of data at different time scales, thereby effectively improving the accuracy of traffic flow prediction and showing excellent time series prediction performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] Figure 1 is a flow chart of a traffic flow prediction method corresponding to Embodiment 1 of the present invention;

[0093] Figure 2 is a flow chart of a traffic flow prediction method corresponding to Embodiment 2 of the present invention;

[0094] Figure 3 is a schematic diagram of a traffic flow prediction model provided by an embodiment of the present invention;

[0095] Figure 4 is a schematic diagram of a node update module provided by an embodiment of the present invention;

[0096] Figure 5is a schematic diagram of an edge update module provided by an embodiment of the present invention;

[0097] Figure 6 It is a schematic diagram of the temporal convolution prediction module provided by an embodiment of the present invention, wherein (a) is an expansion convolution layer, (b) is a temporal convolution layer, and (c) is a graph convolution prediction layer. DETAILED DESCRIPTION

[0098] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention.

[0099] Example 1

[0100] like Figure 1 As shown, this embodiment provides a traffic flow prediction method, including:

[0101] Obtain the historical traffic flow of the station within the set period, and obtain the historical traffic flow without abnormalities after preprocessing;

[0102] The historical traffic flow without abnormalities is input into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station in the predicted period. The traffic flow prediction model includes:

[0103] A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station;

[0104] Node update module, updates the node information in static graph and dynamic graph;

[0105] The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix;

[0106] The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result.

[0107] The present invention updates the node information and edge information (static adjacency matrix and the third dynamic adjacency matrix) in the static graph and the dynamic graph through the node update module and the edge update module. The dynamic graph takes into account the changes of nodes over time. The above means are used to capture the complex implicit spatiotemporal relationships in the input historical traffic flow data (a type of data containing time series information), thereby improving the accuracy of traffic flow prediction.

[0108] Example 2

[0109] like Figure 2 As shown, this implementation provides a traffic flow prediction method, and the specific implementation includes:

[0110] Step 1: Data collection and preprocessing.

[0111] The present invention collects the time-series traffic flow of a site, pre-processes the data, and constructs a training data set. In this embodiment, the site is a traffic sensor site.

[0112] Data source: This embodiment uses the PEMS (Performance Measurement System, California Highway Performance Measurement System) data set, specifically the data in the PEMS04 data set and the PEMS08 data set for experiments. The PEMS04 data set stores the traffic flow of 307 traffic sensor stations in the California Highway 4 area in January and February 2018. In the PEMS04 data set, sampling and storage are performed once every 5 minutes, that is, there are 12 data items per hour, totaling 16992 time steps. The time step in the present invention represents a set period of time, more specifically, in this embodiment, it represents 5 minutes, including data from 307 stations, and the input data format is 16992×307×1. The 1 in the input data format means that there is only one feature, traffic flow. The PEMS08 dataset stores the traffic flow of 170 traffic sensor stations in the California Highway 8 area in July and August 2016. In the PEMS08 dataset, sampling is performed and stored every 5 minutes, that is, there are 12 data points per hour, a total of 17,856 time steps, including data from 170 stations. The input data format is 17856×170×1, and the 1 in the input data format means that there is only one feature, traffic flow.

[0113] Data preprocessing: Check the integrity of the data. For missing data, complete the data based on the difference in historical traffic flow at the previous and next adjacent moments.

[0114] Dataset division: The first 60% of the data in the PEMS04 and PEMS08 datasets are selected as the training set, the last 20% of the data are used as the test set, and the remaining 20% ​​of the data are used as the validation set.

[0115] Step 2: Construction and prediction of traffic flow prediction model based on dynamic space-time graph.

[0116] The present invention inputs the preprocessed historical traffic flow within a set time period of each station (the set time period here specifically refers to the set time step K) into a trained traffic flow prediction model to obtain the traffic flow prediction results of each station within the future set time period. The total duration of the set time period corresponding to the input historical traffic flow is equal to the total duration of the future set time period corresponding to the traffic flow prediction results.

[0117] like Figure 2 and Figure 3 As shown, the construction of the traffic flow prediction model includes the construction of the following modules: graph construction module, node update module, edge update module and time convolution prediction module.

[0118] like Figure 3 As shown, the traffic flow prediction model provided by the present invention includes a graph construction module, a node update module, an edge update module and a time convolution prediction module; first, the historical traffic flow within the set time period of each station is input into the graph construction module, a static graph is constructed in the graph construction module by a node embedding method, and a dynamic graph is constructed by using an information fusion layer to capture the fixed explicit spatiotemporal associations in the historical traffic flow; then, a TGCN network (Temporal Graph Convolutional Network) is used in the node update module to capture the relationship between modeling nodes and the dynamic changes of historical traffic flow in the time dimension, and update the node information; then, a hidden state is set in the edge update module, and the iteration of RNN (Recurrent Neural Network) and the bidirectional graph convolution network are integrated, and the static adjacency matrix and the third dynamic adjacency matrix are updated respectively using the updated node information, so as to capture the deeper hidden spatiotemporal relationship between the historical traffic flow, and obtain the updated static graph and dynamic graph containing the hidden spatiotemporal features; finally, an expansion convolution is used in the time convolution prediction module to capture information of different time scales, and the final traffic flow prediction result is obtained by using graph convolution.

[0119] The specific implementation process of step 2 includes operations performed in the graph construction module, operations performed in the node update module, operations performed in the edge update module, and operations performed in the temporal convolution prediction module.

[0120] In the present invention, each station that monitors traffic flow is regarded as a node in the traffic flow graph, one station corresponds to one node, and the correlation between two stations is regarded as the edge connecting the corresponding two nodes in the traffic flow graph. The traffic flow graph is constructed by the above method.

[0121] The graph construction module includes a static graph construction layer, and operations performed in the static graph construction layer include: mapping nodes into node embedding vectors, calculating static correlations, and constructing a static adjacency matrix.

[0122] Mapping nodes to node embedding vectors is done as follows:

[0123] Nodes are mapped to node embedding vectors through traffic flow site indexes, retaining the structure and semantic information of nodes in the traffic flow graph.

[0124] The nodes in the traffic flow graph are mapped to node embedding vectors using the following formula:

[0125] ;

[0126] in, represents the node embedding vector of the i-th node, that is, the low-dimensional vector representation of the historical traffic flow of the i-th node in the traffic flow graph, , represents the space composed of d-dimensional real vectors, that is, is a d-dimensional vector, E represents the set embedding matrix, represents the index of the node or site, E is a matrix of N×d dimensions, d represents the dimension of node embedding, N represents the number of sites, that is, the number of nodes in the traffic flow graph, and i represents the ordinal number of the node.

[0127] The node embedding vectors of all nodes are represented as Z, and the dimension of Z is N×d, that is, there are N nodes in total, and each node is mapped to d dimensions.

[0128] Static correlation is calculated by the following method: Static correlation between nodes is calculated based on long-term temporal patterns to construct a static adjacency matrix.

[0129] Specifically, the static correlation between nodes is calculated by the following formula:

[0130] ;

[0131] in, , , represents the node embedding vector of the ith node, represents the node embedding vector of the jth node, represents the static correlation between the i-th node and the j-th node, Relu represents the Relu activation function, Softmax represents the Softmax function, and the superscript T represents transpose.

[0132] The Relu activation function is used to filter the negative correlation of each pair of nodes, retaining only the positive correlation to prevent the negative correlation from interfering with the static correlation between nodes. The Softmax function is used to normalize the correlation of each pair of nodes to generate a probability distribution, which is normalized to [0,1] to measure the static correlation between the i-th node and the j-th node. Therefore, the static correlation is essentially a probability distribution.

[0133] Construct a static adjacency matrix using the static correlation between each pair of nodes , is a matrix of N×N dimensions, which represents the static correlation between each pair of nodes in N nodes, that is, the static correlation between each pair of N traffic flow monitoring stations. The specific method of constructing a static adjacency matrix is: construct a static adjacency matrix based on the static correlation between nodes. ; Among them, the static adjacency matrix The i-th row and j-th column of .

[0134] The graph construction module includes a dynamic graph construction layer, and the operations performed in the dynamic graph construction layer include: using the static graph and the historical traffic flow of each station within a set period of time, using the information fusion gating mechanism to model the dynamic time series changes of node correlation, calculating the dynamic correlation between nodes, and then constructing a third dynamic adjacency matrix based on the dynamic correlation between nodes. The static graph refers to the collection of node information and static edge information, the node information refers to the historical traffic flow of the node, and the static edge information refers to the above-mentioned static adjacency matrix.

[0135] The formula of the gating mechanism based on information fusion is as follows:

[0136] ;

[0137] ;

[0138] ;

[0139] ;

[0140] in, , , , and is the set weight matrix. In this embodiment, it can be learned and updated in advance through training to obtain the final weight matrices. Z represents the node embedding vector of all nodes, that is, the long-term global features of the nodes. X represents the historical traffic flow corresponding to the nodes, that is, the short-term local features of the nodes that change over time. First, the FFN (Feedforward Neural Network) layer is used to convert X into , It is a matrix of N×K dimensions, where K represents the set time step, which means inputting K historical traffic flows at a time and then predicting L future traffic flows, which facilitates subsequent information fusion and obtains the final node state output at the current time step through the gating mechanism. , is a matrix of dimension N×d, z represents the update gate weight coefficient, r represents the reset gate weight coefficient, h represents the new state candidate value of the current time step, tanh represents the tanh function, sigmoid represents the sigmoid function, and the superscript T represents the transpose.

[0141] The dynamic correlation between nodes is calculated by the following method: The complex spatiotemporal dependencies are captured through a multi-head attention mechanism to calculate the dynamic correlation between nodes.

[0142] Spatiotemporal dependency refers to the mutual influence relationship between data in the time dimension and space dimension, including time dependency and space dependency. Time dependency means that the data at the current time is affected by the past data and affects the future data. Space dependency refers to the mutual influence between data at different locations.

[0143] Specifically, based on the output of the above gating mechanism, the dynamic correlation between nodes is calculated by the following formula:

[0144] ;

[0145] ;

[0146] in, and represents the set weight matrix, which can be learned and updated in advance through training in this embodiment to obtain the final weight matrices. and Both A matrix of dimension, represents the final node state of the i-th node, represents the final node state of the jth node, represents the size of the spatial dimension, represents the intermediate dynamic correlation between the i-th node and the j-th node, Represents the dynamic correlation between the i-th node and the j-th node.

[0147] Construct a third dynamic adjacency matrix using the dynamic correlation between each pair of nodes , is a matrix of N×N dimensions, the third dynamic adjacency matrix The i-th row and j-th column in the above calculation is the dynamic correlation between the i-th node and the j-th node. The specific method of constructing the dynamic adjacency matrix is ​​as follows: According to the dynamic correlation between nodes, the third dynamic adjacency matrix is ​​constructed. ; Among them, the third dynamic adjacency matrix The i-th row and j-th column of .

[0148] The present invention uses node embedding in the static graph construction layer, which can map the node information in the graph structure to a low-dimensional node embedding vector, thereby retaining the structure of the graph and the semantic information of the nodes, while calculating the relationship between the nodes, and constructing a static graph according to the long-term time pattern in the time series data. In the dynamic graph construction layer, a gating mechanism is used to fuse the static graph and the historical traffic flow that changes over time. The gating mechanism can control the flow of information, pay attention to the evolutionary pattern of nodes and node correlations in time during modeling, and capture the dynamic correlation of nodes; use the decomposition of the multi-head mechanism and the calculation of attention to infer the dynamic correlation between each pair of nodes. The attention mechanisms of different heads focus on different aspects of node features, capture more complex node relationships, and construct a dynamic graph that contains time-varying and explicit spatiotemporal features. The dynamic graph refers to a collection of node information and dynamic edge information. The node information refers to the historical traffic flow of the node, and the dynamic edge information refers to the third dynamic adjacency matrix mentioned above.

[0149] like Figure 4 As shown, the present invention provides a node update module.

[0150] In step 1, the spatial relationship of the data captured in the static graph and the dynamic graph is updated through graph convolution respectively, and the update is performed through the following formula:

[0151] ;

[0152] ;

[0153] Among them, X K It represents the historical traffic flow of each station within the set time step K, that is, the node information of each node within the time step K of the traffic flow graph, and They represent the initially constructed static adjacency matrix and the third dynamic adjacency matrix, i.e., the edge information in the traffic flow graph. Represents the static node information obtained after the spatial relationship is updated. Indicates the dynamic node information obtained after the spatial relationship is updated. and They are all matrices of N×K dimensions, GCN represents graph convolutional network, and Relu represents Relu function.

[0154] Through the gated recurrent unit (GRU), the static node information and dynamic node information after the spatial relationship update are fused to obtain dynamic time series feature modeling and realize the update of time relationship through the following formula:

[0155] ;

[0156] in, Indicates the node information after the time relationship is updated. It is a matrix of N×K dimensions, and GRU stands for gated recurrent unit.

[0157] The present invention sets a node update module to realize the dynamic change of node features in the updated traffic flow graph. The module is based on TGCN (Temporal Graph Convolution Networks, which includes gated recurrent units and graph convolution networks), uses gated recurrent units to model the time dimension, and uses graph convolution networks to capture the static and dynamic relationships between nodes, thereby modeling the spatial dimension. Compared with other complex spatial modeling methods, this method has fewer parameters and higher efficiency, and the node state will be updated at each time step, and the spatial information of the node will be updated in the graph convolution network. The update process is based on the captured spatial dependencies between nodes.

[0158] like Figure 5 As shown, the present invention provides an edge update module, Figure 5 The adjacency matrix J in is a static adjacency matrix or a third dynamic adjacency matrix.

[0159] The edge update module is reused twice independently, the first time with the static adjacency matrix obtained in step 2 as input Node information after the time relationship is updated with step 2 , output the updated static adjacency matrix , input the third dynamic adjacency matrix obtained in step 2 for the second time Node information after the time relationship is updated with step 2 , output the updated third dynamic adjacency matrix .

[0160] Set the initial hidden state to , is an N×k matrix, where k is the feature dimension of the initial hidden state.

[0161] When you use the edge update module for the first time, you enter the static adjacency matrix Node information updated with time relationship , the first update operation performed in the edge update module includes:

[0162] Update the hidden state at each time step using the following formula:

[0163] ;

[0164] ;

[0165] in, represents the historical traffic flow of the node in the mth cycle, Indicates the node information after the time relationship is updated. Represents a serial operation, and is a hyperparameter that controls the weights of different components, represents the hidden state of the mth cycle in the edge update module, represents the hidden state of the m+1th cycle in the edge update module, represents the static adjacency matrix of the mth cycle. When m=1, It is input , GCN stands for graph convolutional network.

[0166] Through the dynamic filter, the first dynamic filter tensor and the second dynamic filter tensor are obtained, which are performed by the following formula:

[0167] ;

[0168] ;

[0169] in, Represents the reverse static adjacency matrix of the mth cycle, which is Transpose, the superscript T represents transposition, is a cyclic graph convolution operation, represents the first dynamic filter tensor of the mth cycle, Represents the second dynamic filter tensor of the m-th loop.

[0170] get and After that, the Hadamard product is performed with the node embedding vector (obtained from the graph construction module) and then processed by the tanh function to obtain the first dynamic adjacency matrix and the second dynamic adjacency matrix generated by the original node embedding vector and the target node embedding vector, which are performed by the following formula:

[0171] ;

[0172] ;

[0173] in, represents the first dynamic adjacency matrix, Represents the second dynamic adjacency matrix and are all matrices of N×N dimension, represents the Hadamard product, and Z represents the node embedding vectors of all nodes.

[0174] Then, the similarity between nodes is calculated to obtain the final updated static adjacency matrix, which is performed by the following formula:

[0175] ;

[0176] in, Represents the static adjacency matrix output after completing the mth loop.

[0177] Execute the above loop until the number of loops reaches 12, output the static adjacency matrix of the last loop, and complete the update of the static adjacency matrix. The updated static adjacency matrix is .

[0178] When using the edge update module for the second time, input the third dynamic adjacency matrix Node information updated with time relationship , the second update operation performed in the edge update module includes:

[0179] Update the hidden state at each time step using the following formula:

[0180] ;

[0181] ;

[0182] in, represents the historical traffic flow of the node in the mth cycle, Represents a serial operation, and is a hyperparameter that controls the weights of different components, represents the hidden state of the mth cycle in the edge update module, Represents the dynamic adjacency matrix of the mth cycle. When m=1, It is input , GCN stands for graph convolutional network.

[0183] Through the dynamic filter, the first dynamic filter tensor and the second dynamic filter tensor are obtained, which are performed by the following formula:

[0184] ;

[0185] ;

[0186] in, Represents the reverse static adjacency matrix of the mth cycle, which is Transpose, the superscript T represents transposition, is a cyclic graph convolution operation, represents the first dynamic filter tensor of the mth cycle, Represents the second dynamic filter tensor of the m-th loop.

[0187] get and After that, the Hadamard product is performed with the node embedding vector (obtained from the graph construction module) and then processed by the tanh function to obtain the first dynamic adjacency matrix and the second dynamic adjacency matrix generated by the original node embedding vector and the target node embedding vector, which are performed by the following formula:

[0188] ;

[0189] ;

[0190] in, represents the first dynamic adjacency matrix, represents the second dynamic adjacency matrix, and are all matrices of N×N dimension, represents the Hadamard product, and Z represents the node embedding vectors of all nodes.

[0191] Then, the similarity between nodes is calculated to obtain the final updated third dynamic adjacency matrix, which is performed by the following formula:

[0192] ;

[0193] in, Represents the third dynamic adjacency matrix output after completing the mth cycle.

[0194] Execute the above loop until the number of loops reaches the preset number, output the third dynamic adjacency matrix of the last loop, and complete the update of the third dynamic adjacency matrix. The updated third dynamic adjacency matrix is .

[0195] The present invention uses a hypernetwork to set an initial hidden state in the edge update module, updates the hidden state through a bidirectional graph convolution loop, generates two dynamic filter tensors, the original node embedding vector and the target node embedding vector, respectively, and then uses the similarity between nodes to cyclically update the dynamic adjacency matrix and the static adjacency matrix, thereby dynamically capturing the hidden spatiotemporal features in the time series data. The data is bidirectionally spatiotemporally modeled through the forward adjacency matrix (ordinary static adjacency matrix and dynamic adjacency matrix) and the reverse adjacency matrix, and the bidirectional information is updated to finally obtain the updated dynamic adjacency matrix and static adjacency matrix. This process needs to be repeated twice, with the first input being and , and finally get the updated static adjacency matrix , the second input is and , and finally get the updated third dynamic adjacency matrix .

[0196] like Figure 6 As shown, the present invention provides a temporal convolution prediction module, wherein (a) is a dilated convolution layer, (b) is a temporal convolution layer, and (c) is a graph convolution prediction layer.

[0197] The traffic flow input of the i-th node is , is a matrix with a dimension of K, where K represents the set time step. The present invention sets four filters of different sizes in the dilated convolution layer. , , and , represents a filter of size 1×2, represents a filter of size 1×3, represents a filter of size 1×6, Represents a filter of size 1×7.

[0198] The expression of the initial layer (layer 1) of the dilated convolutional layer is:

[0199] ;

[0200] Among them, * represents the convolution operation. Convolution is performed through four filters of different sizes, and the outputs of the four filters are truncated into the same dimension according to the shortest output sequence, and spliced ​​together through the concat operation. represents the output of the first layer of the dilated convolutional layer, It is a vector with dimension L, where L represents the prediction time step, indicating that the prediction is for L future traffic flows.

[0201] Two different activation functions, tanh and sigmoid, are used in the temporal convolution layer to dynamically select hidden spatiotemporal features. The expression of the temporal convolution layer is as follows:

[0202] ;

[0203] in, represents the Hadamard product, Represents the node information within the prediction time step L, Contains time features, is a matrix of dimension N×L, Represents the output of the dilated convolutional layer.

[0204] The updated node information and the updated edge information (static adjacency matrix and dynamic adjacency matrix) are fused through the graph convolutional network to obtain the final traffic flow prediction result of L time steps, which is expressed as follows:

[0205] ;

[0206] in, represents the traffic flow prediction result, represents the updated static adjacency matrix, Represents the updated dynamic adjacency matrix.

[0207] Get the traffic flow prediction result of L time steps , the dimension of the traffic flow prediction result is N×L, that is, the traffic flow prediction result is the traffic flow of N stations and L time steps.

[0208] The present invention uses dilated convolution combined with the time convolution layer in the time convolution prediction module, uses different receptive fields while ensuring computational efficiency, captures time features of different scales at multiple time steps, and then combines different activation functions so that the model can simultaneously capture local and global time series features. Two different activation functions are used in the time convolution layer, tanh provides the main features in the time series, sigmoid can be regarded as the gating part, dynamically selects the more accurate part of the hidden spatiotemporal features, and multiplies the results of using two different activation functions, which can effectively suppress noise information and enhance the ability to capture key patterns in the time series.

[0209] Step 3: Model training, optimization and verification. The optimal model is obtained through step 3.

[0210] The present invention uses SmoothL1Loss as the loss function, which is a loss function suitable for regression tasks. It provides a smooth transition between MSE (mean-square error) loss and MAE (Mean Absolute Error) loss, combining the advantages of both, and can reduce the sensitivity of outliers to the loss function.

[0211] The specific calculation formula of SmoothL1Loss is as follows:

[0212] ;

[0213] in, represents the value of the SmoothL1Loss loss function, y represents the true value of traffic flow, and ŷ represents the predicted value of traffic flow. Through iterative training, the model parameters with the best performance on the validation set are saved, and the model is used to process the input historical traffic flow, and finally the traffic flow prediction result for the set time in the future is output.

[0214] Step 4: Use the trained model to make predictions. Step 4 outputs the time series prediction results. In this embodiment, the specific output is the traffic flow prediction results of the stations in the predicted period, that is, the traffic flow of N stations with L time steps, and then visualizes the results.

[0215] Example 3

[0216] This embodiment provides a traffic flow prediction device, including:

[0217] The historical traffic flow acquisition module is configured to: acquire the historical traffic flow of the station within a set period of time, and obtain the historical traffic flow without abnormalities after preprocessing;

[0218] The future traffic flow prediction module is configured to: input the historical traffic flow without abnormalities into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station within the prediction period;

[0219] Wherein, the traffic flow prediction model includes:

[0220] A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station;

[0221] Node update module, updates the node information in static graph and dynamic graph;

[0222] The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix;

[0223] The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result.

[0224] Example 4

[0225] This embodiment provides a computer-readable storage medium, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the traffic flow prediction method provided in Embodiment 1 are implemented:

[0226] Obtain the historical traffic flow of the station within the set period, and obtain the historical traffic flow without abnormalities after preprocessing;

[0227] Input the historical traffic flow without abnormalities into the trained traffic flow prediction model to obtain the traffic flow prediction results of the station within the prediction period;

[0228] Wherein, the traffic flow prediction model includes:

[0229] A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station;

[0230] Node update module, updates the node information in static graph and dynamic graph;

[0231] The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix;

[0232] The temporal convolution prediction module performs prediction based on the updated node information, static adjacency matrix and dynamic adjacency matrix to obtain the traffic flow prediction results.

[0233] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0234] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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 generate 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 flowchart and / or block diagram. 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.

[0235] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.

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

[0237] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A traffic flow prediction method, characterized in that: include: Obtain the historical traffic flow of the station within the set period, and obtain the historical traffic flow without abnormalities after preprocessing; The historical traffic flow without abnormalities is input into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station in the predicted period. The traffic flow prediction model includes: A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station; Node update module, updates the node information in static graph and dynamic graph; The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; wherein the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix; The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result; The method of constructing a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the site includes: A station that monitors traffic flow is used as a node in the traffic flow graph, the historical traffic flow of the node is used as the node information, and the correlation between two stations is used as the edge in the traffic flow graph to construct the traffic flow graph; Map the nodes in the traffic flow graph to node embedding vectors through station indexes; The static correlation between nodes is calculated by the following formula: ; in, represents the node embedding vector of the i-th node, represents the node embedding vector of the jth node, represents the static correlation between the i-th node and the j-th node, Relu represents the Relu activation function, Softmax represents the Softmax function, and the superscript T represents the transpose; Construct a static adjacency matrix based on the static correlation between nodes ; Among them, the static adjacency matrix The i-th row and j-th column of ; Replace the edges in the traffic flow graph with the corresponding static correlations in the static adjacency matrix to obtain a static graph; The dynamic correlation between nodes is calculated by the following formula: ; ; ; ; ; ; in, , , , , , and is the set weight matrix, Z represents the node embedding vector of all nodes, X represents the historical traffic flow of the node, represents the final node state output at the current time step, z represents the update gate weight coefficient, r represents the reset gate weight coefficient, h represents the new state candidate value at the current time step, tanh represents the tanh function, sigmoid represents the sigmoid function, represents the final node state of the i-th node, represents the final node state of the jth node, represents the size of the spatial dimension, represents the intermediate dynamic correlation between the i-th node and the j-th node, Represents the dynamic correlation between the i-th node and the j-th node; According to the dynamic correlation between nodes, the third dynamic adjacency matrix is ​​constructed ; Among them, the third dynamic adjacency matrix The i-th row and j-th column of ; The edges in the traffic flow graph are replaced with the corresponding dynamic correlations in the third dynamic adjacency matrix to obtain a dynamic graph.

2. The traffic flow prediction method according to claim 1, characterized in that: The preprocessing includes completing the missing data of historical traffic flow by the following method: According to the difference of historical traffic flow before and after the missing data, the missing data is supplemented to obtain the historical traffic flow without abnormalities.

3. The traffic flow prediction method according to claim 1, characterized in that: The node update module is an improved temporal graph convolutional network, which includes a graph convolutional network and a gated recurrent unit. The graph convolutional network updates the spatial relationship of node information in the static graph and the dynamic graph based on the input historical traffic flow, and the gated recurrent unit updates the temporal relationship of node information in the static graph and the dynamic graph to obtain updated node information. The expression of the graph convolutional network is: ; ; Among them, X K represents the historical traffic flow of each node within the set time step K, represents the static adjacency matrix, represents the third dynamic adjacency matrix, Indicates the static node information after the spatial relationship is updated. Represents the dynamic node information after the spatial relationship is updated, GCN represents the graph convolutional network, and Relu represents the Relu function; The expression of the gated recurrent unit is: ; in, Represents the updated node information, and GRU represents the gated recurrent unit.

4. The traffic flow prediction method according to claim 1, characterized in that: The edge update module includes a hypernetwork, a bidirectional graph convolution loop, a dynamic filter and a similarity loop; The hypernetwork is used to generate an initial hidden state; The bidirectional graph convolution loop is used to update the historical traffic flow and hidden state according to the input hidden state, adjacency matrix J and updated node information; The dynamic filter is used to generate two dynamic filter tensors according to the updated historical traffic flow, and to generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors; The similarity loop is used to update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix.

5. The traffic flow prediction method according to claim 1, characterized in that: In the edge update module, the static adjacency matrix is ​​updated through the following loop: ; ; ; ; ; ; ; in, represents the historical traffic flow of the node in the mth cycle, Indicates the updated node information. Represents a serial operation, and is a hyperparameter that controls the weights of different components, and Respectively represent the hidden states of the mth and m+1th cycles, represents the static adjacency matrix of the mth cycle. When m=1, is the static adjacency matrix of the input edge update module, GCN represents graph convolutional network, Represents the reverse static adjacency matrix of the mth cycle, which is Transpose, the superscript T indicates transposition, is a cyclic graph convolution operation, represents the first dynamic filter tensor of the mth cycle, represents the second dynamic filter tensor of the mth cycle, represents the first dynamic adjacency matrix, represents the second dynamic adjacency matrix, represents the Hadamard product, Z represents the node embedding vector of all nodes, Represents the static adjacency matrix output after completing the mth cycle; Execute the above loop until the number of loops reaches the preset number, output the static adjacency matrix of the last loop, and obtain the updated static adjacency matrix ; In the edge update module, the third dynamic adjacency matrix is ​​updated using the following formula: ; ; ; ; ; ; ; in, represents the third dynamic adjacency matrix of the mth cycle. When m=1, is the third dynamic adjacency matrix of the input edge update module, Represents the third dynamic adjacency matrix output after completing the mth cycle; Execute the above loop until the number of loops reaches the preset number, output the third dynamic adjacency matrix of the last loop, and obtain the updated third dynamic adjacency matrix .

6. The traffic flow prediction method according to claim 1, characterized in that: The temporal convolution prediction module includes a convolution expansion layer, a temporal convolution layer and a graph convolution prediction layer; The expression of the convolution expansion layer is: ; Among them, * represents the convolution operation, represents the historical traffic flow of the ith node, represents the output of the first layer of the dilated convolutional layer, represents a filter of size 1×2, represents a filter of size 1×3, represents a filter of size 1×6, represents a filter of size 1×7, and concat represents the concat function; The expression of the temporal convolutional layer is: ; in, represents the Hadamard product, Represents the node information within the prediction time step L, represents the output of the last layer of the dilated convolutional layer, tanh represents the tanh function, and sigmoid represents the sigmoid function; The expression of the graph convolution prediction layer is: ; in, represents the updated static adjacency matrix, represents the updated third dynamic adjacency matrix, GCN represents graph convolutional network, Represents the traffic flow prediction result.

7. The traffic flow prediction method according to claim 1, characterized in that: The loss function used in the traffic flow prediction model training is the SmoothL1Loss loss function, and the expression of the SmoothL1Loss loss function is: ; in, represents the value of the SmoothL1Loss loss function, y represents the true value of traffic flow, and ŷ represents the predicted result of traffic flow.

8. A traffic flow prediction device, characterized in that: include: The historical traffic flow acquisition module is configured to: acquire the historical traffic flow of the station within a set period of time, and obtain the historical traffic flow without abnormalities after preprocessing; The future traffic flow prediction module is configured to: input the historical traffic flow without abnormalities into the trained traffic flow prediction model to obtain the traffic flow prediction result of the station within the prediction period; Wherein, the traffic flow prediction model includes: A graph construction module, which constructs a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the station; Node update module, updates the node information in static graph and dynamic graph; The edge update module generates an initial hidden state, and then executes the following loop to update the adjacency matrix J: update the historical traffic flow and the hidden state according to the input hidden state, the adjacency matrix J and the updated node information, generate two dynamic filter tensors according to the updated historical traffic flow, generate a first dynamic adjacency matrix and a second dynamic adjacency matrix according to the two dynamic filter tensors, and update the adjacency matrix J according to the first dynamic adjacency matrix and the second dynamic adjacency matrix; wherein the adjacency matrix J is a static adjacency matrix or a third dynamic adjacency matrix; The temporal convolution prediction module performs prediction based on the updated node information, the static adjacency matrix and the third dynamic adjacency matrix to obtain the traffic flow prediction result; The method of constructing a static graph including node information and a static adjacency matrix and a dynamic graph including node information and a third dynamic adjacency matrix based on the historical traffic flow of the site includes: A station that monitors traffic flow is used as a node in the traffic flow graph, the historical traffic flow of the node is used as the node information, and the correlation between two stations is used as the edge in the traffic flow graph to construct the traffic flow graph; Map the nodes in the traffic flow graph to node embedding vectors through station indexes; The static correlation between nodes is calculated by the following formula: ; in, represents the node embedding vector of the ith node, represents the node embedding vector of the jth node, represents the static correlation between the i-th node and the j-th node, Relu represents the Relu activation function, Softmax represents the Softmax function, and the superscript T represents the transpose; Construct a static adjacency matrix based on the static correlation between nodes ; Among them, the static adjacency matrix The i-th row and j-th column of ; Replace the edges in the traffic flow graph with the corresponding static correlations in the static adjacency matrix to obtain a static graph; The dynamic correlation between nodes is calculated by the following formula: ; ; ; ; ; ; in, , , , , , and is the set weight matrix, Z represents the node embedding vector of all nodes, X represents the historical traffic flow of the node, represents the final node state output at the current time step, z represents the update gate weight coefficient, r represents the reset gate weight coefficient, h represents the new state candidate value at the current time step, tanh represents the tanh function, sigmoid represents the sigmoid function, represents the final node state of the i-th node, represents the final node state of the jth node, represents the size of the spatial dimension, represents the intermediate dynamic correlation between the i-th node and the j-th node, Represents the dynamic correlation between the i-th node and the j-th node; According to the dynamic correlation between nodes, the third dynamic adjacency matrix is ​​constructed ; Among them, the third dynamic adjacency matrix The i-th row and j-th column of ; The edges in the traffic flow graph are replaced with the corresponding dynamic correlations in the third dynamic adjacency matrix to obtain a dynamic graph.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the traffic flow prediction method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Optimized traffic flow prediction model based on space-time diagram convolutional network

    CN113505536A

  • Traffic flow prediction method based on time-varying fusion graph convolutional network

    CN118262517A