Traffic flow prediction method, device, equipment, storage medium and product
Through the combination of deep convolutional network, gated loop unit and double-layer optimization task framework, the problem of insufficient spatial and temporal correlation capture in traffic flow prediction is solved, and the accuracy of traffic flow prediction is improved.
Patent Information
- Application Number
- CN202411418599.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-03
AI Technical Summary
The existing deep learning neural network model cannot effectively capture the spatial and temporal correlation of traffic data in traffic flow prediction, resulting in low accuracy of traffic flow prediction.
The traffic distribution prediction model consisting of a deep convolutional network, gated cyclic units and a two-layer optimization task framework is adopted to model the space-time dependence relationship of road node pairs on the target traffic flow matrix of the predicted area, and the double-layer optimization task framework is used to optimize the task framework. Optimize the traffic distribution prediction model.
The accuracy of traffic flow prediction is improved, and the accuracy of prediction results is further improved by effectively capturing the space-time dependence information of road node pairs and optimizing the traffic distribution prediction model regularly.
Smart Images

Figure CN119252027A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to traffic flow prediction methods, devices, equipment, storage media and products. Background Art
[0002] At present, with the advancement of urbanization, urban traffic management has become an important part of it. Traffic flow prediction in urban traffic management is an important part of intelligent transportation system and smart city construction, which involves in-depth analysis and understanding of urban traffic conditions. Therefore, how to achieve accurate traffic flow prediction is a technical problem that needs to be solved urgently.
[0003] Related technologies usually use deep learning neural network models to achieve traffic flow prediction in the current traffic flow prediction area. However, this method cannot effectively capture the spatiotemporal correlation of traffic data, resulting in low accuracy of traffic flow prediction.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a traffic flow prediction method, aiming to solve the technical problem of low accuracy of traffic flow prediction.
[0006] To achieve the above objectives, the present application proposes a traffic flow prediction method, which includes:
[0007] Obtain the target traffic flow matrix of the area to be predicted;
[0008] Based on the target traffic flow matrix, a temporal and spatial dependency relationship is modeled by a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the temporal and spatial dependency relationship of each road node pair;
[0009] Based on the target graph signal matrix and the target traffic flow matrix, traffic flow prediction is performed on the area to be predicted to obtain a target traffic flow prediction result of the area to be predicted;
[0010] Based on the target traffic prediction result, the traffic distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model, so that the optimized traffic distribution prediction model can perform the next round of traffic prediction. The traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework. The deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
[0011] Optionally, the step of performing spatiotemporal dependency modeling based on the target traffic flow matrix by using a preset traffic distribution prediction model to obtain a target graph signal matrix includes:
[0012] Acquire a road node pair in the area to be predicted, wherein the road node pair refers to two road nodes having a road connectivity relationship;
[0013] Based on the target traffic flow matrix and the road node pairs, a graph diffusion convolution is performed through a deep convolutional network under a preset traffic distribution prediction model to extract the upstream and downstream spatial dependency relationships between the road nodes, and based on the upstream and downstream spatial dependency relationships, a first graph signal matrix containing the spatial dependency relationships of the road node pairs is generated;
[0014] Based on the target traffic flow matrix and the road node pairs, node flow characteristics are captured by a gated recurrent unit under a preset flow distribution prediction model to obtain a second graph signal matrix including a time dependency relationship of each road node pair, wherein the second graph signal matrix reflects changes in flow characteristics of each road node in a time series dimension;
[0015] The first graph signal matrix and the second graph signal matrix are merged to obtain a target graph signal matrix including the spatiotemporal dependency relationship of each road node pair.
[0016] Optionally, the step of performing traffic flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix to obtain a target traffic flow prediction result for the area to be predicted includes:
[0017] Based on the target traffic flow matrix, determining a position embedding parameter, wherein the position embedding parameter reflects the element position of each vector in the target traffic flow matrix in the sequence;
[0018] Combining the position embedding parameter with the image signal matrix to generate initial global information;
[0019] Based on a preset multi-head self-attention mechanism, the weight information of each element in the initial global information is calculated, wherein the weight information reflects the spatiotemporal dependency relationship between different elements;
[0020] The initial global information and the weight information are subjected to attention calculation to obtain target global information, and based on the target global information, a target flow prediction result of the area to be predicted is determined.
[0021] Optionally, the step of obtaining a target traffic flow matrix of the area to be predicted includes:
[0022] Collecting traffic flow data of the area to be predicted, and constructing an initial traffic flow matrix based on the traffic flow data;
[0023] Calculating the flow value of each vector under the initial traffic flow matrix, and sorting the vectors from large to small based on the flow value to obtain a sorting result;
[0024] Selecting a maximum preset number of first vectors from the sorting results, converting the flow values of all vectors other than the first vectors in the initial traffic flow matrix to 0, to obtain a second vector;
[0025] Based on the first vector and the second vector, a target traffic flow matrix of the area to be predicted is constructed.
[0026] Optionally, the step of optimizing and updating the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model includes:
[0027] Obtaining a flow observation result corresponding to the target flow prediction result;
[0028] Extracting a first flow distribution from the target flow prediction result, and extracting a second flow distribution from the flow observation result;
[0029] Based on the lower-layer task of the preset two-layer optimization task framework, a first difference value between the flow observation result and the target flow prediction result is calculated, and a second difference value between the first flow distribution and the second flow distribution is calculated;
[0030] Based on the upper-layer task of the preset two-layer optimization task framework, the first difference value and the second difference value, the optimal model parameters of the traffic distribution prediction model are calculated by minimizing the objective function;
[0031] Based on the optimal model parameters, the traffic distribution prediction model is optimized and updated to obtain an optimized traffic distribution prediction model.
[0032] Optionally, after the step of optimizing and updating the traffic distribution prediction model based on the optimal model parameters to obtain an optimized traffic distribution prediction model, the method includes:
[0033] Determining a third flow distribution output by the optimized flow distribution prediction model;
[0034] Calculating a third difference value between the second flow distribution and the third flow distribution, and determining whether the third difference value converges;
[0035] If the third difference value has not converged, returning to the step of calculating the optimal model parameters of the traffic distribution prediction model by minimizing the objective function until the third difference value converges, then determining the optimized traffic prediction result output by the optimized traffic distribution prediction model;
[0036] Calculating a fourth difference value between the optimized flow prediction result and the flow observation result, and determining whether the fourth difference value converges; if the fourth difference value does not converge, returning to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the fourth difference value converges, thereby obtaining the optimal model parameters after iterative optimization;
[0037] Based on the optimal model parameters after the iterative optimization, the traffic distribution prediction model is optimized and updated to obtain the iteratively optimized traffic distribution prediction model.
[0038] In addition, to achieve the above purpose, the present application also proposes a traffic flow prediction device, the traffic flow prediction device comprising:
[0039] An acquisition module is used to obtain a target traffic flow matrix of the area to be predicted;
[0040] A modeling module, used to perform spatiotemporal dependency modeling based on the target traffic flow matrix through a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the spatiotemporal dependency of each road node pair;
[0041] A prediction module, used to perform traffic flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix, and obtain a target traffic flow prediction result for the area to be predicted;
[0042] An optimization module is used to optimize and update the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model for the optimized traffic distribution prediction model to perform the next round of traffic prediction, wherein the traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework, the deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a traffic flow prediction device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the traffic flow prediction method as described above.
[0044] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the traffic flow prediction method described above are implemented.
[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the traffic flow prediction method as described above.
[0046] One or more technical solutions proposed in this application have at least the following technical effects:
[0047] Compared with the related art, which usually adopts a deep learning neural network model to realize the traffic flow prediction of the current traffic flow prediction area. However, this method cannot effectively capture the spatiotemporal correlation of traffic data, resulting in low accuracy of traffic flow prediction. In comparison, the present application utilizes a traffic distribution prediction model composed of a deep convolutional network, a gated recurrent unit, and a two-layer optimization task framework to model the spatiotemporal dependency relationship of road node pairs for the target traffic flow matrix of the predicted area, obtain a target graph signal matrix containing the spatiotemporal dependency relationship of each road node pair, and based on the target graph signal matrix and the target traffic flow matrix, perform traffic prediction on the area to be predicted to obtain the target traffic flow prediction result for the area to be predicted. It can be understood that the present application utilizes the deep convolutional network and the gated recurrent unit in the pre-trained traffic distribution prediction model to realize the spatiotemporal dependency relationship modeling of road node pairs, so that its traffic distribution prediction model effectively captures the spatiotemporal dependency information of road node pairs in the area to be predicted, thereby improving the accuracy of traffic flow prediction. It is further proposed that based on the target flow prediction result, the flow distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized flow distribution prediction model, that is, the flow distribution prediction model is regularly optimized through a two-layer optimization task framework, so as to further improve the accuracy of traffic flow prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0050] Figure 1A flow chart of the first embodiment of the traffic flow prediction method of the present application;
[0051] Figure 2 This is a schematic diagram of the traffic flow distribution prediction model structure in the traffic flow prediction method of this application;
[0052] Figure 3 A schematic diagram of the spatiotemporal dependency of road node pairs in the traffic flow prediction method of this application;
[0053] Figure 4 This is a schematic diagram of the module structure of the traffic flow prediction device according to an embodiment of the present application;
[0054] Figure 5 Schematic diagram of the equipment structure of the hardware operating environment involved in the traffic flow prediction method in the embodiment of the present application.
[0055] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0056] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0057] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0058] The main solution of the embodiment of the present application is: obtaining a target traffic flow matrix for the area to be predicted; based on the target traffic flow matrix, modeling the spatiotemporal dependency relationship through a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix contains the spatiotemporal dependency relationship of each road node pair; based on the target graph signal matrix and the target traffic flow matrix, traffic prediction is performed on the area to be predicted to obtain a target traffic prediction result for the area to be predicted; based on the target traffic prediction result, the traffic distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model for the optimized traffic distribution prediction model to perform the next round of traffic prediction, wherein the traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework, the deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
[0059] In this embodiment, the traffic flow prediction device is used as the execution body. For the convenience of description, it will be described as "device" hereinafter.
[0060] Since the relevant technology usually adopts a deep learning neural network model to realize the traffic flow prediction of the current traffic flow prediction area, this method cannot effectively capture the spatiotemporal correlation of traffic data, resulting in low accuracy of traffic flow prediction.
[0061] The present application provides a solution to achieve traffic flow prediction and improve the accuracy of traffic flow prediction.
[0062] From the above embodiments, it can be seen that the present application utilizes a traffic distribution prediction model composed of a deep convolutional network, a gated recurrent unit, and a two-layer optimization task framework to model the spatiotemporal dependency of road node pairs for the target traffic flow matrix of the predicted area, obtain a target graph signal matrix containing the spatiotemporal dependency of each road node pair, and based on the target graph signal matrix and the target traffic flow matrix, perform traffic prediction on the predicted area to obtain the target traffic prediction result of the predicted area. It can be understood that the present application utilizes the deep convolutional network and the gated recurrent unit in the pre-trained traffic distribution prediction model to achieve the spatiotemporal dependency modeling of road node pairs, so that the traffic distribution prediction model effectively captures the spatiotemporal dependency information of road node pairs in the predicted area, thereby improving the accuracy of traffic flow prediction. And further proposes to optimize and update the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model, that is, to optimize the traffic distribution prediction model regularly through a two-layer optimization task framework, thereby further improving the accuracy of traffic flow prediction.
[0063] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, a terminal system, etc. that can realize the above functions. The following takes the traffic flow prediction device as an example to illustrate this embodiment and the following embodiments.
[0064] Based on this, the present application embodiment provides a traffic flow prediction method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the traffic flow prediction method of the present application.
[0065] In this embodiment, the traffic flow prediction method includes steps S100 to S400:
[0066] Step S100, obtaining a target traffic flow matrix of the area to be predicted;
[0067] It should be noted that the area to be predicted refers to a specific area or range whose future state or behavior needs to be predicted when performing forecast analysis. This area can be a geographical area, such as a city, a community, a part of a transportation network, or a specific part of a data set.
[0068] Further, the target traffic flow matrix generally refers to the traffic volume from one area (starting point) to another area (destination) determined in traffic planning and traffic flow distribution, preferably an OD matrix, which is a matrix used to describe traffic flow, and it records the traffic volume from the starting point to the end point. This matrix is an important tool that can help traffic planners and engineers understand the distribution of traffic flow between different regions, and then analyze and evaluate the use and efficiency of the traffic network. In the intelligent transportation system, accurate traffic flow prediction is crucial to achieve inter-regional traffic control, congestion control and to ensure urban public safety. For example, based on accurate automobile flow prediction results, the traffic service platform can perform real-time traffic scheduling to alleviate congestion caused by excessive traffic. At the same time, timely prediction of passenger flow at future moments can reduce the probability of stampede caused by excessive passenger flow to a certain extent.
[0069] In a specific implementation, the device obtains the target traffic flow matrix of the area to be predicted by having a traffic collection device pre-set on the device collect traffic flow data of the area to be predicted, and then constructs the target traffic flow matrix based on the traffic flow matrix construction program / or device, thereby obtaining the target traffic flow matrix of the area to be predicted.
[0070] In a specific implementation, the step of obtaining the target traffic flow matrix of the area to be predicted by the device includes:
[0071] The traffic flow data of the area to be predicted is collected, and an initial traffic flow matrix is constructed based on the traffic flow data; the flow value of each vector under the initial traffic flow matrix is calculated, and the vectors are sorted from large to small based on the flow value to obtain a sorting result; a first vector with a maximum preset number is selected from the sorting result, and the flow values of all vectors other than the first vector in the initial traffic flow matrix are converted to 0 to obtain a second vector; based on the first vector and the second vector, a target traffic flow matrix of the area to be predicted is constructed.
[0072] In a specific implementation, the device collects traffic flow data of the area to be predicted, and constructs an initial traffic flow matrix based on the traffic flow data. On the basis of constructing the initial traffic flow matrix, this application, based on the research on the relationship between the travel OD and the flow corresponding to the OD, can obtain that most important trips are in a small part of the OD combination, which leads to relatively small flows of other OD combinations. Therefore, the generation and attraction flow of the OD matrix will be unevenly distributed in reality, and this characteristic contains the structural information of the OD matrix. In addition, since what is inferred is the distribution rather than the actual value, this scheme intends to set up a sparse matrix in which the values of non-zero elements are finite, in order to reconstruct the specific structural information of the real OD matrix.
[0073] Specifically, the device calculates the flow value of each vector under the initial traffic flow matrix, and sorts them from large to small based on the flow value to obtain a sorting result, selects the first vector with the largest preset number from the sorting result, converts the flow values of all vectors other than the first vector in the initial traffic flow matrix to 0, and obtains a second vector, and constructs a target traffic flow matrix for the area to be predicted based on the first vector and the second vector, that is, the device sets m as the maximum number of OD combinations to sample from the real OD matrix, extracts the first m OD pairs in the traffic flow ranking as important OD groups (that is, the m OD pairs with the largest flow values) and constructs a sparse matrix to make it relatively small to speed up the sampling process, and calculates the corresponding global distribution d p d a and D E , construct the target traffic flow matrix of the area to be predicted, the specific formula is as follows:
[0074]
[0075] Among them, d p and d a They represent the normalized distribution vectors of p and a respectively; p and a represent the distribution vectors from p1 to p i The global traffic generated by a1 to a I The global attraction flow composed of p t represents the trip vector of each node leaving at time interval t, a t represents the travel vector of each node arriving at the time interval t; M ijt Indicates the time interval t from node n i To node n j Traffic flow; D E represents the tensor of traffic flow distribution obtained by normalizing E, E ij represents the traffic flow of the jth road in the i-th observation interval.
[0076] Furthermore, the process of constructing the target traffic flow matrix includes: transforming the node vector n element by element i With traffic flow ∈ τ The distribution of is multiplied to obtain the feature of node i at the observation time τ. In order to obtain the feature χ of all OD nodes in all observation intervals. The device expands N to n od ×1×n sec , D E Expanded to 1×O×n sec , and then broadcast the two tensors To obtain the shape of χ(O,n od ,n sec Then, divide by the dimension O of the tensor and take t×k to t×k+δ each time to get the input tensor (δ,n od ,n sec ). In this case, the OD sequence is estimated for 12 hours, with an estimate made every hour and an observation made every 10 minutes, so I = 12, O = 72, k = 6. Finally, D E is used as the input of NN, d p or a are used as labels to construct data sets (D E ,d p ) and (D E ,d a ), and then train these two models separately.
[0077] Step S200, based on the target traffic flow matrix, a temporal and spatial dependency relationship is modeled by a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the temporal and spatial dependency relationship of each road node pair;
[0078] In the specific implementation, refer to Figure 2 The traffic distribution prediction model is a deep learning model composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework. The device is based on the target traffic flow matrix and uses a preset traffic distribution prediction model to model the spatiotemporal dependency relationship to obtain a target graph signal matrix, wherein the target graph signal matrix contains the spatiotemporal dependency relationship of each road node pair. The road node pair refers to two road nodes with a road connectivity relationship. For example, the area to be predicted includes A, B, and C. Areas A, B, and C can be interconnected, that is, vehicles can travel from A to B and from B to C. Therefore, the road node pairs include AB, BC, and AC.
[0079] Specifically, since traffic flows at different times and spaces can be effectively used to describe OD sequences, this application uses traffic flows from observation interval t to t×k+δ as input to describe the OD matrix of interval t. If δ>k, the observations will overlap between two estimation intervals, refer to Figure 3 , which means that the OD matrix of the current estimation interval t will affect the traffic volume of the next t×k+δ observation intervals, which will cause lag problems. Therefore, in order to obtain the global distribution, this application needs to consider the mutual influence between each OD node in time and space. For example: in the case of a given traffic volume (δ>δ1; δ>δ2), at the observation interval t×k+δ1, node n i and observation interval t×k+δ2 when node n j All trips need to pass through the t×k+δ road segment e, so there will be paired spatiotemporal dependencies between OD nodes. This application selects an improved GRU model as the feature extractor for each OD matrix, which combines a diffuse convolutional network (DCN) and a gated recurrent unit (GRU).
[0080] In the specific implementation, this application proposes an improved GRU model that combines a deep convolutional network (DCN) and a gated recurrent unit (GRU). This combination enables the model to capture the spatial dependency and temporal dependency between nodes in the OD matrix, respectively, providing strong support for more comprehensive and accurate traffic prediction.
[0081] In a specific implementation, the device performs spatiotemporal dependency modeling based on the target traffic flow matrix through a preset traffic distribution prediction model to obtain a target graph signal matrix, including:
[0082] Obtain road node pairs of the area to be predicted, wherein the road node pairs refer to two road nodes with a road connectivity relationship; based on the target traffic flow matrix and the road node pairs, perform graph diffusion convolution through a deep convolutional network under a preset traffic distribution prediction model to extract the upstream and downstream spatial dependencies between each road node, and based on the upstream and downstream spatial dependencies, generate a first graph signal matrix containing the spatial dependencies of each road node pair; based on the target traffic flow matrix and the road node pairs, capture node flow characteristics through a gated recurrent unit under a preset flow distribution prediction model to obtain a second graph signal matrix containing the time dependencies of each road node pair, wherein the second graph signal matrix reflects the changes in the flow characteristics of each road node in the time series dimension; merge the first graph signal matrix and the second graph signal matrix to obtain a target graph signal matrix containing the spatiotemporal dependencies of each road node pair.
[0083] In a specific implementation, the device performs graph diffusion convolution based on the target traffic flow matrix and the road node pairs through a deep convolutional network under a preset traffic distribution prediction model to extract the upstream and downstream spatial dependencies between each road node, and based on the upstream and downstream spatial dependencies, generates a first graph signal matrix containing the spatial dependencies of each road node pair. Specifically, the deep convolutional network DCN under the traffic distribution prediction model can adapt to processing object dependencies in non-Euclidean space. By calculating K-step graph diffusion convolution, the upstream and downstream spatial dependencies between the surrounding K-order neighbor nodes are extracted. GRU can effectively model the evolution of nodes in the time dimension, so that the model can better understand the temporal dependencies between nodes.
[0084] Furthermore, the connection relationship between DCN nodes is represented by the adjacency matrix of the graph. In non-Euclidean space, the node features χ and the adjacency matrix W are used to represent certain associations between nodes. Specifically, the device captures the upstream and downstream spatial dependencies between a node and its surrounding K-order neighbor nodes by performing K-step diffusion on the graph. Finally, these upstream and downstream spatial dependencies are integrated into a comprehensive graph signal χ :,e★g , the mathematical expression is as follows:
[0085]
[0086] Among them, χ ★g In each dimension, each OD node is fused with the graph signal obtained by its K-order neighbors; D o The diagonal matrix representing the out-degree matrix of graph g; represents the learnable filter parameters; D I represents the diagonal matrix of the in-degree matrix; Represent the transfer matrices of the diffusion process and its inverse process respectively; n sec is the number of road segments.
[0087] In a specific implementation, the device captures the node flow characteristics based on the target traffic flow matrix and the road node pairs through a gated recurrent unit under a preset flow distribution prediction model, and obtains a second graph signal matrix containing the time dependency of each road node pair, wherein the second graph signal matrix reflects the change of flow characteristics of each road node in the time series dimension. Specifically, the device uses a gated recurrent unit under a preset flow distribution prediction model, i.e., an improved GRU, to convert the comprehensive graph signal χ :,e★g The feature update process in the unit is as follows:
[0088] r (τ) =σ(Θ r★g [(τ) ,H (τ-1) ]+b r )
[0089] u (τ) =σ(Θ u★g [ (τ) ,H (τ-1) ]+b u )
[0090] C (τ) =tanh(Θ C★g [ (τ) ,r (τ) ⊙H (τ-1) ]+b c )
[0091] H (τ) =u (τ) ⊙H (τ-1) +(1-u (τ) )⊙C (τ)
[0092] The device will output the image signal χ at time τ through DCN (τ) The hidden states of nodes and roads at time τ-1 are used to calculate the reset gate r (τ) , decide which hidden state information of the previous moment to keep and forget at the current moment, and calculate the update gate u (τ) Determine how much information from the previous moment to update to the current hidden state at the current moment, and then use the graph signal χ 9τ) and reset the gate to get the updated state r (τ) ⊙H (τ-1) Generate candidate memory cell C (τ) ; Finally, the new hidden state H at the current moment is generated by updating the gate and the candidate memory unit (τ) .
[0093] Among them, r (τ) is the reset gate at the observation time interval τ, σ(·) represents the S-type activation function, Θ r is a learnable parameter associated with the reset gate, g[χ (τ) ,H (τ-1) ] represents the graph signal defined using diffusive convolution, χ (τ) represents the input at the observation interval τ, b r is the bias of the reset gate; u (τ) represents the update gate at τ, Θ u is a learnable parameter associated with the update gate, b u is the bias of the update gate; C (τ) represents the cell state at the observation time interval τ, tanh(·) represents the hyperbolic tangent activation function, Θ Cis a learnable parameter related to the cell state, ⊙ represents element-wise multiplication, and b c is the bias of the cell state; H (τ) represents the output at the observation interval τ, u (τ) ⊙H (τ-1) Indicates that the previous information is retained, (1-u (τ) )⊙C (τ) Indicates that some information is discarded and new information is added according to the update gate. By expanding the dimension of H, we can obtain (I×n od ,n sec ) input for the encoder.
[0094] In a specific implementation, the device finally merges the first graph signal matrix and the second graph signal matrix to obtain a target graph signal matrix including the spatiotemporal dependency relationship of each road node pair.
[0095] Step S300, based on the target graph signal matrix and the target traffic flow matrix, traffic flow prediction is performed on the area to be predicted to obtain a target traffic flow prediction result of the area to be predicted;
[0096] In the specific implementation, in order to predict the traffic flow in the area to be predicted, this application adopts a method based on graph convolutional neural network (GCN). This method can use the topological structure of the urban road network to capture the spatial dependency of traffic data through graph convolution, while considering time series information, so as to effectively predict the traffic flow.
[0097] In the specific implementation, this solution introduces shared position embedding parameters in the multi-head attention mechanism, further improving the modeling ability of node spatiotemporal mutual information. It not only enhances the modeling of node positions, but also makes the entire model more robust and better able to adapt to different traffic scenarios.
[0098] In a specific implementation, the device performs flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix, and obtains the target flow prediction result of the area to be predicted, including:
[0099] Based on the target traffic flow matrix, determine the position embedding parameters, wherein the position embedding parameters reflect the element position of each vector in the target traffic flow matrix in the sequence; combine the position embedding parameters with the graph signal matrix to generate initial global information; based on a preset multi-head self-attention mechanism, calculate the weight information of each element in the initial global information, wherein the weight information reflects the spatiotemporal dependency relationship between different elements; perform attention calculation on the initial global information and the weight information to obtain the target global information, and determine the target traffic prediction result of the area to be predicted based on the target global information.
[0100] It should be noted that position embedding parameters are a technique used in deep learning models, especially when processing sequence data, to provide position information for each element in the sequence. Position embedding parameters introduce position information into the input and output of the encoder, so that when the model calculates the attention weight through the self-attention mechanism, it not only considers the characteristics of the elements themselves, but also the relative positions of these elements in the sequence. Position embedding parameters are used to generate global information. Through element-by-element addition and inner product operations, the weight of each node relative to the global information can be calculated. These weights reflect how elements at different positions in the sequence contribute relative to the overall data distribution, thereby providing a basis for the prediction or inference of the global distribution. In this way, the model can better integrate global and local information and provide more accurate spatiotemporal predictions. Position embedding parameters help the model learn the relative position characteristics of the sequence during training, which enables the model to better generalize to unseen data or new spatiotemporal structures. By introducing position information, the model can understand not only the characteristics of the elements themselves, but also the position and role of these elements in the overall structure, thereby improving the generalization ability and prediction accuracy of the model.
[0101] In the specific implementation, this solution designs a global distribution inference structure, adding shared position embedding parameters before and after the encoder to introduce information about the position of elements in the sequence. The encoder integrates the information of the spatiotemporal dependency of the previous step output through the self-attention mechanism, so that the model can better understand the spatiotemporal graph structure. The position embedding parameter is used to generate global information. The weight of each node relative to the global information is obtained through element-by-element addition and inner product operations, and finally the inferred global distribution is obtained through the Softmax operation. Used for prediction or inference of global spatiotemporal graphs.
[0102] Furthermore, this scheme adopts a self-built multi-head self-attention mechanism as an encoder. The self-built multi-head self-attention allows the model to focus on different aspects or features at the same time, thereby capturing the dependencies in the sequence data more comprehensively. In multi-head self-attention, the attention weight A is calculated using standard self-attention. Standard self-attention calculates the attention weight A of all elements v. This means that self-attention calculates the weight of each value element v by comparing the correlation between each query (q) and key (k) to determine the dependencies between different elements. A is calculated based on the query (q) and key (k) of the element to measure the input sequence. Pairwise dependencies between different elements in .
[0103]
[0104] SA(ζ)=Av(3)
[0105] Where (1) is the projection operation, ζ is the input sequence composed of the spatiotemporal dependency information and the position embedding parameter, and the sequence is projected into three different subspaces, corresponding to q, k and v, U respectively. qkv is a learnable parameter matrix with dimension d×3d h , d is the feature dimension, h is the number of attention heads; (2) is the attention weight calculation, and the Softmax operation ensures the normalization of the attention weight; (3) is the attention output calculation.
[0106] Furthermore, the device projects the output of the MSA running h SA processes simultaneously. h Keep the dimension unchanged as d / h, where h is the number of heads, and finally output the sequence processed by the multi-head attention mechanism.
[0107]
[0108] Among them, U msa is a learnable parameter. For model training, JS is selected as the loss function to measure the distance between the two distributions.
[0109]
[0110] in Indicates the generated traffic or attracted traffic obtained from the optimized and improved GRU model.
[0111] Step S400, based on the target traffic prediction result, the traffic distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model, so that the optimized traffic distribution prediction model can perform the next round of traffic prediction, wherein the traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework, the deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
[0112] In a specific implementation, the present application proposes to optimize and update the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model, so that the optimized traffic distribution prediction model can perform the next round of traffic prediction. The two-layer framework structure includes an upper layer and a lower layer, and each layer is responsible for different tasks. The task of the upper layer is to improve the accuracy of the estimation by adjusting the OD matrix to adapt to the temporal and spatial changes of the actual traffic data. Typically, numerical optimization methods such as least squares are used to continuously update the OD matrix to fit the observed data. The task of the lower layer is to allocate traffic demand to different road segments or paths to simulate the distribution of traffic flow. This hierarchical structure helps to deal with estimation and allocation problems separately.
[0113] In the specific implementation, this application combines deep learning methods with a two-layer framework, which not only improves the accuracy of the model, but also enhances the model's ability to understand the complex relationships in the transportation network.
[0114] Furthermore, in the traffic flow prediction system, the traffic distribution prediction model will be adjusted and optimized regularly or when triggered by specific conditions to maintain the accuracy and adaptability of the prediction. Specifically, the traffic distribution prediction model can be automatically updated according to a fixed time period (such as every hour, every day, every week, etc.). For example, the traffic flow pattern will change significantly during the morning and evening commuting hours of each weekday, so the model may need to be updated before the start of these periods; it can also be based on data-driven updates, that is, when new traffic flow data is collected, the model will use this data to retrain or fine-tune to reflect the latest traffic conditions. The new traffic flow data comes from road sensors, vehicle-mounted GPS, mobile phone positioning data, etc. Through the above dynamic update mechanism, the present application ensures that the traffic prediction model can adapt to the dynamic changes of the transportation system, thereby providing more accurate and timely prediction results.
[0115] In a specific implementation, the device optimizes and updates the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain the optimized traffic distribution prediction model, including:
[0116] Obtain the traffic observation result corresponding to the target traffic prediction result; extract the first traffic distribution from the target traffic prediction result, and extract the second traffic distribution from the traffic observation result; based on the lower-level task of the preset two-layer optimization task framework, calculate the first difference value between the traffic observation result and the target traffic prediction result, and calculate the second difference value between the first traffic distribution and the second traffic distribution; based on the upper-level task of the preset two-layer optimization task framework, the first difference value and the second difference value, calculate the optimal model parameters of the traffic distribution prediction model by minimizing the objective function; based on the optimal model parameters, optimize and update the traffic distribution prediction model to obtain the optimized traffic distribution prediction model.
[0117] In the specific implementation, this solution adopts a two-layer framework to optimize and best infer the global flow distribution. and the best inferred global attracting traffic distribution Combined with, and select KLD (KL divergence, an indicator that measures the difference between two probability distributions) as the optimization objective function. By adopting a two-layer framework, the algorithm can achieve a better fit to the observed and simulated traffic flow data by optimizing parameters in the upper layer. At the same time, by introducing the least squares term and the KL divergence term, the algorithm comprehensively considers the fit and distribution similarity between the simulated data and the real data in the objective function. At the upper layer, by minimizing a certain objective function To update the estimate of OD flow; in the lower layer, the allocation matrix P is obtained by simulating flow observations and using the back calculation procedure.
[0118] In a specific implementation, the device minimizes the objective function Update OD matrix sequence The objective function is as follows:
[0119]
[0120] in, represents the least squares term, which is used to measure the observed traffic flow ∈ τ and simulated traffic flow The difference between is a divergence term used to measure the OD distribution obtained from the optimization of the two-layer framework. The OD distribution obtained with the best pre-trained trained model The difference between is obtained by using the OD allocation matrix P and the currently estimated OD sequence The simulated traffic flow obtained by reverse calculation.
[0121] In a specific implementation, after the device optimizes and updates the traffic distribution prediction model based on the optimal model parameters to obtain the optimized traffic distribution prediction model, the method includes:
[0122] Determine the third flow distribution output by the optimized flow distribution prediction model; calculate the third difference value between the second flow distribution and the third flow distribution, and determine whether the third difference value converges; if the third difference value does not converge, return to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the third difference value converges, and then determine the optimized flow prediction result output by the optimized flow distribution prediction model; calculate the fourth difference value between the optimized flow prediction result and the flow observation result, and determine whether the fourth difference value converges; if the fourth difference value does not converge, return to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the fourth difference value converges, and obtain the optimal model parameters after iterative optimization; based on the optimal model parameters after iterative optimization, optimize and update the flow distribution prediction model to obtain the iteratively optimized flow distribution prediction model.
[0123] In the specific implementation, after obtaining the optimized traffic distribution prediction model, the device also needs to check the global distribution difference Whether it converges, if it converges, set the balance factor α to 1, if it does not converge, return to the step of calculating the optimal model parameters of the traffic distribution prediction model by minimizing the objective function until the third difference value converges, and then determine the optimized traffic prediction result output by the optimized traffic distribution prediction model.
[0124] In the specific implementation, the model optimization iteration termination condition is to check the overall objective function Whether it converges, if it converges, stop the iteration; if the fourth difference value does not converge, return to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the fourth difference value converges, and obtain the optimal model parameters after iterative optimization; based on the optimal model parameters after iterative optimization, optimize and update the flow distribution prediction model to obtain the iteratively optimized flow distribution prediction model.
[0125] Compared with the related art, which usually adopts a deep learning neural network model to realize the traffic flow prediction of the current traffic flow prediction area. However, this method cannot effectively capture the spatiotemporal correlation of traffic data, resulting in low accuracy of traffic flow prediction. In comparison, the present application utilizes a traffic distribution prediction model composed of a deep convolutional network, a gated recurrent unit, and a two-layer optimization task framework to model the spatiotemporal dependency relationship of road node pairs for the target traffic flow matrix of the predicted area, obtain a target graph signal matrix containing the spatiotemporal dependency relationship of each road node pair, and based on the target graph signal matrix and the target traffic flow matrix, perform traffic prediction on the area to be predicted to obtain the target traffic flow prediction result for the area to be predicted. It can be understood that the present application utilizes the deep convolutional network and the gated recurrent unit in the pre-trained traffic distribution prediction model to realize the spatiotemporal dependency relationship modeling of road node pairs, so that its traffic distribution prediction model effectively captures the spatiotemporal dependency information of road node pairs in the area to be predicted, thereby improving the accuracy of traffic flow prediction. It is further proposed that based on the target flow prediction result, the flow distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized flow distribution prediction model, that is, the flow distribution prediction model is regularly optimized through a two-layer optimization task framework, so as to further improve the accuracy of traffic flow prediction.
[0126] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the traffic flow prediction method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0127] This application also provides a traffic flow prediction device, please refer to Figure 4 , the traffic flow prediction device comprises:
[0128] An acquisition module 10 is used to acquire a target traffic flow matrix of a region to be predicted;
[0129] A modeling module 20 is used to perform spatiotemporal dependency modeling based on the target traffic flow matrix through a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the spatiotemporal dependency of each road node pair;
[0130] A prediction module 30, configured to perform traffic flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix, and obtain a target traffic flow prediction result for the area to be predicted;
[0131] The optimization module 40 is used to optimize and update the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model for the optimized traffic distribution prediction model to perform the next round of traffic prediction, wherein the traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework, the deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
[0132] Optionally, the modeling module 20 includes:
[0133] A road node pair acquisition module, used to acquire a road node pair in the area to be predicted, wherein the road node pair refers to two road nodes having a road connectivity relationship;
[0134] A graph diffusion convolution module is used to perform graph diffusion convolution based on the target traffic flow matrix and the road node pairs through a deep convolutional network under a preset traffic distribution prediction model to extract the upstream and downstream spatial dependency relationships between the road nodes, and generate a first graph signal matrix containing the spatial dependency relationships of the road node pairs based on the upstream and downstream spatial dependency relationships;
[0135] A flow feature capture module is used to capture the node flow features based on the target traffic flow matrix and the road node pairs through a gated cyclic unit under a preset flow distribution prediction model to obtain a second graph signal matrix containing the time dependency relationship of each road node pair, wherein the second graph signal matrix reflects the change of the flow features of each road node in the time series dimension;
[0136] The merging module is used to merge the first graph signal matrix and the second graph signal matrix to obtain a target graph signal matrix including the spatiotemporal dependency relationship of each road node pair.
[0137] Optionally, the prediction module 30 includes:
[0138] A determination module, configured to determine a position embedding parameter based on the target traffic flow matrix, wherein the position embedding parameter reflects the element position of each vector in the target traffic flow matrix in the sequence;
[0139] A combining module, used for combining the position embedding parameter and the image signal matrix to generate initial global information;
[0140] A weight calculation module, used to calculate the weight information of each element in the initial global information based on a preset multi-head self-attention mechanism, wherein the weight information reflects the spatiotemporal dependency relationship between different elements;
[0141] The attention calculation module is used to perform attention calculation on the initial global information and the weight information to obtain target global information, and determine the target traffic prediction result of the area to be predicted based on the target global information.
[0142] Optionally, the acquisition module 10 includes:
[0143] A collection module, used to collect traffic flow data of the area to be predicted, and to construct an initial traffic flow matrix based on the traffic flow data;
[0144] A sorting module, used to calculate the flow value of each vector under the initial traffic flow matrix, and sort the vectors from large to small based on the flow value to obtain a sorting result;
[0145] A selection module, configured to select a maximum preset number of first vectors from the sorting results, convert the flow values of all vectors other than the first vectors in the initial traffic flow matrix to 0, and obtain a second vector;
[0146] A construction module is used to construct a target traffic flow matrix of the area to be predicted based on the first vector and the second vector.
[0147] Optionally, the optimization module 40 includes:
[0148] A flow observation result acquisition module, used to obtain the flow observation result corresponding to the target flow prediction result;
[0149] An extraction module, used for extracting a first flow distribution from the target flow prediction result, and extracting a second flow distribution from the flow observation result;
[0150] A difference calculation module, used for calculating a first difference value between the flow observation result and the target flow prediction result, and calculating a second difference value between the first flow distribution and the second flow distribution based on the lower layer task of the preset two-layer optimization task framework;
[0151] An optimization calculation module, used to calculate the optimal model parameters of the traffic distribution prediction model by minimizing the objective function based on the upper-layer task of the preset two-layer optimization task framework, the first difference value and the second difference value;
[0152] An updating module is used to optimize and update the traffic distribution prediction model based on the optimal model parameters to obtain an optimized traffic distribution prediction model.
[0153] Optionally, the traffic flow prediction device further includes:
[0154] A third flow distribution determination module, used to determine a third flow distribution output by the optimized flow distribution prediction model;
[0155] a first convergence judgment module, configured to calculate a third difference value between the second flow distribution and the third flow distribution, and judge whether the third difference value converges;
[0156] A first iteration module, configured to return to the step of calculating the optimal model parameters of the traffic distribution prediction model by minimizing the objective function if the third difference value has not converged, until the third difference value converges, and then determine the optimized traffic prediction result output by the optimized traffic distribution prediction model;
[0157] A second convergence judgment module is used to calculate a fourth difference value between the optimized flow prediction result and the flow observation result, and judge whether the fourth difference value converges. If the fourth difference value does not converge, return to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the fourth difference value converges to obtain the optimal model parameters after iterative optimization;
[0158] The second iterative module is used to optimize and update the traffic distribution prediction model based on the optimal model parameters after the iterative optimization to obtain the iteratively optimized traffic distribution prediction model.
[0159] The traffic flow prediction device provided by the present application adopts the traffic flow prediction method in the above embodiment, which can solve the technical problem of traffic flow prediction. Compared with the prior art, the beneficial effects of the traffic flow prediction device provided by the present application are the same as the beneficial effects of the traffic flow prediction method provided by the above embodiment, and other technical features in the traffic flow prediction device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0160] The present application provides a traffic flow prediction device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the traffic flow prediction method in the above-mentioned embodiment one.
[0161] Reference below Figure 5, which shows a schematic diagram of the structure of a traffic flow prediction device suitable for implementing the embodiment of the present application. The traffic flow prediction device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The traffic flow prediction device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0162] like Figure 5 As shown, the traffic flow prediction device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the traffic flow prediction device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the traffic flow prediction device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a traffic flow prediction device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0163] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0164] The traffic flow prediction device provided by the present application adopts the traffic flow prediction method in the above embodiment to solve the technical problem of traffic flow prediction. Compared with the prior art, the beneficial effects of the traffic flow prediction device provided by the present application are the same as the beneficial effects of the traffic flow prediction method provided by the above embodiment, and the other technical features in the traffic flow prediction device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0165] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0166] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0167] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the traffic flow prediction method in the above-mentioned embodiment.
[0168] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0169] The computer-readable storage medium may be included in the traffic flow prediction device; or may exist independently without being assembled into the traffic flow prediction device.
[0170] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the traffic flow prediction device, the traffic flow prediction device can perform traffic flow prediction.
[0171] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0172] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0173] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0174] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned traffic flow prediction method, and can solve the technical problem of traffic flow prediction. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the traffic flow prediction method provided in the above-mentioned embodiment, and will not be repeated here.
[0175] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned traffic flow prediction method when executed by a processor.
[0176] The computer program product provided by this application can solve the technical problem of traffic flow prediction. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the traffic flow prediction method provided by the above embodiment, which will not be repeated here.
[0177] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A traffic flow prediction method, characterized in that: The method for traffic flow prediction comprises: Obtain the target traffic flow matrix of the area to be predicted; Based on the target traffic flow matrix, a temporal and spatial dependency relationship is modeled by a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the temporal and spatial dependency relationship of each road node pair; Based on the target graph signal matrix and the target traffic flow matrix, traffic flow prediction is performed on the area to be predicted to obtain a target traffic flow prediction result of the area to be predicted; Based on the target traffic prediction result, the traffic distribution prediction model is optimized and updated through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model, so that the optimized traffic distribution prediction model can perform the next round of traffic prediction. The traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework. The deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
2. The traffic flow prediction method according to claim 1, characterized in that: The step of performing spatiotemporal dependency modeling based on the target traffic flow matrix through a preset traffic distribution prediction model to obtain a target graph signal matrix includes: Acquire a road node pair in the area to be predicted, wherein the road node pair refers to two road nodes having a road connectivity relationship; Based on the target traffic flow matrix and the road node pairs, a graph diffusion convolution is performed through a deep convolutional network under a preset traffic distribution prediction model to extract the upstream and downstream spatial dependency relationships between the road nodes, and based on the upstream and downstream spatial dependency relationships, a first graph signal matrix containing the spatial dependency relationships of the road node pairs is generated; Based on the target traffic flow matrix and the road node pairs, node flow characteristics are captured by a gated recurrent unit under a preset flow distribution prediction model to obtain a second graph signal matrix including a time dependency relationship of each road node pair, wherein the second graph signal matrix reflects changes in flow characteristics of each road node in a time series dimension; The first image signal matrix and the second image signal matrix are combined to obtain a target image signal matrix.
3. The traffic flow prediction method according to claim 1, characterized in that: The step of performing flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix to obtain a target flow prediction result for the area to be predicted includes: Based on the target traffic flow matrix, determining a position embedding parameter, wherein the position embedding parameter reflects the element position of each vector in the target traffic flow matrix in the sequence; Combining the position embedding parameter with the image signal matrix to generate initial global information; Based on a preset multi-head self-attention mechanism, the weight information of each element in the initial global information is calculated, wherein the weight information reflects the spatiotemporal dependency relationship between different elements; The initial global information and the weight information are subjected to attention calculation to obtain target global information, and based on the target global information, a target flow prediction result of the area to be predicted is determined.
4. The traffic flow prediction method according to claim 1, characterized in that: The step of obtaining the target traffic flow matrix of the area to be predicted includes: Collecting traffic flow data of the area to be predicted, and constructing an initial traffic flow matrix based on the traffic flow data; Calculating the flow value of each vector under the initial traffic flow matrix, and sorting the vectors from large to small based on the flow value to obtain a sorting result; Selecting a maximum preset number of first vectors from the sorting results, converting the flow values of all vectors other than the first vectors in the initial traffic flow matrix to 0, to obtain a second vector; Based on the first vector and the second vector, a target traffic flow matrix of the area to be predicted is constructed.
5. The traffic flow prediction method according to claim 1, characterized in that: The step of optimizing and updating the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model includes: Obtaining a flow observation result corresponding to the target flow prediction result; Extracting a first flow distribution from the target flow prediction result, and extracting a second flow distribution from the flow observation result; Based on the lower-layer task of the preset two-layer optimization task framework, a first difference value between the flow observation result and the target flow prediction result is calculated, and a second difference value between the first flow distribution and the second flow distribution is calculated; Based on the upper-layer task of the preset two-layer optimization task framework, the first difference value and the second difference value, the optimal model parameters of the traffic distribution prediction model are calculated by minimizing the objective function; Based on the optimal model parameters, the traffic distribution prediction model is optimized and updated to obtain an optimized traffic distribution prediction model.
6. The traffic flow prediction method according to claim 5, characterized in that: After the step of optimizing and updating the traffic distribution prediction model based on the optimal model parameters to obtain an optimized traffic distribution prediction model, the method includes: Determining a third flow distribution output by the optimized flow distribution prediction model; Calculating a third difference value between the second flow distribution and the third flow distribution, and determining whether the third difference value converges; If the third difference value has not converged, returning to the step of calculating the optimal model parameters of the traffic distribution prediction model by minimizing the objective function until the third difference value converges, then determining the optimized traffic prediction result output by the optimized traffic distribution prediction model; Calculating a fourth difference value between the optimized flow prediction result and the flow observation result, and determining whether the fourth difference value converges; if the fourth difference value does not converge, returning to the step of calculating the optimal model parameters of the flow distribution prediction model by minimizing the objective function until the fourth difference value converges, thereby obtaining the optimal model parameters after iterative optimization; Based on the optimal model parameters after the iterative optimization, the traffic distribution prediction model is optimized and updated to obtain the iteratively optimized traffic distribution prediction model.
7. A traffic flow prediction device, characterized in that: The device comprises: An acquisition module is used to obtain a target traffic flow matrix of the area to be predicted; A modeling module, used to perform spatiotemporal dependency modeling based on the target traffic flow matrix through a preset traffic distribution prediction model to obtain a target graph signal matrix, wherein the target graph signal matrix includes the spatiotemporal dependency of each road node pair; A prediction module, used to perform traffic flow prediction on the area to be predicted based on the target graph signal matrix and the target traffic flow matrix, and obtain a target traffic flow prediction result for the area to be predicted; An optimization module is used to optimize and update the traffic distribution prediction model based on the target traffic prediction result through a preset two-layer optimization task framework to obtain an optimized traffic distribution prediction model for the optimized traffic distribution prediction model to perform the next round of traffic prediction, wherein the traffic distribution prediction model is composed of a deep convolutional network, a gated recurrent unit and a two-layer optimization task framework, the deep convolutional network and the gated recurrent unit are used to realize the spatiotemporal dependency modeling of road node pairs, and the two-layer optimization task framework is used to optimize the traffic distribution prediction model.
8. A traffic flow prediction device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the traffic flow prediction method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the traffic flow prediction method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the traffic flow prediction method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Natural gas hydrate productivity prediction method and device, electronic equipment and storage medium
CN120509552A
A natural gas hydrate production capacity prediction method and device, electronic equipment and storage medium
CN120509552B
