Traffic Information Prediction Method, Device, Equipment and Storage Medium
By dividing the traffic road map of the target city into sub-maps and using the model trained by the source city for prediction, the data scarcity problem is solved, and high-precision and efficient traffic information prediction of small and medium-sized cities is achieved.
Patent Information
- Application Number
- CN202111147932.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-09-29
AI Technical Summary
In the prior art, the problem of scarce urban data has led to poor results in traffic information prediction, especially in small and medium-sized cities, which is difficult to achieve high-precision and efficient traffic information prediction.
By dividing the traffic road map of the target city into multiple target sub-maps, and inputting the target input data into the traffic information prediction model trained by the source city in advance for prediction, the model includes a spatial correlation sub-model and a temporal correlation sub-model. The model is trained using source city data with sufficient data, and then applied to target cities with less data.
It significantly improves the traffic information prediction accuracy and prediction efficiency of the target city, and can achieve efficient traffic information prediction in cities with small amounts of data.
Smart Images

Figure CN113887704B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of data processing, and in particular, to a traffic information prediction method, apparatus, device, and storage medium. Background Art
[0002] The rapid development of urbanization has made people's lives more modern. However, it has also brought many problems to modern cities, such as traffic congestion, environmental pollution, and overuse of land. The spread of big data and the rapid development of computing power have provided the possibility of using data science and computing technology to solve these problems. Urban computing aims to use the massive data generated in cities for the construction of smart city systems.
[0003] For example, traffic speed prediction is a challenge in the construction of smart city systems. In related technologies, there are classical statistical methods and deep learning models. Traditional statistical methods, such as using autoregressive integrated moving average and historical average to predict traffic speed, are limited to non-stationary sequences and have very limited ability to process highly complex non-linear time series data. Deep learning models, such as data-driven models, use big data to predict traffic speed, but this method faces the problem of scarce urban data. This problem of data scarcity is mainly due to the high cost of constructing an integrated traffic sensor system within the city and the relatively long time required to collect data. Summary of the Invention
[0004] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of protection of the claims.
[0005] The embodiments of the present application provide a traffic information prediction method, apparatus, device, and storage medium, which can train a traffic information prediction model using urban data with sufficient data volume and migrate it to a city with scarce data volume for traffic information prediction, effectively improving the accuracy and efficiency of traffic information prediction.
[0006] In a first aspect, the embodiments of the present application provide a traffic information prediction method, including:
[0007] Obtain a traffic road map of a target city and divide the traffic road map of the target city into a plurality of target submaps;
[0008] Form target input data by using the plurality of target submaps and corresponding target traffic state information;
[0009] Input the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value. The traffic information prediction model is pre-trained by using a traffic road map of a source city, and the number of nodes of the traffic road map of the target city is different from the number of nodes of the traffic road network of the source city.
[0010] In an alternative implementation, obtaining the traffic road map of the target city and dividing the traffic road map of the target city into multiple target subgraphs includes:
[0011] Reducing the size of the traffic road map of the target city according to different ratios to obtain multiple thumbnails with different ratios;
[0012] Preliminarily dividing the thumbnail with the smallest ratio according to the number of divisions to obtain a first set of target subgraphs;
[0013] Dividing the traffic road map of the target city into corresponding target subgraphs according to the node mapping relationship in the first set of target subgraphs.
[0014] In an alternative implementation, before obtaining the traffic road map of the target city and dividing the traffic road map of the target city into multiple target subgraphs, it further includes:
[0015] When the number of nodes in the traffic road map of the target city cannot be evenly divided by the number of divisions, using element zero to complete data complementation for the traffic road map of the target city.
[0016] In an alternative implementation, the traffic information prediction model includes a spatial correlation submodel and a temporal correlation submodel;
[0017] Inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value includes:
[0018] Obtaining spatial information by using the spatial correlation submodel according to the target input data;
[0019] Obtaining temporal information by using the temporal correlation submodel according to the spatial information, so as to obtain the traffic information prediction value according to the spatial information and the temporal information.
[0020] In an alternative implementation, the spatial correlation submodel is composed of a graph neural network model, and the temporal correlation submodel is composed of a gated recurrent unit model.
[0021] In an alternative implementation, the training process of the traffic information prediction model includes:
[0022] Constructing a training data set for the source city, where the training data set for the source city includes: source input data and corresponding labels, and the source input data includes source subgraphs corresponding to the traffic road map of the source city and corresponding source traffic state information;
[0023] Inputting the training data set for the source city into the traffic information prediction model to obtain source predicted traffic state information;
[0024] Optimize the loss function according to the error value between the predicted traffic state information of the source and the label, and train to obtain the traffic information prediction model.
[0025] In an optional implementation manner, it further includes adjusting a second loss function by using a second error value between the predicted traffic information value and the true target traffic state information in the prediction time period, and optimizing the parameters of the traffic information prediction model.
[0026] In a second aspect, an embodiment of the present application provides a traffic information prediction device, including:
[0027] A target city traffic road map acquisition module, configured to acquire a target city traffic road map and divide the target city traffic road map into multiple target sub - maps;
[0028] A target input data composition module, configured to compose the multiple target sub - maps and the corresponding target traffic state information into target input data;
[0029] A traffic information prediction module, configured to input the target input data into a pre - trained traffic information prediction model to obtain a traffic information prediction value, where the traffic information prediction model is pre - trained by using a source city traffic road map, and the number of nodes of the target city traffic road map is different from the number of nodes of the source city traffic road network.
[0030] In a third aspect, a computer device includes a processor and a memory;
[0031] The memory is used to store a program;
[0032] The processor is configured to execute the traffic information prediction method according to any one of the first aspects according to the program.
[0033] In a fourth aspect, an embodiment of the present application provides a computer - readable storage medium, storing computer - executable instructions, and the computer - executable instructions are used to execute the traffic information prediction method according to any one of the first aspects.
[0034] A traffic information prediction method provided in the first aspect of the embodiments of the present application, compared with the related art, obtains a traffic road map of a target city, divides the traffic road map of the target city into multiple target sub - maps, then forms target input data with the multiple target sub - maps and corresponding target traffic state information, and finally inputs the target input data into a pre - trained traffic information prediction model to obtain a traffic information prediction value. Among them, the traffic information prediction model is pre - trained by using the traffic road map of a source city, and the number of nodes in the traffic road map of the target city is less than the number of nodes in the traffic road network of the source city. By using the traffic road network data of the source city with sufficient data volume to train the traffic information prediction model and then applying it to the target city with less data volume, the prediction accuracy and prediction efficiency of the traffic information in the target city can be significantly improved.
[0035] It can be understood that the beneficial effects of the above - mentioned second aspect to the fourth aspect compared with the related art are the same as those of the first aspect compared with the related art. For the relevant descriptions, reference can be made to the relevant content in the first aspect, and details will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the related art. Obviously, the following drawings are only some embodiments of the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0037] Figure 1 It is a schematic diagram of an exemplary system architecture provided by an embodiment of the present application;
[0038] Figure 2 It is a flowchart of a traffic information prediction method provided by an embodiment of the present application;
[0039] Figure 3 It is another flowchart of a traffic information prediction method provided by an embodiment of the present application;
[0040] Figure 4 It is a schematic diagram of sub - map division of a traffic information prediction method provided by an embodiment of the present application;
[0041] Figure 5 It is a schematic diagram of a road traffic provided by an embodiment of the present application;
[0042] Figure 6 It is another flowchart of a traffic information prediction method provided by an embodiment of the present application;
[0043] Figure 7 It is another flowchart of a traffic information prediction method provided by an embodiment of the present application;
[0044] Figure 8 It is the performance comparison result of the traffic information prediction method provided by an embodiment of this application;
[0045] Figure 9 It is another performance comparison result of the traffic information prediction method provided by an embodiment of this application;
[0046] Figure 10 It is the structural block diagram of the traffic information prediction device provided by an embodiment of this application. Detailed implementation manners
[0047] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of this application. However, those skilled in the art should clearly understand that the embodiments of this application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the embodiments of this application.
[0048] It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from that in the flowchart. Terms such as "first" and "second" in the specification, claims, and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence.
[0049] It should also be understood that references to "an embodiment" or "some embodiments" etc. described in the specification of the embodiments of this application mean that specific features, structures, or characteristics described in connection with that embodiment are included in one or more embodiments of this application. Thus, statements such as "in an embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "comprise", "include", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in another way.
[0050] The rapid development of urbanization has brought problems such as traffic congestion to modern cities. For example, traffic speed prediction is a challenge in the construction of smart city systems. In related technologies, there are classical statistical methods and deep learning models. Traditional statistical methods, such as using autoregressive integrated moving average and historical average to predict traffic speed, but these methods are all limited to non-stationary sequences and have very limited ability to process highly complex non-linear time series data.
[0051] With the expansion of the scope and increase in the diversity of traffic data, data-driven traffic prediction methods have proven to be superior to traditional simulation-based methods. For example, basic time series models such as autoregressive integrated moving average, Kalman filter and its variants, spatio-temporal regularization regression models, and support vector regression, etc. The above machine learning methods have achieved good results in classification and regression tasks using big data, but these methods require artificial feature processing. With the increase in the amount of data, some deep learning models that require a large amount of data have gradually started to be used for traffic prediction tasks. For example, data-driven models can use big data to predict traffic speed, and deep learning methods can effectively extract high-dimensional features from massive data. Data-driven deep learning traffic prediction models, such as deep belief networks and stacked autoencoders, have shown their superior performance in traffic flow prediction. In recent years, recurrent neural networks have also been widely applied to time series prediction tasks due to their performance in time-dependent modeling. Despite the development of deep learning due to the explosion of urban data, these methods all face the problem of scarce urban data, mainly because the cost of building a comprehensive system of traffic sensors across the city is too high and it takes a considerable amount of time to collect data. However, due to the lack of data collection methods, the amount of traffic data available for building data-driven models in many small cities is limited. With the acceleration of urbanization, the need for traffic construction in small and medium-sized cities is imminent.
[0052] Therefore, the embodiments of the present application provide a traffic information prediction method. Compared with the related art, by obtaining the traffic road map of the target city, dividing the traffic road map of the target city into multiple target subgraphs, then combining the multiple target subgraphs and the corresponding target traffic state information to form target input data, and finally inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value, wherein the traffic information prediction model is pre-trained by using the traffic road map of the source city, and the number of nodes in the traffic road map of the target city is less than the number of nodes in the traffic road network of the source city. Using the traffic road network data of the source city with sufficient data volume to train the traffic information prediction model and then applying it to the target city with less data volume can significantly improve the prediction accuracy and prediction efficiency of the traffic information in the target city.
[0053] It can be understood that the traffic information prediction method provided by the embodiments of the present application can be implemented by various electronic devices with computing and processing capabilities, such as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (such as mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable game devices), etc., or can also be implemented by a server.
[0054] It should be noted that the above server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms. The present invention makes no limitation here.
[0055] To facilitate the understanding of the technical solution provided by the embodiments of the present application, the application scenarios applicable to the traffic information prediction method provided by the embodiments of the present application will be introduced below by taking the traffic information prediction method provided by the embodiments of the present application as an example applied to a server.
[0056] See Figure 1 , Figure 1 which is a schematic diagram of the application scenario of the traffic information prediction method provided by the embodiments of the present application.
[0057] As Figure 1 shown, the system architecture 100 may include a database 101, a network 102, and a server 103. The network 102 is used to provide a medium for the communication link between the database 101 and the server 103. The network 102 may include various connection types, such as wired communication links, wireless communication links, and so on.
[0058] In an embodiment of the present invention, the server 103 obtains the traffic road map of the target city from the database 101, divides the traffic road map of the target city into multiple target sub - maps, and then forms target input data by combining the multiple target sub - maps and the corresponding target traffic state information. By inputting the target input data into a pre - trained traffic information prediction model (the prediction process of traffic information prediction will be described in detail below), a traffic information prediction value is obtained. Training the traffic information prediction model with the traffic road network data of the source city with sufficient data volume and then applying it to the target city with less data volume can significantly improve the traffic information prediction accuracy and prediction efficiency of the target city.
[0059] It should be noted that the traffic information prediction method provided by the embodiments of the present invention is generally executed by the server 103. Correspondingly, the traffic information prediction device is generally set in the server 103. However, in other embodiments of the present invention, the terminal device may also have a similar function to the server, so as to execute the traffic information prediction scheme provided by the embodiments of the present invention.
[0060] The system architecture and application scenarios described in the embodiments of this application are to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art know that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems. Those skilled in the art can understand that Figure 1 The system architecture shown in
[0061] does not constitute a limitation on the embodiments of this application, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0062] As Figure 2 shown, Figure 2 is a flowchart of a traffic information prediction method provided by an embodiment of this application, including but not limited to steps S110 and S130.
[0063] Step S110: Obtain the traffic road map of the target city and divide the traffic road map of the target city into multiple target sub - maps.
[0064] In one embodiment, the traffic road network can be represented as a topological structure similar to a graph structure. The nodes of this graph structure can represent the observation points set in the traffic road network. Sensors or cameras can be set at different positions of the observation points to record the traffic conditions of each observation point in the past period of time. The edges of the graph structure are directed edges and can represent roads.
[0065] In one embodiment, let T represent the target city with less data volume (for example, fewer observation points and less effective information that can be obtained). Suppose it has N T nodes, then the traffic road network of the target city in its target city road network system is represented as G T .
[0066] G T =(V T , E T , A T )
[0067] Among them, V T represents the set of node information of N T nodes in the target city road network system.
[0068] E T represents the set of directed edges connecting N T nodes.
[0069] A TThe adjacency matrix representing the connectivity between nodes in the target urban road network system is expressed as:
[0070]
[0071] where i and j represent node numbers. If there is a node N i pointing to N j and there is no N j pointing to N i , then
[0072] In one embodiment, after obtaining the above-mentioned target urban traffic road network G T , subgraph partitioning is performed on it. Referring to Figure 3 , step S110 includes but is not limited to the following steps:
[0073] Step S111, reducing the size of the target urban traffic road map according to different ratios to obtain multiple thumbnails with different ratios.
[0074] In one embodiment, referring to Figure 4 , it is a schematic diagram of subgraph partitioning. The target urban traffic road map is represented as G0, and G0 is scaled into four thumbnails with different ratios, namely G1, G2, G3, and G4, according to different ratios.
[0075] Step S112, preliminarily partitioning the thumbnail with the smallest ratio according to the number of partitions to obtain the first target subgraph.
[0076] In one embodiment, the number of partitions is k, Figure 4 and the thumbnail with the smallest ratio in
[0077] is G4. G4 is preliminarily partitioned to obtain the first target subgraph set G4'.
[0078] Step S113, partitioning the target urban traffic road map into corresponding target subgraphs according to the node mapping relationship in the first target subgraph set.
[0079] In one embodiment, the METIS graph partitioning method is used for partitioning the subgraph in the above step S110. METIS is a powerful graph partitioning software package developed by Karypis Lab. To be exact, METIS is a serial graph partitioning software package. The algorithm design of METIS is mainly based on the multi-level recursive bisection method, the multi-level k-way partitioning method, and the multi-constraint partitioning mechanism. When users use the METIS software package, they can select the corresponding partitioning method according to their needs.
[0080] The main features of METIS are as follows: First, METIS has high-quality partitioning results, which are said to be 10%-50% more accurate than ordinary spectral clustering. Second, METIS has very high execution efficiency, which is 1-2 orders of magnitude faster than common partitioning algorithms. A graph with millions of vertices can be partitioned into 256 classes within a few seconds. Finally, METIS has a very low injection element, thus reducing the storage load and computational amount.
[0081] In one embodiment, the target urban road network G T is partitioned into M T target subgraphs of similar sizes. When the number of nodes in the target urban road network G T cannot be divisible by the number of partitions (i.e., M T in this example), the target urban road network G T is filled with zeros for data completion.
[0082] Reference Figure 5 is a schematic diagram of road traffic in an embodiment of the present application. According to this schematic diagram, the road traffic is represented in the form of a topological graph.
[0083] In Figure 5 there are two traffic roads, one two-way road and one one-way road. The sections of each road are marked from 1 to 5, and they are defined as the nodes of the target urban road network.
[0084] For node 1 (section 1), there are no other nodes (sections) directly connected to it.
[0085] For node 2 (section 2), there are two nodes (i.e., 3 and 4) connected to this node (node 2).
[0086] Therefore, there are edges (3,2) and (4,2) respectively. According to the adjacency matrix of the connectivity between each node in the target urban road network system, it is represented as A 32 = A 42 = A 15 = 1.
[0087] The matrix form is represented as:
[0088]
[0089] In one embodiment, since the METIS method requires the input of a symmetric adjacency matrix, when performing subgraph partitioning, the above adjacency matrix is symmetrized and represented as:
[0090]
[0091] In one embodiment, the adjacency matrix is represented as:
[0092]
[0093] At the input end of METIS, it is converted into a sparse matrix form, represented as: Input = [[4], [2, 3], [1], [1], [0]], where input[x] represents the numbers of all nodes connected to the x-th node. For the above adjacency matrix, (0, 4) being 1 means there is a connection between the 0-th node and the 4-th node. Therefore, the content of the corresponding sparse matrix input[0] is [4].
[0094] Suppose the content output after METIS is membership = [0, 1, 1, 0, 1], where membership[x] represents which category the x-th node belongs to, and subgraph partitioning is performed according to its category.
[0095] Step S120, form target input data from multiple target subgraphs and corresponding target traffic state information.
[0096] In one embodiment, the target traffic state information at time step t is represented as where N represents nodes, F represents the number of traffic information of interest. In this embodiment, the traffic information includes traffic speed, that is, F = 1 is taken, and traffic information prediction is traffic speed prediction. It can be understood that here the traffic information is only for illustration and does not mean that it can only be traffic speed. Other traffic flow information can also apply the method of this embodiment for traffic information prediction.
[0097] In one embodiment, the target traffic state information includes the target historical traffic state information of the previous H time steps, represented as: The target input information is represented as: [G T , X T .
[0098] Step S130, input the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value.
[0099] In one embodiment, the output is the predicted traffic state information for the next Q time steps, that is, the predicted value of the traffic information of the target city, expressed as:
[0100] In one embodiment, the traffic information prediction model includes a spatial correlation sub-model and a temporal correlation sub-model. Among them, the spatial correlation sub-model is used to obtain spatial information and input the spatial information into the temporal correlation sub-model to obtain temporal information, so as to obtain the traffic information prediction value according to the spatial information and the temporal information.
[0101] In one embodiment, the spatial correlation sub-model is composed of a graph neural network model, and the temporal correlation sub-model is composed of a gated recurrent unit model.
[0102] The graph neural network (Graph convolution Network, GCN) of the spatial correlation sub-model, also known as the graph convolutional neural network, is a feature extractor, but the object it processes is graph data. It can extract features from graph data (such as the above-mentioned spatial information), so that these features can be used to perform node classification, graph classification, edge prediction, etc. on graph data.
[0103] The graph neural network GCN is an effective method for establishing the spatial correlation of the traffic network. It overcomes the shortcoming that the convolutional neural network CNN only processes Euclidean space data. Since the graph structure better reflects the topological structure of the traffic network, the graph neural network GCN can capture more fine-grained spatial information features in the traffic network.
[0104] The graph neural network GCN extracts the spatial information features of the traffic network and can adopt spectral graph convolution. It is based on spectral graph theory, uses spectral clustering to construct filters in the Fourier domain, and studies the properties of the graph through the eigenvalues and eigenvectors of the Laplacian matrix of the graph. The Laplacian matrix is symmetric, and the matrix has non-zero elements only at the vertices themselves and their 1-hop neighbors. These advantages make the convolution process simpler.
[0105] The specific model input and output process is as follows.
[0106] Suppose there is a batch of graph data, where there are N nodes, and each node has its own spatial information features. Let the features of these nodes form an N×D-dimensional feature matrix X. Then, the relationships between the nodes will also form an N×N-dimensional matrix A, which is also called the adjacency matrix. X and A are used as the inputs of the model.
[0107] First, use the adjacency matrix to calculate the Laplacian matrix of the graph, expressed as:
[0108]
[0109] Among them, Denotes the adjacency matrix with self-connections, I N Denotes the identity matrix, Denotes the diagonal matrix of the adjacency matrix with self-connections.
[0110] Since the graph neural network GCN is also a neural network layer, for each convolutional layer, there is H (l+1) = σ(LH (l) θ (l) ), where L represents the number of layers, l represents the layer number, and H (l) represents the output of the l-th layer, and θ (l) represents the weight parameter of the l-th layer, and σ(·) represents the sigmoid function.
[0111] The output is f(X, A), which is expressed as:
[0112] f(X, A) = σ(LReLU(LXW0)W1)
[0113] where X represents the feature matrix, W0 represents the weight matrix mapping input to the hidden unit, W1 represents the weight parameter of the next layer, and ReLU(·) represents the rectified linear unit.
[0114] For a graph with a large number of nodes, the graph neural network GCN has higher requirements for machine performance, and the complexity of the solution process increases. Therefore, in this embodiment, by dividing the subgraph, the graph neural network GCN pays more attention to the information extraction on the subgraph to a certain extent, reduces device consumption, and improves the accuracy.
[0115] When the traffic information is traffic speed, traffic speed prediction is essentially a time series prediction task. Therefore, it is necessary to establish a time correlation sub-model suitable for time series data.
[0116] In one embodiment, the time correlation sub-model is composed of a gated recurrent unit model.
[0117] The gated recurrent unit (GRU) is used to capture time information. The gated recurrent unit GRU is a variant of the recurrent neural network RNN. It can reduce the gradient explosion and gradient disappearance problems existing in the RNN network, and compared with another variant of the RNN (i.e., long short-term memory, LSTM), the gated recurrent unit GRU has fewer model parameters and a simpler structure.
[0118] Therefore, in this embodiment, the graph neural network GCN is used to construct the spatial correlation sub-model, and the gated recurrent unit GRU is used to construct the time correlation sub-model. At the same time, the spatial correlation sub-model and the time correlation sub-model together constitute the traffic information prediction model.
[0119] In one embodiment, the traffic information prediction model is pre-trained by using the traffic road map of the source city. The number of nodes in the traffic road map of the target city is different from that in the traffic road network of the source city. For example, the number of nodes in the traffic road network of the source city can be much larger than that in the traffic road network of the target city. By using the traffic road network data of the source city with sufficient data volume to train the traffic information prediction model and then applying it to the target city with less data volume, the prediction accuracy and efficiency of the traffic information in the target city can be significantly improved.
[0120] Refer to Figure 6 , which is a schematic diagram of the training process of the traffic information prediction model in this embodiment. The training process includes but is not limited to the following steps:
[0121] Step S610: Construct a training data set for the source city. The training data set for the source city includes: source input data and corresponding labels.
[0122] In one embodiment, the source input data includes a source sub-graph corresponding to the traffic road map of the source city and corresponding source traffic state information, and the label is the true source traffic state information in the prediction time period corresponding to the source sub-graph.
[0123] For example, use S to represent the source city with a large amount of data, and assume it has N S nodes. Then the traffic road network of the source city in its source city road network system is represented as G S .
[0124] G S =(V S , E S , A S )
[0125] Among them, V S represents the set of node information of N S nodes in the source city road network system.
[0126] E S represents the set of directed edges connecting N S nodes.
[0127] A S represents the adjacency matrix of the connectivity between nodes in the source city road network system, which is expressed as:
[0128]
[0129] Among them, i and j represent node numbers. If there is a node N i pointing to N j , and there is no N j pointing to N i , then
[0130] Meanwhile, represent the source traffic state information at time step t as where N represents nodes, F represents the number of traffic information of interest. In this embodiment, the traffic information includes traffic speed, that is, take F = 1. It can be understood that this is only an illustration of the traffic information and does not mean that it is limited to traffic speed only. Other traffic flow information can also apply the method of this embodiment for traffic information prediction.
[0131] where the subgraph partitioning method is the same as the above-mentioned target urban traffic road map partitioning method, and the METIS method is used to obtain the source urban traffic road network G S of the source subgraph.
[0132] In one embodiment, the source input data further includes the source historical traffic state information of the previous H time steps, which is represented as: That is, the source input data of the training samples in the source urban training data set is represented as: [G S , X S .
[0133] The label corresponding to the source input data is the true source traffic state information of the prediction time period corresponding to the source subgraph.
[0134] Step S611, input the source urban training data set into the traffic information prediction model to obtain the source predicted traffic state information.
[0135] In one embodiment, input a large amount of source urban training data set (including the previous H time steps) into the traffic information prediction model, and the output is the traffic state information of the next Q time steps predicted, that is, the source predicted traffic state information, which is represented as:
[0136] Step S612, optimize the loss function according to the error value between the source predicted traffic state information and the label, and train to obtain the traffic information prediction model.
[0137] During the training process, judge the performance of the traffic information prediction model according to the error value between the obtained prediction value and the true value (label), define the loss function, calculate the loss value of the loss function according to the error value, and adjust the parameters of the traffic information prediction model until the loss value meets the preset convergence condition, then the traffic information prediction model is trained and completed at this time.
[0138] Refer to Figure 7 , the traffic information prediction flow chart of this application in embodiments.
[0139] First is the training phase.
[0140] Utilize the source urban traffic road map G SThe training process of the traffic information prediction model (represented by ST-block in the figure).
[0141] Construct the training dataset of the source city (including multiple training samples) and input it.
[0142] The traffic road map G of the source city S , where G S =(V S , E S , A S ), and then use the METIS method to divide the traffic road network G of the source city S into M S source subgraphs of similar sizes (each source subgraph represents a type of road).
[0143] The source subgraph is expressed as:
[0144] The label of the training sample in the training dataset of the source city is the source traffic state information corresponding to the source subgraph. The source traffic state information corresponding to each source subgraph includes the source historical traffic state information of the first H time steps, which is expressed as:
[0145]
[0146] The set of source traffic state information is expressed as:
[0147] Therefore, the source input data in the training sample of the training dataset of the source city is expressed as: [G Si , X Si , and the label is expressed as
[0148] Input the above training samples into the traffic information prediction model ST-block respectively, and train to obtain the corresponding predicted source traffic state information, which is expressed as:
[0149] According to the error value between the obtained predicted value and the true value (label) , judge the performance of the traffic information prediction model, define the loss function, calculate the loss value of the loss function according to the error value, and adjust the parameters of the traffic information prediction model until the loss value meets the preset convergence condition. At this time, the training of the traffic information prediction model is completed.
[0150] Then comes the prediction stage.
[0151] Use the trained traffic information prediction model ST-block to predict the traffic road map G T of the target city to obtain the traffic information prediction value.
[0152] Obtain the traffic road map G of the target city T , where G T =(V T , E T , A T ), and then use the METIS method to divide the traffic road network G of the target city T into M T target subgraphs of similar sizes (each target subgraph represents a type of road). The source subgraph and the target subgraph are of similar sizes, facilitating model migration.
[0153] The target subgraph is represented as:
[0154] The target traffic state information corresponding to each target subgraph includes the target historical traffic state information of the first H time steps, which is represented as:
[0155]
[0156] The set of target traffic state information is represented as:
[0157] Therefore, the target input data is represented as: [G Ti , X Ti .
[0158] Input the above target input data into the trained traffic information prediction model ST-block respectively, and obtain the traffic information prediction values of Q time steps, which are represented as:
[0159] Among them, referring to Figure 7 , the structure of the traffic information prediction model ST-block includes a graph neural network GCN and a gated recurrent unit GRU. The output of the GCN is connected to the input of the GRU, and the output of the GRU is connected layer by layer to the input of the next layer of GRU until the output of the last layer of GRU outputs the traffic information prediction value. The GCN captures the spatial information of each pair of input data and inputs it into the GRU, and then the GRU captures the temporal information of these input data, and obtains the traffic information prediction value according to the spatial information and the temporal information.
[0160] In one embodiment, in order to improve the prediction accuracy of the traffic information prediction model migrated to the target city with less data volume, it further includes: using the second error value between the true target traffic state information of the prediction time period (Q time steps) and the above prediction value to adjust the second loss function and optimize the parameters of the traffic information prediction model.
[0161] In one embodiment, the second loss function includes:
[0162] 1) Mean Absolute Error (MAE), expressed as:
[0163]
[0164] 2) Root Mean Square Error (RMAE), expressed as:
[0165]
[0166] 3) Mean Absolute Percentage Error (MAPE), expressed as:
[0167]
[0168] According to the convergence condition, until the second loss value meets the preset convergence condition, the optimization of the traffic information prediction model is completed at this time.
[0169] In one embodiment, in the traffic speed prediction task, the prediction results of the traffic information prediction model of the present application embodiment are compared with those of other baseline models, and the comparison results are as follows.
[0170] A. Experimental settings:
[0171] a) Experimental environment: All experiments were conducted on a Linux server with an Intel E5-2620v4 CPU and a GeForce RTX 2080Ti CPU. All baseline models and the traffic information prediction model of the present application embodiment were built using Pytorch 1.7.0 and Python 3.8.3.
[0172] b) Hyperparameter settings: Use the traffic conditions with a short history (60 minutes) of H = 12 to predict future traffic conditions, and use prediction time periods of Q = 3 / 6 / 9 / 12 (if one time step is 5 minutes, the corresponding prediction time periods are: 15 minutes / 30 minutes / 45 minutes / 60 minutes).
[0173] Use the Adam optimizer to train the traffic information prediction model. For example, the initial learning rate is set to 0.001, the batch size is 64, and the training time for all models is 500. Specifically, the number of hidden units is set to 32.
[0174] The number of subgraph partitions is 8.
[0175] B. Datasets
[0176] Two real network-scale traffic speed datasets were used.
[0177] a) Nav-BJ: This dataset consists of the average vehicle speeds in Beijing from March 1st to March 31st, 2019. The survey data covers 1159 nodes (road segments) in Beijing.
[0178] The experimental data contains two main matrices. The first is an adjacency matrix of size 1159×1159 that describes the spatial relationships between nodes. Each value in the matrix indicates whether the node represented by the row is connected to the node represented by the column. The other is a feature matrix, where each row represents the speed of each node at a certain time. Each column represents the speed of the node from the start time to the end. The time stamp interval is set to 5 minutes.
[0179] b) Nav-SH: This dataset includes the average speeds in Shanghai collected simultaneously with Nav-BJ.
[0180] There are 400 nodes (road segments) in Shanghai for prediction. It has two matrices like Nav-BJ. The first is a 400×400 adjacency matrix. The other is a feature matrix in the same format as Nav-BJ.
[0181] In this embodiment, through the cross-validation process, the dataset from Beijing is used as a large dataset (i.e., the dataset of the source city in transfer learning). At the same time, Shanghai is used as the target city to be transferred. Its data is not used for training, but only as the real-time input of the traffic information prediction model, and after Z-score normalization, the sigmoid activation function is used to map the data to the range (0,1).
[0182] During the optimization process of the traffic information prediction model, a subset of Nav-SH for one day is used to retrain the parameters in the traffic information prediction model.
[0183] C. Baseline Model
[0184] The traffic information prediction model of this application embodiment is compared with two types of methods: non-transfer learning and transfer learning methods. For the non-transfer learning method, the TGCN model is selected, which is one of the latest technologies for traffic speed prediction.
[0185] 1) Non-transfer learning:
[0186] a) TGCN_L: This model uses a subset of the traffic dataset of the target city (Nav-SH) as the training dataset. The subset contains 20 days of data, and there is a rich data source that can be used to predict the traffic speed in the next 15 - 60 minutes.
[0187] b) TGCN_S: This model uses a small part of the target city traffic dataset (Nav-SH) as the training dataset. Different from TGCN-L, this subset only contains one day's data, which is the same as the data in the traffic information prediction model optimization process. In this case, it is considered that the training dataset is small and it is difficult to predict the traffic speed in the next 15 to 60 minutes.
[0188] 2) Transfer learning:
[0189] a) Traffic information prediction model without subgraph partitioning: This model uses all the data of the source city (Nav-BJ) as the training set to predict the target city.
[0190] D. Comparison results
[0191] As Figure 8 shown, the performance comparison results of the above several models are presented. The prediction time periods are: 15 minutes / 30 minutes / 45 minutes / 60 minutes, and the evaluation metrics include: 1) Mean Absolute Error (MAE); 2) Root Mean Square Error (RMAE); 3) Mean Absolute Percentage Error (MAPE).
[0192] Performance comparison results:
[0193] Refer to Figure 8 , which shows the comparison of different methods for predicting 15 minutes / 30 minutes / 45 minutes / 60 minutes in advance on Nav-SH.
[0194] Compared with TGCN_S, the traffic information prediction model without any data from the target city can already rival the performance of TGCN_S with only a small amount of data, indicating that data transfer between cities is possible.
[0195] Compared with TGCN_L, the optimized traffic information prediction model performs slightly worse but better than the traffic information prediction model. The reason is that the optimized traffic information prediction model uses a small part of the target city dataset. This shows that the transfer method can approach the results of the model trained with a large amount of data by only using a small part of the target city data and is better than the calculation results of the model trained with only a small amount of data (TGCN_S). This proves the effectiveness of transfer.
[0196] Compared with the traffic information prediction model without subgraph partitioning, due to the operation of subgraph partitioning, the traffic information prediction model can capture more information in the traffic network graph, which improves in all three evaluation metrics compared to the direct transfer method.
[0197] As Figure 9As shown, it is another performance comparison result of the above several models. The number of partitions for subgraph partitioning is 2, 4, 8, and 16 respectively. The evaluation metrics include: 1) Mean Absolute Error (MAE); 2) Root Mean Squared Error (RMAE); 3) Mean Absolute Percentage Error (MAPE).
[0198] Performance comparison result:
[0199] In the traffic information prediction model, the traffic network of the target city is divided into several target subgraphs (or called clusters) of different sizes. The number of clusters may affect the performance metrics. In this experiment, the number of clusters is set to 2, 4, 8, and 16 respectively to understand how it affects the performance.
[0200] Refer to Figure 9 , the best result can be obtained using the setting of 8. When the number is 4 and 6, the performance will be affected, but not significantly. However, when the number is 2, the performance is much worse. This may be because the traffic networks and data distributions of the two cities are not exactly the same.
[0201] The purpose of transfer learning is to learn similar graph and temporal structures from the source city to the target city. After subgraph partitioning, it is considered that each subgraph represents one or a class of traffic structures (such as intersections and roundabouts in the road), and these structures exist in each city. When the graph is too large, a graph may contain various different traffic structures, so the similarity between the two cities is weakened, and the transfer effect is poor. When subgraph partitioning of an appropriate size is performed on a graph containing one traffic structure or several similar structures, the spatio-temporal information captured by the graph neural network GCN can be better transmitted to the target city, and the prediction effect is better.
[0202] The embodiment of the present application provides a traffic information prediction method. Compared with the related technology, by obtaining the traffic road map of the target city, dividing the traffic road map of the target city into multiple target subgraphs, then combining the multiple target subgraphs and the corresponding target traffic state information to form target input data, and finally inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value, wherein the traffic information prediction model is pre-trained by the traffic road map of the source city, and the number of nodes in the traffic road map of the target city is less than the number of nodes in the traffic road network of the source city. Using the traffic road network data of the source city with sufficient data volume to train the traffic information prediction model and then applying it to the target city with less data volume can significantly improve the traffic information prediction accuracy and prediction efficiency of the target city.
[0203] In addition, an embodiment of the present application also provides a traffic information prediction device. Refer to Figure 10 , the device includes:
[0204] The target city traffic road map acquisition module 101 is used to acquire the target city traffic road map and divide the target city traffic road map into multiple target sub - maps;
[0205] The target input data composition module 102 is used to compose the target input data from multiple target sub - maps and the corresponding target traffic state information;
[0206] The traffic information prediction module 103 is used to input the target input data into a pre - trained traffic information prediction model to obtain a traffic information prediction value. The traffic information prediction model is pre - trained by the source city traffic road map, and the number of nodes in the target city traffic road map is different from the number of nodes in the source city traffic road network.
[0207] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0208] It should be noted that the traffic information prediction device in this embodiment can execute the traffic information prediction method in the embodiment as Figure 2 shown. That is, the traffic information prediction device in this embodiment and the traffic information prediction method in the embodiment as Figure 2 shown belong to the same inventive concept. Therefore, these embodiments have the same implementation principle and technical effects, which will not be elaborated here.
[0209] In addition, an embodiment of the present application also provides a computer device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0210] The processor and the memory can be connected through a bus or other means.
[0211] The memory, as a non - transient computer - readable storage medium, can be used to store non - transient software programs and non - transient computer - executable programs. In addition, the memory can include high - speed random - access memory, and can also include non - transient memory, such as at least one magnetic disk storage device, a flash memory device, or other non - transient solid - state storage devices. In some embodiments, the memory can optionally include a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above - mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and their combinations.
[0212] The non-transitory software program and instructions required to implement the traffic information prediction method of the above embodiments are stored in a memory. When executed by a processor, the traffic information prediction method in the above embodiments is executed. For example, the method steps S110 to S130 described above are executed Figure 2 the method steps S110 to S130 in Figure 3 the method steps S111 to step S113 in Figure 6 the method steps S610 to S612 in etc.
[0213] In addition, an embodiment of the embodiments of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a processor or a controller, for example, executed by a processor in the above computer device embodiment, the above processor can execute the traffic information prediction method in the above embodiments. For example, the method steps S110 to S130 described above are executed Figure 2 the method steps S110 to S130 in Figure 3 the method steps S111 to step S113 in Figure 6 the method steps S610 to S612 in etc.
[0214] For another example, when executed by a processor in the above computer device embodiment, the above processor can execute the traffic information prediction method in the above embodiments. For example, the method steps S110 to S130 described above are executed Figure 2 the method steps S110 to S130 in Figure 3 the method steps S111 to step S113 in Figure 6 the method steps S610 to S612 in etc.
[0215] Those of ordinary skill in the art will understand that all or some of the steps and systems disclosed above can be implemented as software, firmware, hardware, and their appropriate combinations. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically includes computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium.
[0216] The above is a specific description of the preferred implementation of the embodiments of the present application. However, the embodiments of the present application are not limited to the above implementation manners. Those skilled in the art can also make various equivalent deformations or substitutions without departing from the spirit of the embodiments of the present application. These equivalent deformations or substitutions are all included within the scope defined by the claims of the embodiments of the present application.
Claims
1. A traffic information prediction method, characterized in that, Including: Reducing the size of the target city traffic road map according to different scales to obtain multiple thumbnails with different scales, preliminarily dividing the thumbnail with the smallest scale according to the number of divisions to obtain a first set of target subgraphs, and dividing the target city traffic road map into corresponding target subgraphs according to the node mapping relationship in the first set of target subgraphs. Each target subgraph indicates a traffic structure, and the traffic structure at least includes a fork or a roundabout in the road; Combining the multiple target subgraphs and the corresponding target traffic state information into target input data; Inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value. The traffic information prediction model is pre-trained by using a source city traffic road map, and the number of nodes in the target city traffic road map is less than the number of nodes in the source city traffic road network; The traffic information prediction model includes a spatial correlation sub-model and a temporal correlation sub-model; The step of inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value includes: Obtaining spatial information by using the spatial correlation sub-model according to the target input data; Obtaining temporal information by using the temporal correlation sub-model according to the spatial information, and obtaining the traffic information prediction value according to the spatial information and the temporal information; Adjusting a second loss function by using a second error value between the traffic information prediction value and the true target traffic state information in the prediction time period, and optimizing the parameters of the traffic information prediction model.
2. The traffic information prediction method according to claim 1, wherein Before obtaining the target city traffic road map and dividing the target city traffic road map into multiple target subgraphs, it further includes: When the number of nodes in the target city traffic road map cannot be divided evenly by the number of divisions, using element zeros to complete the data of the target city traffic road map.
3. The traffic information prediction method according to claim 1, characterized in that, The spatial correlation sub-model is composed of a graph neural network model, and the temporal correlation sub-model is composed of a gated recurrent unit model.
4. The traffic information prediction method according to claim 1, wherein The training process of the traffic information prediction model includes: Constructing a source city training data set, where the source city training data set includes: source input data and corresponding labels. The source input data includes source subgraphs corresponding to the source city traffic road map and corresponding source traffic state information; Inputting the source city training data set into the traffic information prediction model to obtain source predicted traffic state information; Optimizing a loss function according to an error value between the source predicted traffic state information and the label, and training to obtain the traffic information prediction model.
5. A traffic information prediction device, characterized in that, Including: A target city traffic road map acquisition module, configured to reduce the size of the target city traffic road map according to different scales to obtain multiple thumbnails with different scales, preliminarily divide the thumbnail with the smallest scale according to the number of divisions to obtain a first set of target subgraphs, and divide the target city traffic road map into corresponding target subgraphs according to the node mapping relationship in the first set of target subgraphs. Each target subgraph indicates a traffic structure, and the traffic structure at least includes a fork or a roundabout in the road; A target input data composition module, configured to compose target input data from a plurality of the target subgraphs and corresponding target traffic state information; A traffic information prediction module, configured to input the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value, where the traffic information prediction model is pre-trained by using a source city traffic road map, and the number of nodes in the target city traffic road map is less than the number of nodes in the source city traffic road network; The traffic information prediction model includes a spatial correlation sub-model and a temporal correlation sub-model; The step of inputting the target input data into a pre-trained traffic information prediction model to obtain a traffic information prediction value includes: Obtaining spatial information by using the spatial correlation sub-model according to the target input data; Obtaining temporal information by using the temporal correlation sub-model according to the spatial information, and obtaining the traffic information prediction value according to the spatial information and the temporal information; Optimizing the parameters of the traffic information prediction model by adjusting a second loss function by using a second error value between the traffic information prediction value and real target traffic state information in a prediction time period.
6. A computer device, characterized in that, It includes a processor and a memory; The memory is used to store programs; The processor is configured to execute the traffic information prediction method according to any one of claims 1 to 4 according to the program.
7. A computer-readable storage medium storing computer-executable instructions for executing the traffic information prediction method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Traffic data prediction method and device and vehicle control method
CN111079975A
Cross-modal data prediction method based on transfer learning
CN112863182A