A traffic flow and volume parallel prediction method and device based on space-time graph learning, medium and product

CN118430286BActive Publication Date: 2026-08-11BEIHANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-30
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]在当前领域,交通数据集数量有限且大多不能提供足够全面的信息,制约了研究者对交通系统复杂性的深入理解

Benefits of technology

本发明提供了一种基于时空图学习的交通流速流量并行预测方法、装置、介质及产品,通过获取待预测交通区域在当前时刻以前第一预设时段以内的历史交通数据;交通数据包括有向图、流量、流速和外部因素;所述外部因素包括兴趣点;根据所述历史交通数据,利用流速流量预测模型,确定待预测交通区域下一时段的流速和流量;其中,所述流速流量预测模型是利用训练数据集对神经网络进行训练确定的;所述训练数据集包括训练用交通区域的交通数据和对应的下一时段的流速真实值和流量真实值。本发明基于图卷积与空洞卷积算法,引入了一种新的神经网络结构,包括特征内部时空联系,特征与外部因素之间的潜在关联以及流速流量内部的耦合关系,使该模型能够更好地捕捉交通模式的复杂性,通过历史时间段的流速流量信息预测下一时间段的流速流量数据,提高预测的准确性和实用性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118430286B_ABST
    Figure CN118430286B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, medium, and product for parallel prediction of traffic velocity and flow rate based on spatiotemporal graph learning, relating to the field of traffic velocity and flow rate prediction. The method includes: acquiring historical traffic data of the traffic area to be predicted within a first preset time period before the current time; determining the velocity and flow rate of the traffic area to be predicted in the next time period using a velocity and flow rate prediction model based on the historical traffic data; the velocity and flow rate prediction model is determined by training a neural network using a training dataset; the training dataset includes traffic data of the training traffic area and the corresponding true values ​​of velocity and flow rate for the next time period; the neural network includes a first prediction module, a second prediction module, and a third prediction module; the prediction modules include a linear layer, a begin convolutional layer, a first dilated convolution, a second dilated convolution, a 1×1 convolutional layer, a batch normalization layer, a convolutional layer, a graph convolutional layer, and an end convolutional layer. This invention improves the accuracy of prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic flow velocity and volume prediction, and in particular to a method, apparatus, medium, and product for parallel prediction of traffic flow velocity and volume based on spatiotemporal graph learning. Background Technology

[0002] Traditional methods for predicting traffic velocity and volume typically rely on statistical models or rule-based manual modeling. However, these methods often fall short when faced with complex traffic system dynamics, spatiotemporal dependencies, and nonlinear relationships. Furthermore, these traditional methods often struggle to effectively handle large-scale, high-dimensional real-time traffic data, severely limiting prediction accuracy.

[0003] With the advent of the big data era, the application of deep learning technology in traffic prediction has gradually attracted widespread attention. Deep learning algorithms, through learning from large amounts of real-time and historical traffic data, can automatically discover traffic patterns, extract features, and adjust prediction results in real time. Continuous updates to time series algorithms enable deep learning models to better uncover potential relationships within sequences; graph correlation algorithms also help models simultaneously capture connections within the graph data structure. The application of advanced technologies related to deep learning algorithms has brought new breakthroughs to traffic prediction.

[0004] However, current traffic forecasting systems still face multiple challenges, including data dimensionality reduction, modeling nonlinear spatiotemporal relationships, real-time requirements, and long-term forecasting. Existing technologies have failed to effectively address these challenges, thus necessitating an innovative approach to improve the accuracy and practicality of traffic forecasting.

[0005] In the current field, the limited number of traffic datasets, and the fact that most do not provide sufficiently comprehensive information, restricts researchers' ability to gain a deeper understanding of the complexity of traffic systems. Although different researchers have made the training data more concise and informative by adding extra features and reducing the dataset size, there is currently no unified approach, and the accuracy of the models still has room for improvement. Summary of the Invention

[0006] The purpose of this invention is to provide a method, device, medium, and product for parallel prediction of traffic velocity and flow rate based on spatiotemporal graph learning, so as to improve the accuracy of traffic velocity and flow rate prediction.

