WO2022077767A1 - Traffic flow prediction method and apparatus, computer device, and readable storage medium - Google Patents

Traffic flow prediction method and apparatus, computer device, and readable storage medium Download PDF

Info

Publication number
WO2022077767A1
WO2022077767A1 PCT/CN2020/139299 CN2020139299W WO2022077767A1 WO 2022077767 A1 WO2022077767 A1 WO 2022077767A1 CN 2020139299 W CN2020139299 W CN 2020139299W WO 2022077767 A1 WO2022077767 A1 WO 2022077767A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
traffic
data
recurrent neural
traffic data
Prior art date
Application number
PCT/CN2020/139299
Other languages
French (fr)
Chinese (zh)
Inventor
叶可江
贺航涛
须成忠
Original Assignee
深圳先进技术研究院
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳先进技术研究院 filed Critical 深圳先进技术研究院
Publication of WO2022077767A1 publication Critical patent/WO2022077767A1/en

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/0104Measuring and analyzing of parameters relative to traffic conditions
    • G08G1/0125Traffic data processing
    • G08G1/0129Traffic data processing for creating historical data or processing based on historical data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/0104Measuring and analyzing of parameters relative to traffic conditions
    • G08G1/0137Measuring and analyzing of parameters relative to traffic conditions for specific applications

Definitions

  • the present application relates to the technical field of traffic flow prediction, and in particular, to a traffic flow prediction method, a traffic flow prediction device, computer equipment and a non-volatile computer-readable storage medium.
  • Embodiments of the present application provide a traffic flow prediction method, a traffic flow prediction apparatus, computer equipment and a non-volatile computer-readable storage medium to solve the problem of low prediction accuracy of the existing traffic flow prediction method.
  • the traffic flow prediction method of the embodiment of the present application includes: acquiring original traffic data of a target road section within a predetermined period of time, the original traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section ; Process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section; process the original traffic data according to the influence parameters to obtain revised traffic data from which the influence of the external factors is removed; to obtain training set data and test set data; use the training set data to train the initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model; use the test set data to test the The intermediate causal convolution-recurrent neural network model is obtained to obtain an evaluation result, and when the evaluation result satisfies a predetermined condition, it is confirmed that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent neural network model; and utilizing The target causal convolution-recurrent neural network model predicts the traffic flow of the target road segment at the time point
  • the traffic flow data includes at least one of traffic speed and traffic density; the external factor information includes low temperature, high temperature, normal, light rain, heavy rain, heavy rain, light snow, heavy snow, heavy snow, strong wind, There is information on at least one external factor in traffic conditions, road construction.
  • the processing of the raw traffic data to obtain parameters affecting the traffic flow of the target road section by external factors includes: processing the raw traffic data to obtain the raw traffic data that is not affected by the traffic flow. normal traffic data affected by the external factor and affected traffic data affected by the external factor information; and calculating the influence parameter according to the affected traffic data and the normal traffic data.
  • each of the external factors corresponds to one of the influence parameters
  • the calculating the influence parameters according to the affected traffic data and the normal traffic data includes: for the predetermined time period For each time node, calculate the mean value of the normal traffic data belonging to the same time node to obtain a plurality of mean values corresponding to a plurality of the time nodes; and for each of the external factors, according to the influence of the external factor Calculate the initial parameters of the external factor under each time node of the affected traffic data and the plurality of mean values; and calculate the influence parameter according to the plurality of initial parameters corresponding to the plurality of time nodes.
  • the initial causal convolution-recurrent neural network model includes a causal convolution unit and a recurrent neural network unit
  • the initial causal convolution-recurrent neural network model is trained using the training set data to obtain intermediate A causal convolution-recurrent neural network model, comprising: inputting the training set data into the causal convolution unit in units of a predetermined time period to obtain a causal convolution output result; inputting the causal convolution output result to the obtain a predicted value in the recurrent neural network unit; calculate a loss value according to the actual value and the predicted value; and confirm that the initial causal convolution-recurrent neural network model after training is the desired value when the loss value is less than a predetermined threshold the intermediate initial causal convolution-recurrent convolutional neural network model; when the loss value is greater than the predetermined threshold, continue to train the initial causal convolutional-recurrent neural network model after training.
  • the causal convolution unit includes a plurality of causal convolution layers
  • the recurrent neural network unit is a recurrent gating unit.
  • the predicting the traffic flow of the target road segment at the to-be-predicted time point by using the target causal convolutional neural network model includes: acquiring raw traffic data within a predetermined period, and the The predetermined period includes the time point to be predicted; the original traffic data within the predetermined period is processed according to the influence parameter to obtain the corrected traffic data within the predetermined period; the corrected traffic data within the predetermined period is input to the target a causal convolution-recurrent neural network model to obtain an initial predicted value of the to-be-predicted time point; and calculate a target predicted value according to the initial predicted value and the influence parameter.
  • the traffic flow prediction apparatus of the embodiment of the present application includes an acquisition module, a first processing module, a second processing module, a division module, a training module, a testing module, and a prediction module.
  • the acquisition module is configured to acquire original traffic data of the target road section within a predetermined period of time, the original traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section.
  • the first processing module is used for processing the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section.
  • the second processing module is configured to process the original traffic data according to the influence parameter to obtain revised traffic data from which the influence of the external factor is removed.
  • the dividing module is used for dividing the modified traffic data to obtain training set data and test set data.
  • the training module is used to train an initial causal convolution-recurrent neural network model using the training set data to obtain an intermediate causal convolution-recurrent neural network model.
  • the test module is used to test the intermediate causal convolution-recurrent neural network model using the test set data to obtain an evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is when the evaluation result meets a predetermined condition.
  • the prediction module is configured to use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
  • the computer apparatus of the embodiments of the present application includes a processor, a memory, and one or more programs.
  • the one or more programs are stored in the memory, and the one or more programs can be executed by the processor to implement the traffic flow prediction method according to any one of the above embodiments.
  • the non-volatile computer-readable storage medium of the embodiment of the present application contains a computer program.
  • the computer program is executed by the processor, the traffic flow prediction method described in any one of the above embodiments is implemented.
  • the traffic flow prediction method, the traffic flow prediction device, the electronic device, and the non-volatile computer-readable storage medium of the embodiments of the present application consider the influence of external factors on the traffic flow, and can make the traffic flow prediction result more accurate.
  • the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical traffic data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
  • FIG. 1 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 2 is a schematic diagram of a traffic flow prediction device according to some embodiments of the present application.
  • FIG. 3 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 4 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 5 is a schematic diagram of a first processing module of some embodiments of the present application.
  • FIG. 6 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 7 is a schematic diagram of a training module of some embodiments of the present application.
  • FIG. 8 is a schematic diagram of a causal convolution unit of some embodiments of the present application.
  • FIG. 9 is a schematic diagram of the principle of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 10 is a schematic diagram of the principle of a cycle gating unit according to some embodiments of the present application.
  • FIG. 11 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application.
  • FIG. 12 is a schematic diagram of a prediction module of some embodiments of the present application.
  • FIG. 13 is a schematic diagram of a computer device according to some embodiments of the present application.
  • FIG. 14 is a schematic diagram of interaction between a non-volatile computer-readable storage medium and a processor according to some embodiments of the present application.
  • Traffic flow forecasting methods include:
  • the original traffic data of the target road section includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
  • the traffic flow prediction method of the embodiment of the present application can be realized by the traffic flow prediction apparatus 10 of the embodiment of the present application.
  • the traffic flow prediction device 10 includes an acquisition module 11 , a first processing module 12 , a second processing module 13 , a division module 14 , a training module 15 , and a testing module 16 , a prediction module 17 .
  • step 01 may be realized by the obtaining module 11 .
  • Step 02 may be implemented by the first processing module 12 .
  • Step 03 may be implemented by the second processing module 13 .
  • Step 04 may be implemented by the division module 14 .
  • Step 05 may be implemented by the training module 15 .
  • Step 06 may be implemented by the test module 16 .
  • Step 07 may be implemented by the prediction module 17 .
  • the obtaining module 11 can be used to obtain the original traffic data of the target road segment within a predetermined period of time, and the original traffic data includes the traffic flow data of the target road segment and external factor information affecting the traffic flow of the target road segment.
  • the first processing module 12 may be used to process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road segment.
  • the second processing module 13 may be used to process the original traffic data to obtain corrected traffic data from which the influence of external factors has been removed.
  • the dividing module 14 can be used to divide and correct the traffic data to obtain training set data and test set data.
  • the training module 15 may be used to train an initial causal convolutional-recurrent neural network model using the training set data to obtain an intermediate causal convolutional-recurrent neural network model.
  • the testing module 16 can be used to test the intermediate causal convolution-recurrent neural network model using the test set data to obtain an evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent model when the evaluation result satisfies a predetermined condition. neural network model.
  • the prediction module 17 may be configured to use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
  • the traffic flow data in the original traffic data includes at least one of traffic speed and traffic density. That is, the traffic flow data may include only the traffic speed or the traffic density, or the traffic flow data may include both the traffic speed and the traffic density. In a specific embodiment of the present application, the traffic flow data includes both traffic speed and traffic density. Traffic speed and traffic density can be acquired by sensors placed in the target road segment.
  • the external factor information in the original traffic data includes information of at least one external factor among low temperature, high temperature, normal, light rain, heavy rain, heavy rain, light snow, heavy snow, heavy snow, strong wind, traffic conditions, and road construction.
  • the external factor information may simultaneously include information on six types of external factors: high temperature, normal, light rain, heavy rain, heavy rain, and traffic conditions, or the external factor information may simultaneously include low temperature, high temperature, normal, light rain, heavy rain, heavy rain, Information on twelve external factors such as light snow, heavy snow, blizzard, strong wind, traffic conditions, and road construction.
  • the evaluation criteria for high temperature, light rain, heavy rain, heavy rain, light snow, heavy snow, blizzard, strong wind, etc. can be formulated with reference to the relevant division criteria of the meteorological department for climate phenomena such as temperature, rainfall, snow volume, and wind power.
  • the predetermined duration can be one week, half a month, one month, three months, six months, nine months, one year, two years, three years, five years, etc., which is not limited here.
  • raw traffic data will be collected at regular intervals, for example, at ten-minute intervals.
  • the interval time may also be one minute, five minutes, fifteen minutes, twenty minutes, thirty minutes, etc., which are not limited here.
  • the predetermined duration is one week and the original traffic data is collected every ten minutes, in step 01, the original traffic data of the target road segment within the predetermined duration includes data collected 6 ⁇ 24 ⁇ 7 times.
  • the traffic flow data is represented by a vector X d,t , where d represents a day, t represents a time of day, and the interval of t is ten minutes.
  • External factors P d,t [high temperature, normal, light rain, heavy rain, heavy rain, with traffic conditions]
  • P d, t can be represented by a vector of 0, 1, where 0 means no external factors, 1 means there are external factors .
  • P d,t (0,1,0,0,0,0) indicates that the traffic flow data is normal traffic flow data not affected by external factors
  • P d,t (0,0,0, 0,0,1) indicates that the traffic flow data is the affected traffic flow data affected by the external factor of "traffic condition”.
  • the original traffic data After the original traffic data is obtained, the original traffic data can be further processed and the processed data can be used for model training and testing to obtain the target prediction model. Finally, the traffic flow prediction result can be obtained by using the target prediction model. .
  • the traffic flow prediction method and the traffic flow prediction device 10 consider the influence of external factors on the traffic flow, which can make the prediction result of the traffic flow more accurate.
  • the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
  • step 02 processes the original traffic data to obtain parameters that influence the traffic flow of the target road segment by external factors, including:
  • each external factor corresponds to an influence parameter
  • step 022 calculates the influence parameter according to the affected traffic data and the normal traffic data, including:
  • the first processing module 12 includes a first processing unit 121 and a first computing unit 122 .
  • Step 021 may be implemented by the first processing unit 121
  • step 022 , step 0221 , step 0222 and step 0223 may all be implemented by the first computing unit 122 .
  • the first processing unit 121 may be configured to process the raw traffic data to obtain normal traffic data that is not affected by external factors and affected traffic data that is affected by external factor information in the raw traffic data.
  • the first calculation unit 122 may be configured to calculate the influence parameter according to the affected traffic data and the normal traffic data.
  • the first calculation unit 122 when the first calculation unit 122 is used to calculate the influence parameter according to the affected traffic data and the normal traffic data, the first calculation unit 122 is specifically used to: for each time node within a predetermined time period, calculate the normal traffic belonging to the same time node The mean value of the data is obtained to obtain multiple mean values corresponding to multiple time nodes; for each external factor, the initial parameters of the external factor under each time node are calculated according to the affected traffic data and multiple mean values affected by the external factor ; Calculate influence parameters according to multiple initial parameters corresponding to multiple time nodes.
  • the first processing unit 121 can filter the original traffic data obtained in step 01, and the first processing unit 121 can determine which data is normal traffic data and which data is affected according to the values of each item in P d,t traffic data.
  • P d,t [high temperature, normal, light rain, heavy rain, heavy rain, with traffic conditions]
  • the influence parameters of external factors on the traffic flow of the target road section ⁇ [ ⁇ 1 , ⁇ 2 , ⁇ 3 , ⁇ 4 , ⁇ 5 , ⁇ 6 ] as an example
  • the affected traffic data are merged into the same category of data;
  • the first computing unit 122 can also classify the normal traffic data , and classify different days ( That is, d is different) but the normal traffic data with the same time node (that is, the same t) are merged into the same category of data.
  • the first calculation unit 122 may calculate the influence parameter according to the plurality of initial parameters corresponding to the plurality of time nodes, for example, for the influence parameter of the external factor "traffic condition" on the traffic flow Among them, n represents the number of time nodes t. In this way, the influence parameters of each external factor on the traffic flow can be calculated.
  • the influence parameters of external factors on traffic flow can be uniformly recorded as
  • the second processing module 13 can process the original traffic data within a predetermined period of time according to the influence parameters to obtain revised traffic data within the predetermined period of time. Specifically, correcting traffic data In this way, by de-externalizing the original traffic data, the part of the data weakened by the external factors can be supplemented, so as to obtain the corrected traffic data which is affected by the external factors.
  • the division module 14 can modify the traffic data to be divided into training set data and test set data by methods such as K-fold crossover operation, leave-out method, leave-one-out method, and self-help method. This is not limited.
  • the dividing module 14 uses the K-folded intersection algorithm to divide and correct the traffic data, where the value of K is 10.
  • the value of K can also be other values, which are not limited here. .
  • the dividing module 14 divides all the corrected traffic data into K disjoint subsets ⁇ S 1 , S 2 ,...,S K ⁇ , assuming that the number of all samples in the corrected traffic data is M, then each The subset has M/K examples. Each time, one sample is taken from the divided subset as the test set, and the other K-1 samples are used as the training set, so that the training set data and the test set data can be obtained.
  • K-fold crossover algorithm to divide and correct the traffic data can make good use of all the data in the sample, which is beneficial to the subsequent model training and testing.
  • the initial causal convolution-recurrent neural network model includes a causal convolution unit 151 and a recurrent neural network unit 152, and step 05 uses the training set data to train the initial causal convolution-recurrent neural network model to obtain an intermediate causal convolutional-recurrent neural network model including:
  • the training module 15 includes a causal convolution unit 151 , a recurrent neural network unit 152 , a second calculation unit 153 , and a confirmation unit 154 .
  • Step 051 may be implemented by the causal convolution unit 151 .
  • Step 052 may be implemented by the recurrent neural network unit 152 .
  • Step 053 may be implemented by the second computing unit 153 .
  • Step 054 may be implemented by the confirmation unit 154 .
  • Step 055 may be implemented by the causal convolution unit 151 and the recurrent neural network unit 152 .
  • the causal convolution unit 151 may be configured to perform computation on training set data input in units of a predetermined period to obtain a causal convolution output result.
  • the RNN unit 152 may be used to perform computations on the input causal convolution outputs to obtain predicted values.
  • the second calculation unit 153 may be used to calculate the loss value according to the actual value and the predicted value.
  • the confirming unit 154 may be configured to confirm that the trained initial causal convolution-recurrent neural network model is an intermediate initial causal convolution-recurrent convolutional neural network model when the loss value is less than a predetermined threshold.
  • the causal convolution unit 151 and the recurrent neural network unit 152 may be configured to continue training the initial causal convolution-recurrent neural network model after training when the loss value is greater than a predetermined threshold.
  • the predetermined time period may be 6 hours, 12 hours, 18 hours, 24 hours, 36 hours, 72 hours, etc., which is not limited herein.
  • the training set data is input into the causal convolution unit 151 in units of days (24 hours) for extracting the traffic flow pairs associated with them at each time point to be predicted. Dependence of traffic flow at a time.
  • the causal convolution unit 151 may include one layer of causal convolution layers or multiple layers of causal convolution layers, which is not limited herein.
  • the processing formula for the corrected traffic data is as follows:
  • w d, t, p is the convolution result
  • q is the expansion rate
  • all elements of ⁇ k, m, p represent the convolution kernel
  • K r is the kernel length
  • M is a parameter set for the scalability of the causal convolution unit 151.
  • m is 1.
  • m can also be 2, 3, Values such as 4 and 5 are not limited here
  • P is the number of convolution kernel channels.
  • the causal convolution unit 151 includes multiple layers of causal convolution layers, as shown in FIG. 8 , the causal convolution layer includes four layers, and 15 time nodes can be experienced, wherein, under the second layer, the time to be predicted Point can feel the revised traffic data of the first 3 moments, after superimposing one layer (ie the third layer), the predicted time point can feel the corrected traffic data of the first 7 moments, and then superimpose one layer (ie the fourth layer), The time point to be predicted can feel the data of the first 15 moments. As the number of layers is superimposed, the moment that can be felt at the time point to be predicted increases exponentially. At this time, the processing formula for correcting the traffic data is as follows:
  • * q denotes a causal convolution operation with expansion rate q
  • f is a nonlinear activation function
  • l is the number of layers.
  • the four layers shown in FIG. 8 are only examples.
  • the number of layers of the causal convolution layer in the causal convolution unit 151 may also be two layers, three layers, five layers, ten layers, etc., There is no restriction here.
  • the causal convolution output result W d output by the causal convolution unit 151 will be input to the recurrent neural network unit 152 for training.
  • the recurrent neural network unit 152 may be a recurrent neural network (Recurrent Neural Network, RNN) model, or a variant of the RNN model, a gated recurrent unit (Gate Recurrent Unit, GRU) model. Since the calculation efficiency of the GRU model is high, in an embodiment of the present application, the GRU model is used to process the causal convolution output result W d . As shown in FIG. 9 and FIG. 10 , specifically, firstly, the parameters of the GRU model are initialized by using a standard normal distribution, and the number of iterations is set. Subsequently, the causal convolution output W d is input into the GRU model. Among them, the calculation process of the GRU model is as follows:
  • W d is the input of a certain time point to be predicted
  • r d represents the reset gate
  • z d is the update gate
  • h d-1 is the hidden state of the previous day
  • h d represents the state output of the d day
  • is the sigmoid activation function
  • tanh is the triangular tangent function
  • [] means that the vectors are connected
  • * means the matrix multiplication
  • O d is the predicted value.
  • the causal convolution output result W d is input into the recurrent neural network unit 152 to obtain the predicted value O d .
  • the loss function can be defined in advance: Then the cumulative loss function is:
  • loss is the loss value
  • real d is the real value, which can be obtained from the original traffic data. It should be noted that this formula is illustrated by taking the predetermined time period as one day and the predetermined duration as seven days as an example.
  • the second calculation unit 153 may determine whether the trained initial causal convolution-recurrent neural network model meets the requirements according to whether the loss value is less than or equal to a predetermined threshold. If the loss value is less than or equal to the predetermined threshold, the confirmation unit 154 determines that the initial causal convolution-recurrent neural network model after training is an intermediate causal convolution-recurrent neural network model (ie, the initial causal convolution-recurrent neural network model after training). If the loss value is greater than the predetermined threshold, it is considered that the initial causal convolutional neural network model after training does not meet the requirements, and the training of the initial causal convolutional neural network model after training needs to be continued.
  • the parameters in the initial causal convolutional neural network model after training can be changed using a time backpropagation algorithm, Among them, the weight parameters of each layer form a vector I ⁇ R m .
  • the gradient can be calculated first:
  • the gradient of the current to-be-predicted time point also depends on the cumulative gradient of all previous moments. Considering the cumulative positive and negative problem, the cumulative squared gradient is used:
  • is the learning rate.
  • is 0.002.
  • can also be other values, which is not limited here.
  • the causal convolution of superimposed layers is used to extract a large number of time dependencies of the day, and then the GRU model is used to extract the time dependencies of the time points to be predicted each day in the previous week, so that a wider range of time series perception can be extracted, so that the model prediction can be Relying on the historical traffic data of a large number of time nodes is conducive to improving the accuracy of traffic flow prediction.
  • the mean square error (MSE) of the intermediate causal convolutional-recurrent neural network model can be used to evaluate the training effect of the intermediate causal convolutional-recurrent neural network model. If the evaluation result satisfies the predetermined condition (that is, the expected effect is achieved), confirm that the intermediate causal convolution-recurrent neural network model is the target convolution-recurrent neural network model, if the evaluation result does not meet the predetermined condition (that is, the expected effect is not achieved), Then continue to train the intermediate causal convolutional-recurrent neural network model. It should be noted that other methods other than mean square error (MSE) can also be used to evaluate the training effect of the intermediate causal convolution-recurrent neural network model, which is not limited here.
  • MSE mean square error
  • step 07 utilizes the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted, including:
  • 072 Process the original traffic data in the predetermined period according to the influence parameter to obtain the revised traffic data in the predetermined period;
  • the prediction module 17 includes an acquisition unit 171 , a second processing unit 172 , a prediction unit 173 and a third calculation unit 174 .
  • Step 071 may be implemented by the obtaining unit 171 .
  • Step 072 may be implemented by the second processing unit 172 .
  • Step 073 may be implemented by the prediction unit 173 .
  • Step 074 may be implemented by the third computing unit 174 . That is to say, the acquiring unit 171 may be configured to acquire the original traffic data within a predetermined period, and the predetermined period includes the time point to be predicted.
  • the second processing unit 172 may be configured to process the original traffic data within a predetermined period according to the influencing parameters to obtain revised traffic data within the predetermined period.
  • the prediction unit 173 may be configured to input the revised traffic data within a predetermined period into the target causal convolutional-recurrent neural network model to obtain the initial prediction value of the time point to be predicted.
  • the third calculation unit 174 may be configured to calculate the target predicted value according to the initial predicted value and the influence parameter.
  • the obtaining unit 171 may obtain all the original traffic data one week before the time point to be predicted (including the current day), and the original traffic data includes traffic flow and external factor information. It should be noted that, in addition to one week, the predetermined period may also be three days, five days, ten days, etc., which is not limited here.
  • the second processing unit 172 may process all the original traffic data one week before the to-be-predicted time point according to the influence parameters calculated in step 02 to obtain revised traffic data within a predetermined period.
  • the specific processing procedure is the same as the processing procedure of step 021, and is not repeated here.
  • the prediction unit 173 may input the corrected traffic data within a predetermined period into the causal convolution unit 151 in units of a predetermined period (eg, one day) to obtain the causal convolution output result of each day corresponding to the time point to be predicted . Subsequently, the prediction unit 173 further inputs the causal convolution output result of each day corresponding to the time point to be predicted into the circular convolution unit to output the initial predicted value O of the time point to be predicted.
  • a predetermined period eg, one day
  • the third calculation unit 174 adds the external dependency of the time point to be predicted to the initial predicted value O, that is, restores the initial predicted value in combination with the influence parameters to obtain the target predicted value.
  • the processing formula is as follows:
  • the target predicted value S can be obtained.
  • the traffic flow prediction method and the traffic flow prediction device 10 (shown in FIG. 2 ) according to the embodiment of the present application consider the influence of external factors on the traffic flow, and can make the prediction result of the traffic flow more accurate.
  • the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical traffic data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
  • Computer device 20 includes a processor 21, a memory 22, and one or more programs.
  • One or more programs are stored in the memory 22, and the one or more programs can be executed by the processor 21 to implement the traffic flow prediction method of any one of the above embodiments.
  • one or more programs can be executed by the processor 21 to realize the following steps:
  • the original traffic data of the target road section includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
  • one or more programs can be executed by the processor 21 to realize the following steps:
  • the present application further provides a non-volatile computer-readable storage medium 30 .
  • the non-volatile computer-readable storage medium 30 includes computer programs.
  • the computer program is executed by the processor 21 to realize the traffic flow prediction method of any one of the above-described embodiments.
  • the original traffic data of the target road section includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
  • any description of a process or method in the flowcharts or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing a specified logical function or step of the process , and the scope of the preferred embodiments of the present application includes alternative implementations in which the functions may be performed out of the order shown or discussed, including performing the functions substantially concurrently or in the reverse order depending upon the functions involved, which should It is understood by those skilled in the art to which the embodiments of the present application belong.

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Analytical Chemistry (AREA)
  • Traffic Control Systems (AREA)

