Traffic flow prediction method based on multi-scale linear framework modeling spatiotemporal correlation

By adopting a multi-scale linear framework and a multi-layer perceptron MLP model in traffic flow prediction, combined with downsampling and segmented sampling technology, the existing spatio-time graph neural network model has been solved, and the problem of high time complexity and large memory usage has been achieved. More efficient traffic flow forecasts.

CN118212765BActive Publication Date: 2025-02-25HANGZHOU DIANZI UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311580099.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-02-25
Estimated Expiration
2043-11-24

AI Technical Summary

Technical Problem

The existing spatio-temporal graph neural network model has problems such as high time complexity and large memory usage in traffic flow prediction.

Method used

A traffic flow prediction method based on a multi-scale linear framework is proposed. Through downsampling and segmented sampling, the historical traffic sequence is converted into subsequences, and the spatiotemporal information is modeled using a framework that is completely based on multi-layer perceptron MLP, including DataMLP and SpatialMLP and TemporalMLP module.

Benefits of technology

This method captures global and local time patterns without eliminating any markup, solves the problems of inefficient time and large memory usage of traditional models, and achieves better traffic flow prediction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118212765B_ABST
    Figure CN118212765B_ABST
Patent Text Reader

Abstract

The present invention discloses a traffic flow prediction method based on multi-scale linear framework modeling of spatiotemporal association, comprising the following steps: inputting historical traffic sequences; converting historical traffic sequences into two groups of subsequences by downsampling method and segmented sampling method; extracting features from sequence data by using DataMLP module; modeling spatial correlation of sequences by using SpatialMLP module; modeling temporal correlation of sequences by using TemporalMLP module; and projecting embedded linearly to multi-step prediction results by using output layer. The above technical scheme first converts historical traffic sequences into subsequences by using downsampling and segmented sampling methods, which helps to capture global and local temporal patterns without eliminating any markers, extracts data features in subsequences by using DataMLP module, and then captures spatial correlation and temporal correlation respectively by using SpatialMLP module and TemporalMLP. Finally, multi-step prediction results are obtained by using output layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of spatiotemporal data mining and traffic flow prediction. It analyzes the dynamic spatiotemporal correlation in traffic data through historical traffic data, predicts future traffic flow, and proposes a traffic flow prediction method based on multi-scale linear framework modeling of spatiotemporal correlation. Background Art

[0002] Nowadays, with the growing population and the widespread popularity of transportation, urban road networks have become increasingly complex, bringing various problems, including traffic congestion and potential risks of traffic accidents. In order to optimize traffic management, improve road safety, and reduce the burden of urban management, traffic flow forecasting has become a vital method. Use historical traffic data to build a suitable model to predict future traffic volume. In this process, the key to ensuring accurate prediction of traffic flow lies in effectively modeling the inherent spatiotemporal dynamic nature of traffic data.

[0003] In the early stage of deep learning, convolutional neural networks (CNNs) are often used to capture spatial information in grid data. However, CNNs based on grid data are not applicable due to the non-Euclidean relationships in traffic sequences. With the advancement of graph convolutional networks (GCNs), spatiotemporal graph neural networks (STGNNs) have gradually become a cutting-edge method in the field of traffic prediction. STGNNs combine GCNs with sequence models to process spatiotemporal information. In addition, since attention mechanisms are highly efficient in capturing dynamic correlations in traffic data, they are also widely used in STGNNs.

[0004] However, since STGNNs typically have high time complexity, recent studies have explored alternative techniques to replace graph convolution operations and questioned the necessity of STGNNs. Summary of the invention

[0005] In view of the above problems, the present invention proposes a traffic flow prediction method based on multiscale linear framework modeling spatiotemporal correlation (MultiscaleMLP).

[0006] Specifically, the present invention proposes two sampling methods: downsampling and segmented sampling, and designs a framework based entirely on multi-layer perceptrons (MLPs) to model spatiotemporal information. The framework includes three MLP modules, each of which is used to extract features from the data. Finally, the multi-step prediction results are output through the output layer.

[0007] The present invention provides a traffic flow prediction method based on multi-scale linear framework modeling spatiotemporal association, which specifically includes the following steps:

[0008] Step 1: Input historical traffic sequence;

[0009] Step 2: Sampling and processing historical traffic sequences:

[0010] The historical traffic sequence is converted into two different subsequences through two sampling methods: down sampling and segment sampling.

