Traffic flow prediction method based on long and short term space-time diagram neural network

CN119360635AInactive Publication Date: 2025-01-24CHONGQING UNIV OF POSTS & TELECOMM
9 Cites 0 Cited by

Patent Information

Application Number
CN202411370624.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-24
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure CN119360635A_ABST
    Figure CN119360635A_ABST
Patent Text Reader

Abstract

The invention relates to a traffic flow prediction method based on a long and short term space-time diagram neural network, and belongs to the technical field of computers. The method comprises the following steps: inputting traffic flow data of a long time sequence, dividing the long time sequence into non-overlapping subsequences with equal length, and performing mask reconstruction on the subsequences in order to improve the operation efficiency of a model; the processed subsequences are respectively sent to a long-term feature extractor, a short-term feature extractor and a periodic feature extractor, the extracted features are spliced, and finally the spliced features are further processed through a multi-layer perceptron to obtain a final prediction result. According to the method, a subsequence becomes a basic unit of feature extraction, and a mask mechanism is introduced, so that the model can learn compressed subsequence representation with rich context information from a long-time sequence. Feature extraction is carried out through stacking multilayer expansion causal convolution, trend features in a long-time sequence are captured, and the problem of gradient disappearance in a traditional prediction algorithm is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology and relates to a traffic flow prediction method based on long-term and short-term spatiotemporal graph neural network. Background Art

[0002] In recent years, with the rapid development of urbanization, the number of private cars has increased sharply, and urban traffic jams are common, which is particularly evident during peak hours in the morning and evening and during holidays. The development of science and technology has provided new ideas for the problem of traffic congestion, and the intelligent transportation system is one of the effective strategies to solve this problem. Traffic flow prediction, as an important part of the intelligent transportation system, plays an indispensable role in it. According to the real-time traffic flow, the navigation software can provide users with the best driving route, and the intelligent signal control system can achieve the maximum "green wave travel" for drivers. Whether it is to disperse the traffic flow or to minimize the waiting time at traffic lights, it will greatly alleviate traffic congestion. The hot field of traffic flow prediction has attracted widespread attention in domestic and foreign academic circles and many related fields, and has achieved certain results.

[0003] Traffic flow prediction is an extremely challenging task due to its complex spatial dependencies and nonlinear temporal relationships. Traditional traffic flow prediction methods require assumptions about specific traffic data, and static, predefined network structures cannot meet the needs of dynamically changing traffic conditions. In an era of advanced sensor and data processing technologies, city managers can obtain a large amount of traffic data. With the rapid development of deep learning, methods for traffic flow prediction using deep learning and big data have emerged in an endless stream, and experiments have shown that data-driven traffic flow prediction methods based on deep learning have great potential and have become the mainstream traffic prediction method today. With the introduction of Graph Neural Network (GNN), traffic flow prediction has new possibilities. Researchers use it to model spatial dependencies in traffic networks and combine it with temporal models to extract spatiotemporal information. However, in order to obtain more accurate traffic prediction results, most existing research methods usually use short-term data for prediction, which ignores the rich temporal characteristics in long-term traffic flows. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a traffic flow prediction method based on long-term and short-term spatiotemporal graph neural network. Traffic flow has a certain periodicity, such as the morning and evening peak periods on weekdays, weekly weekends, annual holidays, winter and summer vacations, etc. There is a certain correlation and similarity in the traffic flow information during these periods. In order to more accurately improve the accuracy of the prediction, the present invention introduces a long historical sequence into the traffic flow prediction model, so that the model can make a comprehensive judgment on the traffic flow conditions with the help of long-term and short-term trend information, but the direct introduction of long historical time series will greatly affect the operation efficiency of the model. This method processes the long historical time series, first divides it into non-overlapping subsequences of equal length, and randomly masks the subsequences due to the continuity of the traffic flow sequence. The masked part can still be inferred from the unmasked part, and the subsequences are masked and reorganized, so that the model can effectively learn compressed and context-rich subsequence representations from long time series.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] The present invention provides a traffic flow prediction method using a spatiotemporal graph neural network integrating long-term and short-term time series, comprising the following steps:

[0007] S1: First, obtain the traffic flow data set, divide the traffic flow data set, and process the data;