[0007] To achieve the above objectives, the present invention provides the following solution: A parallel traffic velocity and flow prediction method based on spatiotemporal graph learning includes: Obtain historical traffic data for the traffic area to be predicted within a first preset time period prior to the current time; the traffic data includes a directed graph, traffic flow, flow velocity, and external factors; the external factors include points of interest. Based on the historical traffic data, a flow rate and flow rate prediction model is used to determine the flow rate and flow rate of the traffic area to be predicted in the next time period. The flow rate and flow rate prediction model is determined by training a neural network using a training dataset. The training dataset includes traffic data of the traffic area used for training and the corresponding actual values ​​of flow rate and flow rate for the next time period. The neural network includes a first prediction module, a second prediction module, and a third prediction module; The prediction module includes a linear layer, a begin convolutional layer, a first dilated convolutional layer, a second dilated convolutional layer, a 1×1 convolutional layer, a batch normalization layer, a convolutional layer, a graph convolutional layer, and an end convolutional layer; The linear layer is connected to the beginning convolutional layer; the beginning convolutional layer is connected to the first dilated convolution, the second dilated convolution, the 1×1 convolutional layer, and the batch normalization layer; the first dilated convolution and the second dilated convolution are both connected to the convolutional layer; the convolutional layer and the 1×1 convolutional layer are both connected to the end convolutional layer; the convolutional layer is also connected to the graph convolutional layer; the graph convolutional layer is connected to the batch normalization layer.

[0008] Optionally, based on the historical traffic data, a velocity and flow rate prediction model is used to determine the velocity and flow rate of the traffic area to be predicted for the next time period, specifically including: Based on the directed graph, determine the Laplace matrix; Based on the Laplace matrix, the flow rate, the velocity, and the external factors, the velocity and flow rate of the traffic area to be predicted for the next time period are determined using a velocity and flow rate prediction model.

[0009] Optionally, the Laplace matrix is ​​determined based on the directed graph, specifically including: Using formula Determine the Laplace matrix; Where L is the Laplace matrix; I n D is the identity matrix; D is the diagonal matrix of the out-degrees of A; A is the adjacency matrix of the directed graph.

[0010] Optionally, the neural network is trained using a training dataset, specifically including: Construct the dataset; the dataset includes a training dataset and a validation dataset; The flow rate and flow rate in the training dataset are decentralized to obtain the processed traffic data; Using the processed traffic data as input, the current neural network is trained using a course-based learning approach to obtain the model output data; The model output data is decentralized to obtain the predicted flow velocity and flow rate for the next time period. Based on the predicted flow rate, predicted flow rate, actual flow rate, and actual flow rate for the next time period, a weighted mean square error is calculated to obtain the loss function value predicted by the model. The previously trained neural network is validated using a validation set. Training stops when the maximum number of training rounds is reached or the validation error meets the requirements. Otherwise, the parameters of the previously trained neural network are adjusted according to the loss function value, and the system returns "Using the processed traffic data as input, the current neural network is trained using a course learning method to obtain the model output data". The trained neural network corresponding to the minimum verification error is used as the flow rate prediction model.

[0011] Optionally, a dataset is constructed, specifically including: Acquire flow velocity and flow rate from various sensors in the traffic area; Obtain information on each of the aforementioned points of interest and extract the categories of the points of interest; the categories of the points of interest include furniture services, accommodation, electronic devices and home appliances, transportation, shopping, catering services, health and fitness, finance and services, education and culture, entertainment, car services, pet services, business services, government and public services, and miscellaneous items; Determine the number of missing data points for each sensor within a set time period; The first set of candidate sensors is determined based on the number of missing data and the threshold for the number of missing data. A second set of candidate sensors is determined based on the first set of candidate sensors and the minimum sensor interval. Find the time period in which all sensors collected valid data, and obtain the valid label sequence of sensor data; Based on the valid label sequence, a prefix sum algorithm is used to determine the candidate time series; the candidate time series are the time points where the data is valid at the current time point and within the previous 23 time points. Based on the second set of candidate sensors and the candidate time series, the raw data is determined; The original data is split into input data and output data to obtain a dataset; the time periods of the input data and the output data are equal.

[0012] Optionally, based on the effective labeled sequence, a prefix sum algorithm is used to determine the candidate time series, specifically including: Using formula Calculate the auxiliary array; where, As an auxiliary array, it represents the nth time after discrete time. The total number of invalid data obtained by all sensors within a given time point; C is the second set of candidate sensors; For a valid labeled sequence, 1 indicates the first The sensor at the discrete time of the first... The data obtained at each point in time is valid. 0 indicates the first The sensor at the discrete time of the first... The data obtained at each time point is invalid; The candidate time series is determined based on the auxiliary array.

[0013] A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning.

[0014] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning.

[0015] A computer program product includes a computer program that, when executed by a processor, implements the above-described parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning.