[0011] Step 3: Modeling dynamic spatiotemporal correlations in traffic sequences:

[0012] The subsequences obtained by sampling are modeled with spatiotemporal information through a framework based on a multi-layer perceptron (MLP);

[0013] Step 4: Output the predicted traffic sequence:

[0014] The subsequences with spatiotemporal features are extracted and multi-step prediction results are output through dimension conversion and linear projection;

[0015] Preferably, in step 1, the historical traffic sequence X=(X1,...,X t ,...,X T )∈R T×N , where X t ∈R N It represents the traffic data of N nodes in the road network at time t, T represents the historical length of the historical traffic sequence, and N represents the number of traffic nodes.

[0016] Preferably, in step 2, the method for sampling and processing historical traffic sequences is designed with downsampling and segmented sampling, which helps to capture global and local time patterns without eliminating any markers. The two sampling methods convert each historical traffic sequence of length T into multiple non-overlapping subsequences of length C.

[0017] 1) Downsampling and converting historical traffic sequences:

[0018] For downsampling, each time sampling is performed at a fixed time interval, the corresponding input historical traffic sequence X is converted into a subsequence of length C:

[0019]

[0020]

[0021] Among them, down i ∈R C×N represents the i-th subsequence of downsampling. represents a subsequence of downsampled transformations. Here, if T is not divisible by C, the last time step data X is used. t Fill X.

[0022] 2) Segmented sampling and conversion of historical traffic sequences:

[0023] For segmented sampling, each time a continuous time step is sampled, the corresponding input historical traffic sequence X is converted into a subsequence of length C:

[0024]

[0025] patch i ={X 1+C×(i-1) ,X 2+C×(i-1) ,X 3+C×(i-1) ,...,X i×C},

[0026] Among them, patch i ∈R C×N Represents the i-th subsequence of segmented sampling. represents a subsequence of piecewise sampling transformations. Here, if T is not divisible by C, the last time step data X is used. t Fill X.

[0027] Preferably, in step 3, the dynamic spatiotemporal correlation method in the modeling traffic sequence is used for the subsequences obtained by the two sampling methods in step 2. and The spatiotemporal correlation is modeled through a framework based entirely on multi-layer perceptrons (MLPs). The framework contains three MLP modules, namely the data MLP module (DataMLP module), the spatial MLP module (SpatialMLP module), and the temporal MLP module (TemporalMLP module).

[0028] 1) DataMLP module:

[0029] The DataMLP module is used to extract features from the sequence. The DataMLP module consists of two parts: DataEmbedding and DataEncoder. First, X is extracted through DataEmbedding. down and X patch The two sets of subsequences are mapped to and

[0030]

[0031] Among them, Linear represents the linear layer, d d is the mapping dimension. Then use DataEncoder to extract features:

[0032]

[0033]

[0034] Among them, σ represents the ReLu activation function, Represents the output of the DataMLP module and is also the input of the SpatialMLP module.

[0035] 2) SpatialMLP module:

[0036] The SpatialMLP module is used to model the spatial correlation of the sequence. The SpatialMLP module consists of two parts: SpatialEmbedding and SpatialEncoder. First, the spatial features are embedded through SpatialEmbedding:

[0037]

[0038]

[0039] Among them, Concat represents the concatenation operation. is a learnable parameter that represents the spatial characteristics of the traffic sequence, d s is the feature dimension. For each subsequence, we share the same spatial features, so we copy E' spa parameter Get Represents a hidden representation with spatial information. Then use SpatialEncoder to extract spatial features:

[0040]

[0041]

[0042] Among them, Linear represents the linear layer, σ represents the activation function ReLu, Represents the output of the SpatialMLP module and is also the input of the TemporalMLP module.

[0043] 3) TemporalMLP module:

[0044] The TemporalMLP module is used to model the temporal correlation of the sequence. The TemporalMLP module consists of two parts: TemporalEmbedding and TemporalEncoder. Downsampling and segmented sampling help capture local and global temporal patterns. Assuming that there are K = 288 time points in a day (with a time interval of five minutes) and K' = 7 days in a week, initialize two trainable parameters and Represents the time characteristics of each time point in a day, Represents the time characteristics of each day of the week, d td and d dw is the feature dimension. Temporal features are embedded through TemporalEmbedding:

[0045]

[0046]

