Traffic flow prediction method combining spatial multi-scale and time series multi-granularity structure

By combining spatial multi-scale and temporal multi-granularity graph neural network models, the shortcomings of existing traffic flow prediction models in feature fusion across spatial and temporal scales are addressed, achieving more efficient traffic flow prediction, especially accurate prediction at the urban area scale.

CN117173880BActive Publication Date: 2025-12-26CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310920561.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-26
Publication Date
2025-12-26
Estimated Expiration
2043-07-26

AI Technical Summary

Technical Problem

Existing traffic flow prediction models mainly focus on mining the correlation of a single spatiotemporal scale or multiple spatial scales, neglecting the cross-spatiotemporal scale characteristics and fusion of traffic flow data. This results in poor prediction performance over long distances and long periods, especially insufficient prediction at the urban area scale.

Method used

A traffic flow prediction method combining spatial multi-scale and temporal multi-granularity is adopted. A multi-scale spatiotemporal mining module is designed through a graph neural network model to capture information at multiple time and spatial scales. Features are extracted using graph convolutional networks and long short-term memory networks, and multi-time scale information is fused through an attention mechanism to generate accurate traffic flow prediction values.

Benefits of technology

It effectively improves the accuracy and efficiency of traffic flow prediction, especially at the urban scale, it can better observe the macro traffic conditions, assist in the allocation of traffic resources, and make up for the shortcomings of traditional models in feature fusion across time and space scales.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173880B_ABST
    Figure CN117173880B_ABST
Patent Text Reader

Abstract

The application provides a traffic flow prediction method combining spatial multi-scale and time sequence multi-granularity structure, and belongs to the field of space-time data mining. First, the original data is preprocessed, and a suitable space-time aggregation method is selected to obtain multi-space scale data and multi-granularity time sequence data. Second, the multi-space scale data under the time sequence granularity of the original data is input into a multi-space feature mining module to learn and fuse the multi-scale space correlation between traffic units. Then, the multi-time sequence granularity data under the multi-space scale is input into a multi-time feature mining module to learn and fuse multi-granularity traffic time information. Finally, a multi-time and space feature fusion module is used to effectively aggregate the multi-space scale and multi-time traffic mode features, and output the final prediction result. Compared with the traditional method in the embodiment, the application has obvious advantages in prediction accuracy, can effectively improve the traffic flow prediction efficiency, and can realize efficient prediction.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of spatial data mining, and particularly relates to a traffic flow prediction method combining spatial multi-scale and time sequence multi-granularity structures. BACKGROUND

[0002] Intelligent Transportation Systems (ITS) is a comprehensive transportation and management system that integrates information technology, Internet of Things technology and other high-tech technologies, and is the development trend of modern urban traffic management system, and is crucial to the construction of smart city. China's road infrastructure construction is perfect, and the transportation system is equipped with a large number of sensors, which can collect massive spatio-temporal data such as traffic flow, vehicle speed, road occupancy rate, etc. A solid data foundation is laid for the construction of intelligent transportation systems, making traffic control based on accurate data analysis possible. How to use the collected dynamic spatio-temporal data and intelligent analysis methods to improve the efficiency of the transportation system is one of the important research topics of modern transportation system development.

[0003] Traffic flow prediction based on historical traffic data is the basis for the construction of intelligent transportation systems. On the one hand, timely and effective traffic flow prediction can more reasonably plan travel routes and provide guidance for residents' travel, improving residents' travel experience. On the other hand, traffic prediction at different spatio-temporal scales can provide technical support for the government in the promotion of traffic resource allocation, signal control network construction, etc.

[0004] Traffic flow data is a special time series data, and traffic flow prediction can be modeled as a sequence prediction function, that is, given the flow data changes in the past period, the flow data in the next period is predicted. As early as the 1970s and 1980s, researchers tried to use simple statistical methods to carry out prediction work. HA (historical average model), ARMA (autoregressive moving average model) and other classical statistical algorithms were introduced into traffic flow prediction work. In addition, some scholars also used machine learning methods such as support vector machine (SVR), K-nearest neighbor (KNN) to establish prediction models. Due to the complex spatio-temporal characteristics of traffic flow data, statistical models and machine learning models have certain limitations and cannot adapt to more complex application scenarios. The development of hardware devices and the improvement of deep learning technology have brought new opportunities for traffic flow prediction work. A large number of experimental results prove that the deep learning method is the optimal solution to solve the traffic flow prediction problem.

[0005] Although the traffic flow prediction model is constantly breaking through, some deficiencies have not been solved, and the existing prediction model has not made significant progress in learning the characteristics of traffic data over a long distance and a long period. The above research mainly focuses on the traffic flow change under a single spatio-temporal scale, or only mines the correlation of multiple spatial scales, ignoring the cross spatio-temporal scale characteristics of traffic flow data and its fusion method.