[0016] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: This invention provides a method, apparatus, medium, and product for parallel prediction of traffic velocity and flow rate based on spatiotemporal graph learning. It acquires historical traffic data of the traffic area to be predicted within a first preset time period prior to the current moment. The traffic data includes a directed graph, flow rate, velocity, and external factors, including points of interest. Based on the historical traffic data, a velocity and flow rate prediction model is used to determine the velocity and flow rate of the traffic area to be predicted in the next time period. The velocity and flow rate prediction model is determined by training a neural network using a training dataset. The training dataset includes traffic data of the training traffic area and the corresponding actual velocity and flow rate values ​​for the next time period. This invention introduces a novel neural network structure based on graph convolution and dilated convolution algorithms, including spatiotemporal relationships within features, potential correlations between features and external factors, and coupling relationships within velocity and flow rate. This allows the model to better capture the complexity of traffic patterns and predict velocity and flow rate data for the next time period using historical time period information, improving the accuracy and practicality of the prediction. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning provided in Embodiment 1 of the present invention. Figure 2 A flowchart illustrating the process of building a dataset; Figure 3 This is a schematic diagram of the neural network training process; Figure 4 This is a schematic diagram of the prediction module structure; Figure 5 This is a schematic diagram of the neural network structure in this embodiment; Figure 6 This is a diagram of the internal structure of a computer device. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] The purpose of this invention is to provide a method, device, medium, and product for parallel prediction of traffic velocity and flow rate based on spatiotemporal graph learning, so as to improve the accuracy of traffic velocity and flow rate prediction.

[0021] Traditional time series models are constructed using statistical learning methods such as ARIMA or time-series networks based on basic deep learning models, but they ignore the unique graph structure characteristics of traffic.

[0022] With the rapid development of computer science, artificial intelligence has permeated all aspects of life. Deep learning, as a crucial component of AI, offers supervised learning models through neural networks that achieve higher accuracy compared to traditional statistical learning methods, while also meeting the need for improved computational efficiency. Among numerous deep learning frameworks, graph neural networks (GNNs) have become the best choice to surrogate traditional statistical learning methods due to their highly consistent topological structure with traffic flow network patterns. However, research utilizing GNNs for traffic flow rate prediction is still relatively limited.

[0023] In the field of multi-task prediction of traffic flow rate, problems such as single prediction models and insufficient prediction accuracy still exist. This invention aims to introduce a new dataset creation method and neural network structure based on graph convolution and dilated convolution algorithms, including spatiotemporal feature extraction and feature interaction prediction. This enables the model to better capture the complexity of traffic patterns and predict the flow rate data for the next time period using historical flow rate information, thereby improving the accuracy and practicality of the prediction. This invention is a data-driven graph neural network algorithm that can improve the scalability and accuracy of the model, enabling better traffic flow rate prediction. The data-driven graph neural network method refers to the model automatically capturing potential graph structure information using existing graph structures and feature data. Scalability refers to the scalability of the number of prediction indicators and the number of feature types. Traffic flow rate prediction involves inputting processed historical time period data (including graph structure, flow rate features, and external factors) into the model, and using a deep learning model to predict the flow rate data of each sensor for the next time period.

[0024] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0025] Example 1 like Figure 1 As shown, the parallel traffic flow velocity and volume prediction method based on spatiotemporal graph learning in this embodiment includes: S1: Obtain historical traffic data of the traffic area to be predicted within a first preset time period before the current time; the traffic data includes directed graphs, traffic flow, flow velocity, and external factors; the external factors include points of interest.

[0026] S2: Based on the historical traffic data, the flow rate and flow rate prediction model is used to determine the flow rate and flow rate of the traffic area to be predicted in the next time period; wherein, the flow rate and flow rate prediction model is determined by training a neural network using a training dataset; the training dataset includes traffic data of the traffic area used for training and the corresponding actual values ​​of flow rate and flow rate for the next time period.

[0027] The neural network includes a first prediction module, a second prediction module, and a third prediction module.

[0028] The prediction module includes a linear layer, a begin convolutional layer, a first dilated convolutional layer, a second dilated convolutional layer, a 1×1 convolutional layer, a batch normalization layer, a convolutional layer, a graph convolutional layer, and an end convolutional layer.

[0029] The linear layer is connected to the `begin` convolutional layer; the `begin` convolutional layer is connected to the first dilated convolution, the second dilated convolution, the 1×1 convolutional layer, and the batch normalization layer; the first dilated convolution and the second dilated convolution are both connected to the convolutional layer; the convolutional layer and the 1×1 convolutional layer are both connected to the `end` convolutional layer; the convolutional layer is also connected to the graph convolutional layer; the graph convolutional layer is connected to the batch normalization layer. Graph convolution algorithms are used to extract spatial features from the data; dilated convolution is used to extract temporal features from the data; and a parallel prediction method using a prediction module is used to extract potential relationships within the data and interactions between data points.

[0030] As an optional implementation, step S2 specifically includes: Determine the Laplace matrix based on the directed graph.

[0031] Using formula Determine the Laplace matrix.

[0032] Where L is the Laplace matrix; I n D is the identity matrix; D is the diagonal matrix of the out-degrees of A; A is the adjacency matrix of the directed graph.