[0047] Among them, Concat represents the concatenation operation. Represents the following sampling subsequence X down The first time point is the index, The time feature of the time point is queried in , which represents the time feature of the starting time point in the downsampled subsequence. Since all nodes share the same time information, the time feature of the starting time point is copied N times to obtain the time feature of the starting time point of the downsampled subsequence Represents the following sampling subsequence X down The first time point is the index, The time feature of the time point is queried in , which represents the time feature of the starting week in the downsampled subsequence. Since all nodes share the same time information, the time feature of the starting week is copied N times to obtain the time feature of the starting week of the downsampled subsequence and Represents the following sampling subsequence X down The last time point is indexed, and The time feature of the time point is queried in , which represents the time feature of the end time point and the time feature of the end week in the downsampled subsequence. Since all nodes share the same time information, the time feature of the end time point and the time feature of the end week are copied N times to obtain the time feature of the end time point of the downsampled subsequence and the time characteristics of the end of the cycle and The processing method is the same as above, which represents the time characteristics of the starting time point of the segmented sampling subsequence, the time characteristics of the starting week of the segmented sampling subsequence, the time characteristics of the ending time point of the segmented sampling subsequence, and the time characteristics of the ending week of the segmented sampling subsequence. Represents a hidden representation with time information, and then uses TemporalEncoder to extract time features:

[0048]

[0049]

[0050] Among them, Linear represents the linear layer, σ represents the activation function ReLu, Represents the output of the SpatialMLP module and is also the input of the output layer.

[0051] Preferably, in step 4, the output prediction traffic sequence method is:

[0052] Transform the output in step 3 into and The dimension from Convert to Directly use linear projection to get multi-step prediction results:

[0053]

[0054] Among them, Linear represents the linear layer, rearrange represents the dimension conversion operation, represents the result of multi-step prediction, and T' represents the length of the predicted traffic sequence.

[0055] The present invention has the beneficial effects:

[0056] The present invention is a model completely based on a multi-layer perceptron (MLP), which has the function of being used for traffic flow prediction. The present invention proposes a downsampling and segmented sampling method to capture global and local temporal patterns without eliminating any markers, and designs a framework completely based on a multi-layer perceptron (MLP) to capture spatiotemporal dependencies. The framework includes three modules, namely, a DataMLP module, a SpatialMLP module, and a TemporalMLP module. The DataMLP module is used to extract data features of traffic sequences, and the SpatialMLP module and the TemporalMLP module respectively model the spatial features and temporal features of the sequences. At the same time, additional initialized trainable parameters are used to determine the spatiotemporal information of the sequence, thereby realizing a simple and effective model.

[0057] The present invention solves the problems of low time efficiency and large memory usage of traditional spatiotemporal graph neural network models; and proposes a concise model based entirely on multi-layer perceptron (MLP) to ensure its simplicity and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 Model diagram of an embodiment of a traffic flow prediction method based on multi-scale linear framework modeling of spatiotemporal associations in the present invention.

[0059] Figure 2 Schematic diagram of the traffic sequence sampling method in the implementation of the present invention. DETAILED DESCRIPTION

[0060] The following is a specific description of the traffic flow prediction method based on multi-scale linear framework modeling spatiotemporal association provided by the present invention. The present invention provides a traffic flow prediction method based on multi-scale linear framework modeling spatiotemporal association, such as Figure 1 As shown, the following steps are included:

[0061] Step 1: Input the historical traffic sequence. We use two public datasets, PEMS07 and PEMS04, for experiments. The historical traffic sequence X = (X1, X2, ..., X T )∈R T×N , X t ∈R N It represents the traffic data of N nodes in the road network at time t, T represents the historical length of the historical traffic sequence, and N represents the number of traffic nodes. Among them, the number of nodes of PEMS07 is N=883, and the number of nodes of PEMS04 is N=307. The historical traffic sequence with a historical length of T=48 is used to predict the predicted traffic sequence of T'=12.

[0062] Step 2: Sampling and processing historical traffic sequences: Figure 2 , through downsampling and segmented sampling methods, the corresponding input X is converted into a subsequence and subsequences patch i ={X 1+C×(i-1) ,X 2+C×(i-1) ,X 3+C×(i-1) ,...,X i×C}, where down i ∈R C×N represents the i-th subsequence of downsampling, patch i ∈R C×N represents the i-th subsequence of segmented sampling. If T is not divisible by C, the last time step data X is used. t Fill X. C is set to 12 in the PEMS07 and PEMS04 datasets.

