Traffic flow prediction method, device and equipment
By using the LSTM network and the Seq2Seq model with encoded and decoded structure in a single-intersection situation, the traffic flow prediction is predicted dynamically, and the correlation of flows in each lane is solved, which solves the problem of low prediction accuracy of traditional models at a single-intersection, and achieves high-precision and time-efficient short-term traffic flow prediction.
Patent Information
- Application Number
- CN202210474848.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-04-29
AI Technical Summary
In the case of a single intersection, the traditional traffic flow prediction model has poor correlation between the flow of each lane, resulting in low prediction accuracy, making it difficult to effectively use historical data to predict short-term traffic flow.
The Seq2Seq model based on the LSTM network and the encoding and decoding structure is adopted to obtain the traffic flow information of the intersection, process historical data in slices, build a prediction vector data set, and dynamically fusion is used to predict the total phase flow by dynamically fusion of the single-lane traffic prediction information and the similarity between the total phase flow of the total phase flow.
With only a single-junction traffic flow data, the utilization of historical traffic flow data is effectively improved, the prediction accuracy of total phase flow is improved, and the characteristics of high timeliness and small prediction errors are high, and short-term traffic flows can be well predicted during a certain period of time.
Smart Images

Figure CN114819360B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and in particular to a traffic flow prediction method, device and equipment. Background Art
[0002] With the continuous improvement of the industrialization process, the number of vehicles in the country has increased exponentially. Although my country has a relatively complete road traffic infrastructure, it still cannot meet the growing traffic demand. Due to urban planning, it is impossible to expand roads indefinitely. How to maximize the use of limited road resources to meet people's travel needs is the main problem that the intelligent transportation system needs to solve. Traffic flow prediction, as one of the important functions of the intelligent transportation system, has been the focus of research in the transportation field in recent years. An accurate short-term traffic flow prediction model is an important prerequisite for the intelligent transportation system to conduct traffic induction and traffic situation perception.
[0003] The prediction methods of short-term traffic flow based on historical traffic flow mainly include three prediction methods: machine learning-based traffic flow prediction model, shallow neural network-based and deep neural network-based. Among them, the machine learning-based traffic flow prediction model is prone to fall into local optimality and the accuracy depends on parameters, so it is difficult to make more complex multi-step predictions; shallow neural networks still have obvious deficiencies for random nonlinear data such as traffic flow; with the development of deep neural networks and the improvement of computer computing power, deep learning technology has become an important means of data mining and has attracted widespread attention from scholars at home and abroad. Therefore, deep learning technology has become the mainstream for traffic flow prediction.
[0004] In actual applications, we often encounter the problem of traffic flow prediction at independent intersections at the edge of the road network. Due to the lack of traffic flow at adjacent intersections as an aid, and the large fluctuations in traffic flow in each lane within a single intersection and poor spatial correlation, traditional prediction models cannot achieve high prediction accuracy. How to maximize the use of existing data to improve the accuracy of phase flow prediction in the case of single intersection data is an issue to be solved.
[0005] Therefore, it is necessary to provide a traffic flow prediction method that uses historical traffic flow information to complete future short-term traffic flow prediction and has high prediction accuracy to solve the above technical problems. Summary of the invention
[0006] In order to solve the above technical problems, the present invention provides a traffic flow prediction method, which solves the technical problem that in the prior art, when there is only single intersection traffic flow data, the traffic flow of each lane at a single intersection is poorly correlated and has large volatility, which makes it impossible to use a deep neural network prediction model to predict the traffic flow information of a single intersection in the short term in the future.
[0007] The technical effects of the present invention are achieved as follows:
[0008] A traffic flow prediction method, comprising:
[0009] Get traffic flow information at intersections;
[0010] Slicing the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, the historical traffic flow information including the total phase flow and the date and time corresponding to the total phase flow, the sampling period and the flow of each lane of the intersection;
[0011] Constructing a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset amount of historical traffic flow information;
[0012] Establish a Seq2Seq model based on LSTM network and encoding and decoding structure;
[0013] The single lane traffic prediction information is obtained based on the Seq2Seq model and the prediction vector dataset;
[0014] According to the flow rate of each lane of the intersection and the total flow rate of the phase, the similarity of the flow rate of each lane of the intersection and the total flow rate of the phase is obtained;
[0015] The phase total flow prediction information is obtained by dynamically fusing the similarity between the single lane flow prediction information and the phase total flow. By establishing a Seq2Seq model based on the LSTM network and the encoding and decoding structure, the encoder end in the Seq2Seq model inputs historical traffic flow information, thereby obtaining single lane flow prediction information at the decoder end, dynamically fusing the correlation of each lane flow, and predicting the short-term traffic flow information of a single intersection. By adopting the lane flow fusion prediction method of the present application, when there is only single intersection traffic flow data, the utilization of historical traffic flow data can be effectively improved, and the prediction accuracy of the phase total flow can be improved. It has the characteristics of high timeliness and small prediction error, and can make good predictions of short-term traffic flow in a certain period of time, providing technical support for improving the intelligence and scientificity of flow prediction, and providing more accurate data reference for traffic signal coordination at traffic intersections.
[0016] Furthermore, traffic flow information of the intersection is obtained, which includes:
[0017] Based on the missing value filling algorithm, the missing data in the traffic flow information is completed to obtain the updated traffic flow information.
[0018] Further, based on the preset historical length and the predicted length of future traffic flow information, a prediction vector data set is constructed according to the historical traffic flow information, including:
[0019] Get the date and time of historical traffic flow information;
[0020] Extracting time covariates, minute covariates and date types from date time to obtain time auxiliary factors, where date types include working days and holidays;
[0021] Obtaining a historical traffic flow sequence according to a preset historical length and historical traffic flow information;
[0022] The predicted traffic flow sequence is obtained according to the predicted length of future traffic flow information;
[0023] According to the predicted length of the future traffic flow information and the time auxiliary factors, a prediction covariate sequence is obtained to obtain a prediction vector data set. By extracting the time covariate, minute covariate and date type from the date time to obtain the time auxiliary factor, the time auxiliary factor of the future traffic flow information is encoded to obtain a prediction covariate sequence, which is convenient for completing the subsequent short-term traffic flow prediction process.
[0024] Further, the historical traffic flow sequence is obtained according to the preset historical length and historical traffic flow information, which includes:
[0025] Obtain the traffic flow of each lane at the intersection in the historical traffic flow information;
[0026] Normalizing the flow of each lane of the intersection to obtain the updated flow of each lane of the intersection;
[0027] The time covariate and minute covariate are normalized to obtain the updated time auxiliary factor. By normalizing the flow, time covariate, and minute covariate of each lane of the intersection, the large deviation of data of different scales in the flow, time covariate, and minute covariate of each lane of the intersection is avoided, which is conducive to improving the accuracy of short-term traffic flow prediction.
[0028] Furthermore, the decoding and encoding ends of the Seq2Seq model both use a single-layer LSTM network. According to the Seq2Seq model and the prediction vector dataset, the single-lane traffic prediction information is obtained, including:
[0029] The historical traffic flow sequence and the predicted covariate sequence are used as the input of the encoding end of the Seq2Seq model, and the intermediate semantic code C is obtained through the output of the decoding end;
[0030] The predicted covariate sequence and the semantic encoding C are used as the input of the decoding end of the Seq2Seq model to output the single lane traffic prediction information through the decoding end.
[0031] Set the predicted traffic flow sequence as the decoding end of the Seq2Seq model;
[0032] The historical traffic flow sequence and the predicted covariate sequence are set as the encoding end of the Seq2Seq model to obtain the single-lane traffic flow prediction information.
[0033] Furthermore, the similarity between the flow rate of each lane of the intersection and the total flow rate of the phase is obtained according to the flow rate of each lane of the intersection and the total flow rate of the phase, including:
[0034] Obtain the total phase flow in the historical traffic flow information and the flow of each lane of the intersection corresponding to the total phase flow;
[0035] Based on the DTW similarity algorithm, the similarity between the flow of each lane at the intersection and the total phase flow is obtained according to the total phase flow and the flow of each lane at the intersection corresponding to the total phase flow.
[0036] Furthermore, the phase total flow prediction information is obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity, including:
[0037] Obtain a preset number of historical traffic flow sequences and predicted traffic flow sequences;
[0038] The historical traffic flow sequence and the predicted traffic flow sequence are trained to obtain the traffic flow fusion module;
[0039] Get single lane traffic forecast information;
[0040] Based on the traffic flow fusion module, the phase total flow prediction information is obtained according to the similarity between the flow of each lane at the intersection and the phase total flow and the single lane flow prediction information. The similarity between the flow of each lane at the intersection and the phase total flow, that is, the fusion weight, is calculated through the DTW similarity algorithm, and then fused with the single lane flow prediction information to obtain the prediction information of the future short-term phase total flow.
[0041] Further, the phase total flow prediction information is obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity, and then includes:
[0042] Perform inverse normalization processing on the phase total flow prediction information to obtain the target prediction information;
[0043] Acquire actual traffic flow information of intersections within the prediction length of future traffic flow information;
[0044] Based on the evaluation index, the target prediction information and the actual traffic flow information are used to determine whether the prediction result is accurate. The target prediction information and the actual traffic flow information are judged by the evaluation index, thereby completing the evaluation of the prediction accuracy of the lane flow fusion prediction method of the present application, so as to determine whether the short-term traffic flow prediction information obtained by the prediction method of the present application is closer to the real data of the future short-term traffic flow.
[0045] In addition, a traffic flow prediction device is also provided, the device comprising:
[0046] Real-time traffic acquisition module: used to obtain traffic flow information at intersections;
[0047] A historical traffic flow acquisition module is used to slice the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, wherein the historical traffic flow information includes the total phase flow and the date and time corresponding to the total phase flow, the sampling period, and the flow of each lane of the intersection;
[0048] A prediction vector data set obtaining module: used to construct a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset number of historical traffic flow information;
[0049] Seq2Seq model building module: used to build a Seq2Seq model based on LSTM network and encoding and decoding structure;
[0050] Single lane traffic prediction module: used to obtain single lane traffic prediction information based on the Seq2Seq model and prediction vector dataset;
[0051] Similarity obtaining module: used for obtaining the similarity of the flow rate of each lane of the intersection and the total flow rate of the phase according to the flow rate of each lane of the intersection and the total flow rate of the phase;
[0052] Phase total flow prediction module: used to obtain phase total flow prediction information based on the dynamic fusion of the single lane flow prediction information and the phase total flow similarity.
[0053] In addition, a device is also provided, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the above-mentioned traffic flow prediction method.
[0054] As described above, the present invention has the following beneficial effects:
[0055] 1) By establishing a Seq2Seq model based on the LSTM network and encoding-decoding structure, the encoder side of the Seq2Seq model inputs historical traffic flow information, so that the single-lane traffic flow prediction information is obtained on the decoder side, and the correlation of the traffic flows of each lane is dynamically integrated to predict the short-term traffic flow information of a single intersection.
[0056] 2) By adopting the lane flow fusion prediction method of the present application, when only single-intersection traffic flow data is available, the utilization of historical traffic flow data can be effectively improved, and the prediction accuracy of phase total flow can be improved. It has the characteristics of high timeliness and small prediction error, and can make good predictions of short-term traffic flow in a certain period of time, providing technical support for improving the intelligence and scientific nature of traffic flow prediction, and providing more accurate data reference for traffic signal coordination at traffic intersections.
[0057] 3) By extracting time covariates, minute covariates and date types from the date and time to obtain time auxiliary factors, the time auxiliary factors of future traffic flow information are encoded to obtain a predicted covariate sequence, which facilitates the subsequent short-term traffic flow prediction process.
[0058] 4) By normalizing the flow, time covariates, and minute covariates of each lane at the intersection, large deviations of data of different scales in the flow, time covariates, and minute covariates of each lane at the intersection are avoided, which is beneficial to improving the accuracy of short-term traffic flow prediction.
[0059] 5) The DTW similarity algorithm is used to calculate the similarity between the flow of each lane at the intersection and the total phase flow, that is, the fusion weight, which is then fused with the single-lane flow prediction information to obtain the prediction information of the total phase flow in the short term in the future.
[0060] 6) The target prediction information and the actual traffic flow information are judged through evaluation indicators, so as to complete the evaluation of the prediction accuracy of the lane flow fusion prediction method of the present application, so as to determine whether the short-term traffic flow prediction information obtained by the prediction method of the present application is closer to the real data of future short-term traffic flow. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without creative work.
[0062] Figure 1 A flow chart of a traffic flow prediction method provided in an embodiment of this specification;
[0063] Figure 2 A schematic diagram of an intersection provided in an embodiment of this specification;
[0064] Figure 3 A schematic diagram of the corresponding relationship between the total phase flow and the real-time flow of each lane provided in the embodiment of this specification;
[0065] Figure 4 A flowchart of the steps of constructing a prediction vector data set based on the historical traffic flow information based on the preset historical length and the predicted length of future traffic flow information provided in the embodiments of this specification;
[0066] Figure 5 A schematic diagram of the LSTM "cell" structure provided for the embodiments of this specification;
[0067] Figure 6 A schematic diagram of the structure of a single lane traffic flow prediction model provided in an embodiment of this specification;
[0068] Figure 7 A schematic diagram of the structure of the traffic flow fusion module provided in the embodiments of this specification;
[0069] Figure 8 A data sliding diagram of the actual value and the predicted value provided in the embodiments of this specification;
[0070] Fig. 9 A block diagram of a traffic flow prediction device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0072] It should be noted that the terms "comprises" and "has" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatus.
[0073] Embodiment 1:
[0074] like Figure 1 As shown, the embodiment of this specification provides a traffic flow prediction method, including:
[0075] S100: Obtaining traffic flow information at the intersection;
[0076] In this embodiment, a terminal device installed at an intersection obtains traffic flow information of the intersection in real time. The real-time traffic flow information includes the real-time flow of each lane of the intersection. The corresponding phase total flow can be obtained through the real-time flow of each lane of the intersection.
[0077] Among them, Figure 2 As shown in FIG. 1 , the phase in the phase total flow is defined based on the real-time traffic lanes of the traffic lights at the east, west, south, and north intersections, including Figure 3 The four corresponding phase situations shown are that the phase at different times is one of the four phases. For example, the total phase flow corresponding to the first phase includes the lane flow of the through lane and the right lane of the north intersection and the through lane and the right lane of the south intersection.
[0078] In a specific implementation manner, step S100 obtains traffic flow information at the intersection, and then includes:
[0079] Based on the missing value filling algorithm, the missing data in the traffic flow information is completed to obtain the updated traffic flow information.
[0080] Specifically, due to the adjustment of terminal equipment and the online and offline collection of data, the traffic flow data monitored by the terminal at the intersection is often missing. In order to increase the data volume, a small part of the missing data needs to be filled.
[0081] For smaller data missing cases, linear interpolation of adjacent time is used. For larger data missing cases, the mean of historical data of the same time in the previous and next weeks is used to fill in the missing data. For extremely abnormal outlier data, the 3σ criterion is used to detect and smooth the data to complete the data cleaning and completion of the collected real-time intersection traffic flow information.
[0082] S200: Slicing the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, wherein the historical traffic flow information includes a phase total flow and a date and time corresponding to the phase total flow, a sampling period, and a flow of each lane of an intersection;
[0083] Specifically, when the preset sampling period is short, that is, when the sampling time of traffic flow data is short, it has less effect in actual application and has high random volatility and dispersion. The collected data is not conducive to improving the accuracy of traffic flow prediction. In order to increase the universality of the prediction model, the preset sampling period is generally set to 300s, 600s and 900s, forming the corresponding time series [x1, x2, ..., x n]. Among them, x n is the traffic flow data collected in the nth sampling period, that is, the flow rate L of each lane of the intersection collected in the nth sampling period nk A collection of x n is the traffic volume L of each lane corresponding to the current moment nk The set of [x1, x2, ..., x n ] includes L1=(L 11 , L 12 , ..., L 1k )、L2=(L 21 , L 22 , ..., L 2k )、Ln=(L n1 , L n2 , ..., L nk ).
[0084] The date and time corresponding to the total phase flow of the intersection or the flow of each lane of the intersection is [t1, t2, ..., t n ].
[0085] S300: constructing a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset number of historical traffic flow information;
[0086] like Figure 4 As shown, in a specific implementation manner, step S300 constructs a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, including:
[0087] S310: Obtaining the date and time in the historical traffic flow information;
[0088] S320: extracting time covariates, minute covariates and date types from the date and time to obtain time auxiliary factors, wherein the date types include working days and holidays;
[0089] Specifically, the date and time corresponding to the total phase flow of the intersection or the flow of each lane of the intersection [t1, t2, ..., t n ] includes two data types: time and date. Therefore, first, from [t1, t2, ..., t n ] to extract two covariates, time and minutes, namely [h1, h2, ..., h n ],[m1,m2,...,m n ], Second, mark the date as weekdays and holidays, that is, week_num, isholiday.
[0090] S330: Obtaining a historical traffic flow sequence according to a preset historical length and historical traffic flow information;
[0091] In a specific implementation manner, step S330 obtains a historical traffic flow sequence according to a preset historical length and historical traffic flow information, which includes:
[0092] Obtain the traffic flow of each lane at the intersection in the historical traffic flow information;
[0093] Normalizing the flow of each lane of the intersection to obtain the updated flow of each lane of the intersection;
[0094] The time covariate and minute covariate were normalized separately to obtain the updated time auxiliary factors.
[0095] Specifically, in order to avoid large deviations in data of different scales, the original data and covariates are normalized to the maximum and minimum values and normalized to the interval (-1, 1).
[0096]
[0097] Among them, x is the original data, x norm is the normalized data, x max and x min are the maximum and minimum values in x respectively.
[0098] Furthermore, according to the above-mentioned maximum and minimum value normalization processing method, the flow rate, time covariate, and minute covariate of each lane of the intersection are respectively normalized to obtain the updated flow rate of each lane of the intersection and the updated time auxiliary factor.
[0099] S340: Obtaining a predicted traffic flow sequence according to the predicted length of future traffic flow information;
[0100] S350: Obtain a prediction covariate sequence according to the predicted length of future traffic flow information and the time auxiliary factor to obtain a prediction vector data set.
[0101] Specifically, according to the prediction length k of future traffic flow information and the preset historical length p, a prediction vector data set is constructed, that is, a value pair (X, Y, Assist). k ), Y=(Y1,Y2,...,Y p ), Assist=(assist1, assist2,..., assist p), X is the historical traffic flow sequence, Y is the predicted traffic flow sequence, and Assist is the predicted covariate sequence, i.e., the auxiliary factors known in the prediction time period.
[0102] S400: Establish a Seq2Seq model based on LSTM network and encoding and decoding structure;
[0103] S500: Obtain single lane traffic prediction information according to the Seq2Seq model and the prediction vector data set;
[0104] In a specific implementation manner, step S500 obtains single lane flow prediction information according to the Seq2Seq model and the prediction vector data set, including:
[0105] The historical traffic flow sequence and the predicted covariate sequence are used as the input of the encoding end of the Seq2Seq model, and the intermediate semantic code C is obtained through the output of the decoding end;
[0106] The predicted covariate sequence and the semantic encoding C are used as the input of the decoding end of the Seq2Seq model to output the single lane traffic prediction information through the decoding end.
[0107] Specifically, the principle of the long short-term memory network LSTM (Long Short-Term Memory) is as follows:
[0108] LSTM network is a variant of recurrent neural network, a recurrent neural network RNN (Recurrent Neural Network) with gated recurrent units. In addition to the external RNN, the LSTM network also has an internal self-circulating unit: LSTM cell. The three gated units input gate, forget gate, and output gate selectively learn or forget information, solving the gradient explosion problem that occurs over time when RNN processes long sequence problems. Figure 5 Schematic diagram of the LSTM "cell" structure.
[0109] where c t is the cell state, h t is the hidden state. σ is the sigmoid activation function, which obtains a value between 0 and 1. tanh is the hyperbolic function, and their definitions are:
[0110]
[0111]
[0112] (1) Forget gate f t
[0113] The role of the forget gate is to determine the input cell state c at time t t-1How much information is retained in the cell state c t The specific formula is as follows:
[0114] f t =σ(w f ·[h t-1 , x t ]+b f )
[0115] where h t-1 is the hidden state at the previous moment, w f is the input weight, b f For bias.
[0116] (2) Input gate i t
[0117] The function of the input gate is to determine the input x t How much of the components remain in c t The specific formula is as follows:
[0118] i t =σ(w i ·[h t-1 , x t ]+b i )
[0119]
[0120] (3) Output gate t
[0121] The role of the output gate in determining the cell state c t How much information in will be output to the hidden state h t and the previous hidden state h t-1 How much information will be retained. The specific formula is as follows:
[0122] o t =σ(w o ·[h t-1 , x t ]+b o )
[0123]
[0124] h t =o t *tanh(c t )
[0125] Among them, w f 、w i 、w o is the weight, bf , b i , b o For bias.
[0126] Specifically, the principles of the encoding and decoding structure are as follows:
[0127] like Figure 6 As shown in Figure 1, a Sequence to Sequence (Seq2Seq) architecture based on an encoder-decoder structure is used as a multi-step prediction model. The LSTM unit is used as an encoder to process the input sequence X = (x1, x2, ...x t-1 , x t ), the encoder generates a context C, which in this paper is the hidden state h of the last cell state of the encoder LSTM unit t Generate. Also use LSTM unit as decoder, receive C and generate fixed length prediction sequence Y = (y1, y2, ...y p-1 ,y p ). In the encoder structure, since there is no input sequence, the hidden state output of the previous moment is taken as the input of the current moment. The output of the decoder's p-th cell state is the traffic flow at the p-th time interval of the predicted sequence.
[0128] Y=(y1,y2,…y p-1 ,y p ) = FS(x1, x2, ... x k-1 , x k , assist1, assist2,..., assist p )
[0129] =Decoder(C, assist1, assist2,..., assist p )
[0130] =Decoder(Encoder(x1,x2,...x k-1 , x k ), assist1, assist2,..., assist p )
[0131] Based on the above principles, the LSTM network is combined with the encoding and decoding structure to construct a Seq2Seq model, establish a covariate encoder, and improve the decoding end of the Seq2Seq model to import the known covariate Assist in the future prediction period. The single-lane traffic prediction model Factor-Seq2Seq is established, and the single-lane prediction model Y=FS(X, Assist) is obtained, which is abbreviated as FS function.
[0132] based on Figure 6 The single lane traffic flow prediction model is based on the prediction vector data set composed of historical traffic flow sequence, predicted traffic flow sequence and predicted covariate sequence to obtain the single lane traffic flow prediction information Y corresponding to the predicted traffic flow sequence.
[0133] S600: Obtaining similarity between the flow rate of each lane of the intersection and the total flow rate of the phase according to the flow rate of each lane of the intersection and the total flow rate of the phase;
[0134] In a specific implementation manner, step S600 obtains the similarity between the flow rate of each lane of the intersection and the total flow rate of the phase according to the flow rate of each lane of the intersection and the total flow rate of the phase, including:
[0135] Obtain the total phase flow in the historical traffic flow information and the flow of each lane of the intersection corresponding to the total phase flow;
[0136] Based on the DTW similarity algorithm, the similarity between the flow of each lane at the intersection and the total phase flow is obtained according to the total phase flow and the flow of each lane at the intersection corresponding to the total phase flow.
[0137] In this embodiment, the calculation process of DTW similarity is as follows:
[0138] According to the historical input data, the traffic volume of n lanes L1=(L 11 , L 12 , …, L 1k )、L2=(L 21 , L 22 , …, L 2k )、Ln=(L n1 , L n2 , …, L nk ) and the phase total flow vector phase=(p1,p2,…,p k ), where P k For L n The flow data in the above figure are summed to calculate the similarity between the total flow and the lane flow. The fast-DTW function is used to calculate the similarity to improve the calculation speed. The calculation result is used as the similarity between the flow of each lane at the intersection and the total flow of the phase, that is, the fusion auxiliary weight W = [w1, w2, ..., w n ],w n =fastDTW(phase, Ln) The principle of DTW similarity and the fast-DTW function are prior art and will not be described in detail in this application.
[0139] S700: Dynamically fuse the single lane traffic prediction information and the phase total traffic to obtain the phase total traffic prediction information according to the similarity.
[0140] In a specific implementation manner, step S700 dynamically fuses the single lane flow prediction information and the phase total flow similarity to obtain the phase total flow prediction information, including:
[0141] Obtain a preset number of historical traffic flow sequences and predicted traffic flow sequences;
[0142] The historical traffic flow sequence and the predicted traffic flow sequence are trained to obtain the traffic flow fusion module;
[0143] Get single lane traffic forecast information;
[0144] Based on the traffic flow fusion module, the phase total flow prediction information is obtained according to the similarity between the flow of each lane at the intersection and the phase total flow, and the single lane flow prediction information. The role of the traffic flow fusion module TFM is to capture the relevant rules between lanes at different times through training, and dynamically weight the prediction results of each lane to reduce the prediction error of the phase total flow, so as to improve the prediction accuracy.
[0145] Specifically, the lane flow data is fused according to the time coding and DTW data similarity through the traffic flow fusion module TFM (Traffic fusion module); wherein the traffic flow fusion module is not a formula but a processing unit, and can also be replaced with other models, such as BP neural network.
[0146] The first step is to connect the single lane flow prediction results, auxiliary weights and covariates as the input of the traffic flow fusion module.
[0147]
[0148] Among them, the Concat function is a data connection function that connects two arrays. The function usage is: concat([dataFrame1, dataFrame2, ...]).
[0149] In the second step, the traffic flow fusion module uses the LSTM network to perform data fusion. The traffic flow fusion module is input for training, and the fusion weight is dynamically adjusted over time to achieve lane flow fusion. Figure 7 As shown in Figure 2, the calculation method of the traffic flow fusion module is as follows:
[0150]
[0151] In a specific implementation manner, step S700 dynamically fuses the single lane flow prediction information and the phase total flow similarity to obtain the phase total flow prediction information, and then includes:
[0152] Perform inverse normalization processing on the phase total flow prediction information to obtain the target prediction information;
[0153] Acquire actual traffic flow information of intersections within the prediction length of future traffic flow information;
[0154] Whether the prediction result is accurate is determined based on the evaluation index according to the target prediction information and the actual traffic flow information.
[0155] According to the time continuity, the historical traffic data is used to predict the future short-term traffic data, and the prediction results are inversely standardized. The prediction results are measured by the following four evaluation indicators, the mean absolute error (MAE).
[0156]
[0157]
[0158]
[0159]
[0160] The following are some examples:
[0161] The present invention uses the actual road test data of 11 lanes in three phases from 0:00 to 24:00 on April 3 to June 20, 2021 at the intersection of Changsheng South Road and Huayan Road in Nanhu District, Jiaxing City as experimental data to predict and evaluate the total flow of the phase:
[0162] 1) Data preprocessing: First, the data is integrated and divided. The data of the original data with a sampling period of 1 minute is integrated to generate data with three sampling periods of 5 minutes, 10 minutes, and 15 minutes. The three different scale data are divided into training data, verification data, and test data in a ratio of 6:2:2.
[0163] The initial data format is
[0164] Field Name Format Examples datetime datetime [2021 / 4 / 3 0:00] samplePeriod int 300s flow int 19
[0165] datetime, samplePeriod, Phase, 41-L1, 41-L2, 41-L3, 41-L4, 42-L1, 42-L2, 42-L3, 42-L4, 43-L1, 43-L2, 44-L1. They are datetime, sampling period, total flow of each phase and flow of each lane respectively.
[0166] 2) Data cleaning: missing data are completed using the historical average method and linear interpolation method, and the 3σ criterion is used to detect and replace large outliers.
[0167] 3) Construct covariates and split the time into hour, minute, week number (week_num) and holiday code (isholiday).
[0168] Covariate name Format Examples Hour string 10 o'clock minute string 45 minutes Week_num string 1: Monday, 7: Sunday isholiday string 0: non-holiday, 1: holiday
[0169] 4) Data normalization: all features of the training set, validation set, and verification set data are normalized to the maximum and minimum values and normalized to the range of (-1, 1).
[0170] 5) Data pair cutting and data set construction: According to time continuity, the data sets are constructed for input lengths of 60 sampling periods, prediction lengths of 1 sampling period, 3 sampling periods, and 6 sampling periods, respectively, and the value pairs (X, Y, Assist) are sliced using a sliding window. The specific cutting method is shown in the attached figure. Figure 8 shown.
[0171] According to the traffic information provided by Jiaxing Traffic Management Bureau, the data is summarized every five minutes. The original data is divided into training set, validation set and test set according to the proportion. Each data set is further divided. Figure 8 As shown in the figure, each rectangle represents a time interval, and its value is the total traffic volume. From the beginning of the data, a sliding window of length (m+n) is taken, and m real values and n predicted values are matched into a group, sliding backward with a step length of 1 to generate several groups of data. n is the prediction step length, that is, predicting the traffic volume in the next n 5 minutes. The further divided training set and validation set are sent to the prediction model for training, and the model prediction performance is tested with the test set.
[0172] 6) Construction of single lane traffic prediction model, the model structure is as follows Figure 6 As shown, the Seq2Seq model with information injected at the decoding end is used for prediction, and the single-lane prediction model Factor-Seq2Seq is used to train the traffic data of each lane to obtain the prediction results.
[0173] 7) Use the fast-DTW algorithm to calculate the traffic similarity and obtain the fusion weight W = [w1, w2, ..., w n ],w n =fastDTW(phase, Ln). The similarity matrix between the input traffic sequence of each lane and the input traffic sequence of the total traffic of the phase is obtained.
[0174] 8) Lane flow fusion: The lane flow prediction results are connected with the similarity matrix as the input of the flow fusion module. After training of the traffic flow fusion module, the fusion ratio of each lane predicted flow to the total predicted flow of the phase is dynamically adjusted according to time, and the prediction results are output.
[0175] 9) After the overall model is trained, the effect is tested on the test set, and the test results are denormalized and compared with the actual values. The results are shown in the following table:
[0176]
[0177] Under four different evaluation indicators, the calculation results of MAE and MSE corresponding to the predicted value of the total phase flow obtained by the seq2seq-fusion model of this application are smaller than the calculation results of MAE and MSE corresponding to the predicted value of the total phase flow obtained by the traditional Seq2Seq prediction model. 2 The calculation results are smaller than the R corresponding to the predicted value of the total phase flow obtained by the traditional Seq2Seq prediction model. 2 From the calculation results, it can be seen that the prediction accuracy of the traditional method without traffic fusion is significantly lower than that of our model with lane traffic fusion, and the prediction result of this scheme is closer to the true value.
[0178] Therefore, the lane flow fusion prediction method based on the LSTM encoding and decoding structure proposed in this application can effectively improve the utilization of existing data and the accuracy of phase total flow prediction when there is only single-intersection traffic flow data, and has the characteristics of high timeliness and small prediction error. This application can make good predictions of short-term traffic flow in a certain period of time, provide technical support for improving the intelligence and scientificity of traffic flow prediction, and provide more accurate data reference for traffic signal coordination at traffic intersections.
[0179] like Fig. 9 As shown, the embodiment of this specification also provides a traffic flow prediction device, the device comprising:
[0180] Real-time traffic acquisition module 801: used to obtain traffic flow information at the intersection;
[0181] The historical traffic flow obtaining module 802 is used to slice the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, wherein the historical traffic flow information includes the total phase flow and the date and time corresponding to the total phase flow, the sampling period, and the flow of each lane of the intersection;
[0182] The prediction vector data set obtaining module 803 is used to construct a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset number of historical traffic flow information;
[0183] Seq2Seq model building module 804: used to build a Seq2Seq model based on LSTM network and encoding and decoding structure;
[0184] Single lane traffic prediction module 805: used to obtain single lane traffic prediction information according to the Seq2Seq model and the prediction vector data set;
[0185] Similarity obtaining module 806: used to obtain the similarity of the flow rate of each lane of the intersection and the total flow rate of the phase according to the flow rate of each lane of the intersection and the total flow rate of the phase;
[0186] Phase total flow prediction module 807: used to obtain phase total flow prediction information based on the dynamic fusion of the single lane flow prediction information and the similarity of the phase total flow.
[0187] An embodiment of the present specification provides a device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the traffic flow prediction method in Example 1.
[0188] Although the present invention has been described through preferred embodiments, the present invention is not limited to the embodiments described herein but includes various changes and modifications that may be made without departing from the scope of the present invention.
[0189] In the absence of conflict, the above embodiments and features in the embodiments can be combined with each other.
[0190] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A traffic flow prediction method, characterized in that: include: Get traffic flow information at intersections; Slicing the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, the historical traffic flow information including the total phase flow and the date and time corresponding to the total phase flow, the sampling period and the flow of each lane of the intersection; Constructing a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset amount of historical traffic flow information; Establish a Seq2Seq model based on LSTM network and encoding and decoding structure; The single lane traffic prediction information is obtained based on the Seq2Seq model and the prediction vector dataset; According to the flow rate of each lane of the intersection and the total flow rate of the phase, the similarity of the flow rate of each lane of the intersection and the total flow rate of the phase is obtained; The phase total flow prediction information is obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity; the phase total flow prediction information is obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity, including: Obtain a preset number of historical traffic flow sequences and predicted traffic flow sequences; The historical traffic flow sequence and the predicted traffic flow sequence are trained to obtain the traffic flow fusion module; Get single lane traffic forecast information; Based on the traffic flow fusion module, the phase total flow prediction information is obtained according to the similarity between the flow of each lane at the intersection and the phase total flow and the single lane flow prediction information.
2. The traffic flow prediction method according to claim 1, characterized in that: Get the traffic flow information of the intersection, followed by: Based on the missing value filling algorithm, the missing data in the traffic flow information is completed to obtain the updated traffic flow information.
3. The traffic flow prediction method according to claim 1, characterized in that: Constructing a prediction vector data set based on the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, including: Get the date and time of historical traffic flow information; Extracting time covariates, minute covariates and date types from date time to obtain time auxiliary factors, where date types include working days and holidays; Obtaining a historical traffic flow sequence according to a preset historical length and historical traffic flow information; The predicted traffic flow sequence is obtained according to the predicted length of future traffic flow information; A prediction covariate sequence is obtained according to the prediction length of the future traffic flow information and the time auxiliary factor to obtain a prediction vector data set.
4. The traffic flow prediction method according to claim 3, characterized in that: The historical traffic flow sequence is obtained according to the preset historical length and historical traffic flow information, which includes: Obtain the traffic flow of each lane at the intersection in the historical traffic flow information; Normalizing the flow of each lane of the intersection to obtain the updated flow of each lane of the intersection; The time covariate and minute covariate were normalized separately to obtain the updated time auxiliary factors.
5. According to the traffic flow prediction method of claim 4, both the decoding end and the encoding end of the Seq2Seq model use a single-layer LSTM network, characterized in that: According to the Seq2Seq model and the prediction vector dataset, the single lane traffic prediction information is obtained, including: The historical traffic flow sequence and the predicted covariate sequence are used as the input of the encoding end of the Seq2Seq model to output the semantic encoding through the decoding end; The predicted covariate sequence and semantic encoding are used as input to the decoding end of the Seq2Seq model to output single-lane traffic prediction information through the decoding end.
6. The traffic flow prediction method according to claim 5, characterized in that: According to the traffic flow of each lane at the intersection and the total traffic flow of each phase, the similarity of the traffic flow of each lane at the intersection and the total traffic flow of each phase is obtained, including: Obtain the total phase flow in the historical traffic flow information and the flow of each lane of the intersection corresponding to the total phase flow; Based on the DTW similarity algorithm, the similarity between the flow of each lane at the intersection and the total phase flow is obtained according to the total phase flow and the flow of each lane at the intersection corresponding to the total phase flow.
7. The traffic flow prediction method according to claim 6, characterized in that: The phase total flow prediction information is obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity, and then includes: Perform inverse normalization processing on the phase total flow prediction information to obtain the target prediction information; Acquire actual traffic flow information of intersections within the prediction length of future traffic flow information; Whether the prediction result is accurate is determined based on the evaluation index according to the target prediction information and the actual traffic flow information.
8. A traffic flow prediction device, characterized in that: The device comprises: Real-time traffic acquisition module: used to obtain traffic flow information at intersections; A historical traffic flow acquisition module is used to slice the traffic flow information based on a preset sampling period to obtain a number of historical traffic flow information, wherein the historical traffic flow information includes the total phase flow and the date and time corresponding to the total phase flow, the sampling period, and the flow of each lane of the intersection; A prediction vector data set obtaining module: used to construct a prediction vector data set according to the historical traffic flow information based on a preset historical length and a predicted length of future traffic flow information, wherein the preset historical length is a preset number of historical traffic flow information; Seq2Seq model building module: used to build a Seq2Seq model based on LSTM network and encoding and decoding structure; Single lane traffic prediction module: used to obtain single lane traffic prediction information based on the Seq2Seq model and prediction vector dataset; Similarity obtaining module: used for obtaining the similarity of the flow rate of each lane of the intersection and the total flow rate of the phase according to the flow rate of each lane of the intersection and the total flow rate of the phase; Phase total flow prediction module: used to obtain phase total flow prediction information by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity; the phase total flow prediction information obtained by dynamically fusing the single lane flow prediction information and the phase total flow according to the similarity includes: Obtain a preset number of historical traffic flow sequences and predicted traffic flow sequences; The historical traffic flow sequence and the predicted traffic flow sequence are trained to obtain the traffic flow fusion module; Get single lane traffic forecast information; Based on the traffic flow fusion module, the phase total flow prediction information is obtained according to the similarity between the flow of each lane at the intersection and the phase total flow and the single lane flow prediction information.
9. A device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the traffic flow prediction method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Short-term traffic flow prediction method
CN109785629A
Large-scale real-time traffic flow prediction method based on fuzzy logic and deep LSTM
US20210209939A1