CN116090669A - Traffic flow prediction method, equipment and medium based on hybrid neural network - Google Patents

Traffic flow prediction method, equipment and medium based on hybrid neural network Download PDF

Info

Publication number
CN116090669A
CN116090669A CN202310339653.1A CN202310339653A CN116090669A CN 116090669 A CN116090669 A CN 116090669A CN 202310339653 A CN202310339653 A CN 202310339653A CN 116090669 A CN116090669 A CN 116090669A
Authority
CN
China
Prior art keywords
traffic flow
neural network
flow data
data
corrected
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310339653.1A
Other languages
Chinese (zh)
Inventor
沈阳
喻斌
邓芳明
罗阳
彭仁夔
张伟
郑志斌
张帆
程荣
饶先明
段军华
韦宝泉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangxi Kingroad Technology Development Co ltd
Original Assignee
Jiangxi Kingroad Technology Development Co ltd
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 Jiangxi Kingroad Technology Development Co ltd filed Critical Jiangxi Kingroad Technology Development Co ltd
Priority to CN202310339653.1A priority Critical patent/CN116090669A/en
Publication of CN116090669A publication Critical patent/CN116090669A/en
Pending legal-status Critical Current

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
    • 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
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Abstract

The invention discloses a traffic flow prediction method, equipment and medium based on a hybrid neural network, wherein the method is applied to a traffic flow prediction system based on the hybrid neural network, which comprises the following steps: acquiring traffic flow data of a road to be predicted, and correcting the traffic flow data; and processing the corrected traffic flow data through a traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of the road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data is sequentially processed through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism. By the method, the traffic flow prediction result generated by the traffic flow prediction model based on the hybrid neural network is closer to the real traffic flow, and the prediction accuracy is high.

Description

