A traffic flow prediction method, device and storage medium
By constructing a traffic flow prediction model that includes a head network and multiple prediction modules, the shortcomings of existing methods in handling complex traffic data are addressed, and faster and more accurate traffic flow prediction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2026-04-03
AI Technical Summary
Existing traffic flow prediction methods struggle to effectively handle traffic data in complex real-world environments, especially non-Euclidean data, and deep learning models perform poorly when extracting spatial and temporal features.
A traffic flow prediction model is constructed, including a head network, multiple prediction modules, and an output network. Through a network structure composed of a data embedding layer, a location encoding layer, a graph neural network submodule, an attention submodule, and a feedforward neural network layer, spatiotemporal feature extraction and linear transformation are performed to compensate for missing location information and avoid gradient vanishing or exploding problems.
It improves the computational speed and accuracy of traffic flow prediction, reduces computational costs, and can better extract spatiotemporal features to output accurate traffic flow prediction data.
Smart Images

Figure CN117669834B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction technology, specifically to a traffic flow prediction method, device, and storage medium. Background Technology
[0002] Existing traffic flow prediction methods can be divided into two categories: methods based on statistical models and methods based on deep learning models.
[0003] Statistical model-based methods use statistical models to statistically summarize traffic flow data, obtain patterns of data change, and then make predictions. The models used include queuing theory models, cell transmission models, micro-fundamental graph models, and autoregressive composite moving average (ARI MA) models, among others.
[0004] However, in reality, traffic data is affected by a variety of factors, and existing statistical models are difficult to describe the changes in traffic data in complex real-world environments.
[0005] Deep learning-based methods extract features implicit in traffic flow data, including spatial and temporal information. Models used include Convolutional Neural Networks (CNNs), Recurrent Neural Networks and their variants (RNNs, LSTMs, GRUs), Graph Neural Networks (GNNs), and attention mechanisms (represented by Transformers).
[0006] However, CNNs are suitable for Euclidean data, while road network traffic flow data is non-Euclidean data, and CNNs perform poorly in processing it; RNNs and their variants cannot be computed in parallel, resulting in high computation time and the inability to extract global information; GNNs are suitable for non-Euclidean data, but cannot extract temporal features from the data; Transformers can be computed in parallel and can extract the implicit temporal features and global information from the data, but they perform poorly in extracting spatial features. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a traffic flow prediction method, device and storage medium to address the shortcomings of the prior art.
[0008] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A traffic flow prediction method, comprising the following steps:
[0009] S1. Construct a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules and an output network;
[0010] S2. Train the traffic flow prediction model using a pre-constructed traffic flow data training set to obtain the trained traffic flow prediction model.
[0011] S3. The traffic flow data used for prediction is imported into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each prediction module for spatiotemporal feature extraction to obtain the spatiotemporal feature vectors corresponding to each prediction module. All spatiotemporal feature vectors are input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data.
[0012] Furthermore, the head network includes a data embedding layer and a position encoding layer; each prediction module includes a graph neural network submodule, an attention submodule, a first data processing layer, a second data processing layer, and a feedforward neural network layer; the output network includes a linear layer, a normalized exponential function layer, and an output layer.
[0013] The output of the data embedding layer is connected to the input of the position encoding layer. The output of the position encoding layer is connected to the input of the graph neural network submodule of each prediction module and the input of the first data processing layer. The output of the graph neural network submodule is connected to the input of the attention submodule. The output of the attention submodule is connected to the input of the first data processing layer. The output of the first data processing layer is connected to the input of the feedforward neural network layer and the input of the second data processing layer. The output of the feedforward neural network layer is connected to the input of the second data processing layer. The input of the linear layer is connected to the output of the second data processing layer of each prediction module. The output of the linear layer is connected to the input of the normalized exponential function layer. The output of the normalized exponential function layer is connected to the input of the output layer.
[0014] Furthermore, S3 specifically refers to:
[0015] Traffic flow data for prediction is imported into a data embedding layer, which maps the traffic flow data for prediction to a high-dimensional space and captures the relationships between data in the high-dimensional space to obtain the mapped data.
[0016] The mapped data is position-encoded through the position encoding layer to obtain encoded data;
[0017] In each of the prediction modules, spatial information features are extracted from the encoded data through the graph neural network submodule to obtain spatial information feature data.
[0018] The attention submodule extracts temporal information features from the spatial information feature data to obtain spatiotemporal information feature data.
[0019] The first data processing layer performs residual concatenation and normalization on the encoded data and the spatiotemporal information feature data to obtain the first-stage data.
[0020] The feedforward neural network layer performs a nonlinear transformation on each sequence position feature of the first stage data to obtain nonlinear transformed data.
[0021] The second data processing layer performs residual connection and normalization on the first stage data and the nonlinear transformation data to obtain the second stage data, which is the spatiotemporal feature vector.
[0022] The linear layer performs linear transformation on all the second-stage data to map all the second-stage data onto the same vector set, thus obtaining vector set data.
[0023] Traffic flow prediction data is obtained by calculating the normalized probability distribution of the vector set data through the normalized exponential function layer.
[0024] The traffic flow prediction data is output through the output layer.
[0025] The beneficial effects of adopting the above-mentioned further scheme are: mapping the original traffic flow data into a high-dimensional space and performing location encoding to make up for the lack of location information; extracting spatiotemporal information features from the encoded data; and performing residual connection, normalization, and nonlinear transformation on the spatiotemporal information feature data to obtain nonlinear transformed data. Performing residual connection and normalization on the nonlinear transformed data can avoid the gradient vanishing or gradient explosion problem and improve the model's expressive power.
[0026] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A traffic flow prediction device, comprising a model building module, a model training module, and a traffic flow prediction module:
[0027] The model building module is used to build a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules and an output network;
[0028] The model training module is used to train the traffic flow prediction model using a pre-built traffic flow data training set to obtain the trained traffic flow prediction model.
[0029] The traffic flow prediction module is used to import the traffic flow data for prediction into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each of the prediction modules for spatiotemporal feature extraction to obtain the spatiotemporal feature vectors corresponding to each prediction module. All spatiotemporal feature vectors are then input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data.
[0030] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a traffic flow prediction device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the traffic flow prediction method as described above.
[0031] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the traffic flow prediction method as described above.
[0032] The beneficial effects of this invention are: it constructs and trains a traffic flow prediction model, and through the head network, multiple prediction modules and output network of the trained traffic flow prediction model, it encodes traffic flow data, extracts spatiotemporal features, performs linear transformation and normalized probability distribution calculation, and finally outputs traffic flow prediction data. The traffic flow prediction model can improve the calculation speed, save calculation costs and obtain more accurate traffic flow prediction data. Attached Figure Description
[0033] Figure 1 A schematic flowchart of the traffic flow prediction method provided in an embodiment of the present invention;
[0034] Figure 2 This is a schematic diagram of the traffic flow prediction model provided in an embodiment of the present invention;
[0035] Figure 3 This is a schematic diagram of a traffic flow prediction device provided in an embodiment of the present invention. Detailed Implementation
[0036] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0037] like Figure 1 As shown in the embodiment of the present invention, a traffic flow prediction method includes the following steps:
[0038] S1. Construct a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules and an output network;
[0039] S2. Train the traffic flow prediction model using a pre-constructed traffic flow data training set to obtain the trained traffic flow prediction model.
[0040] S3. The traffic flow data used for prediction is imported into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each prediction module for spatiotemporal feature extraction to obtain the spatiotemporal feature vectors corresponding to each prediction module. All spatiotemporal feature vectors are input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data.
[0041] In this embodiment, a traffic flow prediction model is constructed and trained. The traffic flow prediction model, through its head network, multiple prediction modules, and output network, encodes, extracts, performs spatiotemporal features, and calculates linear transformations and normalized probability distributions on the traffic flow data. Finally, it outputs traffic flow prediction data. The traffic flow prediction model can improve computation speed, save computational costs, and obtain more accurate traffic flow prediction data.
[0042] Specifically, in S2, the traffic flow prediction model is trained using a pre-built traffic flow data training set, as follows:
[0043] 1. Data preparation: Traffic flow data obtained through road sensors is preprocessed and organized into the corresponding format, and the data is divided into training set, validation set and test set.
[0044] 2. Model Training: The traffic flow prediction model is trained using the training set data to optimize the loss function of the traffic flow prediction model.
[0045] 3. Model Validation: Input the validation set data into the trained traffic flow prediction model to check the model's status and adjust the model's hyperparameters.
[0046] 4. Model testing: Use test set data to evaluate the model's generalization ability.
[0047] Preferably, such as Figure 2 As shown, the head network includes a data embedding layer and a position encoding layer; each prediction module includes a graph neural network submodule, an attention submodule, a first data processing layer, a second data processing layer, and a feedforward neural network layer; the output network includes a linear layer, a normalized exponential function layer, and an output layer.
[0048] The output of the data embedding layer is connected to the input of the position encoding layer. The output of the position encoding layer is connected to the input of the graph neural network submodule of each prediction module and the input of the first data processing layer. The output of the graph neural network submodule is connected to the input of the attention submodule. The output of the attention submodule is connected to the input of the first data processing layer. The output of the first data processing layer is connected to the input of the feedforward neural network layer and the input of the second data processing layer. The output of the feedforward neural network layer is connected to the input of the second data processing layer. The input of the linear layer is connected to the output of the second data processing layer of each prediction module. The output of the linear layer is connected to the input of the normalized exponential function layer. The output of the normalized exponential function layer is connected to the input of the output layer.
[0049] Preferably, S3 specifically includes:
[0050] Traffic flow data for prediction is imported into a data embedding layer, which maps the traffic flow data for prediction to a high-dimensional space and captures the relationships between data in the high-dimensional space to obtain the mapped data.
[0051] The location encoding layer performs location encoding on the mapping data to compensate for the lack of location information and obtain encoded data.
[0052] In each of the prediction modules, spatial information features are extracted from the encoded data through the graph neural network submodule to obtain spatial information feature data.
[0053] The attention submodule extracts temporal information features from the spatial information feature data to obtain spatiotemporal information feature data.
[0054] The first data processing layer performs residual concatenation and normalization on the encoded data and the spatiotemporal information feature data to avoid gradient vanishing or gradient exploding problems, thus obtaining the first-stage data.
[0055] The feedforward neural network layer performs a nonlinear transformation on the sequence position features of the first stage data to improve the model's expressive power and obtain nonlinearly transformed data.
[0056] The second data processing layer performs residual connection and normalization on the first stage data and the nonlinear transformation data to obtain the second stage data, which is the spatiotemporal feature vector.
[0057] The linear layer performs linear transformation on all the second-stage data to map all the second-stage data onto the same vector set, thus obtaining vector set data.
[0058] Traffic flow prediction data is obtained by calculating the normalized probability distribution of the vector set data through the normalized exponential function layer.
[0059] The traffic flow prediction data is output through the output layer.
[0060] When performing traffic flow prediction, traffic flow data is input into the model. The graph neural network submodules of each prediction module extract the road topology information implicit in the traffic flow data to obtain spatial information feature data. Then, the spatial information feature data is input into the attention submodule to extract temporal information feature data to obtain spatiotemporal information feature data. Finally, all the second-stage data are mapped to the same vector set through a linear layer, and the normalized probability distribution is calculated through a normalized exponential function layer. The result with the highest probability value is output to obtain the traffic flow prediction data.
[0061] In this embodiment, the original traffic flow data is mapped into a high-dimensional space and encoded in terms of location to compensate for the lack of location information. Spatiotemporal information features are extracted from the encoded data to improve the model's predictive ability. The spatiotemporal information feature data is then subjected to residual connection, normalization, and nonlinear transformation to obtain nonlinear transformed data. Residual connection and normalization of the nonlinear transformed data can avoid gradient vanishing or gradient exploding problems and improve the model's expressive ability.
[0062] Preferably, the step of calculating the normalized probability distribution of the vector set data through the normalized exponential function layer specifically involves:
[0063] Select the last dimension vector in the vector set data, scale the numbers in the last dimension vector to the probability range of 0 to 1, and ensure that the sum of all probabilities is 1. Output the result with the largest corresponding probability value to obtain traffic flow prediction data.
[0064] In this embodiment, by performing normalized probability distribution calculation on the vector set data and outputting the result with the highest corresponding probability value, relatively accurate traffic flow prediction data can be obtained.
[0065] like Figure 3 As shown, the traffic flow prediction device provided in this embodiment of the invention includes a model building module, a model training module, and a traffic flow prediction module:
[0066] The model building module is used to build a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules and an output network;
[0067] The model training module is used to train the traffic flow prediction model using a pre-built traffic flow data training set to obtain the trained traffic flow prediction model.
[0068] The traffic flow prediction module is used to import the traffic flow data for prediction into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each of the prediction modules for spatiotemporal feature extraction to obtain the spatiotemporal feature vectors corresponding to each prediction module. All spatiotemporal feature vectors are then input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data.
[0069] Preferably, such as Figure 2 As shown, the head network includes a data embedding layer and a position encoding layer; each prediction module includes a graph neural network submodule, an attention submodule, a first data processing layer, a second data processing layer, and a feedforward neural network layer; the output network includes a linear layer, a normalized exponential function layer, and an output layer.
[0070] The output of the data embedding layer is connected to the input of the position encoding layer. The output of the position encoding layer is connected to the input of the graph neural network submodule of each prediction module and the input of the first data processing layer. The output of the graph neural network submodule is connected to the input of the attention submodule. The output of the attention submodule is connected to the input of the first data processing layer. The output of the first data processing layer is connected to the input of the feedforward neural network layer and the input of the second data processing layer. The output of the feedforward neural network layer is connected to the input of the second data processing layer. The input of the linear layer is connected to the output of the second data processing layer of each prediction module. The output of the linear layer is connected to the input of the normalized exponential function layer. The output of the normalized exponential function layer is connected to the input of the output layer.
[0071] Preferably, the traffic flow prediction module is specifically used for:
[0072] Traffic flow data for prediction is imported into a data embedding layer, which maps the traffic flow data for prediction to a high-dimensional space and captures the relationships between data in the high-dimensional space to obtain the mapped data.
[0073] The mapped data is position-encoded through the position encoding layer to obtain encoded data;
[0074] In each of the prediction modules, spatial information features are extracted from the encoded data through the graph neural network submodule to obtain spatial information feature data.
[0075] The attention submodule extracts temporal information features from the spatial information feature data to obtain spatiotemporal information feature data.
[0076] The first data processing layer performs residual concatenation and normalization on the encoded data and the spatiotemporal information feature data to obtain the first-stage data.
[0077] The feedforward neural network layer performs a nonlinear transformation on each sequence position feature of the first stage data to obtain nonlinear transformed data.
[0078] The second data processing layer performs residual connection and normalization on the first stage data and the nonlinear transformation data to obtain the second stage data, which is the spatiotemporal feature vector.
[0079] The linear layer performs linear transformation on all the second-stage data to map all the second-stage data onto the same vector set, thus obtaining vector set data.
[0080] Traffic flow prediction data is obtained by calculating the normalized probability distribution of the vector set data through the normalized exponential function layer.
[0081] The traffic flow prediction data is output through the output layer.
[0082] Preferably, in the traffic flow prediction module, the normalized probability distribution of the vector set data is calculated through the normalized exponential function layer, specifically as follows:
[0083] Select the last dimension vector in the vector set data, scale the numbers in the last dimension vector to the probability range of 0 to 1, and ensure that the sum of all probabilities is 1. Output the result with the largest corresponding probability value to obtain traffic flow prediction data.
[0084] An embodiment of the present invention provides a traffic flow prediction device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the traffic flow prediction method as described above.
[0085] The present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the traffic flow prediction method as described above.
[0086] The advantages of this invention are: it constructs and trains a traffic flow prediction model, and through the head network, multiple prediction modules and output network of the trained traffic flow prediction model, it encodes traffic flow data, extracts spatiotemporal features, performs linear transformation and normalized probability distribution calculation, and finally outputs traffic flow prediction data. The traffic flow prediction model can improve the calculation speed, save calculation costs and obtain more accurate traffic flow prediction data.
[0087] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0089] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0090] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0091] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0092] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A traffic flow prediction method, characterized in that, Includes the following steps: S1. Construct a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules, and an output network; the head network includes a data embedding layer and a location encoding layer; each prediction module includes a graph neural network submodule, an attention submodule, a first data processing layer, a second data processing layer, and a feedforward neural network layer; the output network includes a linear layer, a normalized exponential function layer, and an output layer; S2. Train the traffic flow prediction model using a pre-constructed traffic flow data training set to obtain the trained traffic flow prediction model. S3. The traffic flow data used for prediction is imported into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each prediction module for spatiotemporal feature extraction to obtain the spatiotemporal feature vectors corresponding to each prediction module. All spatiotemporal feature vectors are then input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data. Specifically, S3 is: Traffic flow data for prediction is imported into a data embedding layer, which maps the traffic flow data for prediction to a high-dimensional space and captures the relationships between data in the high-dimensional space to obtain the mapped data. The mapped data is position-encoded through the position encoding layer to obtain encoded data; In each of the prediction modules, spatial information features are extracted from the encoded data through the graph neural network submodule to obtain spatial information feature data. The attention submodule extracts temporal information features from the spatial information feature data to obtain spatiotemporal information feature data. The first data processing layer performs residual connection and normalization on the encoded data and the spatiotemporal information feature data to obtain the first stage data. The feedforward neural network layer performs a nonlinear transformation on each sequence position feature of the first stage data to obtain nonlinear transformed data. The second data processing layer performs residual connection and normalization on the first stage data and the nonlinear transformation data to obtain the second stage data, which is the spatiotemporal feature vector. The linear layer performs linear transformation on all the second-stage data to map all the second-stage data onto the same vector set, thus obtaining vector set data. Traffic flow prediction data is obtained by calculating the normalized probability distribution of the vector set data through the normalized exponential function layer. The traffic flow prediction data is output through the output layer.
2. The traffic flow prediction method according to claim 1, characterized in that, The output of the data embedding layer is connected to the input of the position encoding layer. The output of the position encoding layer is connected to the input of the graph neural network submodule of each prediction module and the input of the first data processing layer. The output of the graph neural network submodule is connected to the input of the attention submodule. The output of the attention submodule is connected to the input of the first data processing layer. The output of the first data processing layer is connected to the input of the feedforward neural network layer and the input of the second data processing layer. The output of the feedforward neural network layer is connected to the input of the second data processing layer. The input of the linear layer is connected to the output of the second data processing layer of each prediction module. The output of the linear layer is connected to the input of the normalized exponential function layer. The output of the normalized exponential function layer is connected to the input of the output layer.
3. The traffic flow prediction method according to claim 1, characterized in that, The process of calculating the normalized probability distribution of the vector set data through the normalized exponential function layer specifically involves: Select the last dimension vector in the vector set data, scale the numbers in the last dimension vector to the probability range of 0 to 1, and ensure that the sum of all probabilities is 1. Output the result with the largest corresponding probability value to obtain traffic flow prediction data.
4. A traffic flow prediction device, characterized in that, It includes a model building module, a model training module, and a traffic flow prediction module: A model building module is used to construct a traffic flow prediction model, wherein the traffic flow prediction model includes a head network, multiple prediction modules, and an output network; the head network includes a data embedding layer and a location encoding layer; each prediction module includes a graph neural network submodule, an attention submodule, a first data processing layer, a second data processing layer, and a feedforward neural network layer; the output network includes a linear layer, a normalized exponential function layer, and an output layer. The model training module is used to train the traffic flow prediction model using a pre-built traffic flow data training set to obtain the trained traffic flow prediction model. The traffic flow prediction module is used to import the traffic flow data for prediction into the head network of the trained traffic flow prediction model for encoding processing to obtain encoded data. The encoded data is then input into each prediction module for spatiotemporal feature extraction to obtain the spatiotemporal feature vector corresponding to each prediction module. All spatiotemporal feature vectors are input into the output network for linear transformation and normalized probability distribution calculation to obtain traffic flow prediction data. The traffic flow prediction module is specifically used for: Traffic flow data for prediction is imported into a data embedding layer, which maps the traffic flow data for prediction to a high-dimensional space and captures the relationships between data in the high-dimensional space to obtain the mapped data. The mapped data is position-encoded through the position encoding layer to obtain encoded data; In each of the prediction modules, spatial information features are extracted from the encoded data through the graph neural network submodule to obtain spatial information feature data. The attention submodule extracts temporal information features from the spatial information feature data to obtain spatiotemporal information feature data. The first data processing layer performs residual concatenation and normalization on the encoded data and the spatiotemporal information feature data to obtain the first-stage data. The feedforward neural network layer performs a nonlinear transformation on each sequence position feature of the first stage data to obtain nonlinear transformed data. The second data processing layer performs residual connection and normalization on the first stage data and the nonlinear transformation data to obtain the second stage data, which is the spatiotemporal feature vector. The linear layer performs linear transformation on all the second-stage data to map all the second-stage data onto the same vector set, thus obtaining vector set data. Traffic flow prediction data is obtained by calculating the normalized probability distribution of the vector set data through the normalized exponential function layer. The traffic flow prediction data is output through the output layer.
5. The traffic flow prediction device according to claim 4, characterized in that, The output of the data embedding layer is connected to the input of the position encoding layer. The output of the position encoding layer is connected to the input of the graph neural network submodule of each prediction module and the input of the first data processing layer. The output of the graph neural network submodule is connected to the input of the attention submodule. The output of the attention submodule is connected to the input of the first data processing layer. The output of the first data processing layer is connected to the input of the feedforward neural network layer and the input of the second data processing layer. The output of the feedforward neural network layer is connected to the input of the second data processing layer. The input of the linear layer is connected to the output of the second data processing layer of each prediction module. The output of the linear layer is connected to the input of the normalized exponential function layer. The output of the normalized exponential function layer is connected to the input of the output layer.
6. The traffic flow prediction device according to claim 4, characterized in that, In the traffic flow prediction module, the normalized probability distribution of the vector set data is calculated through the normalized exponential function layer, specifically as follows: Select the last dimension vector in the vector set data, scale the numbers of the last dimension vector to the probability range of 0 to 1, and ensure that the sum of all probabilities is 1. Output the result with the largest corresponding probability value to obtain traffic flow prediction data.
7. A traffic flow prediction device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the traffic flow prediction method as described in any one of claims 1 to 3.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the traffic flow prediction method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Traffic flow prediction method based on Transform space-time diagram convolutional network
CN114330671A