[0063] Step 3: Modeling the dynamic spatiotemporal correlation in traffic sequences: The sampling processing results are used to simulate the dynamic spatiotemporal correlation of traffic data through a framework based on a multi-layer perceptron (MLP), such as Figure 1 shown.

[0064] Sub-step 3-1, DataMLP module extracts sequence data features. Through step 2, the input X is sampled and processed into X down and X patch , extract X through the DataMLP module down and Xpatch The data characteristics in .

[0065] First, use DataEmbedding to embed X down and X patch The two sets of subsequences are mapped to and

[0066] Next, use DataEncoder for feature extraction: σ represents the activation function ReLu, in, Data with sequence characteristics. and At the same time, it is used as the input of the SpatialMLP module. In the PEMS07 and PEMS04 datasets, d d Set to 32.

[0067] Sub-step 3-2, SpatialMLP module models the spatial correlation of the sequence. Through sub-step 3-1, X down and X patch Processed as and The SpatialMLP module is then used to model the spatial correlation of the sequence.

[0068] First, embed the spatial features through SpatialEmbedding: Concat represents a concatenation operation. is a learnable parameter. Since each subsequence shares the same spatial features, the copy E' spa parameter Get In the PEMS07 and PEMS04 datasets, d s Set to 32.

[0069] Then, spatial feature extraction is performed through SpatialEncoder: Linear represents the linear layer, σ represents the activation function ReLu, in, Contains spatial correlation of the sequence. It also serves as the input of the TemporalMLP module.

[0070] Sub-step 3-3, TemporalMLP module models the temporal correlation of the sequence, through sub-step 3-2, Processed for The TemporalMLP module is then used to model the temporal correlation of the sequence.

[0071] First, initialize two trainable parameters and Then with X down and X patch The first and last time points of the subsequence are indexed. and Query in To represent the time feature, and then embed the time feature through TemporalEmbedding: Concat represents a concatenation operation, where In the PEMS07 and PEMS04 datasets, d td Set to 32, K to 288, d dw Set to 32 and K' to 7.

[0072] Then, TemporalEncoder is used to extract temporal features: Linear represents the linear layer, σ represents the ReLu activation function, in, Contains time correlation of the series. It also serves as the input of the TemporalMLP module.

[0073] Step 4: Output the predicted traffic sequence method: Output the output in step 3 The dimension from Convert to Then the multi-step prediction results are obtained through linear projection: Linear represents a linear layer. It represents the result of multi-step traffic flow prediction. In the PEMS07 and PEMS04 datasets, T' is set to 12.

[0074] The experiments on real data sets in this embodiment show that the traffic flow prediction method based on multi-scale linear framework modeling of spatiotemporal associations shows better performance than traditional models, and its indicators (MAE, RMSE and MAPE, the smaller the better) on multiple traffic data sets all exceed traditional traffic flow prediction algorithms.

[0075] Set model training parameters:

[0076] Batch_Size = 64, indicating the amount of data for each training batch;

[0077] learning_rate = 0.002, learning rate;

[0078] weight decay = 0.0001, weight decay;

[0079] epochs = 100, the maximum number of iterations;

[0080] The specific performance is as follows:

[0081]

[0082] Among them, PeMS07 and PeMS04 are two public real datasets. MultiscaleMLP is an invention method. The best results are in bold and the second best results are underlined.

[0083] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments including components are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.

Claims