Abstract

A traffic flow prediction method and an apparatus, a computer device, and a readable storage medium. The method comprises: obtaining raw traffic data of a target road section for a predetermined duration; processing the raw traffic data to obtain parameters concerning the impact of external factors on the flow of traffic on the target road section; processing the raw traffic data according to the impact parameters to obtain corrected traffic data; dividing the corrected traffic data to obtain training set data and testing set data; using the training set data to train an initial causal convolutional recurrent neural network model to obtain an intermediate causal convolutional recurrent neural network model; using the testing set data to test the intermediate causal convolutional recurrent neural network model to obtain an evaluation result, and, if the evaluation result satisfies predetermined conditions, confirming the intermediate causal convolutional recurrent neural network model as a target causal convolutional recurrent neural network model; using the target causal convolutional recurrent neural network to predict the flow of traffic of the target road section at a time point to be predicted.

Description

交通流量预测方法及装置、计算机设备及可读存储介质Traffic flow prediction method and device, computer equipment and readable storage medium 技术领域technical field
本申请涉及交通流量预测技术领域,特别涉及一种交通流量预测方法、交通流量预测装置、计算机设备及非易失性计算机可读存储介质。The present application relates to the technical field of traffic flow prediction, and in particular, to a traffic flow prediction method, a traffic flow prediction device, computer equipment and a non-volatile computer-readable storage medium.
背景技术Background technique
交通在每个人的日常生活中起着至关重要的作用,每个人每天需要花大量时间在交通出行上,在这种情况下,准确的实时交通状况预测对道路使用者、私营部门和政府来说非常重要。而且,目前人们广泛使用的交通服务,如流量控制、路线规划和导航等,也严重依赖于高质量的交通状况评估,所以对交通状态的精准预测显得十分有意义,交通预测的目的是根据基础路网结构内的历史交通数据预测相连路段的未来交通状态。然而,现有的交通流量预测方法存在预测精度不高的问题。Traffic plays a vital role in everyone's daily life, and everyone spends a lot of time in traffic every day. In this case, accurate real-time traffic situation prediction is very important for road users, the private sector and the government. Say it is very important. Moreover, currently widely used traffic services, such as flow control, route planning, and navigation, also rely heavily on high-quality traffic condition assessment, so it is very meaningful to accurately predict traffic conditions. Historical traffic data within the road network structure predicts future traffic conditions on connected road segments. However, the existing traffic flow prediction methods have the problem of low prediction accuracy.
发明内容SUMMARY OF THE INVENTION
本申请实施方式提供了一种交通流量预测方法、交通流量预测装置、计算机设备及非易失性计算机可读存储介质,以解决现有的交通流量预测方法的预测精度不高的问题。Embodiments of the present application provide a traffic flow prediction method, a traffic flow prediction apparatus, computer equipment and a non-volatile computer-readable storage medium to solve the problem of low prediction accuracy of the existing traffic flow prediction method.
本申请实施方式的交通流量预测方法包括:获取目标路段在预定时长内的原始交通数据,所述原始交通数据包括所述目标路段的交通流量数据及影响所述目标路段的交通流量的外部因素信息;处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数;根据所述影响参数处理所述原始交通数据以获取去除了所述外部因素影响的修正交通数据;划分所述修正交通数据以得到训练集数据及测试集数据;利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;利用所述测试集数据测试所述中间因果卷积-循环神经网络模型以获得评估结果,并在所述评估结果满足预定条件时确认所述中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测。The traffic flow prediction method of the embodiment of the present application includes: acquiring original traffic data of a target road section within a predetermined period of time, the original traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section ; Process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section; process the original traffic data according to the influence parameters to obtain revised traffic data from which the influence of the external factors is removed; to obtain training set data and test set data; use the training set data to train the initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model; use the test set data to test the The intermediate causal convolution-recurrent neural network model is obtained to obtain an evaluation result, and when the evaluation result satisfies a predetermined condition, it is confirmed that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent neural network model; and utilizing The target causal convolution-recurrent neural network model predicts the traffic flow of the target road segment at the time point to be predicted.
在某些实施方式中,所述交通流量数据包括交通速度及交通密度中的至少一种;所述外部因素信息包括低温、高温、正常、小雨、大雨、暴雨、小雪、大雪、暴雪、大风、有交通状况、修路中至少一种外部因素的信息。In some embodiments, the traffic flow data includes at least one of traffic speed and traffic density; the external factor information includes low temperature, high temperature, normal, light rain, heavy rain, heavy rain, light snow, heavy snow, heavy snow, strong wind, There is information on at least one external factor in traffic conditions, road construction.
在某些实施方式中,所述处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数,包括:处理所述原始交通数据以获取所述原始交通数据中未受到所述外部因素影响的正常交通数据及受到所述外部因素信息影响的受影响交通数据;及根据所述受影响交通数据及所述正常交通数据计算所述影响参数。In some embodiments, the processing of the raw traffic data to obtain parameters affecting the traffic flow of the target road section by external factors includes: processing the raw traffic data to obtain the raw traffic data that is not affected by the traffic flow. normal traffic data affected by the external factor and affected traffic data affected by the external factor information; and calculating the influence parameter according to the affected traffic data and the normal traffic data.
在某些实施方式中,每个所述外部因素对应一个所述影响参数,所述根据所述受影响交通数据及所述正常交通数据计算所述影响参数,包括:对于所述预定时长内的每个时间节点,计算属于同一所述时间节点的所述正常交通数据的均值以获得对应于多个所述时间节点的多个均值;及对于每个所述外部因素,根据受该外部因素影响的受影响交通数据及所述多个均值计算该外部因素在每个所述时间节点下的初始参数;及根据多个所述时间节点对应的多个所述初始参数计算所述影响参数。In some embodiments, each of the external factors corresponds to one of the influence parameters, and the calculating the influence parameters according to the affected traffic data and the normal traffic data includes: for the predetermined time period For each time node, calculate the mean value of the normal traffic data belonging to the same time node to obtain a plurality of mean values corresponding to a plurality of the time nodes; and for each of the external factors, according to the influence of the external factor Calculate the initial parameters of the external factor under each time node of the affected traffic data and the plurality of mean values; and calculate the influence parameter according to the plurality of initial parameters corresponding to the plurality of time nodes.
在某些实施方式中,所述初始因果卷积-循环神经网络模型包括因果卷积单元及循环神经网络单元,所述利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型,包括:将所述训练集数据以预定时段为单位输入到所述因果卷积单元中以获得因果卷积输出结果;将所述因果卷积输出结果输入到所述循环神经网络单元中以获得预测值;根据真实值和所述预测值计算损耗值;及在所述损耗值小于预定阈值时确 认训练后的所述初始因果卷积-循环神经网络模型为所述中间初始因果卷积-循环卷积神经网络模型;在所述损耗值大于所述预定阈值时继续对训练后的所述初始因果卷积-循环神经网络模型进行训练。In some embodiments, the initial causal convolution-recurrent neural network model includes a causal convolution unit and a recurrent neural network unit, and the initial causal convolution-recurrent neural network model is trained using the training set data to obtain intermediate A causal convolution-recurrent neural network model, comprising: inputting the training set data into the causal convolution unit in units of a predetermined time period to obtain a causal convolution output result; inputting the causal convolution output result to the obtain a predicted value in the recurrent neural network unit; calculate a loss value according to the actual value and the predicted value; and confirm that the initial causal convolution-recurrent neural network model after training is the desired value when the loss value is less than a predetermined threshold the intermediate initial causal convolution-recurrent convolutional neural network model; when the loss value is greater than the predetermined threshold, continue to train the initial causal convolutional-recurrent neural network model after training.
在某些实施方式中,所述因果卷积单元包括多个因果卷积层,所述循环神经网络单元为循环门控单元。In some embodiments, the causal convolution unit includes a plurality of causal convolution layers, and the recurrent neural network unit is a recurrent gating unit.
在某些实施方式中,所述利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测包括:获取预定周期内的原始交通数据,所述预定周期包括待预测时间点;根据所述影响参数处理所述预定周期内的原始交通数据以获得所述预定周期内的修正交通数据;将所述预定周期内的修正交通数据输入到所述目标因果卷积-循环神经网络模型以获得所述待预测时间点的初始预测值;及根据所述初始预测值及所述影响参数计算目标预测值。In some embodiments, the predicting the traffic flow of the target road segment at the to-be-predicted time point by using the target causal convolutional neural network model includes: acquiring raw traffic data within a predetermined period, and the The predetermined period includes the time point to be predicted; the original traffic data within the predetermined period is processed according to the influence parameter to obtain the corrected traffic data within the predetermined period; the corrected traffic data within the predetermined period is input to the target a causal convolution-recurrent neural network model to obtain an initial predicted value of the to-be-predicted time point; and calculate a target predicted value according to the initial predicted value and the influence parameter.
本申请实施方式的交通流量预测装置包括获取模块、第一处理模块、第二处理模块、划分模块、训练模块、测试模块及预测模块。获取模块用于获取目标路段在预定时长内的原始交通数据,所述原始交通数据包括所述目标路段的交通流量数据及影响所述目标路段的交通流量的外部因素信息。第一处理模块用于处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数。第二处理模块用于根据所述影响参数处理所述原始交通数据以获取去除了所述外部因素影响的修正交通数据。划分模块用于划分所述修正交通数据以得到训练集数据及测试集数据。训练模块用于利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型。测试模块用于利用所述测试集数据测试所述中间因果卷积-循环神经网络模型以获得评估结果,并在所述评估结果满足预定条件时确认所述中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型。预测模块用于利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测。The traffic flow prediction apparatus of the embodiment of the present application includes an acquisition module, a first processing module, a second processing module, a division module, a training module, a testing module, and a prediction module. The acquisition module is configured to acquire original traffic data of the target road section within a predetermined period of time, the original traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section. The first processing module is used for processing the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section. The second processing module is configured to process the original traffic data according to the influence parameter to obtain revised traffic data from which the influence of the external factor is removed. The dividing module is used for dividing the modified traffic data to obtain training set data and test set data. The training module is used to train an initial causal convolution-recurrent neural network model using the training set data to obtain an intermediate causal convolution-recurrent neural network model. The test module is used to test the intermediate causal convolution-recurrent neural network model using the test set data to obtain an evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is when the evaluation result meets a predetermined condition. Targeted causal convolutional-recurrent neural network model. The prediction module is configured to use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
本申请实施方式的计算机设备包括处理器、存储器及一个或多个程序。所述一个或多个程序存储在所述存储器中,所述一个或多个程序能够被所述处理器执行以实现上述任意一个实施方式所述的交通流量预测方法。The computer apparatus of the embodiments of the present application includes a processor, a memory, and one or more programs. The one or more programs are stored in the memory, and the one or more programs can be executed by the processor to implement the traffic flow prediction method according to any one of the above embodiments.
本申请实施方式的非易失性计算机可读存储介质包含计算机程序。所述计算机程序被处理器执行时实现上述任意一个实施方式所述的交通流量预测方法。The non-volatile computer-readable storage medium of the embodiment of the present application contains a computer program. When the computer program is executed by the processor, the traffic flow prediction method described in any one of the above embodiments is implemented.
本申请实施方式的交通流量预测方法、交通流量预测装置、电子装置及非易失性计算机可读存储介质考虑了外部因素对交通流量的影响,可以使得交通流量的预测结果更为准确。并且,本申请采用了因果卷积-循环神经网络模型来预测交通流量,由于因果卷积-循环神经网络模型可以在降低计算量的前提下感受到更大时间宽度的时间序列,从而使得该模型可以依赖于大量时间节点的历史交通数据来预测待预测时间点的交通流量,不仅有利于进一步提升交通流量预测的准确性,还有利于提高交通流量预测的实时性。The traffic flow prediction method, the traffic flow prediction device, the electronic device, and the non-volatile computer-readable storage medium of the embodiments of the present application consider the influence of external factors on the traffic flow, and can make the traffic flow prediction result more accurate. In addition, the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical traffic data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
本申请实施方式的附加方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of embodiments of the present application will be set forth, in part, in the following description, and in part will be apparent from the following description, or learned by practice of the present application.
附图说明Description of drawings
本申请的上述和/或附加的方面和优点可以从结合下面附图对实施方式的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the following description of embodiments in conjunction with the accompanying drawings, wherein:
图1是本申请某些实施方式的交通流量预测方法的流程示意图;1 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application;
图2是本申请某些实施方式的交通流量预测装置的示意图;2 is a schematic diagram of a traffic flow prediction device according to some embodiments of the present application;
图3是本申请某些实施方式的交通流量预测方法的流程示意图;3 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application;
图4是本申请某些实施方式的交通流量预测方法的流程示意图;4 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application;
图5是本申请某些实施方式的第一处理模块的示意图;5 is a schematic diagram of a first processing module of some embodiments of the present application;
图6是本申请某些实施方式的交通流量预测方法的流程示意图;6 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application;
图7是本申请某些实施方式的训练模块的示意图;7 is a schematic diagram of a training module of some embodiments of the present application;
图8是本申请某些实施方式的因果卷积单元的示意图;8 is a schematic diagram of a causal convolution unit of some embodiments of the present application;
图9是本申请某些实施方式的交通流量预测方法的原理示意图;9 is a schematic diagram of the principle of a traffic flow prediction method according to some embodiments of the present application;
图10是本申请某些实施方式的循环门控单元的原理示意图;10 is a schematic diagram of the principle of a cycle gating unit according to some embodiments of the present application;
图11是本申请某些实施方式的交通流量预测方法的流程示意图;11 is a schematic flowchart of a traffic flow prediction method according to some embodiments of the present application;
图12是本申请某些实施方式的预测模块的示意图;12 is a schematic diagram of a prediction module of some embodiments of the present application;
图13是本申请某些实施方式的计算机设备的示意图;13 is a schematic diagram of a computer device according to some embodiments of the present application;
图14是本申请某些实施方式的非易失性计算机可读存储介质与处理器的交互示意图。FIG. 14 is a schematic diagram of interaction between a non-volatile computer-readable storage medium and a processor according to some embodiments of the present application.
具体实施方式Detailed ways
下面详细描述本申请的实施方式,所述实施方式的示例在附图中示出,其中,相同或类似的标号自始至终表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施方式是示例性的,仅用于解释本申请的实施方式,而不能理解为对本申请的实施方式的限制。Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary, only used to explain the embodiments of the present application, and should not be construed as limitations on the embodiments of the present application.
请参阅图1,本申请公开一种交通流量预测方法。交通流量预测方法包括:Referring to FIG. 1 , the present application discloses a traffic flow prediction method. Traffic flow forecasting methods include:
01:获取目标路段在预定时长内的原始交通数据,原始交通数据包括目标路段的交通流量数据及影响目标路段的交通流量的外部因素信息;01: Obtain the original traffic data of the target road section within a predetermined period of time, the original traffic data includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
02:处理原始交通数据以获取外部因素对目标路段的交通流量的影响参数;02: Process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section;
03:处理原始交通数据以获取去除了外部因素影响的修正交通数据;03: Process the raw traffic data to obtain corrected traffic data with the influence of external factors removed;
04:划分修正交通数据以得到训练集数据及测试集数据;04: Divide and correct traffic data to obtain training set data and test set data;
05:利用训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;05: Use the training set data to train an initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model;
06:利用测试集数据测试中间因果卷积-循环神经网络模型以获得评估结果,并在评估结果满足预定条件时确认中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及06: Use the test set data to test the intermediate causal convolution-recurrent neural network model to obtain the evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent neural network model when the evaluation result meets the predetermined conditions; and
07:利用目标因果卷积-循环神经网络模型对目标路段在待预测时间点下的交通流量进行预测。07: Use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
请参阅图2,本申请还公开一种交通流量预测装置10。本申请实施方式的交通流量预测方法可以由本申请实施方式的交通流量预测装置10实现。交通流量预测装置10包括获取模块11、第一处理模块12、第二处理模块13、划分模块14、训练模块15、测试模块16级预测模块17。其中,步骤01可以由获取模块11实现。步骤02可以由第一处理模块12实现。步骤03可以由第二处理模块13实现。步骤04可以由划分模块14实现。步骤05可以由训练模块15实现。步骤06可以由测试模块16实现。步骤07可以由预测模块17实现。Please refer to FIG. 2 , the present application also discloses a traffic flow prediction device 10 . The traffic flow prediction method of the embodiment of the present application can be realized by the traffic flow prediction apparatus 10 of the embodiment of the present application. The traffic flow prediction device 10 includes an acquisition module 11 , a first processing module 12 , a second processing module 13 , a division module 14 , a training module 15 , and a testing module 16 , a prediction module 17 . Wherein, step 01 may be realized by the obtaining module 11 . Step 02 may be implemented by the first processing module 12 . Step 03 may be implemented by the second processing module 13 . Step 04 may be implemented by the division module 14 . Step 05 may be implemented by the training module 15 . Step 06 may be implemented by the test module 16 . Step 07 may be implemented by the prediction module 17 .
也即是说,获取模块11可以用于获取目标路段在预定时长内的原始交通数据,原始交通数据包括目标路段的交通流量数据及影响目标路段的交通流量的外部因素信息。第一处理模块12可以用于处理原始交通数据以获取外部因素对目标路段的交通流量的影响参数。第二处理模块13可以用于处理原始交通数据以获取去除了外部因素影响的修正交通数据。划分模块14可以用于划分修正交通数据以得到训练集数据及测试集数据。训练模块15可以用于利用训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型。测试模块16可以用于利用测试集数据测试中间因果卷积-循环神经网络模型以获得评估结果,并在评估结果满足预定条件时确认中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型。预测模块17可以用于利用目标因果卷积-循环神经网络模型对目标路段在待预测时间点下的交通流量进行预测。That is to say, the obtaining module 11 can be used to obtain the original traffic data of the target road segment within a predetermined period of time, and the original traffic data includes the traffic flow data of the target road segment and external factor information affecting the traffic flow of the target road segment. The first processing module 12 may be used to process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road segment. The second processing module 13 may be used to process the original traffic data to obtain corrected traffic data from which the influence of external factors has been removed. The dividing module 14 can be used to divide and correct the traffic data to obtain training set data and test set data. The training module 15 may be used to train an initial causal convolutional-recurrent neural network model using the training set data to obtain an intermediate causal convolutional-recurrent neural network model. The testing module 16 can be used to test the intermediate causal convolution-recurrent neural network model using the test set data to obtain an evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent model when the evaluation result satisfies a predetermined condition. neural network model. The prediction module 17 may be configured to use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
其中,原始交通数据中的交通流量数据包括交通速度及交通密度中的至少一种。也即是说,交通流量数据可以仅包括交通速度或交通密度,或者,交通流量数据可以同时包括交通速度和交通密度。在本申请的具体实施例中,交通流量数据同时包括交通速度和交通密度。 交通速度和交通密度可以通过设置在目标路段中的传感器获取。The traffic flow data in the original traffic data includes at least one of traffic speed and traffic density. That is, the traffic flow data may include only the traffic speed or the traffic density, or the traffic flow data may include both the traffic speed and the traffic density. In a specific embodiment of the present application, the traffic flow data includes both traffic speed and traffic density. Traffic speed and traffic density can be acquired by sensors placed in the target road segment.
原始交通数据中的外部因素信息包括低温、高温、正常、小雨、大雨、暴雨、小雪、大雪、暴雪、大风、有交通状况、修路中至少一种外部因素的信息。示例地,外部因素信息可以同时包括高温、正常、小雨、大雨、暴雨、有交通状况这六种外部因素的信息,或者,外部因素信息可以同时包括低温、高温、正常、小雨、大雨、暴雨、小雪、大雪、暴雪、大风、有交通状况、修路这十二种外部因素的信息等。需要说明的是,高温、小雨、大雨、暴雨、小雪、大雪、暴雪、大风等的评判标准可以参照气象部门对于温度、雨量、雪量、风力等气候现象的相关划分准则来制定。The external factor information in the original traffic data includes information of at least one external factor among low temperature, high temperature, normal, light rain, heavy rain, heavy rain, light snow, heavy snow, heavy snow, strong wind, traffic conditions, and road construction. Exemplarily, the external factor information may simultaneously include information on six types of external factors: high temperature, normal, light rain, heavy rain, heavy rain, and traffic conditions, or the external factor information may simultaneously include low temperature, high temperature, normal, light rain, heavy rain, heavy rain, Information on twelve external factors such as light snow, heavy snow, blizzard, strong wind, traffic conditions, and road construction. It should be noted that the evaluation criteria for high temperature, light rain, heavy rain, heavy rain, light snow, heavy snow, blizzard, strong wind, etc. can be formulated with reference to the relevant division criteria of the meteorological department for climate phenomena such as temperature, rainfall, snow volume, and wind power.
预定时长可以是一周、半个月、一个月、三个月、六个月、九个月、一年、两年、三年、五年等,在此不作限制。预定时长内,原始交通数据每间隔一段时间会被采集一次,例如,每间隔十分钟采集一次数据。当然,在其他实施例中,间隔的时间也可以是一分钟、五分钟、十五分钟、二十分钟、三十分钟等,在此不作限制。此处,假设预定时长为一周,原始交通数据每隔十分钟会被采集一次,则步骤01中,目标路段在预定时长内的原始交通数据包括采集了6×24×7次的数据。The predetermined duration can be one week, half a month, one month, three months, six months, nine months, one year, two years, three years, five years, etc., which is not limited here. For a predetermined period of time, raw traffic data will be collected at regular intervals, for example, at ten-minute intervals. Of course, in other embodiments, the interval time may also be one minute, five minutes, fifteen minutes, twenty minutes, thirty minutes, etc., which are not limited here. Here, assuming that the predetermined duration is one week and the original traffic data is collected every ten minutes, in step 01, the original traffic data of the target road segment within the predetermined duration includes data collected 6×24×7 times.
在本申请的一个实施例中,交通流量数据以向量X d,t表示,其中,d表示天,t表示一天中的时间,t的间隔为十分钟。外部因素P d,t=[高温,正常,小雨,大雨,暴雨,有交通状况],P d,t可以用0,1向量表示,其中,0表示无该外部因素,1表示有该外部因素。示例地,P d,t=(0,1,0,0,0,0)表示该交通流量数据为不受外部因素影响的正常交通流量数据;P d,t=(0,0,0,0,0,1)表示该交通流量数据为受到“有交通状况”这一外部因素影响的受影响交通流量数据。 In one embodiment of the present application, the traffic flow data is represented by a vector X d,t , where d represents a day, t represents a time of day, and the interval of t is ten minutes. External factors P d,t = [high temperature, normal, light rain, heavy rain, heavy rain, with traffic conditions], P d, t can be represented by a vector of 0, 1, where 0 means no external factors, 1 means there are external factors . For example, P d,t =(0,1,0,0,0,0) indicates that the traffic flow data is normal traffic flow data not affected by external factors; P d,t =(0,0,0, 0,0,1) indicates that the traffic flow data is the affected traffic flow data affected by the external factor of "traffic condition".
在获取到原始交通数据后,即可对原始交通数据作进一步处理并将处理后的数据用于模型训练和测试,以获得目标的预测模型,最后,可以利用目标的预测模型获得交通流量预测结果。After the original traffic data is obtained, the original traffic data can be further processed and the processed data can be used for model training and testing to obtain the target prediction model. Finally, the traffic flow prediction result can be obtained by using the target prediction model. .
可以理解,相关技术中,可以使用统计分析方法、非线性理论方法、深度学习方法等来实现交通流量预测。然而,这些方法存在交通流量预测结果精度较低,抑或是计算量过于庞大等问题。It can be understood that, in the related art, a statistical analysis method, a nonlinear theoretical method, a deep learning method, etc. can be used to realize the traffic flow prediction. However, these methods have problems such as low accuracy of traffic flow prediction results or too large amount of computation.
本申请实施方式的交通流量预测方法及交通流量预测装置10考虑了外部因素对交通流量的影响,可以使得交通流量的预测结果更为准确。并且,本申请采用了因果卷积-循环神经网络模型来预测交通流量,由于因果卷积-循环神经网络模型可以在降低计算量的前提下感受到更大时间宽度的时间序列,从而使得该模型可以依赖于大量时间节点的历史数据来预测待预测时间点的交通流量,不仅有利于进一步提升交通流量预测的准确性,还有利于提高交通流量预测的实时性。The traffic flow prediction method and the traffic flow prediction device 10 according to the embodiments of the present application consider the influence of external factors on the traffic flow, which can make the prediction result of the traffic flow more accurate. In addition, the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
请参阅图3和图4,在某些实施方式中,步骤02处理原始交通数据以获取外部因素对目标路段的交通流量的影响参数,包括:Referring to FIG. 3 and FIG. 4, in some embodiments, step 02 processes the original traffic data to obtain parameters that influence the traffic flow of the target road segment by external factors, including:
021:处理原始交通数据以获取原始交通数据中未受到外部因素影响的正常交通数据及受到外部因素信息影响的受影响交通数据;及021: Processing raw traffic data to obtain normal traffic data unaffected by external factors and affected traffic data affected by external factor information in the raw traffic data; and
022:根据受影响交通数据及正常交通数据计算影响参数。022: Calculate the impact parameters according to the affected traffic data and normal traffic data.
其中,每个外部因素对应一个影响参数,步骤022根据受影响交通数据及正常交通数据计算影响参数,包括:Wherein, each external factor corresponds to an influence parameter, and step 022 calculates the influence parameter according to the affected traffic data and the normal traffic data, including:
0221:对于预定时长内的每个时间节点,计算属于同一时间节点的正常交通数据的均值以获得对应于多个时间节点的多个均值;及0221: For each time node within a predetermined time period, calculate the mean value of the normal traffic data belonging to the same time node to obtain a plurality of mean values corresponding to the plurality of time nodes; and
0222:对于每个外部因素,根据受该外部因素影响的受影响交通数据及多个均值计算该外部因素在每个时间节点下的初始参数;及0222: For each external factor, calculate the initial parameters of the external factor at each time node based on the affected traffic data and multiple averages affected by the external factor; and
0223:根据多个时间节点对应的多个初始参数计算影响参数。0223: Calculate the influence parameter according to the multiple initial parameters corresponding to the multiple time nodes.
请参阅图5,在某些实施方式中,第一处理模块12包括第一处理单元121及第一计算单元122。步骤021可以由第一处理单元121实现,步骤022、步骤0221、步骤0222及步骤0223均可以由第一计算单元122实现。Referring to FIG. 5 , in some embodiments, the first processing module 12 includes a first processing unit 121 and a first computing unit 122 . Step 021 may be implemented by the first processing unit 121 , and step 022 , step 0221 , step 0222 and step 0223 may all be implemented by the first computing unit 122 .
也即是说,第一处理单元121可以用于处理原始交通数据以获取原始交通数据中未受到外部因素影响的正常交通数据及受到外部因素信息影响的受影响交通数据。第一计算单元122可以用于根据受影响交通数据及正常交通数据计算影响参数。其中,第一计算单元122用于根据受影响交通数据及正常交通数据计算影响参数时,第一计算单元122具体用于:对于预定时长内的每个时间节点,计算属于同一时间节点的正常交通数据的均值以获得对应于多个时间节点的多个均值;对于每个外部因素,根据受该外部因素影响的受影响交通数据及多个均值计算该外部因素在每个时间节点下的初始参数;根据多个时间节点对应的多个初始参数计算影响参数。That is to say, the first processing unit 121 may be configured to process the raw traffic data to obtain normal traffic data that is not affected by external factors and affected traffic data that is affected by external factor information in the raw traffic data. The first calculation unit 122 may be configured to calculate the influence parameter according to the affected traffic data and the normal traffic data. Wherein, when the first calculation unit 122 is used to calculate the influence parameter according to the affected traffic data and the normal traffic data, the first calculation unit 122 is specifically used to: for each time node within a predetermined time period, calculate the normal traffic belonging to the same time node The mean value of the data is obtained to obtain multiple mean values corresponding to multiple time nodes; for each external factor, the initial parameters of the external factor under each time node are calculated according to the affected traffic data and multiple mean values affected by the external factor ; Calculate influence parameters according to multiple initial parameters corresponding to multiple time nodes.
具体地,第一处理单元121可以对步骤01获取的原始交通数据进行筛选,第一处理单元121可以根据P d,t中各项的值来确定哪些数据为正常交通数据,哪些数据为受影响交通数据。以外部因素P d,t=[高温,正常,小雨,大雨,暴雨,有交通状况],外部因素对目标路段的交通流量的影响参数ω=[ω 12345,ω 6]为例,第一处理单元121将原始交通数据中所有P d,t=(0,1,0,0,0,0)的数据筛选出来以作为正常交通数据,并将原始交通数据中除P d,t=(0,1,0,0,0,0)的数据以外的数据全部归并为受影响交通数据。 Specifically, the first processing unit 121 can filter the original traffic data obtained in step 01, and the first processing unit 121 can determine which data is normal traffic data and which data is affected according to the values of each item in P d,t traffic data. With external factors P d,t = [high temperature, normal, light rain, heavy rain, heavy rain, with traffic conditions], the influence parameters of external factors on the traffic flow of the target road section ω = [ω 1 , ω 2 , ω 3 , ω 4 , ω 5 , ω 6 ] as an example, the first processing unit 121 filters out all the data with P d,t =(0,1,0,0,0,0) in the original traffic data as normal traffic data, and uses All data in the original traffic data except the data of P d,t =(0,1,0,0,0,0) are merged into the affected traffic data.
随后,第一计算单元122可以对受影响交通数据做分类,把X d,t,i(其中,i=1,2,3,4,5,6,P d,t≠(0,1,0,0,0,0))中不同天(即d不同)但时间节点相同(即t相同)、且受相同外部因素影响(即i相同)的受影响交通数据归并为相同类别的数据;同样地,第一计算单元122还可以对正常交通数据做分类,把X d,t,2(其中,P d,t=(0,1,0,0,0,0))中不同天(即d不同)但时间节点相同(即t相同)的正常交通数据归并为相同类别的数据。 Subsequently, the first computing unit 122 can classify the affected traffic data, and classify X d,t,i (wherein, i=1,2,3,4,5,6, P d,t ≠(0,1, 0,0,0,0)) in different days (that is, d is different) but the time node is the same (that is, t is the same), and affected by the same external factors (that is, the same i) The affected traffic data are merged into the same category of data; Similarly, the first computing unit 122 can also classify the normal traffic data , and classify different days ( That is, d is different) but the normal traffic data with the same time node (that is, the same t) are merged into the same category of data.
随后,对于每一个时间节点,第一计算子单元可以根据该时间节点下的正常交通数据计算出该时间节点下的正常交通数据的均值
Figure PCTCN2020139299-appb-000001
(此处2表示i=2,对应于以1表示序列的第一项的情况;若以0表示序列的第一项,则此处的i=1),例如,假设预定时长为7天,则对于t=10(即每天的零点十分)这一时间节点,第一计算单元122可以根据这7天中7个t=10下的正常交通数据来计算t=10下的正常交通数据均值,也即
Figure PCTCN2020139299-appb-000002
Figure PCTCN2020139299-appb-000003
同样地,对于t=60(即每天的一点整)这一时间节点,第一计算单元122可以根据这7天中7个t=60下的正常交通数据来计算t=10下的正常交通数据均值,也即
Figure PCTCN2020139299-appb-000004
Figure PCTCN2020139299-appb-000005
以此类推。
Subsequently, for each time node, the first calculation subunit may calculate the average value of the normal traffic data under the time node according to the normal traffic data at the time node
Figure PCTCN2020139299-appb-000001
(2 here means i=2, corresponding to the case where 1 represents the first item of the sequence; if 0 represents the first item of the sequence, then i=1 here), for example, assuming that the predetermined duration is 7 days, Then, for the time node of t=10 (that is, 10:00 every day), the first calculation unit 122 can calculate the normal traffic data at t=10 according to the normal traffic data at t=10 in the seven days mean, that is
Figure PCTCN2020139299-appb-000002
Figure PCTCN2020139299-appb-000003
Similarly, for the time node of t=60 (that is, one o'clock every day), the first calculation unit 122 may calculate the normal traffic data at t=10 according to the normal traffic data at t=60 during the seven days mean, that is
Figure PCTCN2020139299-appb-000004
Figure PCTCN2020139299-appb-000005
And so on.
随后,对于每一个外部因素,第一计算单元122可以根据同一时间节点下的且受相同外部因素影响的受影响交通数据及多个均值计算每个外部因素在每个时间节点下的初始参数ω t,i,也即
Figure PCTCN2020139299-appb-000006
其中,d=1,2,3,…,n。示例地,对于“有交通状况”这一外部因素,第一计算单元122可以根据t=10(即每天的零点十分)这一时间节点下的受“有交通状况”这一外部因素影响的受影响交通数据X d,10,6以及t=10下的正常交通数据均值
Figure PCTCN2020139299-appb-000007
来计算“有交通状况”这一外部因素在t=10这一时间节点下对交通流量的影响的初始参数ω 10,6,同样地,第一计算单元122可以根据t=60(即每天的一点整)这一时间节点下的受“有交通状况”这一外部因素影响的受影响交通数据X d,60,6以及t=60下的正常交通数据均值
Figure PCTCN2020139299-appb-000008
来计算“有交通状况”这一外部因素在t=60这一时间节点下对交通流量的影响的初始参数ω 60,6,以此类推。
Subsequently, for each external factor, the first calculation unit 122 may calculate the initial parameter ω of each external factor at each time node according to the affected traffic data and multiple mean values at the same time node and affected by the same external factor t,i , that is,
Figure PCTCN2020139299-appb-000006
Wherein, d=1, 2, 3, ..., n. For example, for the external factor of "traffic condition", the first calculation unit 122 may be influenced by the external factor of "traffic condition" according to the time node of t=10 (ie, 10:00 every day) The affected traffic data X d, 10, 6 and the mean of normal traffic data at t=10
Figure PCTCN2020139299-appb-000007
to calculate the initial parameter ω 10,6 of the influence of the external factor "traffic condition" on the traffic flow at the time node of t=10. Similarly, the first calculation unit 122 can One point and one point) The affected traffic data X d, 60, 6 and the average value of normal traffic data at t=60 under the influence of the external factor of "traffic condition" at this time node
Figure PCTCN2020139299-appb-000008
to calculate the initial parameter ω 60,6 of the influence of the external factor "traffic condition" on the traffic flow at the time node t=60, and so on.
随后,第一计算单元122可以根据多个时间节点对应的多个初始参数计算影响参数,示例地,对于“有交通状况”这一外部因素对交通流量的影响参数
Figure PCTCN2020139299-appb-000009
其中,n表示时间节点t的个数。如此,即可计算出每个外部因素对交通流量的影响参数。外部因素对交通流量的影响参数可统一记为
Figure PCTCN2020139299-appb-000010
Subsequently, the first calculation unit 122 may calculate the influence parameter according to the plurality of initial parameters corresponding to the plurality of time nodes, for example, for the influence parameter of the external factor "traffic condition" on the traffic flow
Figure PCTCN2020139299-appb-000009
Among them, n represents the number of time nodes t. In this way, the influence parameters of each external factor on the traffic flow can be calculated. The influence parameters of external factors on traffic flow can be uniformly recorded as
Figure PCTCN2020139299-appb-000010
请参阅图1,在某些实施方式中,在获得影响参数后,第二处理模块13即可根据影响参数处理预定时长内的原始交通数据以获得预定时长内的修正交通数据。具体地,修正交通数据
Figure PCTCN2020139299-appb-000011
如此,通过对原始交通数据进行去外部依赖化处理,可以补齐被外部因素削弱的这一部分数据,以获得去除外部因素影响的修正交通数据。
Referring to FIG. 1 , in some embodiments, after obtaining the influence parameters, the second processing module 13 can process the original traffic data within a predetermined period of time according to the influence parameters to obtain revised traffic data within the predetermined period of time. Specifically, correcting traffic data
Figure PCTCN2020139299-appb-000011
In this way, by de-externalizing the original traffic data, the part of the data weakened by the external factors can be supplemented, so as to obtain the corrected traffic data which is affected by the external factors.
请继续参阅图1,在某些实施方式中,划分模块14可以通过K折交叉运算法、留出法、留一法、自助法等方法修正交通数据划分为训练集数据和测试集数据,在此不作限制。在本申请的具体实施例中,划分模块14采用K折交叉运算法来划分修正交通数据,其中,K的取值为10,当然,K的取值还可以是其他值,在此也不作限制。具体地,划分模块14将全部的修正交通数据分成K个不相交的子集{S 1,S 2,…,S K},假设修正交通数据中的所有样例个数为M,那么每一个子集有M/K个样例。每次从分好的子集中取出一个样例作为测试集,其它K-1个样例作为训练集,如此即可获得训练集数据和测试集数据。采用K折交叉运算法划分修正交通数据可以很好地利用到样本中的所有数据,有利于后续的模型训练和测试。 Please continue to refer to FIG. 1 , in some embodiments, the division module 14 can modify the traffic data to be divided into training set data and test set data by methods such as K-fold crossover operation, leave-out method, leave-one-out method, and self-help method. This is not limited. In the specific embodiment of the present application, the dividing module 14 uses the K-folded intersection algorithm to divide and correct the traffic data, where the value of K is 10. Of course, the value of K can also be other values, which are not limited here. . Specifically, the dividing module 14 divides all the corrected traffic data into K disjoint subsets {S 1 , S 2 ,...,S K }, assuming that the number of all samples in the corrected traffic data is M, then each The subset has M/K examples. Each time, one sample is taken from the divided subset as the test set, and the other K-1 samples are used as the training set, so that the training set data and the test set data can be obtained. Using the K-fold crossover algorithm to divide and correct the traffic data can make good use of all the data in the sample, which is beneficial to the subsequent model training and testing.
请参阅图6,在某些实施方式中,初始因果卷积-循环神经网络模型包括因果卷积单元151及循环神经网络单元152,步骤05利用训练集数据训练初始因果卷积-循环神经网络模 型以获得中间因果卷积-循环神经网络模型,包括:Referring to FIG. 6 , in some embodiments, the initial causal convolution-recurrent neural network model includes a causal convolution unit 151 and a recurrent neural network unit 152, and step 05 uses the training set data to train the initial causal convolution-recurrent neural network model to obtain an intermediate causal convolutional-recurrent neural network model including:
051:将训练集数据以预定时段为单位输入到因果卷积单元151中以获得因果卷积输出结果;051: input the training set data into the causal convolution unit 151 in units of a predetermined period to obtain a causal convolution output result;
052:将因果卷积输出结果输入到循环神经网络单元152中以获得预测值;052: input the causal convolution output result into the recurrent neural network unit 152 to obtain the predicted value;
053:根据真实值和预测值计算损耗值;及053: Calculate loss values based on actual and predicted values; and
054:在损耗值小于预定阈值时确认训练后的初始因果卷积-循环神经网络模型为中间初始因果卷积-循环卷积神经网络模型;054: Confirm that the initial causal convolution-recurrent neural network model after training is an intermediate initial causal convolution-recurrent convolutional neural network model when the loss value is less than the predetermined threshold;
055:在损耗值大于预定阈值时继续对训练后的初始因果卷积-循环神经网络模型进行训练。055: Continue to train the initial causal convolution-recurrent neural network model after training when the loss value is greater than the predetermined threshold.
请参阅图7,在某些实施方式中,训练模块15包括因果卷积单元151、循环神经网络单元152、第二计算单元153、确认单元154。步骤051可以由因果卷积单元151实现。步骤052可以由循环神经网络单元152实现。步骤053可以由第二计算单元153实现。步骤054可以由确认单元154实现。步骤055可以由因果卷积单元151和循环神经网络单元152实现。也即是说,因果卷积单元151可以用于对以预定时段为单位输入的训练集数据进行计算以获得因果卷积输出结果。循环神经网络单元152可以用于对输入的因果卷积输出结果进行计算以获得预测值。第二计算单元153可以用于根据真实值和预测值计算损耗值。确认单元154可以用于在损耗值小于预定阈值时确认训练后的初始因果卷积-循环神经网络模型为中间初始因果卷积-循环卷积神经网络模型。因果卷积单元151和循环神经网络单元152可以用于在损耗值大于预定阈值时继续对训练后的初始因果卷积-循环神经网络模型进行训练。Referring to FIG. 7 , in some embodiments, the training module 15 includes a causal convolution unit 151 , a recurrent neural network unit 152 , a second calculation unit 153 , and a confirmation unit 154 . Step 051 may be implemented by the causal convolution unit 151 . Step 052 may be implemented by the recurrent neural network unit 152 . Step 053 may be implemented by the second computing unit 153 . Step 054 may be implemented by the confirmation unit 154 . Step 055 may be implemented by the causal convolution unit 151 and the recurrent neural network unit 152 . That is to say, the causal convolution unit 151 may be configured to perform computation on training set data input in units of a predetermined period to obtain a causal convolution output result. The RNN unit 152 may be used to perform computations on the input causal convolution outputs to obtain predicted values. The second calculation unit 153 may be used to calculate the loss value according to the actual value and the predicted value. The confirming unit 154 may be configured to confirm that the trained initial causal convolution-recurrent neural network model is an intermediate initial causal convolution-recurrent convolutional neural network model when the loss value is less than a predetermined threshold. The causal convolution unit 151 and the recurrent neural network unit 152 may be configured to continue training the initial causal convolution-recurrent neural network model after training when the loss value is greater than a predetermined threshold.
其中,预定时段可以是6小时、12小时、18小时、24小时、36小时、72小时等,在此不作限制。The predetermined time period may be 6 hours, 12 hours, 18 hours, 24 hours, 36 hours, 72 hours, etc., which is not limited herein.
示例地,请结合图7至图10,训练集数据以天(24小时)为单位输入到因果卷积单元151中,以用于提取各待预测时间点的交通流量对与之相关联的多个时刻的交通流量的依赖。其中,因果卷积单元151可以包括一层因果卷积层或多层因果卷积层,在此不作限制。7 to 10, the training set data is input into the causal convolution unit 151 in units of days (24 hours) for extracting the traffic flow pairs associated with them at each time point to be predicted. Dependence of traffic flow at a time. The causal convolution unit 151 may include one layer of causal convolution layers or multiple layers of causal convolution layers, which is not limited herein.
示例地,当因果卷积单元151仅包括一层因果卷积层时,步骤04中获得的修正交通数据Y d,t输入到该一层因果卷积层时,修正交通数据的处理公式如下: Exemplarily, when the causal convolution unit 151 includes only one causal convolution layer, when the corrected traffic data Y d, t obtained in step 04 is input to the one causal convolution layer, the processing formula for the corrected traffic data is as follows:
Figure PCTCN2020139299-appb-000012
Figure PCTCN2020139299-appb-000012
其中,w d,t,p为卷积结果;q为展开率;φ k,m,p的所有元素都表示卷积核,
Figure PCTCN2020139299-appb-000013
K r为核长度;M是为了因果卷积单元151的扩展性而设置的参数,在本申请的一个实施例中,m为1,当然,在其他例子中,m还可以是2、3、4、5等数值,在此不做限制;P是卷积核通道数。上式可记为:W=Φ* qY。
Among them, w d, t, p is the convolution result; q is the expansion rate; all elements of φ k, m, p represent the convolution kernel,
Figure PCTCN2020139299-appb-000013
K r is the kernel length; M is a parameter set for the scalability of the causal convolution unit 151. In an embodiment of the present application, m is 1. Of course, in other examples, m can also be 2, 3, Values such as 4 and 5 are not limited here; P is the number of convolution kernel channels. The above formula can be written as: W=Φ* q Y.
示例地,当因果卷积单元151包括多层因果卷积层时,如图8所示,因果卷积层包括四层,可以感受15个时间节点,其中,在第二层下,待预测时间点可以感受前3个时刻的修正交通数据,叠加一层(即第三层)后,待预测时间点可以感受前7个时刻的修正交通数据,再叠加一层(即第四层)后,待预测时间点可以感受前15个时刻的数据。随着层数的叠加,待预测时间点可以感受到的时刻呈指数级上升。此时,修正交通数据的处理公式如下:For example, when the causal convolution unit 151 includes multiple layers of causal convolution layers, as shown in FIG. 8 , the causal convolution layer includes four layers, and 15 time nodes can be experienced, wherein, under the second layer, the time to be predicted Point can feel the revised traffic data of the first 3 moments, after superimposing one layer (ie the third layer), the predicted time point can feel the corrected traffic data of the first 7 moments, and then superimpose one layer (ie the fourth layer), The time point to be predicted can feel the data of the first 15 moments. As the number of layers is superimposed, the moment that can be felt at the time point to be predicted increases exponentially. At this time, the processing formula for correcting the traffic data is as follows:
Figure PCTCN2020139299-appb-000014
Figure PCTCN2020139299-appb-000014
其中,* q表示展开率为q的因果卷积操作,f为非线性激活函数,l为层数。 where * q denotes a causal convolution operation with expansion rate q, f is a nonlinear activation function, and l is the number of layers.
需要说明的是,图8所示的四层仅为示例,在其他例子中,因果卷积单元151中因果卷积层的层数也可以是两层、三层、五层、十层等,在此不作限制。It should be noted that the four layers shown in FIG. 8 are only examples. In other examples, the number of layers of the causal convolution layer in the causal convolution unit 151 may also be two layers, three layers, five layers, ten layers, etc., There is no restriction here.
因果卷积单元151输出的因果卷积输出结果W d会被输入到循环神经网络单元152中进行训练。其中,循环神经网络单元152可以是循环神经网络(Recurrent Neural Network,RNN)模型,或者RNN模型的变体循环门控单元(Gate Recurrent Unit,GRU)模型。由于GRU模型的计算效率较高,因此,在本申请的一个实施例中,采用GRU模型对因果卷积输出结果W d进行处理。如图9和图10所示,具体地,首先为采用标准正态分布初始化GRU模型的参数,设置迭代次数。随后,将因果卷积输出结果W d输入到GRU模型中。其中,GRU模型的计算过程如下所示: The causal convolution output result W d output by the causal convolution unit 151 will be input to the recurrent neural network unit 152 for training. The recurrent neural network unit 152 may be a recurrent neural network (Recurrent Neural Network, RNN) model, or a variant of the RNN model, a gated recurrent unit (Gate Recurrent Unit, GRU) model. Since the calculation efficiency of the GRU model is high, in an embodiment of the present application, the GRU model is used to process the causal convolution output result W d . As shown in FIG. 9 and FIG. 10 , specifically, firstly, the parameters of the GRU model are initialized by using a standard normal distribution, and the number of iterations is set. Subsequently, the causal convolution output W d is input into the GRU model. Among them, the calculation process of the GRU model is as follows:
r d=σ(υ r·[h d-1,W d]) r d =σ(υ r ·[h d-1 ,W d ])
z d=σ(υ z·[h d-1,W d]) z d =σ(υ z ·[h d-1 ,W d ])
Figure PCTCN2020139299-appb-000015
Figure PCTCN2020139299-appb-000015
Figure PCTCN2020139299-appb-000016
Figure PCTCN2020139299-appb-000016
O d=σ(W o·h d) O d =σ(W o ·h d )
其中,
Figure PCTCN2020139299-appb-000017
是需要训练的参数,W d为某一待预测时间点的输入,r d表示复位门,z d为更新门,h d-1为上一天的隐藏状态,h d表示第d天的状态输出,
Figure PCTCN2020139299-appb-000018
为中间参数,σ为sigmoid激活函数,tanh为三角正切函数;[]表示向量相连,*表示矩阵乘法,O d为预测值。
in,
Figure PCTCN2020139299-appb-000017
is the parameter to be trained, W d is the input of a certain time point to be predicted, r d represents the reset gate, z d is the update gate, h d-1 is the hidden state of the previous day, and h d represents the state output of the d day ,
Figure PCTCN2020139299-appb-000018
is the intermediate parameter, σ is the sigmoid activation function, and tanh is the triangular tangent function; [] means that the vectors are connected, * means the matrix multiplication, and O d is the predicted value.
如此,将因果卷积输出结果W d输入到循环神经网络单元152中,即可获得预测值O dIn this way, the causal convolution output result W d is input into the recurrent neural network unit 152 to obtain the predicted value O d .
可以事先定义损失函数:
Figure PCTCN2020139299-appb-000019
则累计损失函数为:
The loss function can be defined in advance:
Figure PCTCN2020139299-appb-000019
Then the cumulative loss function is:
Figure PCTCN2020139299-appb-000020
Figure PCTCN2020139299-appb-000020
其中,loss为损耗值;real d为真实值,可以从原始交通数据中获得。需要说明的是,此公式以预定时段为1天,预定时长为7天为例示出。 Among them, loss is the loss value; real d is the real value, which can be obtained from the original traffic data. It should be noted that this formula is illustrated by taking the predetermined time period as one day and the predetermined duration as seven days as an example.
第二计算单元153可以根据损耗值是否小于或等于预定阈值来判定训练后的初始因果卷积-循环神经网络模型是否满足要求。若损耗值小于或等于预定阈值,则确认单元154确定训练后的初始因果卷积-循环神经网络模型为中间因果卷积-循环神经网络模型(即训练后的初始因果卷积-循环神经网络模型满足要求);若损耗值大于预定阈值,则认为训练后的初始因果卷积-循环神经网络模型不满足要求,需要继续对训练后的初始因果卷积-循环神经网络模型进行训练。The second calculation unit 153 may determine whether the trained initial causal convolution-recurrent neural network model meets the requirements according to whether the loss value is less than or equal to a predetermined threshold. If the loss value is less than or equal to the predetermined threshold, the confirmation unit 154 determines that the initial causal convolution-recurrent neural network model after training is an intermediate causal convolution-recurrent neural network model (ie, the initial causal convolution-recurrent neural network model after training). If the loss value is greater than the predetermined threshold, it is considered that the initial causal convolutional neural network model after training does not meet the requirements, and the training of the initial causal convolutional neural network model after training needs to be continued.
示例地,在进一步对训练后的初始因果卷积-循环神经网络模型进行训练时,可以使用时间反向传播算法来对该训练后的初始因果卷积-循环神经网络模型中的参数进行更改, 其中,各层权重参数组成向量I∈R m。具体地,可以先计算梯度: Illustratively, when further training the initial causal convolutional neural network model after training, the parameters in the initial causal convolutional neural network model after training can be changed using a time backpropagation algorithm, Among them, the weight parameters of each layer form a vector I∈R m . Specifically, the gradient can be calculated first:
Figure PCTCN2020139299-appb-000021
Figure PCTCN2020139299-appb-000021
由于参数每一时刻共享,所以当前的待预测时间点的梯度还要依赖于之前所有时刻的累计梯度,考虑到累计正负问题,所以使用累计平方梯度:Since the parameters are shared at each moment, the gradient of the current to-be-predicted time point also depends on the cumulative gradient of all previous moments. Considering the cumulative positive and negative problem, the cumulative squared gradient is used:
Figure PCTCN2020139299-appb-000022
Figure PCTCN2020139299-appb-000022
则参数更新方程为:Then the parameter update equation is:
I j=I j-1-αΔloss I j =I j-1 -αΔloss
其中,α为学习率。在本申请的一个实施例中,α取0.002,当然,在其他例子中,α也可以是其他值,在此不作限制。where α is the learning rate. In an embodiment of the present application, α is 0.002. Of course, in other examples, α can also be other values, which is not limited here.
本申请实施例使用叠加层次的因果卷积提取大量当天时间依赖,再使用GRU模型来提取前一周每天待预测时间点的时间依赖,从而可以提取更大宽度的时间序列感受范围,使得模型预测可以依赖于大量时间节点的历史交通数据,有利于提升交通流量预测的准确性。In the embodiment of the present application, the causal convolution of superimposed layers is used to extract a large number of time dependencies of the day, and then the GRU model is used to extract the time dependencies of the time points to be predicted each day in the previous week, so that a wider range of time series perception can be extracted, so that the model prediction can be Relying on the historical traffic data of a large number of time nodes is conducive to improving the accuracy of traffic flow prediction.
请继续参阅图1,在某些实施方式中,可以使用中间因果卷积-循环神经网络模型的均方误差(MSE)对中间因果卷积-循环神经网络模型的训练效果进行评估。如果评估结果满足预定条件(即达到预期效果),则确认中间因果卷积-循环神经网络模型为目标卷积-循环神经网络模型,如果评估结果不满足预定条件(即达不到预期效果),则继续对中间因果卷积-循环神经网络模型进行训练。需要说明的是,也可以使用除均方误差(MSE)外的其他方法对中间因果卷积-循环神经网络模型的训练效果进行评估,在此不作限制。Continuing to refer to FIG. 1 , in some embodiments, the mean square error (MSE) of the intermediate causal convolutional-recurrent neural network model can be used to evaluate the training effect of the intermediate causal convolutional-recurrent neural network model. If the evaluation result satisfies the predetermined condition (that is, the expected effect is achieved), confirm that the intermediate causal convolution-recurrent neural network model is the target convolution-recurrent neural network model, if the evaluation result does not meet the predetermined condition (that is, the expected effect is not achieved), Then continue to train the intermediate causal convolutional-recurrent neural network model. It should be noted that other methods other than mean square error (MSE) can also be used to evaluate the training effect of the intermediate causal convolution-recurrent neural network model, which is not limited here.
请参阅图11,在某些实施方式中,步骤07利用目标因果卷积-循环神经网络模型对目标路段在待预测时间点下的交通流量进行预测,包括:Referring to FIG. 11, in some embodiments, step 07 utilizes the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted, including:
071:获取预定周期内的原始交通数据,预定周期包括待预测时间点;071: Acquire original traffic data within a predetermined period, where the predetermined period includes the time point to be predicted;
072:根据影响参数处理预定周期内的原始交通数据以获得预定周期内的修正交通数据;072: Process the original traffic data in the predetermined period according to the influence parameter to obtain the revised traffic data in the predetermined period;
073:将预定周期内的修正交通数据输入到目标因果卷积-循环神经网络模型以获得待预测时间点的初始预测值;及073: Input the revised traffic data within the predetermined period into the target causal convolution-recurrent neural network model to obtain the initial predicted value of the time point to be predicted; and
074:根据初始预测值及影响参数计算目标预测值。074: Calculate the target predicted value according to the initial predicted value and the influence parameters.
请参阅图12,在某些实施方式中,预测模块17包括获取单元171、第二处理单元172、预测单元173及第三计算单元174。步骤071可以由获取单元171实现。步骤072可以由第二处理单元172实现。步骤073可以由预测单元173实现。步骤074可以由第三计算单元174实现。也即是说,获取单元171可以用于获取预定周期内的原始交通数据,预定周期包括待预测时间点。第二处理单元172可以用于根据影响参数处理预定周期内的原始交通数据以获得预定周期内的修正交通数据。预测单元173可以用于将预定周期内的修正交通数据输入到目标因果卷积-循环神经网络模型以获得待预测时间点的初始预测值。第三计算单元174可以用于根据初始预测值及影响参数计算目标预测值。Referring to FIG. 12 , in some embodiments, the prediction module 17 includes an acquisition unit 171 , a second processing unit 172 , a prediction unit 173 and a third calculation unit 174 . Step 071 may be implemented by the obtaining unit 171 . Step 072 may be implemented by the second processing unit 172 . Step 073 may be implemented by the prediction unit 173 . Step 074 may be implemented by the third computing unit 174 . That is to say, the acquiring unit 171 may be configured to acquire the original traffic data within a predetermined period, and the predetermined period includes the time point to be predicted. The second processing unit 172 may be configured to process the original traffic data within a predetermined period according to the influencing parameters to obtain revised traffic data within the predetermined period. The prediction unit 173 may be configured to input the revised traffic data within a predetermined period into the target causal convolutional-recurrent neural network model to obtain the initial prediction value of the time point to be predicted. The third calculation unit 174 may be configured to calculate the target predicted value according to the initial predicted value and the influence parameter.
具体地,对于待预测时间点,获取目标路段预定周期内的原始交通数据,该预定周期包含该待预测时间点。示例地,获取单元171可以获取待预测时间点前一周(包含当天)的所有原始交通数据,原始交通数据包括交通流量及外部因素信息。需要说明的是,预定周期除了可以取一周外,也可以是三天、五天、十天等,在此不作限制。Specifically, for the to-be-predicted time point, raw traffic data within a predetermined period of the target road segment is acquired, and the predetermined period includes the to-be-predicted time point. For example, the obtaining unit 171 may obtain all the original traffic data one week before the time point to be predicted (including the current day), and the original traffic data includes traffic flow and external factor information. It should be noted that, in addition to one week, the predetermined period may also be three days, five days, ten days, etc., which is not limited here.
随后,第二处理单元172可以根据步骤02计算得到的影响参数对待预测时间点前一周的所有原始交通数据进行处理以获得预定周期内的修正交通数据。具体的处理过程与步骤021的处理过程相同,在此不再赘述。Subsequently, the second processing unit 172 may process all the original traffic data one week before the to-be-predicted time point according to the influence parameters calculated in step 02 to obtain revised traffic data within a predetermined period. The specific processing procedure is the same as the processing procedure of step 021, and is not repeated here.
随后,预测单元173可以将预定周期内的修正交通数据按预定时段(例如,一天)为单元输入到因果卷积单元151中,以获得与待预测时间点对应的每一天的因果卷积输出结果。随后,预测单元173进一步将与待预测时间点对应的每一天的因果卷积输出结果输入到循环卷积单元中,以输出待预测时间点的初始预测值O。Subsequently, the prediction unit 173 may input the corrected traffic data within a predetermined period into the causal convolution unit 151 in units of a predetermined period (eg, one day) to obtain the causal convolution output result of each day corresponding to the time point to be predicted . Subsequently, the prediction unit 173 further inputs the causal convolution output result of each day corresponding to the time point to be predicted into the circular convolution unit to output the initial predicted value O of the time point to be predicted.
最后,第三计算单元174再对初始预测值O添加待预测时间点的外部依赖,也即结合影响参数对初始预测值进行还原以得到目标预测值,处理公式如下:Finally, the third calculation unit 174 adds the external dependency of the time point to be predicted to the initial predicted value O, that is, restores the initial predicted value in combination with the influence parameters to obtain the target predicted value. The processing formula is as follows:
S=(1-P d,tT)O S=(1-P d,tT )O
如此,即可得到目标预测值S。In this way, the target predicted value S can be obtained.
综上,本申请实施方式的交通流预测方法及交通流量预测装置10(图2所示)考虑了外部因素对交通流量的影响,可以使得交通流量的预测结果更为准确。并且,本申请采用了因果卷积-循环神经网络模型来预测交通流量,由于因果卷积-循环神经网络模型可以在降低计算量的前提下感受到更大时间宽度的时间序列,从而使得该模型可以依赖于大量时间节点的历史交通数据来预测待预测时间点的交通流量,不仅有利于进一步提升交通流量预测的准确性,还有利于提高交通流量预测的实时性。To sum up, the traffic flow prediction method and the traffic flow prediction device 10 (shown in FIG. 2 ) according to the embodiment of the present application consider the influence of external factors on the traffic flow, and can make the prediction result of the traffic flow more accurate. In addition, the present application adopts a causal convolution-recurrent neural network model to predict traffic flow. Since the causal convolution-recurrent neural network model can experience a time series with a larger time width under the premise of reducing the amount of calculation, the model makes the It is possible to rely on the historical traffic data of a large number of time nodes to predict the traffic flow at the time to be predicted, which is not only conducive to further improving the accuracy of traffic flow forecasting, but also improving the real-time performance of traffic flow forecasting.
请参阅图12,本申请还提供一种计算机设备20。计算机设备20包括处理器21、存储器22及一个或多个程序。一个或多个程序存储在存储器22中,一个或多个程序能够被处理器21执行以实现上述任意一个实施方式的交通流量预测方法。Please refer to FIG. 12 , the present application also provides a computer device 20 . Computer device 20 includes a processor 21, a memory 22, and one or more programs. One or more programs are stored in the memory 22, and the one or more programs can be executed by the processor 21 to implement the traffic flow prediction method of any one of the above embodiments.
例如,请结合图1和图12,一个或多个程序能够被处理器21执行以实现以下步骤:For example, referring to FIG. 1 and FIG. 12, one or more programs can be executed by the processor 21 to realize the following steps:
01:获取目标路段在预定时长内的原始交通数据,原始交通数据包括目标路段的交通流量数据及影响目标路段的交通流量的外部因素信息;01: Obtain the original traffic data of the target road section within a predetermined period of time, the original traffic data includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
02:处理原始交通数据以获取外部因素对目标路段的交通流量的影响参数;02: Process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section;
03:处理原始交通数据以获取去除了外部因素影响的修正交通数据;03: Process the raw traffic data to obtain corrected traffic data with the influence of external factors removed;
04:划分修正交通数据以得到训练集数据及测试集数据;04: Divide and correct traffic data to obtain training set data and test set data;
05:利用训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;05: Use the training set data to train an initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model;
06:利用测试集数据测试中间因果卷积-循环神经网络模型以获得评估结果,并在评估结果满足预定条件时确认中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及06: Use the test set data to test the intermediate causal convolution-recurrent neural network model to obtain the evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent neural network model when the evaluation result meets the predetermined conditions; and
07:利用目标因果卷积-循环神经网络模型对目标路段在待预测时间点下的交通流量进行预测。07: Use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
再例如,请结合图3和图12,一个或多个程序能够被处理器21执行以实现以下步骤:For another example, referring to FIG. 3 and FIG. 12 , one or more programs can be executed by the processor 21 to realize the following steps:
021:处理原始交通数据以获取原始交通数据中未受到外部因素影响的正常交通数据及受到外部因素信息影响的受影响交通数据;及021: Processing raw traffic data to obtain normal traffic data unaffected by external factors and affected traffic data affected by external factor information in the raw traffic data; and
022:根据受影响交通数据及正常交通数据计算影响参数。022: Calculate the impact parameters according to the affected traffic data and normal traffic data.
请参阅图13,本申请还提供一种非易失性计算机可读存储介质30。非易失性计算机可读存储介质30包括计算机程序。计算机程序被处理器21执行时以实现上述任意一个实施方式的交通流量预测方法。Referring to FIG. 13 , the present application further provides a non-volatile computer-readable storage medium 30 . The non-volatile computer-readable storage medium 30 includes computer programs. The computer program is executed by the processor 21 to realize the traffic flow prediction method of any one of the above-described embodiments.
例如,请结合图1和图13,计算机程序被处理器21执行时以实现以下步骤:For example, please refer to FIG. 1 and FIG. 13, when the computer program is executed by the processor 21 to realize the following steps:
01:获取目标路段在预定时长内的原始交通数据,原始交通数据包括目标路段的交通流量数据及影响目标路段的交通流量的外部因素信息;01: Obtain the original traffic data of the target road section within a predetermined period of time, the original traffic data includes the traffic flow data of the target road section and the external factor information affecting the traffic flow of the target road section;
02:处理原始交通数据以获取外部因素对目标路段的交通流量的影响参数;02: Process the original traffic data to obtain the influence parameters of external factors on the traffic flow of the target road section;
03:处理原始交通数据以获取去除了外部因素影响的修正交通数据;03: Process the raw traffic data to obtain corrected traffic data with the influence of external factors removed;
04:划分修正交通数据以得到训练集数据及测试集数据;04: Divide and correct traffic data to obtain training set data and test set data;
05:利用训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;05: Use the training set data to train an initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model;
06:利用测试集数据测试中间因果卷积-循环神经网络模型以获得评估结果,并在评估结果满足预定条件时确认中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及06: Use the test set data to test the intermediate causal convolution-recurrent neural network model to obtain the evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution-recurrent neural network model when the evaluation result meets the predetermined conditions; and
07:利用目标因果卷积-循环神经网络模型对目标路段在待预测时间点下的交通流量进行预测。07: Use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
再例如,请结合图3和图13,计算机程序被处理器21执行时以实现以下步骤:For another example, please refer to FIG. 3 and FIG. 13 , when the computer program is executed by the processor 21 to realize the following steps:
021:处理原始交通数据以获取原始交通数据中未受到外部因素影响的正常交通数据及受到外部因素信息影响的受影响交通数据;及021: Processing raw traffic data to obtain normal traffic data unaffected by external factors and affected traffic data affected by external factor information in the raw traffic data; and
022:根据受影响交通数据及正常交通数据计算影响参数。022: Calculate the impact parameters according to the affected traffic data and normal traffic data.
在本说明书的描述中,参考术语“一个实施方式”、“一些实施方式”、“示意性实施方式”、“示例”、“具体示例”或“一些示例”等的描述意指结合所述实施方式或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施方式或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施方式或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施方式或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, reference to the terms "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" or the like is meant to be used in conjunction with the described embodiments. A particular feature, structure, material, or characteristic described in a manner or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and combine the different embodiments or examples described in this specification, as well as the features of the different embodiments or examples, without conflicting each other.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。Any description of a process or method in the flowcharts or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing a specified logical function or step of the process , and the scope of the preferred embodiments of the present application includes alternative implementations in which the functions may be performed out of the order shown or discussed, including performing the functions substantially concurrently or in the reverse order depending upon the functions involved, which should It is understood by those skilled in the art to which the embodiments of the present application belong.
尽管上面已经示出和描述了本申请的实施方式,可以理解的是,上述实施方式是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施方式进行变化、修改、替换和变型。Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limitations to the present application. Embodiments are subject to variations, modifications, substitutions and alterations.