[0008] S2: The data used in the present invention is the METR-LA dataset, which contains 207 nodes, that is, 207 sensors are used for data collection, and there are 1722 edges in total. The traffic data in the traffic flow dataset is collected at 5-minute intervals, and the total number of samples is 34272. The traffic flow dataset is divided into a training set, a validation set, and a data set in a ratio of 7:2:1;

[0009] S3: Input a long historical time series and divide it into multiple equal-length non-overlapping subsequences;

[0010] S4: The divided subsequences are fed into the subsequence temporal representation learner. This module aims to infer the content of the masked subsequence from a small number of subsequences and their temporal contexts, so that the model can effectively learn compressed and context-rich subsequence representations from long time sequences.

[0011] S5: The processed subsequences are sent to the long-term trend feature extractor, the periodic feature extractor and the short-term feature extractor respectively. Due to the periodicity of traffic flow data, a higher weight is given to the periodic feature. In order to comprehensively consider the long-term and short-term features in the long historical sequence, the extracted features are fused to obtain the final prediction result.

[0012] The beneficial effects of the present invention are:

[0013] (1) By dividing long time series into subsequences and performing mask reconstruction, the present invention can effectively learn compressed subsequence representations with rich context information from long historical data, thereby better capturing the long-term fluctuation trend of traffic flow.

[0014] (2) The present invention integrates long-term trend characteristics, periodic trend characteristics and short-term trend characteristics, which can more comprehensively analyze the changing patterns of traffic flow and improve prediction accuracy.

[0015] (3) Compared with directly using long historical sequences for prediction, the present invention significantly improves the operating efficiency of the model through subsequence division and mask reconstruction.

[0016] (4) The present invention adopts a data-driven approach and can automatically learn the changing patterns of traffic flow without pre-defining the network structure, making it more suitable for dynamically changing traffic conditions.

[0017] (5) The present invention can be applied to intelligent transportation systems, such as traffic flow prediction, route planning, signal control, etc., to help alleviate traffic congestion and improve traffic efficiency.

[0018] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0020] Figure 1 Provides an overview of the framework of the present invention;

[0021] Figure 2 is a long-term trend feature extractor;

[0022] Figure 3 A masked subsequence converter. DETAILED DESCRIPTION

[0023] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

[0024] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0025] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0026] like Figure 1 As shown, the present invention discloses a traffic flow prediction algorithm of a long-term and short-term graph neural network, and the detailed steps are as follows:

[0027] S1: Collect traffic flow dataset;

[0028] S2: Preprocess the text data. The traffic flow dataset is divided into a training set, a validation set, and a data set in a ratio of 7:2:1 and processed.

[0029] S3: The traffic network G can be expressed as G = (V, E, A), where V represents the number of sensors in the network or the intersection of the road, and E represents the spatial distance between sensors. In this way, a traffic network can be represented by an undirected graph, and A is the adjacency matrix of the undirected graph. After defining the network, the present invention defines the traffic flow prediction problem as: given the historical traffic characteristics of H time steps, predict the traffic characteristics of the future t time steps, which is expressed by the following formula:

[0030] [Xt ,X t+1 ,X t+2 ...X t+F-1 ]=f[A,X t-H ,X t-H+1 ,X t-H+2 ...X t-1 ] (1)

[0031] In the formula represents the traffic feature matrix, where N is the feature dimension and T is the total length of the time series in the traffic flow dataset. The method proposed in this invention aims to use the time pattern in a longer historical sequence to predict future traffic flow, which is expressed by the following formula:

[0032] [X t ,X t+1 ,X t+2 ...X t+F-1 ]=f[A,X short ,X long ] (2)

[0033] X short =[X t-S ,X t-S+1 ,X t-S+2 ...X t-1 ] (3)

[0034] X long =[X t-L ,X t-L+1 ,X t-L+2 ...X t-1 ] (4)

[0035] S4: Convert the long time series X long Divide into non-overlapping subsequences. Specific implementation: convert the long history sequence X long =[X t-L ,X t-L+1 ,X t-L+2 ...X t-1 ] is divided into non-overlapping subsequences, each subsequence contains S time steps, and the number of subsequences is N = L / S.