[0033] Based on the Laplace matrix, the flow rate, the velocity, and the external factors, the velocity and flow rate of the traffic area to be predicted for the next time period are determined using a velocity and flow rate prediction model.

[0034] In practical applications, inputting historical traffic data into a trained neural network (flow velocity and flow prediction model) involves four steps, including: 1) Construct the Laplace matrix from the adjacency matrix of the directed graph obtained from the dataset according to the formula: .

[0035] in, Representative unit array, It represents Out-of-degree diagonal matrix, This represents the adjacency matrix of the constructed directed graph.

[0036] 2) Transform the external factors whose feature dimensions differ from those of flow velocity and flow rate using the following formula: .

[0037] in, For parameter matrices, Representing the original external factors, These are the processed features.

[0038] 3) Learn the underlying graph structure using the parameter matrix.

[0039] 4) Use graph convolution and dilated convolution to predict flow velocity and flow rate information for the next time period.

[0040] The calculations in these four steps may exhibit linear or nonlinear relationships. Therefore, the model's effectiveness is evaluated by calculating the difference between the predicted results and the actual values. After appropriately selecting the model and corresponding parameters, this method can predict future flow velocity and flow rate information with high accuracy over long periods.

[0041] As an alternative implementation method, such as Figure 3 As shown, training the neural network using the training dataset specifically includes: Step 100: Construct the dataset; the dataset includes a training dataset and a validation dataset. In practical applications, follow... Figure 2 The dataset is constructed in the following manner: Step 001: Obtain the directed graph of the traffic network at the current time. The nodes of the directed graph correspond to the various sensors on the traffic segments. The edges of the directed graph represent the transition probabilities between the sensors corresponding to the two nodes connected by the edge. This can be calculated by obtaining the location information of the sensors within the selected area. Let the distance between the two sensors be denoted as . The standard deviation of the distance between all sensors is The formula for calculating the transition probability is: .

[0042] in, For the transition probability; The threshold value is set. The final flow of vehicles moves on this directed graph.

[0043] We acquire information about points of interest around each sensor and extract all categories of interest points that appear. Instead of directly using all categories of interest points provided by the information source, we only focus on the categories that appear. The purpose is to reduce the size of this information by eliminating useless information, thereby reducing the size of the model and the number of model parameters, so that the model can have a better learning effect.

[0044] In this embodiment, the information source classifies all points of interest around the sensors as follows: Laundry shops, construction companies, home furnishing stores, shops, auto repair shops, accommodations, electronics stores, plumbing shops, appliance stores, transportation stations, department stores, hardware stores, grocery stores or supermarkets, furniture stores, video stores, clothing stores, health and wellness stores, movie rental stores, gyms, spas, financial institutions, pharmacies, ATMs, restaurants, cafes, schools, tourist attractions, locksmiths, bicycle shops, parks, car rentals, clinics, hospitals, real estate agencies, beauty salons, barbershops, law firms, dentists, parking lots, insurance agencies, gas stations, accounting firms, libraries, tobacco and liquor stores, supermarkets, pharmacies, convenience stores, bars, bakeries, takeout shops, shoe stores, bookstores, post offices, banks, art galleries, car dealerships, veterinarians, pet shops, car washes, roofing contractors, warehouses, light rail stations, physical therapists, jewelry stores, food delivery points, RV parking lots, fire stations, paint shops, moving companies, museums, taxi stands, bus stops, local government offices, stadiums, train stations, secondary schools, police stations, shopping malls, travel agencies, subway stations.

[0045] To achieve a smaller model parameter size and better model training results, it is necessary to reduce the number of label categories while minimizing the loss of information that is helpful for model training. Therefore, the above labels are divided into the following categories according to their specific functions: Furniture services, accommodation, electronic equipment and appliances, transportation, shopping, food and beverage services, health and fitness, finance and services, education and culture, entertainment, automotive services, pet services, business services, government and public services, and miscellaneous.

[0046] The distribution results of points of interest around each sensor are processed according to the above classification and then combined with the sensor's flow velocity and flow rate data for subsequent data filtering.

[0047] Step 002: Determine the time period to be selected for the dataset. Discretize the time period data generated by the data collected in Step 001 in chronological order, determine the data gap threshold for a single sensor, obtain the number of gap data for each sensor in the selected time period, discard sensors with a number of gap data not less than the data gap threshold for a single sensor, and determine the candidate sensor set 1 (the first candidate sensor set) accordingly.