Claims (10)

  1. 一种交通流量预测方法,其特征在于,所述交通流量预测方法包括:A traffic flow prediction method, characterized in that the traffic flow prediction method comprises:
    获取目标路段在预定时长内的原始交通数据,所述原始交通数据包括所述目标路段的交通流量数据及影响所述目标路段的交通流量的外部因素信息;Acquiring raw traffic data of the target road section within a predetermined period of time, the raw traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section;
    处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数;processing the raw traffic data to obtain the influence parameters of external factors on the traffic flow of the target road segment;
    根据所述影响参数处理所述原始交通数据以获取去除了所述外部因素影响的修正交通数据;processing the raw traffic data according to the influence parameter to obtain corrected traffic data from which the influence of the external factor has been removed;
    划分所述修正交通数据以得到训练集数据及测试集数据;dividing the modified traffic data to obtain training set data and test set data;
    利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;Using the training set data to train an initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model;
    利用所述测试集数据测试所述中间因果卷积-循环神经网络模型以获得评估结果,并在所述评估结果满足预定条件时确认所述中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及Use the test set data to test the intermediate causal convolution-recurrent neural network model to obtain an evaluation result, and confirm that the intermediate causal convolution-recurrent neural network model is the target causal convolution when the evaluation result satisfies a predetermined condition - a recurrent neural network model; and
    利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测。Using the target causal convolution-recurrent neural network model, the traffic flow of the target road segment at the time point to be predicted is predicted.
  2. 根据权利要求1所述的交通流量预测方法,其特征在于,所述交通流量数据包括交通速度及交通密度中的至少一种;The traffic flow prediction method according to claim 1, wherein the traffic flow data includes at least one of traffic speed and traffic density;
    所述外部因素信息包括低温、高温、正常、小雨、大雨、暴雨、小雪、大雪、暴雪、大风、有交通状况、修路中至少一种外部因素的信息。The external factor information includes information on at least one external factor of low temperature, high temperature, normal, light rain, heavy rain, heavy rain, light snow, heavy snow, heavy snow, strong wind, traffic conditions, and road construction.
  3. 根据权利要求2所述的交通流量预测方法,其特征在于,所述处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数,包括:The traffic flow prediction method according to claim 2, wherein the processing of the raw traffic data to obtain parameters that affect the traffic flow of the target road section by external factors, comprising:
    处理所述原始交通数据以获取所述原始交通数据中未受到所述外部因素影响的正常交通数据及受到所述外部因素信息影响的受影响交通数据;及processing the raw traffic data to obtain normal traffic data unaffected by the external factor and affected traffic data affected by the external factor information in the raw traffic data; and
    根据所述受影响交通数据及所述正常交通数据计算所述影响参数。The influence parameter is calculated from the affected traffic data and the normal traffic data.
  4. 根据权利要求3所述的交通流量预测方法,其特征在于,每个所述外部因素对应一个所述影响参数,所述根据所述受影响交通数据及所述正常交通数据计算所述影响参数,包括:The traffic flow prediction method according to claim 3, wherein each of the external factors corresponds to one of the influence parameters, and the influence parameters are calculated according to the affected traffic data and the normal traffic data, include:
    对于所述预定时长内的每个时间节点,计算属于同一所述时间节点的所述正常交通数据的均值以获得对应于多个所述时间节点的多个均值;及For each time node within the predetermined time period, calculating an average value of the normal traffic data belonging to the same time node to obtain a plurality of average values corresponding to a plurality of the time nodes; and
    对于每个所述外部因素,根据受该外部因素影响的受影响交通数据及所述多个均值计算该外部因素在每个所述时间节点下的初始参数;及For each of the external factors, calculating the initial parameters of the external factor at each of the time nodes according to the affected traffic data and the plurality of mean values affected by the external factor; and
    根据多个所述时间节点对应的多个所述初始参数计算所述影响参数。The influence parameter is calculated according to a plurality of the initial parameters corresponding to the plurality of time nodes.
  5. 根据权利要求1所述的交通流量预测方法,其特征在于,所述初始因果卷积-循环神经网络模型包括因果卷积单元及循环神经网络单元,所述利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型,包括:The traffic flow prediction method according to claim 1, wherein the initial causal convolution-recurrent neural network model comprises a causal convolution unit and a recurrent neural network unit, and the initial causal volume is trained by using the training set data Product-recurrent neural network models to obtain intermediate causal convolutional-recurrent neural network models, including:
    将所述训练集数据以预定时段为单位输入到所述因果卷积单元中以获得因果卷积输出结果;inputting the training set data into the causal convolution unit in units of a predetermined period to obtain a causal convolution output result;
    将所述因果卷积输出结果输入到所述循环神经网络单元中以获得预测值;inputting the causal convolution output into the recurrent neural network unit to obtain a predicted value;
    根据真实值和所述预测值计算损耗值;及Calculate a loss value based on the actual value and the predicted value; and
    在所述损耗值小于预定阈值时确认训练后的所述初始因果卷积-循环神经网络模型为所述中间初始因果卷积-循环卷积神经网络模型;When the loss value is less than a predetermined threshold, confirm that the initial causal convolution-recurrent neural network model after training is the intermediate initial causal convolution-recurrent convolutional neural network model;
    在所述损耗值大于所述预定阈值时继续对训练后的所述初始因果卷积-循环神经网络模型进行训练。Continue to train the initial causal convolutional neural network model after training when the loss value is greater than the predetermined threshold.
  6. 根据权利要求5所述的交通流量预测方法,其特征在于,所述因果卷积单元包括多个因果卷积层,所述循环神经网络单元为循环门控单元。The traffic flow prediction method according to claim 5, wherein the causal convolution unit comprises a plurality of causal convolution layers, and the recurrent neural network unit is a recurrent gating unit.
  7. 根据权利要求1所述的交通流量预测方法,其特征在于,所述利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测,包括:The traffic flow prediction method according to claim 1, wherein the predicting the traffic flow of the target road section at the time point to be predicted by using the target causal convolutional neural network model, comprising:
    获取预定周期内的原始交通数据,所述预定周期包括待预测时间点;obtaining raw traffic data within a predetermined period, the predetermined period including the time point to be predicted;
    根据所述影响参数处理所述预定周期内的原始交通数据以获得所述预定周期内的修正交通数据;Process the original traffic data within the predetermined period according to the influence parameter to obtain revised traffic data within the predetermined period;
    将所述预定周期内的修正交通数据输入到所述目标因果卷积-循环神经网络模型以获得所述待预测时间点的初始预测值;及inputting the revised traffic data within the predetermined period into the target causal convolutional-recurrent neural network model to obtain the initial predicted value of the to-be-predicted time point; and
    根据所述初始预测值及所述影响参数计算目标预测值。A target predicted value is calculated according to the initial predicted value and the influence parameter.
  8. 一种交通流量预测装置,其特征在于,包括:A traffic flow prediction device, characterized in that it includes:
    获取模块,用于获取目标路段在预定时长内的原始交通数据,所述原始交通数据包括所述目标路段的交通流量数据及影响所述目标路段的交通流量的外部因素信息;an acquisition module, configured to acquire original traffic data of the target road section within a predetermined period of time, the original traffic data including the traffic flow data of the target road section and external factor information affecting the traffic flow of the target road section;
    第一处理模块,用于处理所述原始交通数据以获取外部因素对所述目标路段的交通流量的影响参数;a first processing module, configured to process the original traffic data to obtain parameters that affect the traffic flow of the target road section by external factors;
    第二处理模块,用于根据所述影响参数处理所述原始交通数据以获取去除了所述外部因素影响的修正交通数据;a second processing module, configured to process the original traffic data according to the influence parameter to obtain revised traffic data from which the influence of the external factor has been removed;
    划分模块,用于划分所述修正交通数据以得到训练集数据及测试集数据;a dividing module, used for dividing the modified traffic data to obtain training set data and test set data;
    训练模块,用于利用所述训练集数据训练初始因果卷积-循环神经网络模型以获得中间因果卷积-循环神经网络模型;a training module for using the training set data to train an initial causal convolution-recurrent neural network model to obtain an intermediate causal convolution-recurrent neural network model;
    测试模块,用于利用所述测试集数据测试所述中间因果卷积-循环神经网络模型以获得 评估结果,并在所述评估结果满足预定条件时确认所述中间因果卷积-循环神经网络模型为目标因果卷积-循环神经网络模型;及A test module for testing the intermediate causal convolution-recurrent neural network model using the test set data to obtain an evaluation result, and confirming the intermediate causal convolution-recurrent neural network model when the evaluation result satisfies a predetermined condition a causal convolutional-recurrent neural network model for the target; and
    预测模块,用于利用所述目标因果卷积-循环神经网络模型对所述目标路段在待预测时间点下的交通流量进行预测。A prediction module, configured to use the target causal convolution-recurrent neural network model to predict the traffic flow of the target road segment at the time point to be predicted.
  9. 一种计算机设备,其特征在于,包括:A computer equipment, characterized in that, comprising:
    处理器;processor;
    存储器;及memory; and
    一个或多个程序,所述一个或多个程序存储在所述存储器中,所述一个或多个程序能够被所述处理器执行以实现权利要求1-7任意一项所述的交通流量预测方法。one or more programs, stored in the memory, executable by the processor to implement the traffic flow prediction of any one of claims 1-7 method.
  10. 一种包含计算机程序的非易失性计算机可读存储介质,其特征在于,所述计算机程序被处理器执行时实现权利要求1-7任意一项所述的交通流量预测方法。A non-volatile computer-readable storage medium containing a computer program, characterized in that, when the computer program is executed by a processor, the traffic flow prediction method according to any one of claims 1-7 is implemented.
