Traffic flow prediction method, device and equipment and computer readable storage medium
By using a multi-time periodic sequence modeling mechanism (MTPM) in traffic flow prediction, traffic flow data is divided into hourly and day-weekly periodic sequences and predicted separately, the problem of insufficient time heterogeneity capture ability in the prior art is solved, and the accuracy of prediction is improved.
Patent Information
- Application Number
- CN202411824025.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art has difficulties in capturing temporal heterogeneity in traffic flow sequence data, resulting in low prediction accuracy.
By constructing a multi-time periodic sequence modeling mechanism (MTPM), traffic flow data are divided into hourly periodic sequences and day-weekly periodic sequences, and feature extraction and prediction are performed through the prediction module in the target traffic flow prediction model respectively.
Improve the ability to capture multiple temporal heterogeneity in traffic flows and enhance the accuracy of predictions.
Smart Images

Figure CN119851463A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a traffic flow prediction method, device, equipment and computer-readable storage medium. Background Art
[0002] At present, traffic flow prediction is a key research in smart transportation. Usually, the existing technology uses an adaptive graph convolutional recurrent network (AGCRN) to predict traffic flow. Although the AGCRN network can use independent weights and biases for each sensor (i.e., node) through the node adaptive parameter learning (NAPL) module to learn the unique pattern of each node, thereby improving the ability to capture spatial heterogeneity in traffic flow sequence data. However, when capturing long-term dependencies in traffic flow sequence data, the AGCRN network will confuse different time characteristics, resulting in insufficient ability to capture temporal heterogeneity in traffic flow sequence data, resulting in low prediction accuracy. Summary of the invention
[0003] To solve the above technical problems, the embodiments of the present application hope to provide a traffic flow prediction method, device, equipment and computer-readable storage medium, which can solve the problem that the related technology is insufficient in capturing the temporal heterogeneity in traffic flow sequence data, thereby resulting in low prediction accuracy.
[0004] The technical solution of this application is implemented as follows:
[0005] A traffic flow prediction method, the method comprising:
[0006] Obtain the target historical traffic flow of the target road section within the target historical time period before the time to be predicted;
[0007] Based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow, determining the first target sequence and the second target sequence corresponding to the target historical traffic flow; wherein the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample road section within the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods;
[0008] Using the first prediction module and the second prediction module in the target traffic flow prediction model, respectively extracting features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information;
[0009] Based on the first target feature information and the second target feature information, a target predicted traffic flow of the target road section at the time to be predicted is obtained.
[0010] In the above scheme, the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow are used to determine the first target sequence and the second target sequence corresponding to the target historical traffic flow, including:
[0011] Determining the first target sequence from the target historical traffic flow based on a plurality of first time steps before the initial time of the time to be predicted; wherein the first time step represents a time related to an hour;
[0012] The second target sequence is determined from the target historical traffic flow based on a plurality of second time steps before the initial time; wherein the second time steps represent time related to the day and week.
[0013] In the above solution, the determining the second target sequence from the target historical traffic flow based on a plurality of second time steps before the initial time includes:
[0014] Determining a first sub-target sequence from the target historical traffic flow data based on a plurality of first sub-time steps before the initial time; wherein the first sub-time steps represent time associated with the day;
[0015] Based on a plurality of second sub-time steps before the initial time, a second sub-target sequence is determined from the target historical traffic flow data; wherein the second sub-time steps represent a time related to a week.
[0016] In the above scheme, the first prediction module and the second prediction module in the target traffic flow prediction model are used to extract features of the first target sequence and the second target sequence respectively to obtain first target feature information and second target feature information, including:
[0017] Obtaining a first target feature matrix based on the N prediction units in the first prediction module and the first initial feature matrix in the first target sequence;
[0018] Based on the N prediction units in the second prediction module and the second initial feature matrix in the second target sequence, a second target feature matrix is obtained; wherein the first prediction module has the same structure as the second prediction module, and the N prediction units have the same structure.
[0019] In the above solution, the first target feature matrix is obtained based on the N prediction units in the first prediction module and each first initial feature matrix in the first target sequence, including:
[0020] Obtaining a first sub-prediction feature matrix based on the first prediction unit in the first prediction module and each of the first initial feature matrices;
[0021] Based on the second prediction unit in the first prediction module and the first sub-prediction feature, obtaining a second sub-prediction feature matrix;
[0022] Based on the Nth prediction unit in the first prediction module and the N-1th sub-prediction feature matrix, obtaining an Nth sub-prediction feature matrix;
[0023] Feature fusion is performed on the first sub-prediction feature matrix, the second sub-prediction feature matrix and the Nth sub-prediction feature matrix to obtain the first target feature matrix.
[0024] In the above solution, the first prediction unit in the first prediction module and each of the first initial feature matrices are used to obtain the first sub-prediction feature matrix, including:
[0025] For each of the first initial feature matrices, extracting features from the first initial feature matrix based on a hidden state module in the first prediction unit to obtain a first output feature matrix;
[0026] The first sub-prediction feature matrix is obtained based on the first prediction unit, the first initial feature matrix, the first output feature matrix and the adaptive matrix.
[0027] In the above solution, the first prediction sub-feature matrix is obtained based on the first prediction unit, the first initial feature matrix, the first output matrix and the adaptive matrix, including:
[0028] Obtaining a second output feature matrix based on the reset gate module in the first prediction unit, the first output feature matrix, the first initial feature matrix, and the adaptive matrix;
[0029] Obtaining a third output feature matrix based on the update gate module in the first prediction unit, the first output feature matrix, the second output feature matrix, the first initial feature matrix, and the adaptive matrix;
[0030] The first sub-prediction feature matrix is obtained based on the first output feature matrix, the second output feature matrix, and the third output feature matrix.
[0031] In the above solution, obtaining the target predicted traffic flow of the target road section at the time to be predicted based on the first target feature information and the second target feature information includes:
[0032] Determine a first weight corresponding to the first target sequence and a second weight corresponding to the second target sequence;
[0033] The first target feature matrix, the second target feature matrix, the first weight, and the second weight are operated to obtain the target predicted traffic flow.
[0034] A traffic flow prediction device, comprising:
[0035] An acquisition unit, used for acquiring a target historical traffic flow of a target road section within a target historical time period before a time to be predicted;
[0036] A processing unit, for determining a first target sequence and a second target sequence corresponding to the target historical traffic flow based on a data modeling mechanism in a target traffic flow prediction model and the target historical traffic flow; wherein the target traffic flow prediction model is obtained by training an initial traffic flow prediction model based on sample historical traffic flows of sample road sections within a sample historical time period; and the data modeling mechanism is used to construct time periodic sequences of different time periods;
[0037] The processing unit is further used to use the first prediction module and the second prediction module in the target traffic flow prediction model to respectively extract features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information;
[0038] A determination unit is used to obtain a target predicted traffic flow of the target road section at the time to be predicted based on the first target feature information and the second target feature information.
[0039] A traffic flow prediction device, the device comprising: a processor, a memory and a communication bus;
[0040] The communication bus is used to realize the communication connection between the processor and the memory;
[0041] The processor is used to execute the traffic flow prediction program stored in the memory to implement the steps of the above-mentioned traffic flow prediction method.
[0042] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned traffic flow prediction method.
[0043] The traffic flow prediction method, apparatus, device and computer-readable storage medium provided in the embodiments of the present application first obtain the target historical traffic flow of the target section in the target historical time period before the time to be predicted, and then determine the first target sequence and the second target sequence corresponding to the target historical traffic flow based on the data modeling mechanism and the target historical traffic flow in the target traffic flow prediction model, and the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample section in the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods, and then the first prediction module and the second prediction module in the target traffic flow prediction model are used to train the first target sequence and the second target sequence respectively. The feature extraction of the target sequence is performed to obtain the first target feature information and the second target feature information. Then, based on the first target feature information and the second target feature information, the target predicted traffic flow of the target section at the time to be predicted is obtained. In this way, the first target sequence and the second target sequence of different time periods are constructed by adopting the data modeling mechanism, that is, the different characteristics of the traffic flow in the time dimension are modeled respectively, and then the two periodic sequences are processed by a prediction module respectively, and the first target feature information and the second target feature information are obtained to jointly predict. This not only realizes the improvement of the ability to capture various time heterogeneities in the traffic flow, but also has the ability to better capture the time heterogeneity in the traffic flow, thereby improving the accuracy of the prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flow chart of a traffic flow prediction method provided in an embodiment of the present application;
[0045] Figure 2 A flow chart of another traffic flow prediction method provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of MTPM-AGCRN in a traffic flow prediction method provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of comparing results in a traffic flow prediction method provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of comparing results in a traffic flow prediction method provided in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of the structure of a traffic flow prediction device provided in an embodiment of the present application;
[0050] Figure 7 A schematic diagram of the structure of a traffic flow prediction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0052] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] It should be noted that traffic flow prediction, namely vehicle flow prediction, is a key research in smart transportation, which can be applied to the following application scenarios: 1) Traffic management: By predicting vehicle flow, the timing of traffic lights can be reasonably arranged, vehicle flow distribution can be adjusted, the operating efficiency of the transportation network can be optimized, and traffic congestion can be reduced; 2) Route planning: According to the vehicle flow prediction results, a relatively smooth route can be selected to avoid severely congested roads, providing drivers with more accurate and fast navigation options; 3) Travel decision-making: For individual travelers or public transportation operators, vehicle flow prediction can provide traffic conditions in a certain period of time in the future, helping people make more informed travel decisions and choose the best travel time and mode of transportation; 4) Urban planning: Vehicle flow prediction can provide an important reference for urban planning, helping relevant departments to reasonably plan transportation infrastructure such as roads, bus routes, and parking facilities to meet future traffic needs; 5) Smart city construction: Vehicle flow prediction combined with other intelligent technologies can provide data support for smart city construction and realize the construction of intelligent transportation systems such as traffic signal optimization and intelligent parking management. In summary, vehicle flow prediction has broad application prospects in traffic management, route planning, travel decisions, urban planning and smart city construction, and can improve traffic efficiency and the quality of urban operation.
[0054] For vehicle flow prediction, existing technologies are mainly based on graph convolutional networks (GCN). Specifically, in solution one, the vehicle speed information per unit time is first collected to construct a data set; then the site network structure topology diagram is generated; then a graph convolutional neural network model is constructed to encode the road network topology and vehicle flow time series information to learn the spatial dependency feature information of the data; then the obtained encoded information is input into the Informer layer for training and learning the long-term dependency feature information of the data to achieve the prediction of future vehicle flow; that is, in solution one, the network topology of the traffic road network is learned through the graph convolutional neural network, and the long-term flow characteristics are combined with the Informer framework to predict the traffic change trend. In the second scheme, the vehicle global positioning system (GPS) data in the past period of time is first collected, and the GPS data is integrated with the actual road network information data to generate a road adjacency matrix; then, based on the road adjacency matrix and the road vehicle flow feature matrix, the spatial characteristics of the vehicle flow data of the road are extracted through the GCN network, and the temporal characteristics of the vehicle flow data of the road are extracted through the long short-term memory (LSTM) network. The spatial characteristics and temporal characteristics of the vehicle flow data of the road are integrated to obtain the predicted value of the vehicle flow data of the road in the next time period; then the time period characteristics and weather characteristics of the vehicle flow data on the road to be predicted are extracted, and the time period characteristics are obtained by decomposing the time series data of the vehicle flow on the road, and the weather characteristics are obtained by the temperature of each hour of the day; then the spatial characteristics, time characteristics, time period characteristics and weather characteristics of the vehicle flow data on the road to be predicted are linearly integrated to obtain the final prediction result of the vehicle flow data of the next time period of the road to be predicted; that is, the vehicle flow is predicted by considering the time period characteristics and weather characteristics factors in the second scheme. In Scheme 3, based on historical traffic flow data, as well as external factors such as weather factors and holidays, Convolutional Neural Network (CNN) and Residual Units are used to achieve a traffic flow prediction that utilizes space-time characteristics; that is, Scheme 3 takes into account the impact of holidays to predict traffic flow.Scheme 4 uses AGCRN to predict traffic flow. Specifically, the AGCRN technology uses two adaptive modules. One is the NAPL module, which uses the Node Adaptive Parameter Learning-Graph Convolutional Network (NAPL-GCN) to replace the Multi-Layer Perceptron (MLP) layer in the Gated Recurrent Unit (GRU) to capture the spatial and temporal correlation of specific nodes in vehicle flow data; the other is the Data Adaptive Graph Generation (DAGG) module, which is used to automatically discover the spatial dependency of vehicle flow sequences, and further propose a complete AGCRN network to automatically capture the spatiotemporal correlation in vehicle flow sequence data. Although the AGCRN technical solution uses independent weights and biases for each node through the NAPL module to learn the unique patterns of each node and improve the ability to capture spatial heterogeneity in vehicle flow sequence data, this technical solution will confuse different temporal characteristics when capturing long-term dependencies in vehicle flow sequence data. In other words, this technical solution is insufficient in capturing temporal heterogeneity in vehicle flow sequence data.
[0055] Based on this, this application uses a data modeling mechanism (such as Multi-TemporalPeriodicity series Modeling (MTPM)) to optimize the AGCRN technical solution to address the problem that the AGCRN technical solution is difficult to capture the temporal heterogeneity in vehicle flow series data, and obtains the MTPM-AGCRN technical solution.
[0056] The present application embodiment provides a traffic flow prediction method, which can be applied to a traffic flow prediction device, referring to Figure 1 As shown, the method comprises the following steps:
[0057] Step 101: Obtain a target historical traffic flow of a target road section within a target historical time period before a time to be predicted.
[0058] In the embodiment of the present application, the time to be predicted is the time when traffic flow needs to be predicted; the target historical time is the time before the time to be predicted; the target historical traffic flow may refer to the traffic flow collected on the target road section within the target historical time period, and it is time-based sequence data; traffic flow (i.e., vehicle flow) refers to time series data that records the number of vehicles passing through a certain location (i.e., target road section) in different time periods; and it can be collected through sensors (i.e., nodes) in the traffic road network; traffic flow prediction is based on a given historical traffic flow (i.e., target historical traffic flow) to predict future traffic flow through a certain traffic flow prediction method.
[0059] It should be noted that the traffic network can be defined as an undirected graph This undirected graph is used to represent the relationship between nodes in the spatial dimension, where γ is the set of nodes in the traffic network, γ = |N is the number of nodes, and ε is the set of edges between nodes. To represent the graph The adjacency matrix of the adjacency relationship between nodes in the graph. The traffic sequence data on Where N is the number of nodes, F is the number of features (such as flow and speed) of this sequence at each node, and T is the time step of this sequence. Represents the graph signal at the tth time step, using Represents the observation sequence of F features at the nth node at the tth time step, thus using represents the observation sequence of F features on all nodes at the tth time step, and will start from the tth time step to the past T in The observation sequence of F features on all nodes at time steps is expressed as and will As the input historical observation sequence of the prediction problem (i.e., the target historical traffic flow).
[0060] Step 102: Based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow, determine a first target sequence and a second target sequence corresponding to the target historical traffic flow.
[0061] Among them, the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample section within the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods.
[0062] In an embodiment of the present application, the data modeling mechanism may refer to a multi-temporal periodicity series modeling mechanism (MTPM), which is used to construct periodic sequences of different time periods, and the data modeling mechanism may include an hourly periodicity sequence modeling mechanism, a daily periodicity sequence modeling mechanism, and a weekly periodicity sequence modeling mechanism; the first target sequence may refer to an hourly periodicity sequence established with an hourly period; the second target sequence may refer to a day-weekly periodicity sequence established with a day-weekly period; the first target sequence may be determined based on the hourly periodicity sequence modeling mechanism and the target historical traffic flow, and the second target sequence may be determined based on the daily periodicity sequence modeling mechanism, the weekly periodicity sequence modeling mechanism, and the target historical traffic flow.
[0063] Step 103: Using the first prediction module and the second prediction module in the target traffic flow prediction model, respectively extract features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information.
[0064] In an embodiment of the present application, the first prediction module is used to extract features from the first target sequence, and the second prediction module is used to extract features from the second target sequence, that is, the first target sequence and the second target sequence are each extracted features by a prediction module; and the first prediction module and the second prediction module have the same structure; the first target feature information refers to the feature information obtained by extracting features from the first target sequence using the first prediction module, and the second target feature information refers to the feature information obtained by extracting features from the second target sequence using the second prediction module. In a feasible implementation, the first prediction module and the second prediction module may refer to an adaptive graph convolutional recurrent neural network (AGCRN).
[0065] Step 104: Based on the first target feature information and the second target feature information, obtain the target predicted traffic flow of the target road section at the time to be predicted.
[0066] In the embodiment of the present application, the target predicted traffic flow may refer to the traffic flow at the time to be predicted obtained by using the target historical traffic flow prediction; after obtaining the first target feature information and the second target feature information, the first target feature information and the second target feature information may be integrated to obtain the target predicted traffic flow at the time to be predicted. In this way, by adopting a data modeling mechanism (such as the MTPM mechanism), different characteristics in the time dimension of the vehicle flow sequence are modeled and integrated respectively. Compared with the prior art, it has the advantage of being able to better capture the temporal heterogeneity in the vehicle flow sequence data, and realizes the improvement of the ability to capture multiple temporal heterogeneities in the vehicle flow sequence.
[0067] It should be noted that you can use represents the observation sequence of the fth feature (such as flow) on all nodes at the tth time step, and will start from the t+1th time step to the future T out The observation sequence of the fth feature on all nodes at time steps is expressed as and will As the target sequence of the prediction problem (i.e. the real sequence), you can use represents the predicted sequence of the fth feature on all nodes at the tth time step, and will start from the t+1th time step to the future T out The prediction sequence of the fth feature on all nodes at time steps is expressed as and will As the output of the prediction problem, the future prediction sequence (i.e., the target predicted traffic flow at the time to be predicted) is used.
[0068] It should be noted that in the actual research of traffic flow prediction, the prediction problem can be defined as: finding a in The input history observation sequence of time steps To predict the future out The output future prediction sequence of time steps The function of , that is, to find H(·) in the following formula, can make With the future T out target sequence of time steps Closest to:
[0069] The traffic flow prediction method provided in the embodiment of the present application adopts a data modeling mechanism to construct a first target sequence and a second target sequence of different time periods, that is, different characteristics of traffic flow in the time dimension are modeled separately, and then the two periodic sequences are processed by a prediction module respectively, and the first target feature information and the second target feature information obtained are used to jointly predict, which not only improves the ability to capture various temporal heterogeneities in traffic flow, but also has the ability to better capture the temporal heterogeneity in traffic flow, thereby improving the accuracy of prediction.
[0070] Based on the above embodiments, the present application provides another traffic flow prediction method. Figure 2 and Figure 3 As shown, the method may include the following steps:
[0071] Step 201: The traffic flow prediction device obtains a target historical traffic flow of a target road section within a target historical time period before a time to be predicted.
[0072] Step 202: The traffic flow prediction device determines a first target sequence from the target historical traffic flow based on a plurality of first time steps before the initial time of the time to be predicted.
[0073] Therein, the first time step represents the time related to hours.
[0074] In the embodiment of the present application, the first target sequence is from the initial time t t Towards the past hourly T in The input sequence is composed of observation sequences of time steps; specifically, the hourly periodic sequence modeling mechanism can be used to select the initial time t from the target historical traffic flow t The previous hourly T in The sequence corresponding to the time steps constitutes the first target sequence, which can be expressed as
[0075]
[0076] Step 203: The traffic flow prediction device determines a second target sequence from the target historical traffic flow based on a plurality of second time steps before the initial time.
[0077] Here, the second time step represents the time related to the day and week.
[0078] In the embodiment of the present application, the second target sequence may refer to a daily-weekly periodic sequence, which is composed of a daily periodic sequence and a weekly periodic sequence intersecting each other.
[0079] It should be noted that step 203 can be implemented in the following ways:
[0080] Step 203A: The traffic flow prediction device determines a first sub-target sequence from the target historical traffic flow data based on a plurality of first sub-time steps before the initial time.
[0081] Here, the first sub-time step represents the time relative to the day.
[0082] Step 203B: The traffic flow prediction device determines a second sub-target sequence from the target historical traffic flow data based on multiple second sub-time steps before the initial time.
[0083] The second sub-time step represents the time related to the week.
[0084] It should be noted that, for actual traffic flow, the daily periodicity similarity between weekdays (i.e. Monday to Friday) is higher, the daily periodicity similarity between weekends (i.e. Saturday and Sunday) is higher, and the daily periodicity similarity between weekdays and weekends is moderate; therefore, if only the daily periodicity sequence modeling mechanism is adopted, then when the vehicle flow sequence data on Monday or Saturday is predicted, the periodicity between weekdays and weekends that is not similar enough will be mixed, thereby affecting the accuracy of the prediction; and if only the long-term periodicity sequence modeling mechanism such as weekly periodicity is adopted, all predictions are based on a long time span, then the accuracy of the prediction may be affected due to the existence of uncertain external factors; therefore, the present application is based on the idea of predicting weekday sequence data with weekday sequence data and predicting weekend sequence data with weekend sequence data, to construct a daily periodicity sequence (i.e. the first sub-target sequence) and a weekly periodicity sequence (i.e. the second sub-target sequence).
[0085] In the embodiment of the present application, the first sub-goal sequence may refer to a daily periodic sequence; the second sub-goal sequence may refer to a weekly periodic sequence; and the daily periodic sequence may refer to a periodic sequence from the initial time step t t Towards the past T with a full day cycle in The observation sequence is an observation sequence of time steps. Specifically, the daily periodic sequence modeling mechanism can be used to select the initial time t from the target historical traffic flow. t The previous T with a full day cycle in The sequence corresponding to the time steps constitutes the first sub-target sequence, which can be expressed as The weekly periodic series can refer to the period from the initial time step t t Towards the past T with a full cycle in The input sequence is composed of observation sequences of time steps. Specifically, a weekly periodic sequence modeling mechanism can be used to select the initial time t from the target historical traffic flow. t The previous T with a full week as a cycle inThe sequence corresponding to the time steps constitutes the second sub-target sequence, which can be expressed as
[0086] In the embodiment of the present application, when the initial time is on a certain day among Tuesday, Wednesday, Thursday, Friday or Sunday, the daily periodic sequence modeling mechanism is adopted; when the initial time is on a certain day among Monday or Saturday, the weekly periodic sequence modeling mechanism is adopted; then, the second target sequence (i.e., the daily-weekly periodic sequence) can be expressed as the following expression:
[0087]
[0088] Among them, Tue, Fri, Sun, Mon and Sat represent Tuesday, Friday, Sunday, Monday and Saturday respectively, and (Tue, Fri) represents the interval from Tuesday to Friday.
[0089] In summary, under the action of the MTPM mechanism, the input historical observation sequence can be (i.e., the target historical traffic flow) is modeled as an hourly periodic sequence and daily-weekly periodic series These two periodic sequences can better capture the temporal heterogeneity in traffic flow series data.
[0090] Step 204: The traffic flow prediction device obtains a first target feature matrix based on the N prediction units in the first prediction module and the first initial feature matrix in the first target sequence.
[0091] In the embodiment of the present application, the first target feature information includes a first target feature matrix; the first target feature matrix refers to a feature matrix obtained by integrating a matrix obtained by processing each first initial feature matrix using N prediction units; the first prediction module includes N prediction units, and the N prediction units have the same structure; for each first initial feature matrix (i.e. ), the first initial feature matrix can be processed in sequence by using N prediction unit pairs, and then the matrix output by each prediction unit is integrated to obtain the first target feature matrix. In a feasible implementation, when the first prediction module is AGCRN, each prediction unit can refer to an AGCRN element.
[0092] It should be noted that step 204 can be implemented in the following ways:
[0093] Step 204C: The traffic flow prediction device obtains a first sub-prediction feature matrix based on the first prediction unit in the first prediction module and each first initial feature matrix.
[0094] In an embodiment of the present application, the first sub-prediction feature matrix may refer to a feature matrix output by the first prediction unit; each first initial feature matrix may be input into the first prediction unit for feature processing to obtain an output feature matrix, and then the output feature matrices of each first initial feature matrix in the first target sequence may be stacked to obtain a first sub-prediction feature matrix.
[0095] It should be noted that step 204C can be implemented in the following ways:
[0096] Step 204C1: The traffic flow prediction device extracts features from each first initial feature matrix based on the hidden state module in the first prediction unit to obtain a first output feature matrix.
[0097] In the embodiment of the present application, the hidden state module is mainly used to extract features from the first initial feature matrix; for each first initial feature matrix, the first initial feature matrix can be input into the hidden state module in the first prediction unit for feature extraction to obtain a first output feature matrix Where, and H is the output dimension of the first output feature matrix.
[0098] Step 204C2: The traffic flow prediction device obtains a first sub-prediction feature matrix based on the first prediction unit, the first initial feature matrix, the first output feature matrix and the adaptive matrix.
[0099] In the embodiment of the present application, the first initial feature matrix, the first output feature matrix and the adaptive matrix can be processed by the reset gate module and the update gate module in the first prediction unit to obtain the first sub-prediction feature matrix.
[0100] It should be noted that step 204C2 can be implemented in the following ways:
[0101] Step 204c1: The traffic flow prediction device obtains a second output feature matrix based on the reset gate module, the first output feature matrix, the first initial feature matrix and the adaptive matrix in the first prediction unit.
[0102] In the embodiment of the present application, the second output characteristic matrix may refer to the matrix output by the reset gate module; for each first initial characteristic matrix and its corresponding first output characteristic matrix, the first output characteristic matrix, the first initial characteristic matrix and the adaptive matrix The two are input into the reset gate module for feature processing to obtain the second output feature matrix. Specifically, the processing process of the reset gate module on the first output feature matrix, the first initial feature matrix and the adaptive matrix can be expressed by the following formula:
[0103]
[0104] in, is the identity matrix, and are weight pool and bias pool respectively, which are learnable parameters, and P is the order of Chebyshev polynomial. Represents the Einstein summation convention, performing the sum of the products of corresponding terms.
[0105] Step 204c2: The traffic flow prediction device obtains a third output feature matrix based on the update gate module in the first prediction unit, the first output feature matrix, the second output feature matrix, the first initial feature matrix and the adaptive matrix.
[0106] In the embodiment of the present application, the third output feature matrix may refer to the feature matrix output by the update gate module; the calculation logic of the update gate module is the same as that of the reset gate module, except that the input and output dimensions are different; for each first initial feature matrix and its corresponding first output feature matrix and second output feature matrix, an activation function (such as a sigmoid activation function) may be first used to activate the second output feature matrix Processed, then multiplied with the first output feature matrix, and then multiplied with the first initial feature matrix Perform the connection operation and then with the adaptive matrix Input into an update gate module together to obtain the third output feature matrix
[0107]
[0108] Step 204c3: The traffic flow prediction device obtains a first sub-prediction feature matrix based on the first output feature matrix, the second output feature matrix, and the third output feature matrix.
[0109] In the embodiment of the present application, the first activation function can be used to perform nonlinear processing on the second output matrix to obtain a fourth output feature matrix, and then the fourth output feature matrix and the first output feature matrix are multiplied to obtain a fifth output feature matrix, and then the second activation function is used to process the third output feature matrix to obtain a sixth output feature matrix, and then the fourth output feature matrix and the sixth output feature matrix are multiplied and then added to the fifth output feature matrix to obtain the first prediction feature matrix. That is, the process can be expressed by the formula: It should be noted that each first initial feature matrix will obtain a predicted feature matrix.
[0110] In the embodiment of the present application, for each output of the first initial feature matrix All will be used as the hidden state input of the next first initial feature matrix, and all the first initial feature matrices output After the stacking operation, the output of a single AGCRN element is obtained, that is, the first sub-prediction feature matrix And T is the time dimension of the vehicle flow sequence data. This output is used as the input of the next detection unit.
[0111] In a feasible implementation, the first activation function may refer to a sigmoid activation function; and the second activation function may refer to a tanh activation function.
[0112] Step 204D: The traffic flow prediction device obtains a second sub-prediction feature matrix based on the second prediction unit in the first prediction module and the first sub-prediction feature.
[0113] In the embodiment of the present application, after obtaining the first sub-prediction feature, in addition to retaining the first sub-prediction feature, the first sub-prediction feature needs to be input into the next prediction unit (i.e., the second prediction unit). The processing process in the second prediction unit is the same as step 204C and will not be repeated here.
[0114] Step 204E: The traffic flow prediction device obtains the Nth sub-prediction feature matrix based on the Nth prediction unit and the N-1th sub-prediction feature matrix in the first prediction module.
[0115] Step 204F: The traffic flow prediction device performs feature fusion on the first sub-prediction feature matrix, the second sub-prediction feature matrix and the Nth sub-prediction feature matrix to obtain a first target feature matrix.
[0116] In the embodiment of the present application, after obtaining the output of each detection unit (i.e., the first sub-prediction feature matrix, the second sub-prediction feature matrix, and the Nth sub-prediction feature matrix), after being processed by a two-dimensional convolution layer and fusing the output features, the output of the first detection module is obtained.
[0117] Step 205: The traffic flow prediction device obtains a second target feature matrix based on the N prediction units in the second prediction module and the second initial feature matrix in the second target sequence.
[0118] The first prediction module and the second prediction module have the same structure, and the N prediction units have the same structure.
[0119] In the embodiment of the present application, the second target feature information includes a second target feature matrix; the N prediction units in the second prediction module process each second initial feature matrix in the second target sequence to obtain the second target feature matrix The process is the same as the processing of each first initial feature matrix in the first target sequence by the N prediction units in the first prediction module, indicating that the feature matrix of the input is different, which will not be repeated here.
[0120] Step 206: The traffic flow prediction device determines a first weight corresponding to the first target sequence and a second weight corresponding to the second target sequence.
[0121] Step 207: Calculate the first target feature matrix, the second target feature matrix, the first weight, and the second weight to obtain the target predicted traffic flow.
[0122] In the embodiment of the present application, the first prediction module and the second prediction module respectively output after processing the data (ie, the first target sequence and the second target sequence). and After the integration operation is performed through the following formula (4), the output of the MTPM-AGCRN technical solution is obtained, that is, the target predicted traffic flow
[0123] Y A =W h WY A,h +W dw WY A,dw Formula (4)
[0124] Among them, Y A,h With Y A,dw are the prediction sequences of hourly periodic sequence and daily-weekly periodic sequence on traffic characteristics, W h With W dw are the weight of the hourly periodic sequence (i.e., the first weight) and the weight of the daily-weekly periodic sequence (i.e., the second weight), respectively, indicating the influence of the two periodic historical sequences on the final target predicted traffic flow, and W represents the Hadamard product operation.
[0125] It should be noted that in order to verify the effectiveness of the proposed MTPM mechanism in the long-term prediction of vehicle flow, the prediction performance of MTPM-AGCRN and AGCRN on the two datasets PeMS04 and PeMS08 is compared by three evaluation indicators (such as mean absolute percentage error (MAPE), mean absolute error (MAE), and root mean square error (RMSE)) within a 1-hour prediction range. The comparison results are shown in Table 1 below:
[0126] Table 1
[0127]
[0128] Among them, it can be intuitively observed from the results in the table that the MTPM-AGCRN proposed in this application has achieved better prediction performance than AGCRN in the three evaluation indicators of the two data sets, which proves the effectiveness of the MTPM mechanism proposed in this application in vehicle flow prediction research.
[0129] It should be noted that in order to verify the effectiveness of the proposed MTPM mechanism in vehicle flow prediction research, multiple groups of experiments were carried out on two public traffic datasets for the MTPM-AGCRN technical solution, and the results were presented in the form of graphs and tables to intuitively reflect the improvement of the prediction performance of MTPM-AGCRN compared with AGCRN, as well as the effectiveness of the proposed MTPM mechanism.
[0130] (I) Analysis of long-term prediction results: In order to better understand the prediction performance of the MTPM-AGCRN proposed in this application, the predicted sequence data of MTPM-AGCRN, the corresponding real sequence data and the predicted sequence data of AGCRN were visually compared on the two datasets PeMS04 and PeMS08. The comparison results are shown in Figure 2. Figure 4 As shown. Among them, Figure 4 The upper subgraph in the figure shows the prediction results for the entire week from 00:00 on February 22, 2018 to 00:00 on March 1, 2018 on the 299th node in the PeMS04 dataset. Figure 4 The upper sub-figure in Figure 2 shows that the predicted sequence data curves of MTPM-AGCRN and AGCRN are roughly consistent with the real sequence data curves, indicating that both MTPM-AGCRN and AGCRN can predict the global change trend of the real vehicle flow sequence data. To further observe the details of the visual comparison of the prediction results, the prediction results of the entire day from 00:00 on February 26, 2018 to 00:00 on February 27, 2018 on the 299th node in the PeMS04 dataset are enlarged. The enlarged results are shown in Figure 2. Figure 4 As shown in the following sub-figure in Figure 4 The following sub-figures: 1) Observing the real sequence data curve, we can find that its frequency and degree of twists and turns are very high, and the curves in few intervals are smooth; 2) Observing the predicted sequence data curve of AGCRN, we can find that although its overall change trend is similar to the real sequence data curve, further observation Figure 4From the curves of the time periods of 06:30-07:00, 08:00-09:30, and 14:30-18:30 in the lower sub-figure, it can be found that for the intervals where local peaks and troughs appear continuously, the curve passes through in a smooth manner, indicating that although AGCRN can predict the overall change trend of vehicle flow series data, it cannot predict its local trend. Using a roughly middle value as the prediction value for continuous peaks and troughs, although AGCRN can obtain a good prediction performance, it cannot achieve a more accurate prediction; 3) Observing the predicted sequence data curve of MTPM-AGCRN again, it can be found that not only its overall trend is more similar to the real sequence data curve, but also further observing the curves of the lower sub-graph of 06:30-07:00, 08:00-09:30 and 14:30-18:30 in the time period, it can be found that although the curve is not very consistent with the peaks and troughs of the real sequence data curve, it is more similar to its changing trend, indicating that the proposed MTPM-AGCRN can predict the local continuous changing trend of vehicle flow sequence data and obtain better prediction performance. It also verifies the effectiveness of the MTPM mechanism in vehicle flow prediction research.
[0131] (II) Performance analysis of capturing temporal heterogeneity: In order to verify the effectiveness of the MTPM mechanism proposed in this application for capturing temporal heterogeneity in vehicle flow sequence data, the predicted sequence data of MTPM-AGCRN, the corresponding real sequence data and the predicted sequence data of AGCRN are visually compared. The comparison results are shown in Figure 2. Figure 5 As shown, and from Figure 5 It can be seen from the middle subgraph in that the predicted sequence data curves of AGCRN and MTPM-AGCRN are relatively close to the real sequence data curves, indicating that both models can roughly predict the overall trend of vehicle flow sequence data; however, compared with the predicted sequence data curve of MTPM-AGCRN, the degree of fit between the predicted sequence data curve of AGCRN and the real sequence data curve is not high enough. In order to further analyze the prediction mode of AGCRN for vehicle flow sequence data, only the predicted curve of AGCRN model and the target curve are observed, as shown in Figure 5 As shown in the following sub-figure in Figure 5The following sub-graphs are shown in the figure below: 1) Observe the interval between 400 and 500 of the vehicle flow sequence data values in the left sub-graph, and it can be found that in this interval, the trend of the predicted sequence data curve of ACGRN on Saturday is more similar to the trend of the real sequence data curve on Friday, rather than the real sequence data curve of the day; 2) Observe the interval between 350 and 450 of the vehicle flow sequence data values in the middle sub-graph, and it can be found that in this interval, the trend of the predicted sequence data curve of ACGRN on Monday is more similar to the trend of the real sequence data curve on Sunday, rather than the real sequence data curve of the day; 3) Observe the first obvious local peak in the real sequence data curve on Monday in the middle sub-graph, and it can be found that the predicted sequence data curve of ACGRN is nearly 4) Observe the first obvious local trough in the real sequence data curves on Tuesday and Wednesday in the right sub-figure, and find that the predicted sequence data curve of ACGRN passes through these two intervals in a manner similar to the trend of the real sequence data curve in this interval on Monday. Although the occurrence of the local trough is predicted, the prediction pattern is closer to the same time period on Monday, rather than that of the same day; 5) Observe the interval corresponding to the vehicle flow sequence data values between 400 and 500 in the right sub-figure, and find that in this interval, the trend of the predicted sequence data curve of ACGRN on Wednesday is more similar to the trend of the real sequence data curve on Tuesday, rather than the real sequence data curve on the same day. In summary, ACGRN does not capture the characteristics of different days in the vehicle flow series data very well, that is, ACGRN’s performance in capturing the temporal heterogeneity in the vehicle flow series data is insufficient, while the proposed MTPM-AGCRN handles this problem very well, which illustrates the effectiveness of the MTPM mechanism proposed in this application in capturing the temporal heterogeneity in the vehicle flow series data.
[0132] In other embodiments of the present application, the implementation of AGCRN is mainly based on two adaptive modules, one is NAPL, which is used to extract node-specific patterns; the other is the DAGG module, which is used to infer inter-sequence dependencies, and further proposes a complete AGCRN technical solution to automatically capture the spatiotemporal correlations in vehicle flow sequence data.
[0133] In the NAPL module, the traditional graph convolution operation is first approximated as a first-order Chebyshev polynomial expansion and generated as a high-dimensional GCN. The process can be expressed as the following formula (5):
[0134]
[0135] in, is the identity matrix, and N is the number of nodes in the graph, is the adjacency matrix of the graph, D is the degree matrix, and are the input and output of the GCN layer respectively, and C and F represent the number of input channels and output features respectively, and represent the learnable weight and bias respectively.
[0136] To avoid assigning parameters to each node, resulting in an excessive number of parameters, instead of directly learning , the NAPL module is used to learn a smaller parameter matrix: one is the node adaptive matrix where: a is the adaptive dimension, and a << N; the other is the weight pool
[0137] After that, Θ is generated through , that is, according to the adaptive matrix of the i-th node, Θ is extracted from the weight pool . The following formula (6) represents the graph convolution operation enhanced by the NAPL module: i .
[0138]
[0139] In the DAGG module, first, a learnable node adaptive dictionary is randomly initialized for all nodes, where D each row in represents a node adaptive row, and a D represents the adaptive dimension. Similar to defining a graph through node similarity, the spatial correlation between nodes D and can be inferred by performing a dot product operation, and this operation process is shown in the following formula (7):
[0140]
[0141] where the softmax function is used to normalize the adjacency matrix. This process directly generates
[0142]
[0143] to avoid unnecessary calculations during training. During training, will be automatically updated to learn the hidden dependencies between different vehicle flow sequences and obtain the adjacency matrix for graph convolution operations. The following formula (8) represents the graph convolution operation enhanced by DAGG: D
[0144]
[0145] For the prediction of vehicle flow, in addition to spatial correlation, it also involves complex temporal correlation. Therefore, the AGCRN technical solution integrates NAPL-GCN, DAGG and GRU to further capture the spatial and temporal correlation of specific nodes in the vehicle flow sequence data. The AGCRN technical solution uses NAPL-GCN to replace the MLP layer in the GRU to learn the specific patterns of nodes in the graph; and uses the DAGG module to automatically discover the spatial dependencies of vehicle flow sequences. The following formulas (9-1) to (9-5) represent the main operations in the AGCRN technical solution:
[0146]
[0147] Among them, X :,t With h t are the input and output at time step t, respectively. [·] represents the connection operation. z and r are the reset and update gates, respectively. A, W z , W r , b z 、b r and is a learnable parameter in AGCRN.
[0148] From the above formula, we can see that the AGCRN technical solution unifies all adaptive matrices into A, instead of learning separate node adaptive matrices in different NAPL-GCN layers and DAGG modules, to ensure that the node adaptive matrices between all graph convolution blocks are consistent.
[0149] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.
[0150] The traffic flow prediction method provided in the embodiment of the present application adopts a data modeling mechanism to construct a first target sequence and a second target sequence of different time periods, that is, different characteristics of traffic flow in the time dimension are modeled separately, and then the two periodic sequences are processed by a prediction module respectively, and the first target feature information and the second target feature information obtained are used to jointly predict, which not only improves the ability to capture various temporal heterogeneities in traffic flow, but also has the ability to better capture the temporal heterogeneity in traffic flow, thereby improving the accuracy of prediction.
[0151] Based on the above embodiments, the present application provides a traffic flow prediction device, which can be applied to Figure 1 and Figure 2In the traffic flow prediction method provided in the corresponding embodiment, refer to Figure 6 As shown, the traffic flow prediction device 3 may include: an acquisition unit 31, a processing unit 32 and a determination unit 33, wherein:
[0152] An acquisition unit 31 is used to acquire a target historical traffic flow of a target road section in a target historical time period before a time to be predicted;
[0153] The processing unit 32 is used to determine a first target sequence and a second target sequence corresponding to the target historical traffic flow based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow; wherein the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample road section within the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods;
[0154] The processing unit 32 is further used to use the first prediction module and the second prediction module in the target traffic flow prediction model to extract features from the first target sequence and the second target sequence respectively to obtain first target feature information and second target feature information;
[0155] The determination unit 33 is used to obtain the target predicted traffic flow of the target road section at the time to be predicted based on the first target feature information and the second target feature information.
[0156] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0157] Determining a first target sequence from the target historical traffic flow based on a plurality of first time steps before the initial time of the time to be predicted; wherein the first time step represents a time related to the hour;
[0158] A second target sequence is determined from the target historical traffic flow based on a plurality of second time steps before the initial time; wherein the second time steps represent time related to the day and week.
[0159] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0160] Determine a first sub-target sequence from the target historical traffic flow data based on a plurality of first sub-time steps before the initial time; wherein the first sub-time step represents a time associated with the day;
[0161] Based on a plurality of second sub-time steps before the initial time, a second sub-target sequence is determined from the target historical traffic flow data; wherein the second sub-time step represents a time related to a week.
[0162] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0163] Based on the N prediction units in the first prediction module and the first initial feature matrix in the first target sequence, a first target feature matrix is obtained;
[0164] Based on the N prediction units in the second prediction module and the second initial feature matrix in the second target sequence, a second target feature matrix is obtained; wherein the first prediction module has the same structure as the second prediction module, and the N prediction units have the same structure.
[0165] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0166] Based on the first prediction unit in the first prediction module and each first initial feature matrix, a first sub-prediction feature matrix is obtained;
[0167] Based on the second prediction unit in the first prediction module and the first sub-prediction feature, a second sub-prediction feature matrix is obtained;
[0168] Based on the Nth prediction unit and the N-1th sub-prediction feature matrix in the first prediction module, obtaining the Nth sub-prediction feature matrix;
[0169] The first sub-prediction feature matrix, the second sub-prediction feature matrix and the Nth sub-prediction feature matrix are subjected to feature fusion to obtain a first target feature matrix.
[0170] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0171] For each first initial feature matrix, extract features from the first initial feature matrix based on the hidden state module in the first prediction unit to obtain a first output feature matrix;
[0172] A first sub-prediction feature matrix is obtained based on the first prediction unit, the first initial feature matrix, the first output feature matrix and the adaptive matrix.
[0173] In other embodiments of the present application, the processing unit 32 is further configured to perform the following steps:
[0174] Based on the reset gate module in the first prediction unit, the first output feature matrix, the first initial feature matrix and the adaptive matrix, a second output feature matrix is obtained;
[0175] Based on the update gate module in the first prediction unit, the first output feature matrix, the second output feature matrix, the first initial feature matrix and the adaptive matrix, a third output feature matrix is obtained;
[0176] Based on the first output feature matrix, the second output feature matrix, and the third output feature matrix, a first sub-prediction feature matrix is obtained.
[0177] In other embodiments of the present application, the determining unit 33 is further configured to perform the following steps:
[0178] Determine a first weight corresponding to the first target sequence and a second weight corresponding to the second target sequence;
[0179] The first target feature matrix, the second target feature matrix, the first weight and the second weight are operated to obtain the target predicted traffic flow.
[0180] It should be noted that the specific implementation process of the steps performed by each module in the embodiment of the present application can be referred to Figure 1 and Figure 2 The implementation process of the traffic flow prediction method provided in the corresponding embodiment will not be repeated here.
[0181] The traffic flow prediction device provided in the embodiment of the present application constructs a first target sequence and a second target sequence of different time periods by adopting a data modeling mechanism, that is, the different characteristics of traffic flow in the time dimension are modeled respectively, and then the two periodic sequences are processed by a prediction module respectively, and the prediction is jointly performed through the obtained first target feature information and second target feature information, which not only achieves the improvement of the ability to capture various temporal heterogeneities in traffic flow, but also has the ability to better capture the temporal heterogeneity in traffic flow, thereby improving the accuracy of prediction.
[0182] Based on the above embodiments, the embodiments of the present application provide a traffic flow prediction device, which can be applied to Figure 1 and Figure 2 In the traffic flow prediction method provided in the corresponding embodiment, refer to Figure 7 As shown, the traffic flow prediction device 4 may include: a processor 41, a memory 42 and a communication bus 43, wherein:
[0183] The communication bus 43 is used to realize the communication connection between the processor 41 and the memory 42;
[0184] The processor 41 is used to execute the traffic flow prediction program in the memory 42 to implement the following steps:
[0185] Obtain the target historical traffic flow of the target road section within the target historical time period before the time to be predicted;
[0186] Based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow, a first target sequence and a second target sequence corresponding to the target historical traffic flow are determined; wherein the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample road section within the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods;
[0187] Using the first prediction module and the second prediction module in the target traffic flow prediction model, respectively extracting features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information;
[0188] Based on the first target feature information and the second target feature information, a target predicted traffic flow of the target road section at the time to be predicted is obtained.
[0189] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow, and determine the first target sequence and the second target sequence corresponding to the target historical traffic flow, including:
[0190] Determining a first target sequence from the target historical traffic flow based on a plurality of first time steps before the initial time of the time to be predicted; wherein the first time step represents a time related to the hour;
[0191] A second target sequence is determined from the target historical traffic flow based on a plurality of second time steps before the initial time; wherein the second time steps represent time related to the day and week.
[0192] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on multiple second time steps before the initial time, and determine the second target sequence from the target historical traffic flow to implement the following steps:
[0193] Determine a first sub-target sequence from the target historical traffic flow data based on a plurality of first sub-time steps before the initial time; wherein the first sub-time step represents a time associated with the day;
[0194] Based on a plurality of second sub-time steps before the initial time, a second sub-target sequence is determined from the target historical traffic flow data; wherein the second sub-time step represents a time related to a week.
[0195] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42, adopt the first prediction module and the second prediction module in the target traffic flow prediction model, respectively extract features from the first target sequence and the second target sequence, and obtain the first target feature information and the second target feature information to implement the following steps:
[0196] Based on the N prediction units in the first prediction module and the first initial feature matrix in the first target sequence, a first target feature matrix is obtained;
[0197] Based on the N prediction units in the second prediction module and the second initial feature matrix in the second target sequence, a second target feature matrix is obtained; wherein the first prediction module has the same structure as the second prediction module, and the N prediction units have the same structure.
[0198] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on the N prediction units in the first prediction module and each first initial feature matrix in the first target sequence to obtain the first target feature matrix to implement the following steps:
[0199] Based on the first prediction unit in the first prediction module and each first initial feature matrix, a first sub-prediction feature matrix is obtained;
[0200] Based on the second prediction unit in the first prediction module and the first sub-prediction feature, a second sub-prediction feature matrix is obtained;
[0201] Based on the Nth prediction unit and the N-1th sub-prediction feature matrix in the first prediction module, obtaining the Nth sub-prediction feature matrix;
[0202] The first sub-prediction feature matrix, the second sub-prediction feature matrix and the Nth sub-prediction feature matrix are subjected to feature fusion to obtain a first target feature matrix.
[0203] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on the first prediction unit in the first prediction module and each first initial feature matrix to obtain a first sub-prediction feature matrix to implement the following steps:
[0204] For each first initial feature matrix, extract features from the first initial feature matrix based on the hidden state module in the first prediction unit to obtain a first output feature matrix;
[0205] A first sub-prediction feature matrix is obtained based on the first prediction unit, the first initial feature matrix, the first output feature matrix and the adaptive matrix.
[0206] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on the first prediction unit, the first initial feature matrix, the first output matrix and the adaptive matrix to obtain the first sub-prediction feature matrix to implement the following steps:
[0207] Based on the reset gate module in the first prediction unit, the first output feature matrix, the first initial feature matrix and the adaptive matrix, a second output feature matrix is obtained;
[0208] Based on the update gate module in the first prediction unit, the first output feature matrix, the second output feature matrix, the first initial feature matrix and the adaptive matrix, a third output feature matrix is obtained;
[0209] Based on the first output feature matrix, the second output feature matrix, and the third output feature matrix, a first sub-prediction feature matrix is obtained.
[0210] In other embodiments of the present application, the processor 41 is used to execute the traffic flow prediction program in the memory 42 based on the first target feature information and the second target feature information to obtain the target predicted traffic flow of the target road section at the time to be predicted, so as to implement the following steps:
[0211] Determine a first weight corresponding to the first target sequence and a second weight corresponding to the second target sequence;
[0212] The first target feature matrix, the second target feature matrix, the first weight and the second weight are operated to obtain the target predicted traffic flow.
[0213] It should be noted that the specific description of the steps executed by the processor can be referred to Figure 1 and Figure 2 The implementation process of the traffic flow prediction method provided in the corresponding embodiment will not be repeated here.
[0214] The traffic flow prediction device provided in the embodiment of the present application constructs a first target sequence and a second target sequence of different time periods by adopting a data modeling mechanism, that is, the different characteristics of traffic flow in the time dimension are modeled respectively, and then the two periodic sequences are processed by a prediction module respectively, and the prediction is jointly performed through the obtained first target feature information and second target feature information, which not only achieves the improvement of the ability to capture various temporal heterogeneities in traffic flow, but also has the ability to better capture the temporal heterogeneity in traffic flow, thereby improving the accuracy of prediction.
[0215] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement Figure 1 and Figure 2 The corresponding embodiments provide steps in the traffic flow prediction method.
[0216] It should be noted that the above-mentioned computer-readable storage medium can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various electronic devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0217] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0218] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0219] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0220] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products of the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0221] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0222] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0223] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A traffic flow prediction method, characterized in that: The method comprises: Obtain the target historical traffic flow of the target road section within the target historical time period before the time to be predicted; Based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow, determining the first target sequence and the second target sequence corresponding to the target historical traffic flow; wherein the target traffic flow prediction model is obtained by training the initial traffic flow prediction model based on the sample historical traffic flow of the sample road section within the sample historical time period; the data modeling mechanism is used to construct time periodic sequences of different time periods; Using the first prediction module and the second prediction module in the target traffic flow prediction model, respectively extracting features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information; Based on the first target feature information and the second target feature information, a target predicted traffic flow of the target road section at the time to be predicted is obtained.
2. The method according to claim 1, characterized in that The determining of the first target sequence and the second target sequence corresponding to the target historical traffic flow based on the data modeling mechanism in the target traffic flow prediction model and the target historical traffic flow includes: Determining the first target sequence from the target historical traffic flow based on a plurality of first time steps before the initial time of the time to be predicted; wherein the first time step represents a time related to an hour; The second target sequence is determined from the target historical traffic flow based on a plurality of second time steps before the initial time; wherein the second time steps represent time related to the day and week.
3. The method according to claim 2, characterized in that The determining the second target sequence from the target historical traffic flow based on a plurality of second time steps before the initial time comprises: Determining a first sub-target sequence from the target historical traffic flow data based on a plurality of first sub-time steps before the initial time; wherein the first sub-time steps represent time associated with the day; Based on a plurality of second sub-time steps before the initial time, a second sub-target sequence is determined from the target historical traffic flow data; wherein the second sub-time steps represent a time related to a week.
4. The method according to claim 1, characterized in that: The first prediction module and the second prediction module in the target traffic flow prediction model are used to extract features from the first target sequence and the second target sequence respectively to obtain first target feature information and second target feature information, including: Obtaining a first target feature matrix based on the N prediction units in the first prediction module and the first initial feature matrix in the first target sequence; Based on the N prediction units in the second prediction module and the second initial feature matrix in the second target sequence, a second target feature matrix is obtained; wherein the first prediction module has the same structure as the second prediction module, and the N prediction units have the same structure.
5. The method according to claim 4, characterized in that The obtaining a first target feature matrix based on the N prediction units in the first prediction module and each first initial feature matrix in the first target sequence includes: Obtaining a first sub-prediction feature matrix based on the first prediction unit in the first prediction module and each of the first initial feature matrices; Based on the second prediction unit in the first prediction module and the first sub-prediction feature, obtaining a second sub-prediction feature matrix; Based on the Nth prediction unit in the first prediction module and the N-1th sub-prediction feature matrix, obtaining an Nth sub-prediction feature matrix; Feature fusion is performed on the first sub-prediction feature matrix, the second sub-prediction feature matrix and the Nth sub-prediction feature matrix to obtain the first target feature matrix.
6. The method according to claim 5, characterized in that The obtaining of a first sub-prediction feature matrix based on the first prediction unit in the first prediction module and each of the first initial feature matrices includes: For each of the first initial feature matrices, extracting features from the first initial feature matrix based on a hidden state module in the first prediction unit to obtain a first output feature matrix; The first sub-prediction feature matrix is obtained based on the first prediction unit, the first initial feature matrix, the first output feature matrix and the adaptive matrix.
7. The method according to claim 6, characterized in that The obtaining the first sub-prediction feature matrix based on the first prediction unit, the first initial feature matrix, the first output matrix and the adaptive matrix includes: Obtaining a second output feature matrix based on the reset gate module in the first prediction unit, the first output feature matrix, the first initial feature matrix, and the adaptive matrix; Obtaining a third output feature matrix based on the update gate module in the first prediction unit, the first output feature matrix, the second output feature matrix, the first initial feature matrix, and the adaptive matrix; The first sub-prediction feature matrix is obtained based on the first output feature matrix, the second output feature matrix, and the third output feature matrix.
8. The method according to claim 4, characterized in that The obtaining, based on the first target feature information and the second target feature information, a target predicted traffic flow of the target road section at the time to be predicted, comprises: Determine a first weight corresponding to the first target sequence and a second weight corresponding to the second target sequence; The first target feature matrix, the second target feature matrix, the first weight, and the second weight are operated to obtain the target predicted traffic flow.
9. A traffic flow prediction device, characterized in that: The device comprises: An acquisition unit, used for acquiring a target historical traffic flow of a target road section within a target historical time period before a time to be predicted; A processing unit, for determining a first target sequence and a second target sequence corresponding to the target historical traffic flow based on a data modeling mechanism in a target traffic flow prediction model and the target historical traffic flow; wherein the target traffic flow prediction model is obtained by training an initial traffic flow prediction model based on sample historical traffic flows of sample road sections within a sample historical time period; and the data modeling mechanism is used to construct time periodic sequences of different time periods; The processing unit is further used to use the first prediction module and the second prediction module in the target traffic flow prediction model to respectively extract features from the first target sequence and the second target sequence to obtain first target feature information and second target feature information; A determination unit is used to obtain a target predicted traffic flow of the target road section at the time to be predicted based on the first target feature information and the second target feature information.
10. A traffic flow prediction device, characterized in that: The device comprises: a processor, a memory and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the information processing program in the memory to implement the steps of the traffic flow prediction method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the traffic flow prediction method according to any one of claims 1 to 8.