[0036] S5: Send the subsequences processed by S4 to the subsequence temporal representation learner, and then mask 75% of the subsequences. These masked subsequences are recorded as X maxked , the remaining unmasked 25% of the subsequence is X unmasked The unmasked subsequences are fed into the representation learning model to learn the event representations of these unmasked subsequences and obtain the features S of the unmasked subsequences unmasked , through the self-supervised task head, combined with the representation S of the unmasked subsequence unmaskedand a learnable mask tag S MASK , infer and reconstruct masked subsequences Finally, the loss function To calculate the reconstructed masked subsequence and the true masked subsequence X masked The error between Figure 3 .

[0037] S6: Input the subsequence processed by S5 into the long-term trend extractor, which mainly uses one-dimensional dilated causal convolution to extract time series features. For details, refer to Figure 2 The dilated convolution expands the receptive field by adding holes in the convolution kernel. The dilated causal convolution combines the advantages of causal convolution and dilated convolution, which can not only consider the temporal causal relationship, but also effectively capture long-term dependencies. The main formula of the dilated causal convolution is as follows:

[0038]

[0039] Among them, F(s) represents the convolution result at position s, x is the input time series, x s-d·i It represents the element of the input sequence at position sd·i, f(i) is the value of the convolution kernel, d is the dilation rate, when d=1, the convolution kernel is continuous, similar to ordinary convolution, s represents the position index of the current output, and the long-term trend extractor can capture the long-term fluctuation trend more accurately in traffic flow prediction by stacking dilated convolution layers.

[0040] S7-1: The data processed by S5 is fed into the cycle trend extractor. The cycle extractor mainly uses the data from the previous day S day and the previous week week The subsequence representations of the same time period are taken as input and are respectively subjected to three different diffusion mechanisms: forward diffusion, backward diffusion, and hidden diffusion to capture spatial dependencies. The specific definitions are as follows:

[0041]

[0042]

[0043]

[0044]

[0045]

[0046] Among them, formula (6) and formula (7) are forward diffusion formulas, which are mainly used to capture the information dependency transmitted from the source node to the target node. represents the weight matrix of the k-th layer forward diffusion, S week and Sday are the subsequence representations corresponding to each week and each day, respectively, W k is the weight matrix of different layers, A adp is the adaptive diffusion matrix; Formula (8) and Formula (9) are backward diffusion formulas, which are mainly used to capture the dependency of information transmitted from the target node to the original node. represents the weight matrix of the k-th layer backward diffusion, and other symbols are similar to the forward diffusion. Formula (10) is the hidden diffusion formula, which dynamically adjusts the spatial dependency through an adaptive adjacency matrix.

[0047] S7-2: The data processed by S5 is sent to the short-term feature extractor. The short-term spatiotemporal extractor mainly uses the spatiotemporal graph neural network, which performs well in extracting short-term spatiotemporal features. It can learn features in both spatial and temporal dimensions at the same time, and can combine the two features through the spatiotemporal fusion neural architecture to capture fine-grained features. The formula is as follows:

[0048] H short =STGNN(A,X short ) (11)

[0049] Where X short is the last short-term subsequence in the long sequence, and A is the adjacency matrix.

[0050] S8: The long-term trend features, periodic trend features and short-term trend features extracted from S6 to S8 are combined to predict traffic flow. The specific implementation is as follows:

[0051]

[0052] This formula is mainly used to calculate the prediction results, where || represents the concatenation operation of features, and H long , H week , H day and H short They represent the long-term trend, weekly trend, daily trend and short-term trend features extracted by the model. These spliced ​​features are further processed by a multi-layer perceptron to obtain the final prediction result.

[0053]

[0054] This formula is the prediction process of the model, where Y = [X t ,X t+1 ,…,X t+F-1 ] represents the real traffic flow data, Θ is the learnable parameter in the model. By minimizing the absolute distance between the predicted value and the true value, the model can gradually improve the prediction accuracy.