[0006] In recent years, a large number of prediction models have focused on the flow prediction at the road network arc segment scale, i.e., the fine-grained scale, while ignoring the traffic conditions at the city region scale, i.e., the coarse-grained scale. However, in actual business applications, the flow prediction at the city region scale is also indispensable, which can help the government better observe the macro traffic conditions and better allocate urban traffic resources. In addition, there is a certain correspondence between coarse-grained data and fine-grained data, and the fine-grained data covered in the same coarse-grained data node often have stronger spatial correlation. Combined with the characteristics of coarse-grained data, the fine-grained data can learn more macro traffic information to achieve better prediction results. Considering the high correlation between traffic data of different spatial scales, due to the high correlation between fine-grained and coarse-grained flows, the feature learning of the two data scales needs to be jointly performed rather than separately. How to map the spatial features of multiple scales to a common latent space and reasonably fuse them together is a highly challenging problem. While some models have noticed the importance of multi-scale spatial information, they have ignored the correlation of multi-scale graph data in structure. In addition, while some models have considered multi-scale grid information in the Euclidean plane space, they have ignored the interactive modeling of traffic flow in the multi-scale graph structure. Since traffic data often exhibits spatial dependence relationships in non-Euclidean graph structures, traffic feature learning based on multi-scale graph structures has good technical innovation potential.

[0007] The feature information contained in traffic data of different time scales is not the same. Most prediction models only learn the time series information at a single scale, while ignoring the interaction of multi-scale information. On the one hand, the time series features of coarse-grained data are relatively rough, losing a large amount of detailed information compared to the time series features of fine-grained data. On the other hand, when learning long-period features, fine-grained data often needs to be iterated for multiple steps. In contrast, under the coarse-grained unit, the number of iterations required to propagate the same period of information is greatly reduced, which reduces the number of propagation layers and also reduces the information loss in the iteration process. There is currently no traffic flow prediction model that can simultaneously fuse spatial multi-scale and time series multi-granularity structures, so it is difficult for related research to consider multi-scale spatio-temporal structures to carry out accurate flow prediction. SUMMARY

[0008] In order to solve the problems of the prior art, the application provides a traffic flow prediction method combining spatial multi-scale and time sequence multi-granularity structures, which is based on a graph neural network model, and through the design of a multi-scale space-time mining module, multi-time scale information and multi-space scale dependent information can be captured, so that the cross-space-time scale characteristics of data can be learned.

[0009] The application adopts the technical scheme that a traffic flow prediction method combining spatial multi-scale and time sequence multi-granularity structures is provided, and the method comprises the following steps:

[0010] S1, the original input data of a training data set is fine spatial granularity traffic data, and the topological relationship between sensors is stored in the form of a graph G f For the fine spatial granularity traffic data G f , the traffic data collected by the i-th sensor represented by any node i within a set time is a signal value sequence, and the signal value is expressed as where T1 represents the total time step of the fine time granularity data, and the q-th element represents the sum of signal values collected within the q-th time step, and the sequence information of all nodes constitutes the total sequence information X f of the fine spatial fine time granularity N , and N is the number of fine spatial granularity nodes.

[0011] The fine spatial granularity traffic data G f is preprocessed to obtain urban area scale traffic data, i.e., coarse spatial granularity traffic data G c , and a mapping matrix A f from the fine spatial granularity traffic data G c to the coarse spatial granularity traffic data G fc is obtained. The number of nodes of the coarse spatial granularity traffic data G c is M, and the traffic data collected by the sensor represented by any node i in the coarse spatial granularity traffic data G c is expressed as after preprocessing, and the q-th element represents the signal value within the q-th time step after preprocessing, and the sequence information of all nodes constitutes the total sequence information of the coarse spatial fine time granularity. The fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c constitute multi-space scale traffic data.