Traffic flow prediction method, equipment and medium based on hybrid neural network
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a traffic flow prediction method, apparatus, and medium based on a hybrid neural network.
Background
With the rapid development of economy and the general improvement of the living standard of people, the possession of motor vehicles and the traffic of roads are rapidly increasing. In order to solve the urban traffic problem, urban highway traffic flow prediction systems are introduced in many cities.
The traffic departments predict the road traffic flow on the premise of traffic flow control and induction, and the urban road traffic flow prediction system predicts the road traffic flow to obtain the road traffic flow prediction result, so that the pedestrians can make a better travel plan, the relevant departments can conveniently control the traffic with directivity, and the utilization rate of the road is greatly improved. Traffic flow prediction technology can effectively alleviate traffic problems, and is a key technology for intelligent traffic.
In the process of realizing the technical scheme of the embodiment of the application, the inventor at least finds that the following technical problems exist in the prior art:
the existing traffic flow prediction method does not fully utilize the space-time characteristics of traffic flow data, has low accuracy of prediction precision, and cannot well predict traffic flow.
In summary, the existing traffic flow prediction method has the technical problem of low prediction accuracy.
Disclosure of Invention
The embodiment of the application provides a traffic flow prediction method, equipment and medium based on a hybrid neural network, which solve the technical problem of low prediction precision in the existing traffic flow prediction method.
In one aspect, a traffic flow prediction method based on a hybrid neural network is provided and is applied to a traffic flow prediction system based on a hybrid neural network, wherein the traffic flow prediction system based on the hybrid neural network has a traffic flow prediction model based on the hybrid neural network, and the method comprises the following steps: obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure SMS_1
wherein->
Figure SMS_2
Is the corrected value, +.>
Figure SMS_3
,/>
Figure SMS_4
Is the value of the time before and after the abnormal data; and processing the corrected traffic flow data through the traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of a road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data sequentially passes through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism.
Optionally, the processing the corrected traffic flow data through the traffic flow prediction model based on the hybrid neural network specifically includes: the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data; the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data; and the attention mechanism selects the key information of the corrected traffic flow data for processing.
Optionally, the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data, specifically: the convolutional neural network comprises a convolutional layer and a pooling layer, and the convolutional layer processes the corrected traffic flow data to obtain a characteristic diagram of each position; and the pooling layer performs feature selection and information filtering based on the feature map of each position.
Optionally, before the convolutional neural network extracts the spatial characteristics of the modified traffic flow data, the method further comprises: the convolutional neural network prevents the neural network from overfitting by Dropout.
Optionally, after the modifying the traffic flow data, the method further includes: normalizing the corrected traffic flow data.
Optionally, after the obtaining traffic flow data of the road to be predicted, the method further includes: dividing the traffic flow data into a training set and a testing set; the training set is put into the traffic flow prediction model based on the hybrid neural network to predict, and loss function calculation is carried out on the predicted value and the true value; performing mixed neural network parameter optimization by using a gradient descent algorithm; and inputting the test set into the traffic flow prediction model based on the hybrid neural network for detection.
In another aspect, an embodiment of the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements steps of a traffic flow prediction method based on a hybrid neural network when the computer program is executed.
The embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a hybrid neural network based traffic flow prediction method.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of a hybrid neural network based traffic flow prediction method.
One or more technical solutions provided in the embodiments of the present application at least have the following technical effects or advantages:
obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure SMS_5
wherein
Figure SMS_6
Is the corrected value, +.>
Figure SMS_7
,/>
Figure SMS_8
Is the value of the time before and after the abnormal data; through the hybrid neural networkThe traffic flow prediction model of the network processes the corrected traffic flow data to obtain a traffic flow prediction result of a road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a bidirectional long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data sequentially passes through the convolutional neural network, the bidirectional long-short-term memory neural network and the attention mechanism. Because the traffic flow data can influence the traffic flow prediction result, the accuracy of the traffic flow prediction result is improved by correcting the traffic flow data. Because the two-way long-short-term memory neural network analyzes the time characteristics of the corrected traffic flow data from the forward direction and the reverse direction of the current node, not only can the time sequence characteristics of the future traffic flow data be captured, but also the time sequence characteristics of the past traffic flow data can be captured, and therefore, the two-way long-short-term memory neural network has better effect than the one-way long-term memory neural network when processing the sequence data. When the traffic flow data is predicted by adopting the traffic flow prediction model based on the hybrid neural network, the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism are sequentially adopted to process the corrected traffic flow data, and important characteristics in the corrected traffic flow data can be better extracted, so that the traffic flow prediction result generated by the traffic flow prediction model based on the hybrid neural network is closer to the real traffic flow, the prediction precision is high, the traveler can be assisted to make better trip decision, and the traffic control and guidance department can be assisted to make more reasonable traffic control and guidance.
Further, the processing the corrected traffic flow data through the traffic flow prediction model based on the hybrid neural network specifically includes: the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data; the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data; and the attention mechanism selects the key information of the corrected traffic flow data for processing. The hybrid neural network based on the traffic flow prediction model of the hybrid neural network can extract the spatial characteristics of the corrected traffic flow data, the two-way long-short-term memory neural network can extract the time characteristics of the corrected traffic flow data, the attention mechanism can simulate the processing of human vision on information, key information of the corrected traffic flow data can be selected, unimportant information is discarded, and the capability of concentrating on the key information is provided, so that the accuracy of the generated traffic flow prediction result is high, and the prediction precision can be further improved.
Still further, the convolutional neural network extracts spatial characteristics of the corrected traffic flow data, specifically: the convolutional neural network comprises a convolutional layer and a pooling layer, and the convolutional layer processes the corrected traffic flow data to obtain a characteristic diagram of each position; and the pooling layer performs feature selection and information filtering based on the feature map of each position. The convolutional neural network is adopted to further select the characteristics, so that the data volume to be processed is reduced, the calculation efficiency can be improved, and the prediction speed can be improved.
Still further, before the convolutional neural network extracts the spatial characteristics of the modified traffic flow data, the method further comprises: the convolutional neural network prevents the neural network from overfitting by Dropout. The traffic flow data is learned and trained based on the hybrid neural network model, the traffic flow prediction model based on the hybrid neural network is generated, and the Dropout layer is added into the convolutional neural network, so that the serious overfitting phenomenon in the training process can be prevented.
Still further, after the modifying the traffic flow data, the method further includes: and normalizing the corrected traffic flow data, so that the convergence speed of the traffic flow prediction model based on the hybrid neural network can be improved.
Still further, after the obtaining traffic flow data of the road to be predicted, the method further includes: dividing the traffic flow data into a training set and a testing set; the training set is put into the traffic flow prediction model based on the hybrid neural network to predict, and loss function calculation is carried out on the predicted value and the true value; performing mixed neural network parameter optimization by using a gradient descent algorithm; and inputting the test set into the traffic flow prediction model based on the hybrid neural network for detection. The method and the device can optimize parameters of the hybrid neural network, and are beneficial to improving accuracy of the traffic flow prediction model based on the hybrid neural network to the prediction result.
Drawings
FIG. 1 is a flow chart of a traffic flow prediction method based on a hybrid neural network in an embodiment of the present application;
FIG. 2 is a flow chart of a method for processing traffic flow data based on a traffic flow prediction model of a hybrid neural network in an embodiment of the present application;
FIG. 3 is a flow chart of a method for optimizing parameters of a hybrid neural network in an embodiment of the present application;
fig. 4 is a block diagram of a traffic flow prediction model based on a hybrid neural network in an embodiment of the present application.
Detailed Description
The embodiment of the application provides a traffic flow prediction method, equipment and medium based on a hybrid neural network, which solve the technical problem of low prediction precision in the existing traffic flow prediction method.
The technical scheme of an embodiment of the invention aims to solve the problems, and the general idea is as follows:
obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure SMS_9
wherein->
Figure SMS_10
Is the corrected value, +.>
Figure SMS_11
,/>
Figure SMS_12
Is the value of the time before and after the abnormal data; by based on mixed nervesThe traffic flow prediction model of the network processes the corrected traffic flow data to obtain a traffic flow prediction result of a road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data is sequentially processed through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism. Because the traffic flow data can influence the traffic flow prediction result, the accuracy of the traffic flow prediction result is improved by correcting the traffic flow data. Because the two-way long-short-term memory neural network analyzes the time characteristics of the corrected traffic flow data from the forward direction and the reverse direction of the current node, not only can the time sequence characteristics of the future traffic flow data be captured, but also the time sequence characteristics of the past traffic flow data can be captured, and therefore, the two-way long-short-term memory neural network has better effect than the one-way long-term memory neural network when processing the sequence data. When the traffic flow data is predicted by adopting the traffic flow prediction model based on the hybrid neural network, the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism are sequentially adopted to process the corrected traffic flow data, and important characteristics in the corrected traffic flow data can be better extracted, so that the traffic flow prediction result generated by the traffic flow prediction model based on the hybrid neural network is closer to the real traffic flow, the prediction precision is high, the traveler can be assisted to make better trip decision, and the traffic control and guidance department can be assisted to make more reasonable traffic control and guidance.
In order to better understand the above technical solutions, the following detailed description will refer to the accompanying drawings and specific embodiments. It will be apparent that the described embodiments of the invention are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The embodiment provides a traffic flow prediction method based on a hybrid neural network, which is applied to a traffic flow prediction system based on the hybrid neural network.
Referring to fig. 1, a traffic flow prediction method based on a hybrid neural network in an embodiment of the present invention will be described in detail.
Step 101: obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure SMS_13
wherein->
Figure SMS_14
Is the corrected value, +.>
Figure SMS_15
,/>
Figure SMS_16
Is the value of the time before and after the abnormal data;
step 102: and processing the corrected traffic flow data through a traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of the road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data is sequentially processed through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism.
In the following, taking traffic conditions of the cloud flyway in the Nanchang city as an example, a detailed description will be given of a traffic flow prediction method based on the hybrid neural network in the embodiment of the present application.
When the traffic flow prediction system based on the hybrid neural network is started, step 101 is started to be executed: and acquiring traffic flow data of the road to be predicted, and correcting the traffic flow data.
Step 101 is implemented in the following steps: traffic flow data of the cloud flyway of Nanchang city is obtained, wherein the traffic flow data comprises the number of vehicles passing through the cloud flyway, the vehicle speed, the occupancy rate and the like. In the practical application process, the user can customize the time interval for acquiring the traffic flow data, for example, 2 minutes is taken as the time interval for acquiring the traffic flow data.
The method comprises the steps of obtaining a section of traffic flow data of a cloud flyway in Nanchang city, and forming a matrix S of traffic flow space-time characteristics by the traffic flow data, wherein the matrix S can be expressed as:
Figure SMS_17
the row vectors of the matrix S represent time information of traffic flow data of different time points of the same road section, the column vectors represent space information of traffic flow data of different road sections of the same time point, n represents the number of road sections,
Figure SMS_18
traffic flow data representing the road section i at the m time.
Removing abnormal data in traffic flow data, filling in by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, and replacing fault data with the obtained correction value, wherein the formula is as follows:
Figure SMS_19
wherein the method comprises the steps of
Figure SMS_20
Is the corrected value, +.>
Figure SMS_21
,/>
Figure SMS_22
Is the value of the time before and after the abnormal data.
After the traffic flow data is acquired, execution of step 102 is started: and processing the corrected traffic flow data through a traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of the road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data is sequentially processed through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism.
Step 102 is implemented in the following manner: the traffic flow prediction system based on the hybrid neural network pre-establishes a traffic flow prediction model based on the hybrid neural network or trains based on the hybrid neural network model to generate the traffic flow prediction model based on the hybrid neural network.
And processing traffic flow data of the Nanchang city cloud flyway by a traffic flow prediction model based on the hybrid neural network, and outputting a traffic flow prediction result of the Nanchang city cloud flyway by the traffic flow prediction model based on the hybrid neural network.
The structure of the traffic flow prediction model based on the hybrid neural network will be described as follows, as shown in fig. 4, the traffic flow prediction model based on the hybrid neural network includes: an input 11, a convolutional neural network 12, a two-way long and short term memory neural network 13, an attention mechanism 14, and an output 15. The input 11, the convolutional neural network 12, the two-way long-short-period memory neural network 13, the attention mechanism 14 and the output 15 are sequentially connected, traffic flow data enter from the input 11, and after the data processing is sequentially carried out on the convolutional neural network 12, the two-way long-short-period memory neural network 13 and the attention mechanism 14, the traffic flow prediction result is obtained through the output 15.
As shown in fig. 2, in order to further improve the prediction accuracy, the traffic flow data is processed by a traffic flow prediction model based on a hybrid neural network, specifically including the following steps.
Step 1021: the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data;
step 1022: the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data;
step 1023: the attention mechanism selects the key information of the corrected traffic flow data for processing.
The hybrid neural network based on the traffic flow prediction model of the hybrid neural network can extract the spatial characteristics of the corrected traffic flow data, the two-way long-short-term memory neural network can extract the time characteristics of the corrected traffic flow data, the attention mechanism can simulate the processing of human vision on information, key information of the corrected traffic flow data can be selected, unimportant information is discarded, and the capability of concentrating on the key information is provided, so that the accuracy of the generated traffic flow prediction result is high, and the prediction precision can be further improved.
The method for processing the corrected traffic flow data by the traffic flow prediction model based on the hybrid neural network will be described in detail by taking the traffic condition of the cloud flyway in Nanchang city as an example.
When the traffic flow data of the road to be predicted is obtained, after the traffic flow data is corrected, step 1021 is started to be executed: the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data.
In the specific implementation process, step 1021 is, for example: the convolution neural network extracts the spatial characteristics of the input corrected traffic flow data, takes the convolution as a core of the feedforward neural network, each element in the convolution kernel corresponds to a weight coefficient and a deviation vector, and each neuron in the convolution layer is connected with a plurality of neurons in the area close to the position in the previous layer.
After the spatial characteristics of the corrected traffic flow data are extracted by the convolutional neural network, in order to further extract the characteristics of the time series of the corrected traffic flow data, the features extracted by the convolutional neural network are further extracted by the two-way long-short-term memory neural network, and step 1022 is started to be executed: the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data.
Step 1022 is performed, for example: the two-way long-short-term memory neural network is a variant of the cyclic neural network, is good at processing time sequences, can retain important information when being added into the cyclic neural network, can forget other information to a certain extent, and further can realize long-term memory, and the gating link of the two-way long-short-term memory neural network is divided into three parts of forgetting, input and output.
First, forget door
Figure SMS_23
The information content lost from the cell state is determined. The output value of the last moment and the input value of the current moment are input into a forgetting gate, and the forgetting gate is obtained after calculation, and the mathematical formula of the forgetting gate is as follows:
Figure SMS_24
Figure SMS_25
is a forgetful door and a->
Figure SMS_26
To activate functions sigmoid->
Figure SMS_27
And->
Figure SMS_28
Forgetting door weight parameter, < >>
Figure SMS_29
Output of hidden layer for t-1 moment, is->
Figure SMS_30
Is a bias vector.
Secondly, an input door is arranged
Figure SMS_31
Determining new information to be stored in the state of the unit, inputting the output value of the last moment and the input value of the current moment into an input gate, and obtaining the states of the input gate and the temporary memory unit after calculation, wherein the mathematical formula of the input gate is as follows: />
Figure SMS_32
Figure SMS_33
Figure SMS_36
Is an input door, ">
Figure SMS_39
To activate functions sigmoid->
Figure SMS_40
And->
Figure SMS_35
Input gate weight parameters,/->
Figure SMS_38
Output of hidden layer for t-1 moment, is->
Figure SMS_43
Is a bias vector, ++>
Figure SMS_44
Is a temporary memory cell->
Figure SMS_34
For excitation function, +.>
Figure SMS_37
And->
Figure SMS_41
Outputting the gate weight parameter. Wherein->
Figure SMS_42
The value range of (1, 0)
Updating the current cell state, wherein the mathematical formula is as follows:
Figure SMS_45
wherein the method comprises the steps of
Figure SMS_46
For the updated memory cell state->
Figure SMS_47
The range of values of (1, 1).
The output value of the last moment and the input value of the current moment are input into an output gate, and the output value of the output gate is obtained after calculation, wherein the calculation formula is as follows:
Figure SMS_48
wherein the method comprises the steps of
Figure SMS_49
For outputting the output of the gate,/->
Figure SMS_50
The value of (2) is (0, 1),>
Figure SMS_51
for outputting the weight of the gate, +.>
Figure SMS_52
To output the deflection of the door.
Calculating the output of the output gate and the memory unit shape to obtain the output value of the final two-way long-short-term memory neural network, wherein the calculation formula is as follows:
Figure SMS_53
wherein the method comprises the steps of
Figure SMS_54
Is the current output.
The two-way long-short-term memory neural network can consider the historical data in two directions at the same time, and has better effect than the one-way long-short-term memory neural network when processing sequence data. The invention uses a two-way long-short term memory neural network model to extract the time period characteristics of the corrected traffic flow data. The structure of the two-way long-short-term memory neural network is formed by stacking two parts in forward direction and reverse directionOne-way long-short-term memory neural network composition, in which
Figure SMS_55
Indicating that the input forward traffic flow sequence is predicted from start to end,/for the traffic flow sequence>
Figure SMS_56
Representing a prediction of the reverse input traffic flow sequence from end to start. The formula is as follows:
Figure SMS_57
Figure SMS_58
wherein the method comprises the steps of
Figure SMS_59
And->
Figure SMS_60
Hidden layer state of positive and negative long-term memory neural network at t moment, < >>
Figure SMS_61
Is the input of the time t,
Figure SMS_62
And->
Figure SMS_63
Is a hidden layer of the positive and negative long-term memory neural network at the time t-1.
After the two-way long-short term memory neural network extracts the time characteristics of the corrected traffic flow data, step 1023 is started to be executed: the attention mechanism selects the key information of the corrected traffic flow data for processing.
Step 1023 is performed in the specific implementation process, for example: the attention mechanism can selectively pay attention to the key information of the corrected traffic flow data, ignore unimportant information and allocate importance degrees of information at different moments. Thus, using the attention mechanism, key information can be selected from all information according to probability calculation, and attention is paid. And ignoring the irrelevant information, and avoiding the interference of the irrelevant information on the final result, thereby optimizing the traditional model. The output data of the two-way long-short-term memory neural network is used for calculating the attention value of the data at different moments to the predicted value through an attention mechanism, and the formula is as follows:
Figure SMS_64
calculating input vectors
Figure SMS_65
Score of->
Figure SMS_66
Thereby obtaining an input vector +.>
Figure SMS_67
The degree of influence on the output value, wherein +.>
Figure SMS_68
Weight of attention mechanism, +.>
Figure SMS_69
Is the bias of the attention mechanism.
Figure SMS_70
Score for a pair
Figure SMS_71
Numerical conversion of the score using the Softmax function, resulting in a weighting factor +.>
Figure SMS_72
Figure SMS_73
According to the weight coefficient
Figure SMS_74
Input vector->
Figure SMS_75
Calculating to obtain final output value of attention mechanism>
Figure SMS_76
As shown in fig. 2, in order to improve the calculation efficiency and the prediction speed, the convolutional neural network is used to further select features and reduce the amount of data to be processed, and the convolutional neural network in step 1021 extracts the spatial characteristics of the traffic flow data after correction, specifically: the convolutional neural network comprises a convolutional layer and a pooling layer, wherein the convolutional layer processes traffic flow data to obtain a feature map of each position; the pooling layer performs feature selection and information filtering based on the feature map of each location.
In a specific implementation, for example: the convolutional neural network comprises a convolutional layer and a pooling layer, the convolutional neural network obtains a characteristic diagram of each position through the convolutional operation of the convolutional layer, and units from different characteristic diagrams obtain different types of characteristics respectively; a convolutional layer typically contains a plurality of feature maps with different weight vectors, so that more abundant spatial features can be reserved; the expression of the traffic flow data after passing through the convolution layer is:
Figure SMS_77
wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_78
representing the input modified traffic flow data, W (r) s representing the s-th convolution kernel of the r-th layer, relu representing the activation function of the network, +.>
Figure SMS_79
Defined as convolution operation, b denotes the offset term.
Feature extraction operation is performed by using 2 convolution layers, the convolution kernel size of each convolution layer is 5×5, the step size is 1, RELU is used as an activation function of the convolution layers, and the number of feature graphs output by convolution of each layer is 10 and 20 in sequence.
The feature map output by the convolution layer is transferred to the pooling layer for feature selection and information filtering, and the result of a single point in the feature map is replaced by the feature map statistic of the adjacent area.
And sequentially adding a maximum pooling layer with the pooling kernel size of 1 multiplied by 2 and the step length of 1 multiplied by 2 behind each convolution layer, wherein the 2 maximum pooling layers sequentially pool the feature map after each layer of convolution, further select the features and reduce the data quantity.
As shown in fig. 2, to prevent serious overfitting during training, before the convolutional neural network in step 1021 extracts the spatial characteristics of the corrected traffic flow data, the method further includes: the convolutional neural network prevents the neural network from overfitting by Dropout.
In a specific implementation, for example: dropout is a regularization method for preventing the neural network from overfitting, and the essence is to achieve the effect of overfitting prevention by modifying the loss function. The Dropout principle is that while the neuron number of an input layer and an output layer is not changed, part of hidden layer neurons in the hidden layer structure are randomly deleted for current training in the iterative training process of each hidden layer structure, so that each network learning is not too dependent on a certain local characteristic, and then each trained network is different, and further the occurrence of overfitting is prevented.
In order to improve the convergence rate of the traffic flow prediction model based on the hybrid neural network, after the traffic flow data is modified, the method further comprises the following steps: and normalizing the corrected traffic flow data.
In a specific implementation, for example: mapping the actual value domain of traffic flow data to the value domain of 0,1, normalizing input data, and improving a convergence rate calculation formula of a traffic flow prediction model based on a hybrid neural network, wherein the calculation formula is as follows:
Figure SMS_80
wherein the method comprises the steps of
Figure SMS_81
Is normalized data, ++>
Figure SMS_82
Is the original data +.>
Figure SMS_83
,/>
Figure SMS_84
Is the maximum and minimum of the original data set.
As shown in fig. 1 and 3, in order to optimize parameters of the hybrid neural network, it is beneficial to improve accuracy of a traffic flow prediction model based on the hybrid neural network to a prediction result, after obtaining traffic flow data of a road to be predicted in step 101, the following steps are further included.
S10: dividing traffic flow data into a training set and a testing set;
s20: the training set is put into a traffic flow prediction model based on a hybrid neural network to predict, and loss function calculation is carried out on the predicted value and the true value;
s30: performing mixed neural network parameter optimization by using a gradient descent algorithm;
s40: and inputting the test set into a traffic flow prediction model based on the hybrid neural network for detection.
In step S10, the traffic flow data is divided into a training set and a test set, and in a specific implementation process, for example: data set press 7
Figure SMS_85
The 3 scale divides traffic flow data into training and testing sets. Of course. In practical applications, other proportions of the training set and the test set may be used, which is not limited in this application.
Step S20, the training set is put into a traffic flow prediction model based on a hybrid neural network to predict, and the loss function calculation is performed on the predicted value and the true value, and in the specific implementation process, for example: and (3) putting the training set into a traffic flow prediction model based on a hybrid neural network to predict, and calculating a loss function by using a predicted value and a true value, wherein the loss function is Adam.
Step S30 uses a gradient descent algorithm to perform hybrid neural network parameter optimization, and in a specific implementation process, for example: the use optimizer can update the values of the parameters of the neural network in the correct and proper directions in the process of back propagation of the neural network, so that each parameter is close to the optimal. The use of gradient descent algorithms for neural network parameter optimization is the core idea of most optimizers today.
Neural network parameter optimization using a gradient descent algorithm, and the loss function Adam calculates the updated step size and its formula by considering the mean value of the gradient and the non-centralized variance of the gradient
Figure SMS_86
Figure SMS_87
Figure SMS_88
Figure SMS_89
Figure SMS_90
Figure SMS_91
Wherein, the liquid crystal display device comprises a liquid crystal display device,
Figure SMS_97
is->
Figure SMS_94
For->
Figure SMS_108
Obtaining parameters by solving bias derivative>
Figure SMS_93
Gradient of->
Figure SMS_107
Is the hyper-parameter exponential decay rate, < >>
Figure SMS_102
Exponential moving average of gradient,/>
Figure SMS_106
Is->
Figure SMS_96
Exponential moving average of gradients at previous time, +.>
Figure SMS_105
Exponential moving average of gradient squares, +.>
Figure SMS_92
Is->
Figure SMS_100
Exponential moving average of the square of the gradient at the previous moment, +.>
Figure SMS_98
、/>
Figure SMS_103
For deviation correction value, ++>
Figure SMS_99
For updated parameters ∈>
Figure SMS_101
For the pre-update parameters +.>
Figure SMS_95
Training forLearning rate of neural network, +.>
Figure SMS_104
A very small number to prevent the denominator from being zero.
Step S40 inputs the test set into a traffic flow prediction model based on a hybrid neural network for detection, and in a specific implementation process, for example: training based on parameters optimized by the hybrid neural network, storing a traffic flow prediction model based on the hybrid neural network after training is finished, inputting a test set into the traffic flow prediction model based on the hybrid neural network for detection, and realizing real-time prediction of traffic flow.
Another embodiment of the present invention provides a computer device including a memory storing a computer program and a processor implementing the steps of a hybrid neural network based traffic flow prediction method when the processor executes the computer program.
Another embodiment of the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a hybrid neural network-based traffic flow prediction method.
Another embodiment of the invention provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of a hybrid neural network-based traffic flow prediction method.
One or more technical solutions provided in the embodiments of the present application at least have the following technical effects or advantages:
obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure SMS_109
wherein
Figure SMS_110
Is a correctionPost value->
Figure SMS_111
,/>
Figure SMS_112
Is the value of the time before and after the abnormal data; and processing the corrected traffic flow data through a traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of the road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data is sequentially processed through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism. Because the traffic flow data can influence the traffic flow prediction result, the accuracy of the traffic flow prediction result is improved by correcting the traffic flow data. Because the two-way long-short-term memory neural network analyzes the time characteristics of the corrected traffic flow data from the forward direction and the reverse direction of the current node, not only can the time sequence characteristics of the future traffic flow data be captured, but also the time sequence characteristics of the past traffic flow data can be captured, and therefore, the two-way long-short-term memory neural network has better effect than the one-way long-term memory neural network when processing the sequence data. When the traffic flow data is predicted by adopting the traffic flow prediction model based on the hybrid neural network, the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism are sequentially adopted to process the corrected traffic flow data, and important characteristics in the corrected traffic flow data can be better extracted, so that the traffic flow prediction result generated by the traffic flow prediction model based on the hybrid neural network is closer to the real traffic flow, the prediction precision is high, the traveler can be assisted to make better trip decision, and the traffic control and guidance department can be assisted to make more reasonable traffic control and guidance.
Further, the traffic flow prediction model based on the hybrid neural network is used for processing the corrected traffic flow data, and specifically comprises the following steps: the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data; the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data; the attention mechanism selects the key information of the corrected traffic flow data for processing. The hybrid neural network based on the traffic flow prediction model of the hybrid neural network can extract the spatial characteristics of the corrected traffic flow data, the two-way long-short-term memory neural network can extract the time characteristics of the corrected traffic flow data, the attention mechanism can simulate the processing of human vision on information, key information of the corrected traffic flow data can be selected, unimportant information is discarded, and the capability of concentrating on the key information is provided, so that the accuracy of the generated traffic flow prediction result is high, and the prediction precision can be further improved.
Still further, the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data, specifically: the convolutional neural network comprises a convolutional layer and a pooling layer, wherein the convolutional layer processes the corrected traffic flow data to obtain a characteristic diagram of each position; the pooling layer performs feature selection and information filtering based on the feature map of each location. The convolutional neural network is adopted to further select the characteristics, so that the data volume to be processed is reduced, the calculation efficiency can be improved, and the prediction speed can be improved.
Still further, before the convolutional neural network extracts the spatial characteristics of the modified traffic flow data, the method further comprises: the convolutional neural network prevents the neural network from overfitting by Dropout. The traffic flow data is learned and trained based on the hybrid neural network model, the traffic flow prediction model based on the hybrid neural network is generated, and the Dropout layer is added into the convolutional neural network, so that the serious overfitting phenomenon in the training process can be prevented.
Still further, after the correction processing is performed on the traffic flow data, the method further includes: and normalizing the corrected traffic flow data, so that the convergence speed of the traffic flow prediction model based on the hybrid neural network can be improved.
Still further, after obtaining traffic flow data of the road to be predicted, the method further comprises: dividing traffic flow data into a training set and a testing set; the training set is put into a traffic flow prediction model based on a hybrid neural network to predict, and loss function calculation is carried out on the predicted value and the true value; performing mixed neural network parameter optimization by using a gradient descent algorithm; and inputting the test set into a traffic flow prediction model based on the hybrid neural network for detection. The method and the device can optimize parameters of the hybrid neural network, and are beneficial to improving accuracy of the traffic flow prediction model based on the hybrid neural network to the prediction result.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (9)