[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.

Claims

1. A traffic flow prediction method based on long-term and short-term spatiotemporal graph neural network, characterized by: The method comprises the following steps: S1: Collect traffic flow dataset; S2: Divide the traffic flow dataset into training set, validation set and data set in a ratio of 7:2:1; S3: Convert the long time series X long Divide into multiple non-overlapping subsequences of equal length, each subsequence serves as a basic unit of model input; S4: Send the subsequences divided by S3 to the masked subsequence converter to perform masked reconstruction on the subsequences; S5: sending the subsequences processed by S4 to the long-term trend feature extractor, the periodic trend feature extractor and the short-term trend feature extractor for feature extraction respectively; S6: The long-term trend features, periodic trend features, and short-term trend features extracted by S5 are concatenated, and then these concatenated features are further processed by a multi-layer perceptron to obtain the final prediction result: Among them, || represents the concatenation operation of features, H long , H week , H day and H short They represent the long-term trend, weekly trend, daily trend and short-term trend features extracted by the model respectively. MLP is a multi-layer perceptron. The final prediction result is obtained by processing these spliced ​​features through the multi-layer perceptron: in, is the loss function; Y = [X t , X t+1 , ..., X t+F-1 ] represents the real traffic flow data, Θ is the learnable parameter in the model, which improves the prediction accuracy by minimizing the absolute distance between the predicted value and the true value.

2. The traffic flow prediction algorithm based on long-term and short-term spatiotemporal graph neural network according to claim 1 is characterized by: In S4, the working process of the mask subsequence converter is as follows: S4-1: Randomly mask 75% of the input subsequences and feed the remaining unmasked 25% subsequences into the representation learning model; S4-2: Through the self-supervised task head, the representation of the unmasked subsequence and the learnable mask label are combined to infer and reconstruct the masked subsequence; S5-3: Finally, use the loss function The error between the reconstructed masked subsequence and the true masked subsequence is calculated.

3. The traffic flow prediction algorithm based on long-term and short-term spatiotemporal graph neural network according to claim 1 is characterized by: In S5, the long-term trend feature extractor captures the long-term fluctuation trend in traffic flow prediction by stacking multiple layers of dilated causal convolutional layers.

4. The traffic flow prediction algorithm based on long-term and short-term spatiotemporal graph neural network according to claim 3 is characterized by: The dilated causal convolution layer expands the receptive field by adding holes in the convolution kernel. The formula of the dilated causal convolution is as follows: Among them, F(s) represents the convolution result at position s, x is the input time series, x s-d·i It represents the element of the input sequence at position sd·i, f(i) is the value of the convolution kernel, d is the dilation rate, when d=1, the convolution kernel is continuous, and s represents the position index of the current output.

5. The traffic flow prediction algorithm based on long-term and short-term spatiotemporal graph neural network according to claim 1 is characterized by: In S5, the periodic trend feature extractor uses the information from the previous day S day and the previous week week The subsequence representations of the same time period are taken as input and are respectively subjected to three different diffusion mechanisms: forward diffusion, backward diffusion, and hidden diffusion to capture spatial dependencies. The specific definitions are as follows: Among them, the first and second formulas are forward diffusion formulas, which are used to capture the information dependency transmitted from the source node to the target node; H week represents the subsequence characteristics within a week, H day represents the subsequence features within a day, represents the weight matrix of the k-th layer forward diffusion, S week and S day are the subsequence representations corresponding to each week and each day, respectively, W k are the weight matrices of different layers, represents the k-th layer adaptive adjacency matrix; the third and fourth formulas are backward diffusion formulas, which are used to capture the dependency of information transmitted from the target node to the source node. represents the weight matrix of the k-th layer backward diffusion; the fifth formula is the hidden diffusion formula, which dynamically adjusts the spatial dependency through an adaptive adjacency matrix; Softmax is the activation function used for normalization to ensure that the output is a probability distribution, and ReLU is the activation function used to introduce nonlinear features; E1 represents the embedding vector of the source node; E2 represents the embedding vector of the target node, and the correlation between the source node and the target node is captured by the inner product calculation of E1 and E2, which is used to measure the similarity or dependency between the two nodes in the embedding space; the calculated inner product is passed through the ReLU activation function to weaken or remove the weak dependency between the nodes, retaining the strong spatial dependency, and then the result after Relu is normalized through Softmax to generate the adaptive adjacency matrix A adp ,The role of Softmax is to convert the result into a probability distribution in order to represent the degree of spatial dependence between nodes, A adp The matrix is ​​used to capture the information transfer and dependencies between nodes.

Citation Information

Patent Citations

  • Multi-component fusion traffic flow prediction method based on graph neural network

    CN115346372A

  • Traffic flow prediction method and electronic equipment

    CN115705339A

  • Traffic prediction method based on attention reconstruction neural network

    CN116959269A

  • Knowledge-driven traffic prediction method based on knowledge representation model and graph neural network

    CN117116048A

  • Robust multivariate time sequence anomaly detection model

    CN117421666A