[0012] S2, the multi-space scale traffic data is fine time granularity data, and the fine spatial granularity traffic data G fG is obtained by aggregating the traffic data of the sensors represented by the nodes in the fine spatial granularity traffic data G f G' is obtained by aggregating the traffic data of the sensors represented by the nodes in the fine spatial granularity traffic data G T2 represents the total time step of the coarse time granularity data, and the qth element of any node i is represented as X'q represents the signal value in the qth time step after aggregation, and the sequence information of all nodes constitutes the total sequence information X' of the fine spatial coarse time granularity f G' = {X'1, X'2,..., X' T2} ; N G' = {X'1, X'2,..., X' T2} ;

[0013] G is obtained by aggregating the traffic data of the sensors represented by the nodes in the fine spatial granularity traffic data G c G is obtained by aggregating the traffic data of the sensors represented by the nodes in the fine spatial granularity traffic data G c G' is obtained by aggregating the traffic data of the sensors represented by the nodes in the fine spatial granularity traffic data G T2 represents the total time step of the coarse time granularity data, and the qth element of any node i is represented as X'q represents the signal value in the qth time step after aggregation, and the sequence information of all nodes constitutes the total sequence information X' of the fine spatial coarse time granularity

[0014] S3, the fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c are processed by the multi-space scale neural network module and the spatio-temporal features of the multi-space scale data are fused to obtain the multi-space granularity output result;

[0015] S4, the fine spatial granularity traffic data G f and the fine spatial coarse time granularity traffic data G f ', and the coarse spatial granularity traffic data G c and the coarse spatial coarse time granularity traffic data G c ' are respectively processed by the multi-time scale neural network module and the spatio-temporal features of the multi-time scale data are fused to obtain the fine time granularity output result under the corresponding spatial scale;

[0016] S5, the multi-space granularity output result and the fine time granularity output result are fused by the output fusion layer, the output results under the same spatial scale are respectively fused, the multi-time space feature information is exchanged, and the traffic flow prediction value is output;

[0017] S6, the average absolute error average value between the traffic flow prediction value and the actual flow value of the training data set is taken as the loss function, and the Adam optimizer is used for training to obtain the trained traffic flow prediction model combining the spatial multi-scale and time sequence multi-granularity structure;

[0018] S7, input the actual traffic data into the trained traffic flow prediction model combined with the spatial multi-scale and time multi-granularity structure, and complete traffic flow prediction.

[0019] In step S1, the Louvain community discovery algorithm is used to optimize the modularity and process the network condensation, and the fine spatial granularity traffic data G f is aggregated to obtain the coarse spatial granularity traffic data G c , and the corresponding mapping matrix A fc is generated.

[0020] In step S2, the fine spatial granularity traffic data G f is aggregated to obtain the coarse spatial granularity traffic data G , and the total sequence information collected by any node i is calculated by a summation formula to obtain the coarse time granularity flow data , which constitutes the sequence information X' of all nodes of the fine spatial coarse time granularity traffic data G f ′. c ={X′1,X′2,...,X′ M}, and the summation formula is:

[0021]

[0022] p=T c / T f

[0023] wherein n is a preset time step of coarse granularity data, T c is a preset time scale of coarse granularity data, T f is a preset time scale of fine granularity data, and T c is an integer multiple of T f , that is, p is an integer, and (t-n*p)>0.

[0024] The aggregation process of the coarse spatial granularity traffic data G c is the same as that of the fine spatial granularity traffic data G f .

[0025] Step S3 specifically includes the following steps:

[0026] S3.1, input the fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c into the graph convolution network layer of the multi-space scale neural network module respectively to extract the spatial features of the data;

[0027] S3.2, input the output results in step 3.1 into a time attention layer respectively to extract the time features of the data;

[0028] S3.3, obtaining the mapping matrix A by means of step S1 fc , through a multi-scale feature fusion layer of the multi-space scale neural network module, the interaction of data features of multiple space scales is realized through the following formula:

[0029] S c =X cout +η1·softmax(A fc X fout W c )

[0030]

[0031] Wherein X cout and X fout are the fine space granularity traffic data G f and the coarse space granularity traffic data G c corresponding to the graph node in the input of this layer, that is, the output value of step S3.2, c represents the number of traffic features contained in the data, η1 and η2 are the first hyperparameter and the second hyperparameter respectively, both of which are set to 0.5, W c and W f are the first learnable parameter matrix and the second learnable parameter matrix respectively, initialized as zero matrix S c and S f are the coarse space granularity fusion result and the fine space granularity fusion result output by this layer respectively.

[0032] Step S4 specifically comprises the following steps:

[0033] Step S4.1, the coarse space granularity traffic data G c and the coarse space coarse time granularity traffic data G c ′ are input into an LSTM layer to learn the time features of the data, and the fine time granularity output result H c and the coarse time granularity output result H′ c are obtained;

[0034] Step S4.2, the multi-time scale output result obtained in step 4.1 is input into a multi-time scale fusion module based on spatial attention, to supplement the coarse granularity data features for the fine granularity prediction result, and finally output the fine time granularity prediction result H c under the coarse space granularity;

[0035] Step S4.3, the fine space granularity traffic data G f and the fine space coarse time granularity traffic data G f ′ are input into an LSTM layer to learn the time features of the data, the fine time granularity output result and the coarse time granularity output result H fand H' f ;

[0036] Step S4.4, input the multi-time scale output result obtained in step 4.3 into a multi-time scale fusion module based on spatial attention, and output a fine time granularity prediction result H under a fine spatial granularity f .

[0037] Step S4.2 specifically includes the following steps:

[0038] S4.2.1, calculate the correlation of the multi-time scale output result through a spatial attention layer to obtain a fusion value O of coarse granularity data relative to fine granularity data, and the specific formula is:

[0039] Q = H c ·w q

[0040] K = H c ·w k

[0041] V = H c ·w v

[0042] O = softmax(Q·(K) T )·V

[0043] w q , w k and w v are the third trainable parameter, the fourth trainable parameter and the fifth trainable parameter respectively, and the initialization is all zero matrix, H c and H c are the input fine time granularity data and coarse time granularity data respectively, Q and K are the feature matrix of the fine time granularity data and the feature matrix of the coarse time granularity data for calculating the similarity, and V only contains the input coarse time granularity information.

[0044] S4.2.2, add the calculated fusion value to the output of the previous layer fine time granularity data to obtain the final output of step 4.2, and the specific formula is:

[0045] H c = O c + H c

[0046] H c is the coarse spatial granularity output under the corresponding spatial granularity.

[0047] Step S5 specifically includes the following steps:

[0048] S5.1, splice the output results under the same spatial scale in the time dimension to obtain two long vectors;

[0049] S5.2, linearly transform the long vector through a fully connected layer, and output a traffic flow prediction value.

[0050] The present application has the beneficial effects of the technical scheme in that:

[0051] The present application is directed to the deficiencies of the prior art traffic flow prediction methods, which mainly study the traffic flow changes at a single space-time scale, or only mine the correlation of multiple time (space) scales, while ignoring the cross-space-time scale characteristics of traffic flow data. A traffic flow prediction method combining spatial multi-scale and time series multi-granularity is proposed. An effective framework is designed to capture multiple time scale information and multiple spatial scale information by designing a multi-scale spatiotemporal mining module. The following methods are used to achieve this: (1) based on graph neural networks, a neural network module for interactive spatial multi-scale features is designed by combining the high correlation between multi-scale spatial data; (2) based on attention mechanism, a spatiotemporal attention module that integrates multiple time scale information is proposed by combining the spatiotemporal correlation of multi-time scale data. BRIEF DESCRIPTION OF DRAWINGS

[0052] Figure 1 is the total flow chart of the traffic flow prediction model combining spatial multi-scale and time series multi-granularity.

[0053] Figure 2 is the structure diagram of Louvain community discovery algorithm.

[0054] Figure 3 is the comparison diagram of single spatial scale traffic flow prediction algorithm structure and multi-spatial scale traffic flow prediction algorithm structure, wherein Figure 3 (a) is the single spatial scale traffic flow prediction algorithm structure diagram, Figure 3 (b) is the multi-spatial scale traffic flow prediction algorithm structure diagram.

[0055] Figure 4 is the comparison diagram of fine spatial granularity data and coarse spatial granularity data, wherein Figure 4 (a) is a fine spatial granularity data example diagram, Figure 4 (b) is a coarse spatial granularity data example diagram.

[0056] Figure 5 is the comparison diagram of multi-spatial scale neural network module algorithm structure and multi-time scale neural network module algorithm structure, wherein Figure 5 (a) is the multi-spatial scale neural network module algorithm structure diagram, Figure 5 (b) is the multi-time scale neural network module algorithm structure diagram.

[0057] Figure 6is a schematic diagram of traffic flow changes of short time steps (fine time granularity) compared with traffic flow changes of long time steps (coarse time granularity), wherein Figure 6 (a) is a traffic flow change diagram of short time steps (fine time granularity), Figure 6 (b) is a traffic flow change diagram of long time steps (coarse time granularity).

[0058] Figure 7 is an example diagram of 5 mins prediction results of PEMS D4 dataset.

[0059] Figure 8 is an example diagram of 15 mins prediction results of PEMS D4 dataset.

[0060] Figure 9 is an example diagram of 30 mins prediction results of PEMS D4 dataset.

[0061] Figure 10 is an example diagram of loss function of PEMS D4 dataset. DETAILED DESCRIPTION

[0062] The application will be further described below in conjunction with the accompanying drawings and examples. The examples described below by referring to the accompanying drawings are exemplary and are only used to explain the application, and cannot be understood as a limitation of the application.

[0063] The application provides a traffic flow prediction method combining spatial multi-scale and time sequence multi-granularity structures, referring to Figure 1 , which is realized through four basic steps of necessary preprocessing of traffic flow dataset, multi-space scale neural network module processing, multi-time scale neural network module processing and output fusion layer processing. Referring to Figure 1 , specifically comprising the following steps:

[0064] S1, set the original input data of the training dataset as fine spatial granularity traffic data, and the topological relationship between each sensor is stored in the form of a graph represented as G f ={V f ,E f ,A f}, V f ={v1,v2,...,v N} is a fine spatial granularity node set, E f is an edge set of the fine spatial granularity graph, is an adjacency matrix of the fine spatial granularity graph data. For the fine spatial granularity traffic data G f , the traffic data collected by the i-th sensor represented by any node i in a set time is a signal value sequence, and the signal value in the total sequence information is represented as wherein T1 represents the total time step of fine temporal granularity data, and any qth element represents the signal value collected in the qth time step, and the sequence information of all nodes constitutes the total sequence information X of fine spatial fine temporal granularity f = {X1, X2,..., X N}.

[0065] The fine spatial granularity traffic data G f is preprocessed to obtain the urban regional scale traffic data, i.e., coarse spatial granularity traffic data G c , and the mapping matrix A f from the fine spatial granularity traffic data G c to the coarse spatial granularity traffic data G fc ; the number of nodes of the coarse spatial granularity traffic data G c is M, and in the coarse spatial granularity traffic data G c , the total sequence information of the traffic data collected by the sensor represented by any node i after preprocessing is expressed as any qth element represents the signal value in the qth time step after preprocessing, and the sequence information of all nodes constitutes the total sequence information X of coarse spatial fine temporal granularity The fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c constitute multi-spatial scale traffic data.

[0066] Referring to Figure 2 , the Louvain community discovery algorithm can be specifically used, and the coarse spatial granularity traffic data G f is aggregated from the fine spatial granularity traffic data G c through modularity optimization and network condensation processing, and the corresponding mapping matrix A fc is generated.

[0067] S2, the multi-spatial scale traffic data are all fine temporal granularity data, and the fine spatial granularity traffic data G f is aggregated to obtain the fine spatial coarse temporal granularity traffic data G f ', wherein the traffic data of the sensor represented by any node i is fine spatial coarse temporal granularity flow data T2 represents the total time step of coarse temporal granularity data, and any qth element represents the signal value in the qth time step after aggregation, and the sequence information of all nodes constitutes the total sequence information X of fine spatial coarse temporal granularity f = {X'1, X'2,..., X' N}.

[0068] Coarse spatial granularity traffic data G c Coarse spatial granularity traffic data G c is obtained by aggregating traffic data of all nodes T2 represents the total time step of coarse time granularity data, and the qth element of any node i represents the aggregated coarse spatial coarse time granularity traffic data Xq represents the signal value in the qth time step after aggregation, and the sequence information of all nodes constitutes the total sequence information of fine spatial coarse time granularity

[0069] For fine spatial granularity traffic data G f , the total sequence information collected by any node i The coarse time granularity traffic data can be calculated by a summation formula The sequence information X' of all nodes constituting the fine spatial coarse time granularity traffic data G f ' c ={X'1,X'2,...,X' M}, and the summation formula is:

[0070]

[0071] p=T c / T f

[0072] Wherein, n is the preset time step of coarse granularity data, T c is the preset time scale of coarse granularity data, T f is the preset time scale of fine granularity data, T c is an integer multiple of T f , that is, p is an integer, and (t-n*p)>0.

[0073] Coarse spatial granularity traffic data G c is aggregated in the same way as fine spatial granularity traffic data G f .

[0074] S3, the fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c are processed by a multi-space scale neural network module and the spatio-temporal features of multi-space scale data are fused to obtain multi-space granularity output results. Specifically, the following steps are included:

[0075] S3.1, the fine spatial granularity traffic data G f and the coarse spatial granularity traffic data G c are respectively input into the graph convolution network layer of the multi-space scale neural network module to extract the spatial features of the data;

[0076] S3.2, input the output results in step 3.1 into a time attention layer respectively to extract the time features of the data;

[0077] S3.3, by means of the mapping matrix A obtained in step S1 fc , a multi-scale feature fusion layer of a multi-space scale neural network module is used to realize the interaction of data features of multiple space scales through the following formula:

[0078] S c =X cout +η1·softmax(A fc X fout W c )

[0079]

[0080] Wherein X cout and X fout are the fine space granularity traffic data G f and the coarse space granularity traffic data G c corresponding to the graph node in the input of this layer, that is, the output value of step S3.2, c represents the number of traffic features contained in the data, η1 and η2 are the first hyperparameter and the second hyperparameter respectively, both of which are set to 0.5, W c and W f are the first learnable parameter matrix and the second learnable parameter matrix respectively, initialized as zero matrix S c and S f are the coarse space granularity fusion results and the fine space granularity fusion results output by this layer respectively.

[0081] S4, the fine space granularity traffic data G f and the fine space coarse time granularity traffic data G f ', and the coarse space granularity traffic data G c and the coarse space coarse time granularity traffic data G c ' are processed by a multi-time scale neural network module and the space-time features of the multi-time scale data are fused to obtain the fine time granularity output results under the corresponding space scale. Specifically, the following steps are included:

[0082] Step S4.1, the coarse space granularity traffic data G c and the coarse space coarse time granularity traffic data G c ' are processed by an LSTM layer to learn the time features of the data, and the fine time granularity output results H c and the coarse time granularity output results H' c are obtained.

[0083] Step S4.2, input the multi-time scale output result obtained in step 4.1 into a multi-time scale fusion module based on spatial attention, to supplement the coarse-grained data features for the fine-grained prediction result, and finally output the fine-time-grained prediction result under the coarse spatial granularity H c . Specifically, the following steps are included:

[0084] S4.2.1, calculate the correlation of the multi-time scale output result through a spatial attention layer to obtain the fusion value O of the coarse-grained data relative to the fine-grained data, and the specific formula is:

[0085] Q = H c · w q

[0086] K = H' c · w k

[0087] V = H' c · w v

[0088] O = softmax(Q·(K) T )·V

[0089] w q , w k and w v are the third trainable parameter, the fourth trainable parameter and the fifth trainable parameter respectively, and the initializations are all zero matrices, H c and H' c are the input fine-time-grained data and coarse-time-grained data respectively, Q and K are the feature matrix of the fine-time-grained data and the feature matrix of the coarse-time-grained data for calculating the similarity, and V only contains the input coarse-time-grained information;

[0090] S4.2.2, add the calculated fusion value to the output of the previous layer of fine-time-grained data to obtain the final output of step 4.2, and the specific formula is:

[0091] H c = O c + H c

[0092] H c is the coarse spatial granularity output corresponding to the spatial granularity.

[0093] Step S4.3, pass the fine spatial granularity traffic data G f and the fine spatial coarse-time-grained traffic data G' f through an LSTM layer to learn the time features of the data, and output the fine-time-grained output result and the coarse-time-grained output result H f and H'f .

[0094] Step S4.4, input the multi-time scale output result obtained in step 4.3 into a multi-time scale fusion module based on spatial attention, and output a fine time granularity prediction result H under a fine spatial granularity f .

[0095] S5, fuse the multi-space granularity output result and the fine time granularity output result through an output fusion layer, fuse the output results under the same spatial scale respectively, interact multi-time and space feature information, and output a traffic flow prediction value. Specifically, the following steps are included:

[0096] S5.1, splice the output results under the same spatial scale in the time dimension to obtain two long vectors;

[0097] S5.2, perform linear transformation on the long vectors through a fully connected layer to output the traffic flow prediction value.

[0098] S6, take the average absolute error average value between the traffic flow prediction value and the actual traffic value of the training data set as a loss function, train the loss function using an Adam optimizer, and obtain a trained traffic flow prediction model combining spatial multi-scale and time sequence multi-granularity structures;

[0099] S7, input actual traffic data into the trained traffic flow prediction model combining spatial multi-scale and time sequence multi-granularity structures to complete traffic flow prediction.

[0100] In the embodiment, the two highway data sets PeMSD4 and PeMSD08 of California are processed according to the above steps:

[0101] I. Raw data collection and preprocessing

[0102] The data used in the embodiment is aggregated every five minutes, that is, each sensor contains 288 data per day, and only contains a total flow feature. The PeMSD4 data set contains 307 sensors, and the time span is from January 2018 to February 2018. The PeMSD8 data set contains 170 sensors, and the time span is from July 2016 to August. In the experiment, we use the first 60% of the data as the training set, 20% of the data as the validation set, and the last 20% of the data as the test set. Single training, model input data set includes (take PEMS D4 data as an example): X = {x1, x2,..., x t}(original fine-grained data set), (original fine-grained data adjacency matrix), X c = {x c1 ,x c2 ,...,x ct}(coarse-grained dataset), (coarse-grained data adjacency matrix), and (mapping matrix).

[0103] After processing by the Louvain community discovery algorithm, the new dataset corresponding to PeMSD4 contains 31 communities, and the new dataset corresponding to PeMSD8 contains 15 communities. In addition, we pre-process the dataset by means of maximum and minimum normalization, and the data obtained after pre-processing is between 0 and 1. The specific formula is x' = (x-x min ) / (x max -x min ), x max and x min are the maximum and minimum values in the test set, respectively.

[0104] II. Multi-space-scale feature modeling

[0105] As shown in Figure 3 , the present application learns the cross-scale spatio-temporal features of the data by supplementing the coarse spatial granularity data features. Compared with the traditional single space-scale feature modeling prediction method, the multi-space-scale feature modeling method used in the present application can map the spatial features of multiple scales into a common latent space and reasonably fuse them together.

[0106] As shown in Figure 4 , there is usually a mapping relationship between fine-grained data and coarse-grained data, and the fine-grained nodes that can be mapped to the same coarse-grained node usually have a more close spatial relationship, that is, the coarse-grained data can also be regarded as a traffic community aggregated by a group of traffic nodes with similar traffic conditions. In the embodiment, the present application first extracts the spatial features of the data through the GCN layer (graph convolutional neural network layer), and then extracts the time features of the data through a Time Attention layer (time self-attention layer), respectively, and finally aggregates the spatio-temporal features under multiple space scales through a fusion module combined with the mapping matrix. The specific process is shown in Figure 5 (a).

[0107] III. Multi-time-scale feature modeling

[0108] As shown in Figure 6As shown in the figure, the same traffic data shows different trends at different time scales, and traditional prediction models only learn time series information at a single scale, ignoring the interaction of multi-scale information. The present application learns the multi-time scale information of the learning data, learns the fine-grained detailed time series information contained in the original data, and supplements the global information of coarse time granularity.

[0109] In an embodiment, the present application first inputs the input multi-time scale data at the same spatial scale into an LSTM layer (long short-term memory neural network layer) to learn its time series information, and then inputs the learned features into a multi-time scale fusion module to interact multi-time scale information. As shown in the figure, the present application simultaneously considers the learning of multi-space scale information and multi-time scale information, and needs to model multi-time scale features for data at multiple spatial scales. The specific process is as shown in the figure. Figure 1 Figure 5 (b).

[0110] Four, multi-time and space scale feature fusion

[0111] As shown in the figure, the present application innovatively proposes a traffic flow prediction framework combining multi-space scale information and multi-time granularity information. In an embodiment, the multi-space scale features and multi-time scale features obtained need to be fused to obtain the final prediction result. Figure 1

[0112] Five, results and evaluation

[0113] To evaluate the advantages of the method in traffic flow prediction, comparative experiments were conducted using statistical model HA, machine learning models ARIMA and SVR, classical deep learning baseline models GCN and LSTM, classical graph neural network traffic flow prediction models TGCN and STGCN, graph neural network traffic flow prediction model ASTGCN containing attention mechanism, graph neural network traffic flow prediction model HGCN containing multi-scale information, and recent traffic flow prediction model STG-NCDE, and the result accuracy was compared with that of the present method.

[0114] We selected the classical indicators MAPE, MAE and RMSE in the field of traffic flow prediction as evaluation criteria.

[0115]

[0116]

[0117]

[0118] ​​where y i represents the true value, represents the predicted value, and n is the number of predicted values.

[0119] The loss function of the present application considers two output results, Figure 10 The loss function of the PEMS D4 dataset is shown in the example of FIG. Figure 10 , where train represents the loss curve of the training process, test represents the loss curve of the test process, the horizontal axis represents the epoch value, and the vertical axis represents the loss value. The specific calculation formula of the loss function is as follows:

[0120]

[0121] where X T+1 is the true value of the fine-grained data, is the predicted value of the fine-grained data, X c T+1 is the true value of the coarse-grained data, is the predicted value of the coarse-grained data, and λ and η are hyperparameters.

[0122] In the embodiments, the input data is 12 time steps (60 minutes), and the traffic flow changes in the next 1 time step (5 minutes; Figure 7 ), 3 time steps (15 minutes; Figure 8 ), and 6 time steps (30 minutes; Figure 9 ) are predicted, respectively. In the example graphs of FIG. Figure 7 , Figure 8 and Figure 9 , data is the output value, target is the target value, the horizontal axis represents the xth time step of the output, and the vertical axis represents the flow value. The comparative experimental results on the datasets PEMS D4 and PEMS D8 are shown in Tables 1 and 2, respectively:

[0123]

[0124] Table 1 Comparative experimental results on the PEMS D4 dataset

[0125]

[0126] Table 2 Comparative experimental results on the PEMS D8 dataset

[0127] The experimental results prove that the highest accuracy is obtained in all comparative experiments, which shows that the traffic flow prediction method combining spatial multi-scale and time multi-granularity is always superior to the traditional method. In order to further evaluate the advantages of the method, the prediction efficiency of the model is calculated, in the embodiment, the training calculation time of HGCN, STG-NCDE and the application with the highest comprehensive prediction accuracy in the comparative model is tested respectively. The test uses the PEMS D4 data set, the input data is 12 steps, and the output data is 1 step, and the results are shown in Table 3. Although the MST-NCDE model and the HGCN model also have very excellent performance in prediction, the calculation time of prediction is much higher than the application. In general, the application can obtain higher prediction accuracy in a shorter training time, that is, the prediction efficiency is the highest.

[0128]

[0129] Table 3 Prediction efficiency comparison experiment results on PEMS D4 data set

[0130] In summary, the traffic flow prediction method combining spatial multi-scale and time multi-granularity can make up for the deficiency of the traditional method that ignores the cross-space-time scale characteristics of traffic data, and can effectively improve the prediction efficiency by simultaneously learning and fusing the spatial multi-scale characteristics and the time multi-scale characteristics of traffic data compared with the traditional method.

[0131] The specific embodiments described herein are merely illustrative of the spirit of the application. Those skilled in the art of the technical field to which the application belongs can make various modifications or supplements to the described specific embodiments or replace them with similar ways, without departing from the spirit of the application or exceeding the scope defined by the appended claims.

Claims

1. A traffic flow prediction method combining spatial multi-scale and temporal multi-granularity structures, characterized in that The method comprises the following steps: S1, the original input data of the training data set is fine spatial granularity traffic data, and the topological relationship between each sensor is stored in the form of a graph and represented as For fine spatial granularity traffic data , any node represents the first i sensor, and the traffic data collected by the sensor within a set time is a signal value sequence, and the signal value is expressed as , wherein represents the total time step of fine time granularity data, and any first q element represents the total sum of signal values collected in the first q time step, and the sequence information of all nodes constitutes the total sequence information of fine spatial and fine time granularity , is the number of fine spatial granularity nodes; fine spatial granularity traffic data Data preprocessing yields urban-scale traffic data, i.e., coarse-grained spatial traffic data. At the same time, fine spatial granularity traffic data is obtained. To coarse spatial granularity traffic data mapping matrix Coarse-grained spatial traffic data The number of nodes is M, and the traffic data is coarse-grained. In the context, for any node i The sensor represented, whose collected traffic data, after preprocessing, is described as follows: , any number q element Indicates the number of times after preprocessing. q The signal values ​​within each time step, and the sequence information of all nodes constitute the total sequence information with coarse spatial and fine temporal granularity. ; Fine spatial granularity traffic data and coarse spatial granularity traffic data Traffic data constituting a multi-spatial scale; S2, the traffic data of multiple spatial scales are fine time granularity data, and the fine spatial granularity traffic data is aggregated to obtain fine spatial coarse time granularity traffic data , wherein for any node , the traffic data of the sensor represented by the node is pre-aggregated to obtain fine spatial coarse time granularity traffic data , , wherein T represents the total time step of the coarse time granularity data, and any q , wherein the element represents the signal value in the q th time step after aggregation, and the sequence information of all nodes constitutes the total sequence information of fine spatial coarse time granularity ;​ Coarse spatial granularity traffic data Aggregate to get coarse spatial coarse time granularity traffic data , for any node The sensor represented by it, whose traffic data is aggregated to coarse spatial coarse time granularity traffic data , Total time step length representing coarse time granularity data, any q Element The signal value in the q th time step after aggregation, and the sequence information of all nodes constitutes the total sequence information of fine spatial coarse time granularity ; S3, fine spatial granularity traffic data and coarse spatial granularity traffic data The multi-spatial granularity output result is obtained by processing and fusing the space-time features of the multi-spatial scale data through the multi-spatial scale neural network module. S4, fine spatial granularity traffic data and fine spatial coarse time granularity traffic data and coarse spatial granularity traffic data and coarse spatial coarse time granularity traffic data respectively processed by the multi-time scale neural network module and fused with the spatio-temporal features of the multi-time scale data, to obtain fine time granularity output results under corresponding spatial scales respectively; S5, the multi-space granularity output result and the fine time granularity output result are fused through an output fusion layer, the output results at the same spatial scale are respectively fused, the multi-time and space feature information is exchanged, and a traffic flow prediction value is output; S6, the average absolute error average value between the traffic flow prediction value and the actual traffic flow value of the training data set is taken as a loss function, the Adam optimizer is used for training, and a trained traffic flow prediction model combining spatial multi-scale and time sequence multi-granularity structures is obtained; S7, actual traffic data is input into the trained traffic flow prediction model combining spatial multi-scale and time sequence multi-granularity structures, and traffic flow prediction is completed. 2.The traffic flow prediction method of claim 1, characterized in that: In step S1, the Louvain community detection algorithm is used to obtain the coarse spatial granularity traffic data from the fine spatial granularity traffic data through modularity optimization and network condensation processing The coarse spatial granularity traffic data is aggregated to obtain the fine spatial granularity traffic data , and a corresponding mapping matrix is generated . 3.The traffic flow prediction method of claim 1, wherein: In step S2, for fine-grained spatial traffic data any node Total sequence information collected Coarse-grained flow rate data are obtained by summation formula. This constitutes fine-grained spatial and coarse-grained temporal traffic data. Sequence information of all nodes The summation formula is as follows: , , wherein is a preset time step of coarse-grained data, is a preset time scale of coarse-grained data, is a preset time scale of fine-grained data, is an integer multiple of is an integer, .

4. The traffic flow prediction method combining spatial multi-scale and temporal multi-granularity structure according to claim 3, characterized in that: Coarse spatial granularity traffic data Fine spatial granularity traffic data The process is the same.

5. The traffic flow prediction method of claim 3, wherein: Step S3 specifically comprises the following steps: S3.1, inputting fine spatial granularity traffic data and coarse spatial granularity traffic data respectively into the graph convolution network layers of the multi-space scale neural network module to extract spatial features of the data; S3.2, the output results in step 3.1 are respectively input into a time attention layer to extract the time features of the data; S3.3, with the aid of the mapping matrix obtained in step S1 After a multi-scale feature fusion layer of the multi-space scale neural network module, the interaction of the data features of the multi-space scale is realized through the following formula: , , wherein and are the fine spatial granularity traffic data inputted by the current layer respectively and the coarse spatial granularity traffic data corresponding to the graph node in the fine spatial granularity traffic data inputted by the current layer, i.e., the output value of step S3.2, denotes the number of traffic features contained in the data, and are the first hyperparameter and the second hyperparameter respectively, both of which are set to 0.5, and are the first learnable parameter matrix and the second learnable parameter matrix respectively, which are initialized as zero matrix and are the coarse spatial granularity fusion result and the fine spatial granularity fusion result outputted by the current layer respectively.

6. The traffic flow prediction method of claim 5, wherein: Step S4 Specifically comprises the following steps: Step S4.1, obtaining coarse spatial granularity traffic data and coarse spatial coarse temporal granularity traffic data passing through an LSTM layer to learn the temporal characteristics of the data, to obtain fine temporal granularity output results and coarse temporal granularity output results ; Step S4.2, input the multi-time scale output result obtained in step 4.1 into a multi-time scale fusion module based on spatial attention, supplement the coarse-grained data features for the fine-grained prediction result, and finally output the updated fine-time granularity output result ; Step S4.3, obtaining fine spatial granularity traffic data and fine spatial coarse temporal granularity traffic data passing through an LSTM layer to learn the temporal features of the data, fine temporal granularity output results and coarse temporal granularity output results and ; Step S4.4, input the multi-time scale output result obtained in step 4.3 into a multi-time scale fusion module based on spatial attention, and output a fine time granularity prediction result under a fine spatial granularity .

7. The traffic flow prediction method of claim 5, wherein: Step S4.2 specifically comprises the following steps: S4.2.1, the multi-time scale output result is calculated by a spatial attention layer to obtain the correlation, and a fusion value of coarse-grained data relative to fine-grained data is obtained O The specific formula is: , , , , wherein , and are a third trainable parameter, a fourth trainable parameter and a fifth trainable parameter, respectively, initialized as zero matrices, , are a feature matrix of the fine time granularity data and a feature matrix of the coarse time granularity data, respectively, for computing the similarity, is the coarse time granularity information only containing the input; S4.2.2, the calculated fusion value is added to the output of the previous layer of fine time granularity data to obtain the final output of step 4.2, and the specific formula is: , Thus, an updated fine time granularity output result is obtained .

8. The traffic flow prediction method of claim 1, wherein: Step S5 specifically comprises the following steps: S5.1, the output results at the same spatial scale are spliced in the time dimension to obtain two long vectors; S5.2, a full connection layer is used to perform linear transformation on the long vectors, and a traffic flow prediction value is output.

Citation Information

Patent Citations

  • Multi-scale traffic flow prediction method based on graph convolutional neural network

    CN112767682A

  • Urban mobile network traffic generation method and device, electronic equipment and storage medium

    CN115460546A