1. A traffic flow prediction method based on a hybrid neural network, which is applied to a traffic flow prediction system based on the hybrid neural network, characterized in that the traffic flow prediction system based on the hybrid neural network is provided with a traffic flow prediction model based on the hybrid neural network, and the method comprises the following steps:
obtaining traffic flow data of a road to be predicted, removing abnormal data in the traffic flow data, filling in the abnormal data by adopting an adjacent filling method, selecting data in adjacent time periods, averaging the data, replacing fault data with the obtained correction value, and correcting the traffic flow data, wherein the formula is as follows:
Figure QLYQS_1
wherein->
Figure QLYQS_2
Is the corrected value, +.>
Figure QLYQS_3
,/>
Figure QLYQS_4
Is the value of the time before and after the abnormal data;
and processing the corrected traffic flow data through the traffic flow prediction model based on the hybrid neural network to obtain a traffic flow prediction result of a road to be predicted, wherein the traffic flow prediction model based on the hybrid neural network comprises a convolutional neural network, a two-way long-short-term memory neural network and an attention mechanism, and the corrected traffic flow data sequentially passes through the convolutional neural network, the two-way long-short-term memory neural network and the attention mechanism.
2. The method of claim 1, wherein the processing the corrected traffic flow data by the hybrid neural network-based traffic flow prediction model specifically comprises:
the convolutional neural network extracts the spatial characteristics of the corrected traffic flow data;
the two-way long-short-term memory neural network extracts the time characteristic of the corrected traffic flow data;
and the attention mechanism selects the key information of the corrected traffic flow data for processing.
3. The method according to claim 2, wherein the convolutional neural network extracts spatial characteristics of the modified traffic flow data, in particular:
the convolutional neural network comprises a convolutional layer and a pooling layer, and the convolutional layer processes the corrected traffic flow data to obtain a characteristic diagram of each position;
and the pooling layer performs feature selection and information filtering based on the feature map of each position.
4. The method of claim 2, wherein prior to the convolutional neural network extracting the spatial characteristics of the modified traffic flow data, the method further comprises:
the convolutional neural network prevents the neural network from overfitting by Dropout.
5. The method of claim 1, wherein after said modifying said traffic flow data, said method further comprises:
normalizing the corrected traffic flow data.
6. The method of claim 1, wherein after the obtaining traffic flow data for the link to be predicted, the method further comprises:
dividing the traffic flow data into a training set and a testing set;
the training set is put into the traffic flow prediction model based on the hybrid neural network to predict, and loss function calculation is carried out on the predicted value and the true value;
performing mixed neural network parameter optimization by using a gradient descent algorithm;
and inputting the test set into the traffic flow prediction model based on the hybrid neural network for detection.
7. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1-6 when the computer program is executed.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1-6.
9. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1-6.
CN202310339653.1A 2023-04-03 2023-04-03 Traffic flow prediction method, equipment and medium based on hybrid neural network Pending CN116090669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310339653.1A CN116090669A (en) 2023-04-03 2023-04-03 Traffic flow prediction method, equipment and medium based on hybrid neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310339653.1A CN116090669A (en) 2023-04-03 2023-04-03 Traffic flow prediction method, equipment and medium based on hybrid neural network