[0048] Step 003: Determine the minimum sensor interval. Select a set of 2 (the second set of candidate sensors) that meets the conditions from the set of candidate sensors 1 based on the sensor location information. In this embodiment, an enumeration method can be used, that is, enumerate the sensors that have not been discarded according to the sensor number and discard the sensors whose distance from the currently enumerated sensor is not greater than the determined minimum sensor interval. In actual use, other algorithms can also be selected to make the position distribution of the resulting set of candidate sensors 2 more uniform.

[0049] Step 004: Find the time period during which all sensors collected valid data, and obtain the valid sensor data marker sequence. (for a given) , 1 indicates the first The sensor at the discrete time of the first... The data obtained at the [number]th time point is valid; a value of 0 indicates that the [number]th time point is [value]. The sensor at the discrete time of the first... (If the data obtained at any given time point is invalid), use the prefix sum algorithm to calculate the auxiliary array: in, Indicates the first time after discrete time The sum of invalid data obtained by all sensors within a time point, where C is the set of candidate sensors 2; t is the time point.

[0050] Depend on Calculate each discrete post-time point The candidate time series is the sum of invalid data collected by sensors in each candidate sensor set 2 from the previous 23 time points (a total of 24 time points, of which the first 12 time points are used as input and the last 12 time points are used as values ​​to be predicted). Only the discrete time points corresponding to the results with a result of 0 are selected. That is, the time points in which the data are all valid within the previous 23 time points constitute the candidate time series. This avoids the data not matching the actual situation due to the need for interpolation and other operations to complete the data because of invalid data, which would lead to poor model training results.

[0051] Step 005: The determined candidate sensor set 2 is used as the final selected sensor set. Combined with the candidate time series, the raw data of the dataset is obtained. Specifically, for each time t in the candidate time series, all sensors included in candidate sensor set 2 are selected at discrete time... arrive The flow rate, flow rate, time period, and point of interest data are treated as a single data unit. All data units obtained using this method constitute the complete original data. In this embodiment, time period and point of interest are treated as external factor data and participate in subsequent training.

[0052] Step 006: Decompose the discrete-time part of the original data into arrive and arrive The dataset is divided into two parts: given data (input data) and predicted results (output data), which respectively fulfill the requirement that the historical data of the dataset corresponds to the target value. The dataset is then divided proportionally according to the requirements to complete the production.

[0053] Step 200: Decentralize the flow rate and traffic volume in the training dataset to obtain the processed traffic data.

[0054] In practical applications, the training set portion of the dataset is used as input, and the flow rate and volume data are centered before input. The mean and variance of the flow rate and volume in the training set are then calculated. The centralization formula is: .

[0055] in, represents the centralized flow rate or volume; x represents the flow rate or volume in the training dataset. The average value of flow velocity or flow rate; The variance of flow rate or flow volume.

[0056] According to the central limit theorem, when the sample size is large, the data after this operation will approximate a normal distribution, which is beneficial for model training.

[0057] Step 300: Using the processed traffic data as input, train the current neural network using a course learning method to obtain the model output data.

[0058] In practical applications, a course-based learning approach is used to train the model. Unlike most current models that directly read in 12 time steps and predict 12 time steps, this approach starts by reading in 12 time steps and predicting 2 time steps. Every 10 training epochs, the number of predictions increases by 2 time steps until the target length of predicting 12 time steps is reached.

[0059] Step 400: Perform inverse centralization processing on the model output data to obtain the predicted flow velocity and flow rate for the next time period.

[0060] In practical applications, the output is inversely centered to obtain the predicted value. Let the model output be... The inverse centralization formula is: .

[0061] Step 500: Based on the predicted flow rate, predicted flow rate, actual flow rate, and actual flow rate for the next time period, perform a weighted mean square error calculation to obtain the loss function value predicted by the model.

[0062] In practical applications, the predicted and actual flow rate data are weighted and mean squared errors are calculated. The weight is the reciprocal of the square of the mean of the corresponding variable, with the goal of dimensionless calculation.

[0063] Step 600: Validate the previously trained neural network using the validation set. When the maximum number of training rounds is reached or the validation error meets the requirements, stop training. Otherwise, adjust the parameters of the previously trained neural network according to the loss function value and return "Use the processed traffic data as input, train the current neural network using the course learning method, and obtain the model output data."

[0064] In practical applications, after each training round using the entire training set, the validation set is used to verify the error. Training stops when the required number of training rounds or the error magnitude meets the requirements.

[0065] Step 700: Use the trained neural network corresponding to the minimum verification error as the flow rate prediction model.

[0066] In practical applications, the model with the smallest validation set error is selected as the final pre-trained model.

[0067] The prediction module structure is as follows: Figure 4 As shown, it includes a linear layer, a begin convolutional layer, a first dilated convolutional layer, a second dilated convolutional layer, a 1×1 convolutional layer, a batch normalization layer, a convolutional layer, a graph convolutional layer, and an end convolutional layer. The prediction module in the neural network learns the relationship between a single feature (flow rate or volume) and other features, thereby predicting future changes in this single feature data.