PCT/CN2020/139299 2020-10-16 2020-12-25 Traffic flow prediction method and apparatus, computer device, and readable storage medium WO2022077767A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011107026.8A CN112242060B (en) 2020-10-16 2020-10-16 Traffic flow prediction method and apparatus, computer device, and readable storage medium
CN202011107026.8 2020-10-16

Publications (1)

Publication Number Publication Date
WO2022077767A1 true WO2022077767A1 (en) 2022-04-21

Family

ID=74169201

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/139299 WO2022077767A1 (en) 2020-10-16 2020-12-25 Traffic flow prediction method and apparatus, computer device, and readable storage medium

Country Status (2)

Country Link
CN (1) CN112242060B (en)
WO (1) WO2022077767A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115240418A (en) * 2022-07-20 2022-10-25 浙江科技学院 Short-term traffic flow prediction method based on causal gating-low-pass graph convolution network
CN115457764A (en) * 2022-08-24 2022-12-09 华南理工大学 Road section traffic density estimation method, device and medium based on vehicle track data
CN116362714A (en) * 2023-02-21 2023-06-30 中国公路工程咨询集团有限公司 Prediction method and device for pavement maintenance period
CN116703008A (en) * 2023-08-02 2023-09-05 山东高速股份有限公司 Traffic volume prediction method, equipment and medium for newly built highway

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112700072B (en) * 2021-03-24 2021-06-29 同盾控股有限公司 Traffic condition prediction method, electronic device, and storage medium
CN113139646B (en) * 2021-05-17 2023-10-31 中国水利水电科学研究院 Data correction method and device, electronic equipment and readable storage medium
CN114664090B (en) * 2022-04-14 2023-07-04 山东大学 Traffic data filling method and system based on cyclic neural network

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109147324A (en) * 2018-09-04 2019-01-04 东南大学 A method of the traffic congestion probability forecast based on user feedback mechanisms
US20200120131A1 (en) * 2018-10-10 2020-04-16 Northrop Grumman Systems Corporation Predicted network traffic
CN111027686A (en) * 2019-12-26 2020-04-17 杭州鲁尔物联科技有限公司 Landslide displacement prediction method, device and equipment
CN111027673A (en) * 2019-11-14 2020-04-17 中山大学 Subway passenger flow prediction method
CN111047078A (en) * 2019-11-25 2020-04-21 中山大学 Traffic characteristic prediction method, system and storage medium
CN111126680A (en) * 2019-12-11 2020-05-08 浙江大学 Road section traffic flow prediction method based on time convolution neural network

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150072471A (en) * 2013-12-19 2015-06-30 건국대학교 산학협력단 Traffic flow prediction system using spatiotemporal stochastic model
CN110516846A (en) * 2019-07-26 2019-11-29 浙江工业大学 Intersection turning rate prediction technique based on LSTM neural network
CN110969854A (en) * 2019-12-13 2020-04-07 深圳先进技术研究院 Traffic flow prediction method, system and terminal equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109147324A (en) * 2018-09-04 2019-01-04 东南大学 A method of the traffic congestion probability forecast based on user feedback mechanisms
US20200120131A1 (en) * 2018-10-10 2020-04-16 Northrop Grumman Systems Corporation Predicted network traffic
CN111027673A (en) * 2019-11-14 2020-04-17 中山大学 Subway passenger flow prediction method
CN111047078A (en) * 2019-11-25 2020-04-21 中山大学 Traffic characteristic prediction method, system and storage medium
CN111126680A (en) * 2019-12-11 2020-05-08 浙江大学 Road section traffic flow prediction method based on time convolution neural network
CN111027686A (en) * 2019-12-26 2020-04-17 杭州鲁尔物联科技有限公司 Landslide displacement prediction method, device and equipment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115240418A (en) * 2022-07-20 2022-10-25 浙江科技学院 Short-term traffic flow prediction method based on causal gating-low-pass graph convolution network
CN115240418B (en) * 2022-07-20 2023-07-25 浙江科技学院 Short-time traffic flow prediction method based on causal gate control-low-pass graph convolution network
CN115457764A (en) * 2022-08-24 2022-12-09 华南理工大学 Road section traffic density estimation method, device and medium based on vehicle track data
CN115457764B (en) * 2022-08-24 2023-07-18 华南理工大学 Road section traffic density estimation method, device and medium based on vehicle track data
CN116362714A (en) * 2023-02-21 2023-06-30 中国公路工程咨询集团有限公司 Prediction method and device for pavement maintenance period
CN116362714B (en) * 2023-02-21 2023-11-03 中国公路工程咨询集团有限公司 Prediction method and device for pavement maintenance period
CN116703008A (en) * 2023-08-02 2023-09-05 山东高速股份有限公司 Traffic volume prediction method, equipment and medium for newly built highway
CN116703008B (en) * 2023-08-02 2023-10-31 山东高速股份有限公司 Traffic volume prediction method, equipment and medium for newly built highway

