A road condition prediction method based on big data
By combining the dynamic attention multi-layer perceptron and the topological subgraph neural network, the characteristics of road traffic data are extracted and learned, which solves the problem of difficult learning of road topological relationships in the existing technology and improves the accuracy and simulation of road condition prediction. combined ability.
Patent Information
- Application Number
- CN202310807737.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-04
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2043-07-04
AI Technical Summary
Existing road traffic flow prediction methods are difficult to effectively learn when dealing with complex road conditions, especially emergencies and road topology relationships, resulting in poor prediction results.
A method combining multi-layer perceptron based on dynamic attention and graph neural network of topological subgraph is used to extract continuous features, category features and spatial features, and predict road conditions through the classification layer to improve the fitting ability and accuracy of the model.
Through feature interaction and deep feature extraction, the model's ability to understand road congestion is improved, and the accuracy and fitting ability of road condition prediction are improved.
Smart Images

Figure CN116994427B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data mining, and in particular relates to a road condition prediction method based on big data. Background Art
[0002] With the acceleration of urbanization and the increase in car ownership, road traffic issues have received more and more attention. Ensuring road traffic efficiency and safety has become the key to urban traffic management. However, traditional traffic control measures such as traffic restrictions and license plate restrictions cannot fundamentally solve the problem of traffic congestion. Therefore, predicting road conditions and taking targeted traffic management measures has become a new solution.
[0003] In the era of big data, it has become easier to obtain road traffic data. A large number of sensors, cameras, GPS devices, etc. can obtain road traffic data in real time, which can be used to analyze road conditions and predict future traffic flow. Therefore, road condition prediction methods based on big data have become a research hotspot.
[0004] At present, the prediction methods of road traffic flow can be divided into model-based and data-based methods. Model-based methods include ARIMA, SARIMA, VAR, VEC, etc. These methods need to establish mathematical models and fit data, and the prediction effect of nonlinear and non-stationary road traffic data is not good. Data-based methods such as machine learning and deep learning can adaptively learn data patterns and make predictions, which are more suitable for processing road traffic data. However, due to the complexity of road conditions, the current methods still have many problems, such as emergencies, road topological relationships are difficult to learn, etc. Summary of the invention
[0005] In order to solve the above technical problems, the present invention proposes a road condition prediction method based on big data, comprising:
[0006] S1: Get three original road condition data tables; the fields in the first table include the road section ID, including the current time, the time to be predicted, the number of vehicles passing through the 5 time slices before the current time, the road congestion status and speed; the fields in the second table include the road section ID, road length, width, number of lanes, travel direction, speed limit, and road grade; the fields in the third table include the downstream road ID connected to each road;
[0007] S2: Merge the three acquired original data tables of road conditions into one data table, and extract the continuous features, category features, and spatial features of the data in the data table;
[0008] S3: Establish a traffic condition prediction model, wherein the traffic condition prediction module includes: a multi-layer perceptron based on dynamic attention, a graph neural network based on topological subgraphs, and a classification layer;
[0009] S4: Use multi-layer perceptron based on dynamic attention to learn continuous features and category features;
[0010] S5: Use graph neural network based on topological subgraph to learn spatial features;
[0011] S6: Concatenate the output vector of the multi-layer perceptron based on dynamic attention and the output vector of the graph neural network based on the topological subgraph, and output the prediction result through the classification layer.
[0012] Beneficial effects of the present invention:
[0013] The present invention improves the model's ability to understand features by classifying features and allowing similar features to interact better. It also uses a multi-layer perceptron with dynamic attention to fully mine category features and discrete features, automatically extract deep features that are more closely related to road congestion and assign higher weights to them, thereby improving the model's fitting ability. It also fully learns complex road topology information through the graph neural network of the topological subgraph, further improving the model's accuracy in predicting road conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is the overall flow chart of the present invention;
[0015] Figure 2 The structure diagram of the multi-layer perceptron for feature interaction;
[0016] Figure 3 This is the structural diagram of the dynamic attention network. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] A road condition prediction method based on big data, comprising:
[0019] S1: Get three original road condition data tables; the fields in the first table include the road section ID, including the current time, the time to be predicted, the number of vehicles passing through the 5 time slices before the current time, the road congestion status and speed; the fields in the second table include the road section ID, road length, width, number of lanes, travel direction, speed limit, and road grade; the fields in the third table include the downstream road ID connected to each road;
[0020] S2: Merge the three acquired original data tables of road conditions into one data table, and extract the continuous features, category features, and spatial features of the data in the data table;
[0021] S3: Establish a traffic condition prediction model, wherein the traffic condition prediction module includes: a multi-layer perceptron based on dynamic attention, a graph neural network based on topological subgraphs, and a classification layer;
[0022] S4: Use multi-layer perceptron based on dynamic attention to learn continuous features and category features;
[0023] S5: Use graph neural network based on topological subgraph to learn spatial features;
[0024] S6: Concatenate the output vector of the multi-layer perceptron based on dynamic attention and the output vector of the graph neural network based on the topological subgraph, and output the prediction result through the classification layer.
[0025] In the embodiment of the present invention, the process of feature extraction is:
[0026] Step 1: For continuous features, the data of the five time slices before the current time slice are used as a sequence, and each time slice represents 2 minutes. The average vehicle speed, maximum vehicle speed, minimum vehicle speed, average number of vehicles passing per minute, maximum number of vehicles passing per minute, minimum number of vehicles passing per minute, congestion ratio, and estimated arrival time are counted as continuous features within the window.
[0027] Step 2: For the category features, for each road ID, the hourly road congestion ratio, hourly average vehicle speed, hourly average number of vehicles passing through, weekly road congestion ratio, weekly average vehicle speed, and weekly average number of vehicles passing through are counted as category features.
[0028] Step 3: For spatial features, take road sections as nodes, count the number of upstream and downstream nodes of each road, the road conditions of upstream and downstream nodes, and the current road attribute characteristics as spatial features.
[0029] In an embodiment of the present invention, the process of the multi-layer perceptron based on dynamic attention is:
[0030] Step 1: Send the category feature k into the multi-layer perceptron based on feature interaction for feature extraction to obtain the feature vector E k .
[0031] Step 2: Take all continuous features s as input and get the feature vector E through the dynamic attention network. s .
[0032] Step 3: Transform the eigenvector E k and the eigenvector E sSpliced together, we get the output feature vector E a .
[0033] In the embodiment of the present invention, Figure 2 As shown in Figure 2, the process of the multi-layer perceptron based on feature interaction is:
[0034] Step 1: Encode the category feature k through the Embedding layer to obtain the encoding vector E for each category e .
[0035] Step 2: Transform the encoding vector E e Transpose to get the transposed vector Two multilayer perceptrons with one hidden layer are used to perform high-dimensional mapping on the two vectors to obtain E e1 and
[0036] Step 3: E e1 and Perform matrix multiplication and activate it using the sigmoid activation function, and then use a learnable weight matrix M to make the activated matrix and the original E e1 Fusion is performed. The final output category feature vector E is obtained k The specific calculation formula is as follows:
[0037] E e =ε(k)
[0038] E k =ε(k)+σ(g1(ε(k))g2(ε(k) T ))M
[0039] Among them, E k Represents the category feature vector, ε represents the Embedding code, k represents the category feature, g1 and g2 represent the first and second multi-layer perceptrons, T represents the matrix transpose, M represents the learnable weight matrix, and σ represents the sigmoid activation function.
[0040] The calculation method of sigmoid is as follows:
[0041]
[0042] Here, x represents the input element.
[0043] In the embodiment of the present invention, Figure 3 As shown, the process of the dynamic attention network is:
[0044] Step 1: Send the continuous feature s into three 1×1 convolution kernels respectively to obtain three vectors E1, E2, and E3 with the same dimension.
[0045] Step 2: Perform matrix multiplication on E1 and E2 to obtain the matrix E after feature crossover s1 , and at the same time, E1 and E3 perform matrix multiplication to obtain the matrix E after feature crossover s2 . Use the softmax function to activate the two feature matrices and obtain the corresponding correlation matrix and
[0046] Step 3: Transform the correlation matrix Perform matrix multiplication with E3, which means assigning the weight of the correlation matrix to the original vector, and obtain the first attention vector E sa , and the correlation matrix Perform matrix multiplication with E2 to get the second attention vector E sb The two attention vectors are weighted using two learnable parameters α and β, and finally a 1×1 convolution kernel is used to restore the dimension to the original dimension, and the original feature S is residually connected to obtain a continuous feature vector E s The specific formula is as follows:
[0047]
[0048] Among them, E s represents a continuous feature vector, f1, f2, f3, and f4 represent the first, second, third, and fourth 1×1 convolutional layers, respectively. represents the softmax activation function, α and β represent the first and second learnable weight parameters respectively, s represents the continuous feature of the input, f() represents the convolution operation, and T represents the matrix transpose.
[0049] The softmax activation function is calculated as follows:
[0050]
[0051] Among them, x i and x j Represents the i-th and j-th elements in a vector.
[0052] The initialization value of α is The mean of all values in the matrix, the initial value of β is The mean of all values in the matrix.
[0053] In an embodiment of the present invention, the process of the graph neural network based on the topological subgraph is:
[0054] Step 1: For any road segment, extract the 4th-order nodes of its upstream and downstream to construct an undirected graph. Construct the undirected graph of all roads to obtain the adjacency matrix A.
[0055] Step 2: Send the adjacency matrix A and spatial features F into the graph neural network, calculate layer by layer and use the output of the mth layer of the graph neural network as the topological vector E of the road r .
[0056] Among them, the learning formula of the graph neural network is as follows:
[0057] H0=ε r (link,C1,C2,...,C8), F=[link,C1,C2,...,C8]
[0058]
[0059] E r =H m
[0060] Among them, ε r represents the embedding layer, link, C1, C2, …, C8 represent the road link of spatial feature F and its upstream and downstream nodes respectively, H0 represents the first layer output of graph neural network, H l represents the output of the lth layer of the graph neural network, H m represents the output of the mth layer of the graph neural network, m is the maximum depth of the graph neural network, σ represents the sigmoid activation function, and W l represents the weight of the lth layer of the graph neural network, D represents the degree matrix, tanh represents the tanh activation function, M l Represents the bias weight of the lth layer of the graph neural network.
[0061] The calculation formula of the tanh activation function is as follows:
[0062]
[0063] Where x represents the input element.
[0064] In the embodiment of the present invention, the road condition prediction model is used to predict the traffic road condition: the predicted road congestion level is directly output as the prediction result through the classification layer. The classification layer is a linear layer, the output dimension of the linear layer is the number of categories, and the concatenated vector is used as input to obtain the classification result after passing through the classification layer.
[0065] In the embodiment of the present invention, during the road condition prediction model training phase, the predicted results and the actual results are subjected to cross entropy loss calculation, and the specific calculation formula is as follows:
[0066]
[0067] Among them, L represents the cross entropy loss function, j represents the total number of samples, and y irepresents the true value of the i-th sample, Represents the predicted value of the i-th sample.
[0068] After obtaining the loss value, the various parameters of the model are optimized through back propagation until they converge and the model training is completed.
[0069] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A road condition prediction method based on big data, characterized in that: include: S1: Get three original road condition data tables; the fields in the first table include the road section ID, including the current time, the time to be predicted, the number of vehicles passing through the 5 time slices before the current time, the road congestion status and speed; the fields in the second table include the road section ID, road length, width, number of lanes, travel direction, speed limit, and road grade; the fields in the third table include the downstream road ID connected to each road; S2: Merge the three acquired original data tables of road conditions into one data table, and extract the continuous features, category features, and spatial features of the data in the data table; Extract continuous features, categorical features, and spatial features from data tables, including: For continuous features, the data of the five time slices before the current time slice are used as a sequence. Each time slice represents 2 minutes. The average vehicle speed, maximum vehicle speed, minimum vehicle speed, average number of vehicles passing per minute, maximum number of vehicles passing per minute, minimum number of vehicles passing per minute, congestion ratio, and estimated arrival time are counted within the window as continuous features. For the category features, for each road ID, the hourly road congestion ratio, hourly average vehicle speed, hourly average number of vehicles passing through, weekly road congestion ratio, weekly average vehicle speed, and weekly average number of vehicles passing through are counted as category features; For spatial features, the road sections are taken as nodes, and the number of upstream and downstream nodes of each road, the road conditions of the upstream and downstream nodes, and the current road attribute characteristics are counted as spatial features; S3: Establishing a traffic condition prediction model, the traffic condition prediction model includes: a multi-layer perceptron based on dynamic attention, a graph neural network based on topological subgraphs, and a classification layer; S4: Use multi-layer perceptron based on dynamic attention to learn continuous features and category features; S5: Use graph neural network based on topological subgraph to learn spatial features; S6: Concatenate the output vector of the multi-layer perceptron based on dynamic attention and the output vector of the graph neural network based on the topological subgraph, and output the prediction result through the classification layer.
2. The road condition prediction method based on big data according to claim 1, characterized in that: A multi-layer perceptron based on dynamic attention is used to learn continuous features and category features, including: Step 1: Send the category features into the multi-layer perceptron based on feature interaction for feature extraction to obtain the feature vector E k ; Step 2: Take all continuous features as input and get the feature vector E through the dynamic attention network. s ; Step 3: Transform the eigenvector E k and the eigenvector E s Spliced together, we get the output feature vector E a .
3. The road condition prediction method based on big data according to claim 2 is characterized in that: Feature extraction based on multi-layer perceptron with feature interaction, including: Step 1: Encode the category features through the Embedding layer to obtain the encoding vector E for each category e ; Step 2: Transform the encoding vector E e Transpose to get the transposed vector Two multilayer perceptrons with one hidden layer are used to perform high-dimensional mapping on the two vectors to obtain E e1 and Step 3: E e1 and Perform matrix multiplication and activate it using the sigmoid activation function, and then use a learnable weight matrix M to make the activated matrix and the original E e Fusion is performed to obtain the final output category feature vector E k .
4. The road condition prediction method based on big data according to claim 3 is characterized in that: The category feature vector E is obtained by using a multi-layer perceptron based on feature interaction. k ,include: E k =ε(k)+σ(g1(ε(k))g2(ε(k) T ))M Among them, E k Represents the category feature vector, ε represents Embedding encoding, k represents category features, g1 and g2 represent the first and second multi-layer perceptrons, T represents matrix transpose, M represents the learnable weight matrix, σ represents the sigmoid activation function, and ε(k) represents Embedding encoding of category features.
5. The road condition prediction method based on big data according to claim 2, characterized in that: Extract feature vector E through dynamic attention network s ,include: Step 1: Send the continuous feature S into three 1×1 convolution kernels respectively to obtain three vectors E1, E2, and E3 with the same dimensions; Step 2: Perform matrix multiplication on E1 and E2 to obtain the matrix E after feature crossover s1 , and at the same time, E1 and E3 perform matrix multiplication to obtain the matrix E after feature crossover s2 , use the softmax function to activate the two feature matrices and get the corresponding correlation matrix and Step 3: Transform the correlation matrix Perform matrix multiplication with E3, which means assigning the weight of the correlation matrix to the original vector, and obtain the first attention vector E sa , and the correlation matrix Perform matrix multiplication with E2 to get the second attention vector E sb , two learnable parameters α and β are used to weight the two attention vectors, and finally a 1×1 convolution kernel is used to restore the dimension to the original dimension and perform a residual connection with the original continuous feature S to obtain a continuous feature vector E s .
6. The road condition prediction method based on big data according to claim 5, characterized in that: Obtaining continuous feature vector E through dynamic attention network s ,include: Among them, E s represents a continuous feature vector, f1, f2, f3, and f4 represent the first, second, third, and fourth 1×1 convolutional layers, respectively. represents the softmax activation function, α and β represent the first and second learnable weight parameters respectively, s represents the continuous feature of the input, f() represents the convolution operation, and T represents the matrix transpose.
7. The road condition prediction method based on big data according to claim 1, characterized in that: The spatial features are learned using a graph neural network based on topological subgraphs, including: Step 1: For any section of road, extract the 4th-order nodes of its upstream and downstream to construct an undirected graph, and construct the undirected graph of all roads to form an adjacency matrix A; Step 2: Send the adjacency matrix A and spatial features F into the graph neural network, calculate layer by layer and use the output of the mth layer of the graph neural network as the topological vector E of the road r .
8. The road condition prediction method based on big data according to claim 7, characterized in that: Calculate the topological vector E of the road r ,include: H0=ε r (link,C1,C2,...,C8),F=[link,C1,C2,...,C8] E r =H m Among them, ε r represents the embedding layer, link, C1, C2, …, C8 represent the road link of spatial feature F and its upstream and downstream nodes respectively, H0 represents the first layer output of graph neural network, H l represents the output of the lth layer of the graph neural network, H m represents the output of the mth layer of the graph neural network, m is the maximum depth of the graph neural network, σ represents the sigmoid activation function, and W l represents the weight of the lth layer of the graph neural network, D represents the degree matrix, tanh represents the tanh activation function, M l Represents the bias weight of the lth layer of the graph neural network.
Citation Information
Patent Citations
Graph neural network traffic flow prediction method and system based on attention mechanism
CN111161535A
High-speed traffic flow prediction method based on multi-modal fusion and graph attention mechanism
CN111540199A
Traffic prediction method based on enhanced space-time diagram neural network
CN112241814A
Graph neural network traffic flow prediction method based on multivariate time sequence interpolation
CN113673769A
Urban traffic flow reasoning method based on dynamic multi-view graph neural network
CN114925836A