[0068] The principle behind this prediction module is as follows: Historical flow velocity and flow rate information and the flow velocity and flow rate information for the next time period are viewed as vectors in a high-dimensional space. , The model learns the difference between two vectors. Complete the forecast. Consider. It can be formed by a set of linearly independent bases This is because the true value is only known when the loss is calculated after the predicted result is obtained; therefore, during the model calculation process... The selection of [aspects] is learned through the model. The strategy adopted here is to simulate [the process from...]. Following this The search proceeds along the middle direction to obtain the predicted value. Because the model's gradient descent prioritizes updating parameters in the direction that minimizes the loss, the model will preferentially learn the direction that minimizes the loss. Contributing significantly And because, according to the assumption: Linearly independent, therefore along The search direction is reversible; let's assume that the model training yields... right Its contribution gradually decreased.

[0069] Consider the meaning of Taylor expansion, which is to expand the function... exist This set of bases is decomposed, and the coefficients are... Similarly, to improve the model's fitting ability, a coefficient term is added, resulting in the final model prediction target being... The output is: .

[0070] in, For the model In the convolutional part, summation is achieved through skip connections in the model, where k is the number of spatial basis units, i.e. The size of the set.

[0071] Recursive definition base : ,in For the gated unit in the model, For graph convolution functions; further defined To enhance the model's nonlinear fitting capability, the basis is transformed again. The final output of the model is: .

[0072] The prediction module structure is as follows: Figure 4 As shown: The model's inputs include flow rate or volume data, external factor data, and a Laplacian matrix constructed from the adjacency matrix of the directed graph in the dataset. Specifically, to maintain dimensionality consistency in the input data, the external factors are first linearly transformed to a form similar in shape to the flow rate or volume data. This transformed external factor data is then concatenated with the flow rate or volume data to obtain the model's final input. The processing method for linear layers is as follows: .

[0073] in For parameter matrices, Representing the original external factors, These are the processed features.

[0074] The input to the model is This represents [batch size, number of channels (features), number of sensors, and time step]. After being input into the model, it first passes through the 'begin convolution' module, which changes... The size of the feature increases its dimensionality, enabling the model to extract features from the input data in a higher dimension. The convolution function including the bias term is... ,in This represents the convolution symbol. The two-dimensional convolution formula used in the model is: .

[0075] in, Iterate through all the coordinates of the convolution kernel in sequence; The data to be convolved; This refers to the data at the corresponding position of the two-dimensional convolution kernel; For the first The offset in position.

[0076] Temporal feature extraction employs a GRU-like gating structure and dilated convolution. The difference between dilated convolution and regular convolution lies in the presence of gaps between kernel elements. This means it has a larger receptive field, allowing for a shallower network and reduced model complexity while ensuring sufficient data for computation. The size of the gaps can be determined by adjusting the dilation function. The dilated convolution function, including the bias term, is... ,in Represents the convolution symbol. This is the kernel for dilated convolution. The difference between dilated and regular convolution is that the kernel for dilated convolution can be obtained by transforming the regular kernel—by adding spaces (zeros) between kernel elements to enlarge the kernel. Dilated convolution kernel size. Original kernel size With expansion rate (dilation) Satisfying the formula: .

[0077] The 'gating' in the gated unit is achieved by using the sigmoid function after dilated convolution: .

[0078] Activate to obtain .make After convolution with holes function: .

[0079] Activate: The final output of the gating unit is: .

[0080] in, These represent two convolution processes with different holes; The coefficients obtained from the gating mechanism; Representative of Hadamaji: , Represents the element-wise addition of matrices: The input for this section is... .

[0081] After convolving the obtained output again, we get... For input data conduct Convolution yields coefficients The two are multiplied together as part of the output. .

[0082] To simplify the model complexity, let and Shared parameters. The obtained Graph convolution is performed to obtain The formula for graph convolution is: .

[0083] in, This is the weight matrix. To determine the adjacency matrix of a directed graph Constructed Laplace matrix: .

[0084] Represents the identity matrix. It represents The diagonal matrix of the out-degrees of each point; That is, subtract the adjacency matrix from the out-degree matrix.

[0085] The difference between the convolutional value and the initial value is used to obtain a new basis vector. This is then passed as input to the next layer of the model.

[0086] To ensure robust model convergence and avoid gradient vanishing or exploding before the next input, batch normalization is used on the data. The distribution is standardized.

[0087] Finally, summing the values ​​obtained from the jump connections, we get: .

[0088] Finally, after passing through the 'end convolution' layer, the predicted value is obtained. .

[0089] Unless otherwise specified, the activation function for all models is ReLU. .