Also Published As

Publication number Publication date
CN112242060B (en) 2022-06-21
CN112242060A (en) 2021-01-19

Similar Documents

Publication Publication Date Title
WO2022077767A1 (en) Traffic flow prediction method and apparatus, computer device, and readable storage medium
CN109658695B (en) Multi-factor short-term traffic flow prediction method
CN109142171B (en) Urban PM10 concentration prediction method based on feature expansion and fusing with neural network
Wang et al. Modeling inter-station relationships with attentive temporal graph convolutional network for air quality prediction
CN107111794B (en) Predicting and exploiting variability of travel time in a mapping service
CN106022521B (en) Short-term load prediction method of distributed BP neural network based on Hadoop architecture
Jalalkamali Using of hybrid fuzzy models to predict spatiotemporal groundwater quality parameters
CN111767517B (en) BiGRU multi-step prediction method, system and storage medium applied to flood prediction
Chen et al. Tssrgcn: Temporal spectral spatial retrieval graph convolutional network for traffic flow forecasting
Yahya et al. Designing weather forecasting model using computational intelligence tools
CN112907970B (en) Variable lane steering control method based on vehicle queuing length change rate
US11416007B2 (en) Computer-implemented method and system for evaluating uncertainty in trajectory prediction
CN115759413B (en) Meteorological prediction method and device, storage medium and electronic equipment
CN114330935A (en) New energy power prediction method and system based on multiple combined strategy integrated learning
Prasetya et al. Rainfall forecasting for the natural disasters preparation using recurrent neural networks
CN114428937A (en) Time sequence data prediction method based on space-time diagram neural network
Wang et al. Probabilistic inference coupled with possibilistic reasoning for robust estimation of hydrologic parameters and piecewise characterization of interactive uncertainties
CN112036598A (en) Charging pile use information prediction method based on multi-information coupling
CN111127879A (en) Urban traffic flow prediction method based on generative countermeasure network
Badyalina et al. Streamflow estimation at ungauged basin using modified group method of data handling
CN113053536A (en) Infectious disease prediction method, system and medium based on hidden Markov model
CN116341720A (en) Multi-fan wind speed and direction prediction method based on dynamic graph convolution and transformation
Chen et al. Towards an end-to-end artificial intelligence driven global weather forecasting system
Cheng et al. TIP-Air: Tracking pollution transfer for accurate air quality prediction
Singham et al. Density estimation of simulation output using exponential epi-splines

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20957541

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20957541

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20957541

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12/12/2023)