Publications (1)

Publication Number Publication Date
CN116090669A true CN116090669A (en) 2023-05-09

Family

ID=86210463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310339653.1A Pending CN116090669A (en) 2023-04-03 2023-04-03 Traffic flow prediction method, equipment and medium based on hybrid neural network

Country Status (1)

Country Link
CN (1) CN116090669A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102496266A (en) * 2011-12-07 2012-06-13 北京云星宇交通工程有限公司 Traffic flow data preprocessing method
CN107742420A (en) * 2017-09-22 2018-02-27 北京交通大学 It is a kind of to be used for the method that road traffic flow is predicted under emergent traffic incident
CN111145541A (en) * 2019-12-18 2020-05-12 深圳先进技术研究院 Traffic flow data prediction method, storage medium, and computer device
CN112085947A (en) * 2020-07-31 2020-12-15 浙江工业大学 Traffic jam prediction method based on deep learning and fuzzy clustering
CN115019510A (en) * 2022-06-29 2022-09-06 华南理工大学 Traffic data restoration method based on dynamic self-adaptive generation countermeasure network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102496266A (en) * 2011-12-07 2012-06-13 北京云星宇交通工程有限公司 Traffic flow data preprocessing method
CN107742420A (en) * 2017-09-22 2018-02-27 北京交通大学 It is a kind of to be used for the method that road traffic flow is predicted under emergent traffic incident
CN111145541A (en) * 2019-12-18 2020-05-12 深圳先进技术研究院 Traffic flow data prediction method, storage medium, and computer device
CN112085947A (en) * 2020-07-31 2020-12-15 浙江工业大学 Traffic jam prediction method based on deep learning and fuzzy clustering
CN115019510A (en) * 2022-06-29 2022-09-06 华南理工大学 Traffic data restoration method based on dynamic self-adaptive generation countermeasure network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐先峰等: ""基于卷积神经网络与双向长短时记忆网络组合模型的短时交通流预测"", 《工业仪表与自动化装置》, pages 1 *