[0090] The model consists of 8 prediction layers, namely The kernel size for each dilated convolution layer is... For the case of single feature output, For the case of dual-feature output, The module output size is This represents [batch size, time period, number of sensors, number of predicted features].

[0091] Figure 4 The modules shown are important components of the deep learning architecture provided by this invention. Figure 5 This will demonstrate the specific construction of this deep learning network architecture.

[0092] like Figure 5 The diagram shows the model structure for predicting future changes in flow velocity and flow rate by using a neural network to predict the spatiotemporal relationships and coupling between factors within the flow velocity and flow rate. This model consists of three... Figure 4 The prediction module shown consists of the following components. Their functions are as follows: The first prediction module takes graph structure, flow rate data, and external factors as input, and outputs the predicted flow rate data. The third prediction module takes graph structure, velocity data, and external factors as input, and outputs the predicted velocity data. The second prediction module takes graph structure, velocity, and flow rate data as input, but does not include external factors; its output is twice the size of modules one and three, with the first part representing the predicted flow rate data and the second part representing the predicted velocity data. The weighted mean square error of the two sets of velocity and flow rate data is calculated, with the weight being the reciprocal of the square of the corresponding variable's mean, thus achieving dimensionless data representation.

[0093] .

[0094] Where N is the total number of samples; For model flow rate or flow prediction values; This represents the actual value of the corresponding data.

[0095] Considering that the square of the mean might be large, resulting in a smaller loss and affecting the model's learning performance, this invention assigns a weight of 1 to flow rate and a weight of the flow velocity equal to the ratio of the flow rate mean to the square of the overall flow velocity mean, without adjusting the learning rate. .

[0096] in, This represents the loss value for the model's flow velocity prediction; Represents the true value of the flow velocity data; Model predictions representing flow velocity data; The average value representing actual traffic data; This represents the mean of the actual flow velocity data.

[0097] Multiply the two together as the loss during model training: . The predicted loss values ​​for velocity and flow rate data in modules 1 and 3 of Model 1; This represents the predicted loss value for the velocity and flow rate data in the second module of the model. Note that during prediction, only the velocity and flow rate data output from the first and third modules are used as predicted values, and the output of the second module is not used. The second module only participates in the model training process and does not participate in the model prediction process.

[0098] The three prediction modules serve the following purposes: The first module aims to uncover the spatiotemporal characteristics of flow rate from a directed graph perspective and its potential connections with external factors. The third module, similar to the first, aims to uncover the spatiotemporal characteristics of flow velocity from a directed graph perspective and its potential connections with external factors. The second module aims to uncover the spatiotemporal characteristics of flow velocity and flow rate from a directed graph perspective and the coupling relationship between the two. Because the losses from the two sets of flow velocity and flow rate are ultimately multiplied, when the model parameters are updated (i.e., gradient backpropagation), the parameters in the second prediction module will propagate the gradient to the first and third modules. That is: .

[0099] .

[0100] Ultimately, this model structure can simultaneously capture the spatiotemporal information of flow velocity and flow rate in a directed graph, the potential connections with external factors, and the internal coupling between them, thereby achieving better prediction results.

[0101] By overcoming the shortcomings of existing technologies, this invention achieves more accurate, real-time, and adaptive traffic prediction and provides a unified method for processing external features. Based on graph convolution and dilated convolution algorithms, a novel dataset creation method and neural network structure are introduced, including spatiotemporal feature extraction and feature interaction prediction. This enables the model to better capture the complexity of traffic patterns and predict traffic flow data for the next time period using historical time period flow rate and volume information, thereby improving the accuracy and practicality of predictions.

[0102] Example 2 A computer device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the parallel traffic flow velocity and volume prediction method based on spatiotemporal graph learning in Embodiment 1.

[0103] Example 3 A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning in Embodiment 1.

[0104] Example 4 A computer program product includes a computer program that, when executed by a processor, implements the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning in Embodiment 1.

[0105] Example 5 A computer device, which may be a database, may have an internal structure diagram as shown below. Figure 6 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores pending transactions. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements the parallel traffic flow velocity and volume prediction method based on spatiotemporal graph learning in Embodiment 1.

