CN-121982891-A - Traffic network flow prediction method and system based on pre-training space-time diagram neural network model
Abstract
The invention provides a traffic network flow prediction method and system based on a pre-training space-time diagram neural network model. The method comprises the steps of training an encoder and a decoder by using a long-term space-time sequence in a pre-training stage, freezing parameters of the trained encoder, encoding the long-term space-time sequence based on the frozen encoder in a fine tuning stage, extracting features of a short-term space-time sequence by using a space-time graph neural network STGNN, fusing long-term feature representation and the short-term feature representation by using a multi-layer perceptron, and obtaining a future traffic flow sequence after a fusion result passes through a linear layer. The invention can realize accurate short-time traffic flow prediction.
Inventors
- XU TAO
- DENG JIAMING
- LIU CHUN
- HAN ZHIGANG
- ZHANG JUNTAO
Assignees
- 河南大学
Dates
- Publication Date
- 20260505
- Application Date
- 20260129
Claims (8)
- 1. A traffic network flow prediction method based on a pre-training space-time diagram neural network model is characterized by comprising a pre-training stage and a fine-tuning stage; acquiring historical traffic flow sequence of T time steps before T moment Sequencing the historical traffic flow Segmentation into long-term spatio-temporal sequences And short-term spatiotemporal sequences ; The pre-training phase comprises the steps of firstly performing original long-term time-space sequence Input to encoder, and input the output of encoder to decoder to obtain reconstructed sequence Calculating reconstruction loss according to a preset loss function, and optimizing an encoder and a decoder based on the reconstruction loss; Wherein in the encoder, the sequence is first embedded using a block embedding layer Divided into Non-overlapping subsequences, resulting in block embedding And then adopting a position coding layer to carry out position coding on all the subsequences to obtain a position embedded feature Then embedding features into the locations Random masking to obtain masked fragment level representations And an unmasked fragment level representation Finally, the fragment level representation that is not masked Input to an L-layer space-time transform encoder to obtain a potential output representation In the decoder, all potential outputs are represented by a fast Fourier transform Converting into frequency domain signals, and reconstructing in the frequency domain by linear interpolation to obtain a reconstructed sequence ; The fine tuning stage comprises freezing encoder parameters obtained in the pre-training stage, and performing long-term space-time sequence Input to the encoder to obtain a long-term characteristic representation And the short-term time-space sequence is processed Input to a space-time diagram neural network to obtain a short-term characteristic representation Representing the long-term features using a multi-layer perceptron And the short-term feature representation Fusing, and obtaining the t time after the fused result passes through the linear layer A sequence of future traffic flows for each time step, calculating a predicted loss between the predicted future traffic flow sequence and the actual future traffic sequence, optimizing the space-time diagram neural network, wherein, 。
- 2. The traffic network flow prediction method based on the pre-training space-time diagram neural network model of claim 1, wherein the position coding layer performs position coding by adopting a position embedding which can be learned, and the position coding formula of the ith node is as follows: Wherein, the Representing the result of the position coding of the i-th node, To represent the corresponding learnable parameters of the p-th time slice, Representing a time slice of the i-th node, , Representing the feature dimension after position encoding.
- 3. The traffic network traffic prediction method based on a pre-trained space-time neural network model according to claim 1, characterized in that features are embedded into the locations The random masking is carried out, and specifically comprises the following steps: Setting a masking ratio Masked fragment level representation ; Fragment level representation without masking ; 。
- 4. The traffic network traffic prediction method based on a pre-trained time space neural network model according to claim 1, wherein the segment-level representation to be unmasked Input to an L-layer space-time transform encoder to obtain a potential output representation Comprising: Is provided with And Representation of The ith node in (b) Time step and th And (3) representing time steps, wherein the process of time attention coding of the ith node is as follows: Wherein, the Represent the first The first node Time step pair The time attention weight of the time step, Is a binary function for measuring pairwise correlations, It is indicated that a feature space conversion is performed, Representing a non-linear activation function, Representing a natural exponential function of the sign, Is a binary function for measuring pairwise correlations; Integrating the time attention coding results of all nodes to obtain the time attention mechanism representation of all nodes Based on The potential output representation is obtained according to the following learning process : Wherein, the Representing the time attention mechanism, parameters of all nodes In order for the weights to be a learnable weight, For the d-order neighborhood of graph G, d is the expansion ratio, Represents the mth convolution kernel, M represents the number of kernels of the convolution.
- 5. The traffic network traffic prediction method based on a pre-trained space-time neural network model according to claim 1, characterized in that the long-term characteristics are represented by a multi-layer perceptron And the short-term feature representation The fusion is carried out, and the method specifically comprises the following steps: Wherein, the A multi-layer sensor is shown as such, Representing a pre-measurement head, and adopting a space-time diagram neural network; And represents the fusion result.
- 6. A traffic network traffic prediction system based on a pre-trained space-time diagram neural network model, comprising: the data acquisition module is used for acquiring a historical traffic flow sequence of T time steps before the moment T Sequencing the historical traffic flow Segmentation into long-term spatio-temporal sequences And short-term spatiotemporal sequences ; A pre-training module for performing a pre-training phase including first generating an original long-term space-time sequence Input to encoder, and input the output of encoder to decoder to obtain reconstructed sequence Calculating reconstruction loss according to a preset loss function, and optimizing an encoder and a decoder based on the reconstruction loss; Wherein in the encoder, the sequence is first embedded using a block embedding layer Divided into Non-overlapping subsequences, resulting in block embedding And then adopting a position coding layer to carry out position coding on all the subsequences to obtain a position embedded feature Then embedding features into the locations Random masking to obtain masked fragment level representations And an unmasked fragment level representation Finally, the fragment level representation that is not masked Input to an L-layer space-time transform encoder to obtain a potential output representation In the decoder, all potential outputs are represented by a fast Fourier transform Converting into frequency domain signals, and reconstructing in the frequency domain by linear interpolation to obtain a reconstructed sequence ; A fine tuning module for performing a fine tuning phase including freezing parameters of the encoder obtained in the pre-training phase, and performing a long-term spatio-temporal sequence Input to the encoder to obtain a long-term characteristic representation And the short-term time-space sequence is processed Input to a space-time diagram neural network to obtain a short-term characteristic representation Representing the long-term features using a multi-layer perceptron And the short-term feature representation Fusing, and obtaining the t time after the fused result passes through the linear layer A sequence of future traffic flows for each time step, calculating a predicted loss between the predicted future traffic flow sequence and the actual future traffic sequence, optimizing the space-time diagram neural network, wherein, 。
- 7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 5 when the program is executed by the processor.
- 8. A non-transitory computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the method of any one of claims 1 to 5.
Description
Traffic network flow prediction method and system based on pre-training space-time diagram neural network model Technical Field The invention relates to the technical field of traffic data mining, in particular to a traffic network flow prediction method and system based on a pre-training space-time diagram neural network model. Background The complex traffic network collects a large amount of traffic flow data with space-time labels by using a large number of sensors, and how to use the traffic flow data to predict traffic flow is a core task of intelligent traffic, plays an important role in various applications such as road network planning, traffic management, travel navigation and the like, and has a large number of research and application results. Accurate prediction of traffic flow is helpful for managers to regulate traffic systems, optimize traffic resource allocation, relieve road congestion, support travel route recommendation, predict travel time and the like. The complex traffic network has the advantages of more traffic prediction problem influencing factors and poor prediction stability, and not only needs to model non-stable time sequence traffic data of each traffic node, but also needs to consider the spatial position dependency relationship and interaction mechanism among multiple traffic nodes. By analyzing the inherent space-time characteristics in the historical traffic flow, the existing periodic trend can be identified, and the non-static interaction mechanism for modeling the traffic flow mode can be known, so that the prediction of the future traffic flow is more accurate. The existing traffic prediction method mainly has three problems that (1) the existing graph neural network model can not capture long-term context information, and modeling traffic dependency relationship only by short-term data is unreliable. For example, when checking data within a short-term window, it is observed that the time series is completely different within the short-term time window. However, they have a similar trend in variation from a long time window. Therefore, it is difficult for the existing graph neural network model to accurately predict different trends in the future according to limited historical data. (2) Modeling long sequence data can place a significant computational burden. While long-term time series is advantageous for mitigating noise from short-term fluctuations, inputting such long-term time series into STGNN or a transducer model can result in significant computational overhead. While some pre-training models can process long-term data, the use of masking strategies and multi-layer convertors to learn features and reconstruct sequences during the pre-training phase can lead to increased performance problems, particularly when dealing with complex networks. (3) Traffic data contains not only temporal information, but also spatial correlation between the observation nodes, an aspect that most existing pre-trained models have not adequately addressed. Disclosure of Invention Aiming at the traffic flow prediction problem of a complex traffic network, the invention provides a traffic network flow prediction method and system based on a Pre-training space-time diagram neural network model, and particularly designs a Pre-training space-time diagram neural network model PSTM (Pre-TRAIN SPATIAL Temporal MASKED GRAPH Neural Networks) for modeling the time correlation and the space correlation of historical traffic node data. The model provided by the invention can realize accurate short-time (2 hours) traffic flow prediction, and the prediction precision is superior to that of the existing traffic flow prediction model based on the GNN method and the like. In a first aspect, the invention provides a traffic network flow prediction method based on a pre-training space-time diagram neural network model, which comprises a pre-training stage and a fine-tuning stage; acquiring historical traffic flow sequence of T time steps before T moment Sequencing the historical traffic flowSegmentation into long-term spatio-temporal sequencesAnd short-term spatiotemporal sequences; The pre-training phase comprises the steps of firstly performing original long-term time-space sequenceInput to encoder, and input the output of encoder to decoder to obtain reconstructed sequenceCalculating reconstruction loss according to a preset loss function, and optimizing an encoder and a decoder based on the reconstruction loss; Wherein in the encoder, the sequence is first embedded using a block embedding layer Divided intoNon-overlapping subsequences, resulting in block embeddingAnd then adopting a position coding layer to carry out position coding on all the subsequences to obtain a position embedded featureThen embedding features into the locationsRandom masking to obtain masked fragment level representationsAnd an unmasked fragment level representationFinally, the fragment level representation that is not maskedI