1. A traffic flow prediction method based on multi-scale linear framework modeling of spatiotemporal correlation, characterized in that: The following steps are involved: Step 1: Obtain a historical traffic sequence, wherein the historical traffic sequence X = (X1, ..., X t , ..., X T )∈R T×N , X t ∈R N represents the traffic data of N nodes in the road network at time t, T represents the historical length of the historical traffic sequence, and N represents the number of traffic nodes; Step 2: Convert the historical traffic sequence into two different subsequences through two sampling methods: down sampling and segmented sampling; Each historical traffic sequence of length T is converted into multiple non-overlapping subsequences of length C by downsampling; The downsampling method is: For downsampling, each time sampling is performed at a fixed time interval, the corresponding input historical traffic sequence X is converted into a subsequence of length C: Among them, down i ∈R C×N represents the i-th subsequence obtained by downsampling, represents a subsequence of downsampled transformations. If T is not divisible by C, the last time step data X is used. t Fill X; The segmented sampling method is: For segmented sampling, each time a continuous time step is sampled, the corresponding input historical traffic sequence X is converted into a subsequence of length C: patch i ={X 1+C×(i-1) ,X 2+C×(i-1) ,X 3+C×(i-1) ,…,X i×C }, Among them, patch i ∈R C×N represents the i-th subsequence obtained by segmented sampling, Represents a subsequence of piecewise sampling conversions. If T is not divisible by C, the last time step data X is used. t Fill X; Step 3: The subsequence obtained by sampling is modeled with spatiotemporal information through a framework based on a multi-layer perceptron MLP, wherein the framework of the multi-layer perceptron MLP includes a data MLP module, a space MLP module and a time MLP module. S3-1, take the two groups of subsequences as input and perform feature extraction through the data MLP module; The data MLP module includes a data embedding layer and a data encoder, The method for extracting features by the data MLP module is as follows: first, X is embedded in the data down and X patch The two sets of subsequences are mapped to and Among them, Linear represents the linear layer, d d is the mapping dimension; Then use the data encoder to extract features: Among them, σ represents the ReLu activation function, Represents the output of the data MLP module and is also the input of the spatial MLP module; S3-2, taking the output of the data MLP module as input, and extracting spatial features through the spatial MLP module; The spatial MLP module includes a spatial embedding layer and a spatial encoder. The method for extracting features by the spatial MLP module is as follows: first, spatial features are embedded through a spatial embedding layer: Among them, Concat represents the concatenation operation. is a learnable parameter that represents the spatial characteristics of the traffic sequence, d s is the feature dimension, and for each subsequence sharing the same spatial features, copy E′ spa parameter Get Representing hidden representations with spatial information; Then use the spatial encoder to extract spatial features: Among them, Linear represents the linear layer, σ represents the ReLu activation function, Represents the output of the spatial MLP module and is also the input of the temporal MLP module; S3-3, taking the output of the data MLP module as input, and extracting the time features through the time MLP module; The temporal MLP module includes a temporal embedding layer and a temporal encoder. The method of extracting features by the temporal MLP module is as follows: presuppose that there are K time points in a day and K′=7 days in a week, and initialize two trainable parameters and Represents the time characteristics of each time point in a day, Represents the time characteristics of each day of the week, d td and d dw is the feature dimension, and the time feature is embedded through the time embedding layer, with a hidden representation of time information: Among them, Concat represents the concatenation operation. Represents the following sampling subsequence X down The first time point is the index, Query the time feature of the time point in , which represents the time feature of the starting time point in the down-sampled subsequence; Represents the following sampling subsequence X down The first time point is the index, Query the time feature of the time point in , which represents the time feature of the starting week in the downsampled subsequence; and Represents the following sampling subsequence X down The last time point of is indexed, and Query the time feature of the time point in the downsampled subsequence, which represents the time feature of the end time point and the time feature of the end week; Represents a segmented sampling subsequence X down The first time point is the index, Query the time feature of the time point in the segmented sampling subsequence, which represents the time feature of the starting time point in the segmented sampling subsequence; Represents a segmented sampling subsequence X down The first time point is the index, Query the time feature of the time point in the segmented sampling subsequence, which represents the time feature of the starting week in the segmented sampling subsequence; and Represents a segmented sampling subsequence X down The last time point of is indexed, and The time characteristics of the time point are queried in, which represents the time characteristics of the termination time point and the termination week in the segmented sampling subsequence; Then use the time encoder to extract time features: Among them, Linear represents the linear layer, σ represents the ReLu activation function, Represents the output of the temporal MLP module, which serves as the input of the output layer; Step 4: Forecast traffic sequence through dimension conversion and linear projection output: The subsequence with extracted spatiotemporal features is directly predicted by linear projection, and the expression is as follows: Among them, Linear represents the linear layer, rearrange represents the dimension conversion operation, represents the result of multi-step prediction, T′ represents the length of the predicted traffic sequence, Represents the output of the temporal MLP module.

2. The method for predicting traffic flow based on multi-scale linear framework modeling spatiotemporal association according to claim 1 is characterized in that: The step 4 also includes converting the output in step 3 Perform dimension conversion and and The dimension from Convert to

Citation Information

Patent Citations

  • Traffic space-time sequence multi-step prediction method and system and storage medium

    CN112508173A

  • Traffic prediction system and method based on fine association mining

    CN116756206A

  • Space-time multi-granularity representation learning method for large-scale multivariate time series

    CN117036741A

  • Gesture recognition method and system based on space-time diagram convolution alternating converter

    CN117079345A