[0106] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this invention are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0107] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided by this invention may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided by this invention may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0108] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0109] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning, characterized in that, include: Historical traffic data of the traffic area to be predicted within a first preset time period before the current time is obtained; the traffic data includes a directed graph, flow rate, flow velocity, and external factors; the graph nodes of the directed graph correspond to various sensors on the traffic segments; the edges of the directed graph represent the transition probabilities between the sensors corresponding to the two graph nodes connected by the edge; the external factors include points of interest; the categories of points of interest include furniture services, accommodation, electronic devices and home appliances, transportation, shopping, catering services, health and fitness, finance and services, education and culture, entertainment, car services, pet services, business services, government and public services, and miscellaneous; Based on the historical traffic data, a flow rate and flow rate prediction model is used to determine the flow rate and flow rate of the traffic area to be predicted in the next time period. The flow rate and flow rate prediction model is determined by training a neural network using a training dataset. The training dataset includes traffic data of the traffic area used for training and the corresponding actual values ​​of flow rate and flow rate for the next time period. The neural network includes a first prediction module, a second prediction module, and a third prediction module; The prediction module includes a linear layer, a begin convolutional layer, a first dilated convolutional layer, a second dilated convolutional layer, a 1×1 convolutional layer, a batch normalization layer, a convolutional layer, a graph convolutional layer, and an end convolutional layer; The linear layer is connected to the beginning convolutional layer; the beginning convolutional layer is connected to the first dilated convolution, the second dilated convolution, the 1×1 convolutional layer, and the batch normalization layer; the first dilated convolution and the second dilated convolution are both connected to the convolutional layer; the convolutional layer and the 1×1 convolutional layer are both connected to the end convolutional layer; the convolutional layer is also connected to the graph convolutional layer; the graph convolutional layer is connected to the batch normalization layer. Training a neural network using a training dataset specifically includes: Construct the dataset; the dataset includes a training dataset and a validation dataset; Building the dataset specifically includes: Acquire flow velocity and flow rate from various sensors in the traffic area; Obtain the information of each point of interest and extract the category of the point of interest; Determine the number of missing data points for each sensor within a set time period; The first set of candidate sensors is determined based on the number of missing data and the threshold for the number of missing data. A second set of candidate sensors is determined based on the first set of candidate sensors and the minimum sensor interval. Find the time period in which all sensors collected valid data, and obtain the valid label sequence of sensor data; Based on the valid label sequence, a prefix sum algorithm is used to determine the candidate time series; the candidate time series are the time points where the data is valid at the current time point and within the previous 23 time points. Based on the second set of candidate sensors and the candidate time series, the raw data is determined; The original data is split into input data and output data to obtain a dataset; the time periods of the input data and the output data are equal. The flow rate and flow rate in the training dataset are decentralized to obtain the processed traffic data; Using the processed traffic data as input, the current neural network is trained using a course-based learning approach to obtain the model output data; The model output data is decentralized to obtain the predicted flow velocity and flow rate for the next time period. Based on the predicted flow rate, predicted flow rate, actual flow rate, and actual flow rate for the next time period, a weighted mean square error is calculated to obtain the loss function value predicted by the model. The previously trained neural network is validated using a validation set. Training stops when the maximum number of training rounds is reached or the validation error meets the requirements. Otherwise, the parameters of the previously trained neural network are adjusted according to the loss function value, and the system returns "Using the processed traffic data as input, the current neural network is trained using a course learning method to obtain the model output data". The trained neural network corresponding to the minimum verification error is used as the flow rate and flow prediction model.

2. The parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning according to claim 1, characterized in that, Based on the historical traffic data, a velocity and flow rate prediction model is used to determine the velocity and flow rate of the traffic area to be predicted for the next time period, specifically including: Based on the directed graph, determine the Laplace matrix; Based on the Laplace matrix, the flow rate, the velocity, and the external factors, the velocity and flow rate of the traffic area to be predicted for the next time period are determined using a velocity and flow rate prediction model.

3. The parallel traffic flow velocity and volume prediction method based on spatiotemporal graph learning according to claim 2, characterized in that, Based on the directed graph, the Laplace matrix is ​​determined, specifically including: Using formula Determine the Laplace matrix; Where L is the Laplace matrix; I n D is the identity matrix; D is the diagonal matrix of the out-degrees of A; A is the adjacency matrix of the directed graph.

4. The parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning according to claim 1, characterized in that, Based on the effective labeled sequence, a prefix sum algorithm is used to determine the candidate time series, specifically including: Using formula Calculate the auxiliary array; where, As an auxiliary array, it represents the nth time after discrete time. The total number of invalid data obtained by all sensors within a given time point; C is the second set of candidate sensors; For a valid labeled sequence, 1 indicates the first The sensor at the discrete time of the first... The data obtained at each point in time is valid. 0 indicates the first The sensor at the discrete time of the first... The data obtained at each time point is invalid; The candidate time series is determined based on the auxiliary array.

5. A computer device, comprising: The memory and processor contain a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning as described in any one of claims 1-4.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning as described in any one of claims 1-4.

7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the parallel prediction method for traffic velocity and flow rate based on spatiotemporal graph learning as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Multi-information fusion space-time diagram convolution traffic flow prediction method

    CN116258258A