Similar Documents

Publication Publication Date Title
CN109492814B (en) Urban traffic flow prediction method, system and electronic equipment
CN110223517B (en) Short-term traffic flow prediction method based on space-time correlation
CN111145541B (en) Traffic flow data prediction method, storage medium, and computer device
CN112289034A (en) Deep neural network robust traffic prediction method based on multi-mode space-time data
CN104077613A (en) Crowd density estimation method based on cascaded multilevel convolution neural network
Yu et al. Error correction method based on data transformational GM (1, 1) and application on tax forecasting
CN106781489A (en) A kind of road network trend prediction method based on recurrent neural network
CN107705556A (en) A kind of traffic flow forecasting method combined based on SVMs and BP neural network
CN111861013B (en) Power load prediction method and device
CN106875004A (en) Composite mode neuronal messages processing method and system
CN114170789B (en) Intelligent network link lane change decision modeling method based on space-time diagram neural network
CN111047078B (en) Traffic characteristic prediction method, system and storage medium
CN112766600A (en) Urban area crowd flow prediction method and system
CN114565187A (en) Traffic network data prediction method based on graph space-time self-coding network
CN113887704A (en) Traffic information prediction method, device, equipment and storage medium
CN114419884B (en) Self-adaptive signal control method and system based on reinforcement learning and phase competition
CN110289987B (en) Multi-agent system network anti-attack capability assessment method based on characterization learning
CN114881339A (en) Vehicle trajectory prediction method, system, computer device, and storage medium
CN110543978A (en) Traffic flow data prediction method and device based on wavelet neural network
CN112862084B (en) Traffic flow prediction method based on deep migration fusion learning
CN114373073A (en) Method and system for road scene semantic segmentation
CN113989287A (en) Urban road remote sensing image segmentation method and device, electronic equipment and storage medium
CN116090669A (en) Traffic flow prediction method, equipment and medium based on hybrid neural network
CN114863680B (en) Prediction processing method, prediction processing device, computer equipment and storage medium
CN113807541B (en) Fairness repair method, system, equipment and storage medium for decision system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20230509