Intelligent prediction method and device for highway traffic flow

By constructing a highway traffic flow prediction model based on CNN and LSTM, and training the model using ETC and toll station data, the spatial and temporal features of traffic flow are extracted, solving the problem of low prediction accuracy in existing technologies and achieving higher-precision traffic flow prediction.

CN120998019APending Publication Date: 2025-11-21ANHUI EXPRESSWAY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510972728.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

Existing technologies are not very accurate in predicting highway traffic flow and lack adaptive capabilities, failing to dynamically adjust according to real-time traffic conditions.

Method used

A highway traffic flow prediction model based on CNN and LSTM is constructed. The model is trained using ETC data and toll station data to extract the spatial and temporal features of traffic flow, and the trained model is used for prediction.

Benefits of technology

This improves the accuracy and adaptability of highway traffic flow prediction, enhances the training accuracy of the model, and thus improves the precision of the prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120998019A_ABST
    Figure CN120998019A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent prediction method and device for expressway traffic flow, and the method comprises the steps: constructing an expressway traffic flow prediction model based on CNN and LSTM, obtaining a target data set from an expressway ETC and a toll station, and dividing the target data set into a training data set and a test data set, training the expressway traffic flow prediction model based on the training data set to obtain a trained expressway traffic flow prediction model, and predicting the traffic flow of the expressway based on the trained expressway traffic flow prediction model to obtain an expressway traffic flow prediction result; therefore, the method can extract the traffic flow spatial features based on the CNN and extract the traffic flow time features based on the LSTM layer in the model training process, and then predicts the expressway traffic flow by using the trained model, thereby facilitating the improvement of the training accuracy of the expressway traffic flow prediction model, and improving the expressway traffic flow prediction efficiency. And thus, the prediction accuracy of the highway traffic flow is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation technology, and in particular to an intelligent method and device for predicting highway traffic flow. Background Technology

[0002] With the continuous expansion of highway networks, accurate traffic flow prediction is crucial for alleviating traffic congestion and optimizing road resource allocation. Existing technologies, such as time series analysis and Kalman filtering, often lack accuracy in traffic flow prediction and cannot dynamically adjust to real-time traffic conditions, thus lacking adaptive prediction capabilities. Therefore, providing a method for predicting highway traffic flow to improve its accuracy is of paramount importance. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide an intelligent prediction method and device for highway traffic flow, which can improve the prediction accuracy of highway traffic flow.

[0004] To address the aforementioned technical problems, the first aspect of this invention discloses an intelligent prediction method for highway traffic flow, the method comprising: A highway traffic flow prediction model is constructed, which includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer. The target dataset is obtained and split into a training dataset and a test dataset. The target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, as well as spatiotemporal data obtained by recording vehicles passing through manual lanes at toll stations. The highway traffic flow prediction model is trained based on the training dataset to obtain the trained highway traffic flow prediction model. Based on the trained highway traffic flow prediction model, the highway traffic flow is predicted, and the highway traffic flow prediction results are obtained.

[0005] As an optional implementation, in the first aspect of the present invention, training the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model includes: Initialize all weight parameters of the highway traffic flow prediction model; The training dataset is input into the highway traffic flow prediction model. The spatial features of traffic flow between target stations are extracted through CNN convolutional layers, the temporal features of traffic flow are extracted based on LSTM layers, and the output values ​​corresponding to the training dataset are output through fully connected layers. The target stations include ETC gantries and toll stations. The loss function of the highway traffic flow prediction model is calculated based on the output value, and the gradients corresponding to the weight parameters are calculated based on the loss function. The weight parameters are updated based on the Adam optimization algorithm and the gradients corresponding to the weight parameters. The highway traffic flow prediction model is then iteratively trained based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. The highway traffic flow prediction model at this point is then taken as the completed highway traffic flow prediction model.

[0006] As an optional implementation, in the first aspect of the present invention, the pooling method of the CNN pooling layer of the highway traffic flow prediction model is average pooling; the activation function of the highway traffic flow prediction model is the ReLU function; and the loss function of the highway traffic flow prediction model is mean squared error.

[0007] As an optional implementation, in the first aspect of the present invention, the prediction of highway traffic flow based on the trained highway traffic flow prediction model to obtain highway traffic flow prediction results includes: Based on the trained highway traffic flow prediction model, traffic flow prediction is performed on the test dataset to obtain the prediction results corresponding to the test dataset. Based on the test dataset and the corresponding prediction results, the error index of the highway traffic flow prediction model is calculated. When the error index corresponding to the highway traffic flow prediction model meets the preset error index conditions, the highway traffic flow prediction model is determined as the target prediction model. Traffic flow on highways is predicted based on the target prediction model, and the prediction results are obtained.

[0008] As an optional implementation, in the first aspect of the present invention, the error index is calculated by at least one of mean absolute error calculation, root mean square error calculation, and mean absolute percentage error calculation.

[0009] As an optional implementation, in the first aspect of the present invention, the method further includes: The system uses monitoring equipment on highways to take photos of the road at preset time intervals, and a pre-trained vehicle detection model to determine the number of vehicles in each photo. The vehicle detection model is a target detection model built and trained based on a CNN model. A traffic flow dataset is constructed based on the number of vehicles in each road photo and the time each photo was taken. The traffic flow dataset is split into a first training set and a first test set; A traffic flow prediction model is constructed based on the LSTM model. The traffic flow prediction model includes an input layer, a hidden layer, and an output layer. The traffic flow prediction model is trained based on the first training set to obtain the trained traffic flow prediction model. Based on the trained traffic flow-assisted prediction model, highway traffic flow is predicted on the test dataset to obtain the first prediction result for the first test set. Based on the first test set and the first prediction results corresponding to the first test set, calculate the error index corresponding to the traffic flow auxiliary prediction model. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Traffic flow on highways is predicted based on a target-assisted prediction model, and the auxiliary prediction results of highway traffic flow are obtained.

[0010] As an optional implementation, in the first aspect of the present invention, the method further includes: Based on the error index of the target-assisted prediction model and the error index of the highway traffic flow prediction model, the weights of the highway traffic flow assisted prediction results and the highway traffic flow prediction results are determined. Based on the auxiliary prediction results of highway traffic flow and their corresponding weights, as well as the prediction results of highway traffic flow and their corresponding weights, the comprehensive prediction results of highway traffic flow are determined.

[0011] A second aspect of the present invention discloses an intelligent prediction device for highway traffic flow, the device comprising: The module is used to build a highway traffic flow prediction model, which includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer. The acquisition module is used to acquire the target dataset and split it into a training dataset and a test dataset. The target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, as well as spatiotemporal data obtained by recording vehicles passing through manual lanes at toll stations. The training module is used to train the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model. The prediction module is used to predict highway traffic flow based on the trained highway traffic flow prediction model, and obtain highway traffic flow prediction results.

[0012] As an optional implementation, in the second aspect of the present invention, the training module trains the highway traffic flow prediction model based on the training dataset to obtain a trained highway traffic flow prediction model, specifically including: Initialize all weight parameters of the highway traffic flow prediction model; The training dataset is input into the highway traffic flow prediction model. The spatial features of traffic flow between target stations are extracted through CNN convolutional layers, the temporal features of traffic flow are extracted based on LSTM layers, and the output values ​​corresponding to the training dataset are output through fully connected layers. The target stations include ETC gantries and toll stations. The loss function of the highway traffic flow prediction model is calculated based on the output value, and the gradients corresponding to the weight parameters are calculated based on the loss function. The weight parameters are updated based on the Adam optimization algorithm and the gradients corresponding to the weight parameters. The highway traffic flow prediction model is then iteratively trained based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. The highway traffic flow prediction model at this point is then taken as the completed highway traffic flow prediction model.

[0013] As an optional implementation, in the second aspect of the present invention, the pooling method of the CNN pooling layer of the highway traffic flow prediction model is average pooling; the activation function of the highway traffic flow prediction model is the ReLU function; and the loss function of the highway traffic flow prediction model adopts mean squared error.

[0014] As an optional implementation, in a second aspect of the present invention, the prediction module predicts the traffic flow of the highway based on a trained highway traffic flow prediction model to obtain the highway traffic flow prediction result. Specifically, the method includes: Based on the trained highway traffic flow prediction model, traffic flow prediction is performed on the test dataset to obtain the prediction results corresponding to the test dataset. Based on the test dataset and the corresponding prediction results, the error index of the highway traffic flow prediction model is calculated. When the error index corresponding to the highway traffic flow prediction model meets the preset error index conditions, the highway traffic flow prediction model is determined as the target prediction model. Traffic flow on highways is predicted based on the target prediction model, and the prediction results are obtained.

[0015] As an optional implementation, in the second aspect of the present invention, the error index is calculated by at least one of mean absolute error calculation, root mean square error calculation, and mean absolute percentage error calculation.

[0016] As an optional implementation, in a second aspect of the invention, the device is further configured to: The system uses monitoring equipment on highways to take photos of the road at preset time intervals, and a pre-trained vehicle detection model to determine the number of vehicles in each photo. The vehicle detection model is a target detection model built and trained based on a CNN model. A traffic flow dataset is constructed based on the number of vehicles in each road photo and the time each photo was taken. The traffic flow dataset is split into a first training set and a first test set; A traffic flow prediction model is constructed based on the LSTM model. The traffic flow prediction model includes an input layer, a hidden layer, and an output layer. The traffic flow prediction model is trained based on the first training set to obtain the trained traffic flow prediction model. Based on the trained traffic flow-assisted prediction model, highway traffic flow is predicted on the test dataset to obtain the first prediction result for the first test set. Based on the first test set and the first prediction results corresponding to the first test set, calculate the error index corresponding to the traffic flow auxiliary prediction model. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Traffic flow on highways is predicted based on a target-assisted prediction model, and the auxiliary prediction results of highway traffic flow are obtained.

[0017] As an optional implementation, in a second aspect of the invention, the device is further configured to: Based on the error index of the target-assisted prediction model and the error index of the highway traffic flow prediction model, the weights of the highway traffic flow assisted prediction results and the highway traffic flow prediction results are determined. Based on the auxiliary prediction results of highway traffic flow and their corresponding weights, as well as the prediction results of highway traffic flow and their corresponding weights, the comprehensive prediction results of highway traffic flow are determined.

[0018] A third aspect of this invention discloses an intelligent prediction system for highway traffic flow, the system comprising: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the steps in the intelligent prediction method for highway traffic flow disclosed in the first aspect of the present invention.

[0019] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute steps in the intelligent prediction method for highway traffic flow disclosed in the first aspect of the present invention.

[0020] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: In this embodiment of the invention, a highway traffic flow prediction model based on CNN and LSTM is constructed. Target datasets from highway ETC and toll stations are obtained and split into training and testing datasets. The highway traffic flow prediction model is trained based on the training dataset to obtain a trained highway traffic flow prediction model. Based on the trained highway traffic flow prediction model, highway traffic flow is predicted to obtain the highway traffic flow prediction result. It can be seen that this invention can extract spatial features of traffic flow based on CNN and extract temporal features of traffic flow based on LSTM layers during model training, and then use the trained model to predict highway traffic flow, which is beneficial to improving the training accuracy of the highway traffic flow prediction model, and thus improving the prediction accuracy of highway traffic flow. Attached Figure Description To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a flowchart illustrating an intelligent prediction method for highway traffic flow disclosed in an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of an intelligent traffic flow prediction device for highways disclosed in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an intelligent traffic flow prediction system for highways disclosed in an embodiment of the present invention. Detailed Implementation

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

[0023] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.

[0024] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0025] This invention discloses an intelligent method and apparatus for predicting highway traffic flow. Implementing the method described in the embodiments of this invention enables the extraction of spatial features of traffic flow based on CNN and the extraction of temporal features of traffic flow based on LSTM layers during model training. This allows the trained model to predict highway traffic flow, improving the training accuracy of the highway traffic flow prediction model and consequently enhancing the accuracy of highway traffic flow prediction. Detailed explanations follow.

[0026] Example 1 Please see Figure 1 , Figure 1 This is a flowchart illustrating an intelligent prediction method for highway traffic flow disclosed in an embodiment of the present invention. Figure 1 The described method can be applied to any scenario involving the detection of electrical equipment faults in highway tunnels, and also to the prediction of traffic flow in tunnel types such as undersea tunnels, subway tunnels, and urban expressway tunnels. This invention does not limit the application of this method. Figure 1 As shown, the intelligent traffic flow prediction method for highways includes the following operations: 101. Construct a traffic flow prediction model for highways; In this embodiment of the invention, the highway traffic flow prediction model includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer; 102. Obtain the target dataset and split it into a training dataset and a test dataset; In this embodiment of the invention, the target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, and spatiotemporal data obtained by recording vehicles passing through manual lanes at toll stations. 103. Train the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model; 104. Based on the trained highway traffic flow prediction model, predict the highway traffic flow and obtain the highway traffic flow prediction results.

[0027] In this embodiment of the invention, it can be understood that the highway traffic flow prediction model can be viewed as a model based on the fusion of CNN and LSTM. CNN (Convolutional Neural Network) is a multi-layer supervised learning network used to process grid-like data, including time-series data and image data. It mainly consists of convolutional layers, pooling layers, and fully connected layers. CNN has the characteristic of weight sharing, and it mines spatial local correlation information of natural images by strengthening the local connection patterns between nodes in adjacent layers of the neural network. LSTM (Long Short-Term Memory Network) is a special form of RNN (Recurrent Neural Network), adding memory characteristics to RNN to maintain the long-term memory of the neural network, enabling the model to be well applied to long-term series. LSTM networks add forgetting and remembering units in the hidden layers. When new information is input, the LSTM network filters out some information to retain and discard, saving important information in long-term memory. Spatiotemporal data can be understood as a collection of data such as vehicle, station (location), and time data when a vehicle passes through a station. The target dataset can be split into training and testing datasets, with the training dataset comprising 80% and the testing dataset 20%.

[0028] As can be seen, implementing the method described in this invention can construct a highway traffic flow prediction model based on CNN and LSTM; it obtains target datasets from highway ETC and toll stations and splits them into training and testing datasets; it trains the highway traffic flow prediction model based on the training dataset to obtain a trained highway traffic flow prediction model; and it predicts highway traffic flow based on the trained highway traffic flow prediction model to obtain highway traffic flow prediction results. This method is beneficial for extracting spatial features of traffic flow based on CNN and temporal features of traffic flow based on LSTM layers during model training, and then using the trained model to predict highway traffic flow, which helps improve the training accuracy of the highway traffic flow prediction model and thus improve the prediction accuracy of highway traffic flow.

[0029] In an optional embodiment, the step 103 above, which involves training the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model, may include: Initialize all weight parameters of the highway traffic flow prediction model; The training dataset is input into the highway traffic flow prediction model. The spatial features of traffic flow between target stations are extracted through CNN convolutional layers, the temporal features of traffic flow are extracted based on LSTM layers, and the output values ​​corresponding to the training dataset are output through fully connected layers. The target stations include ETC gantries and toll stations. The loss function of the highway traffic flow prediction model is calculated based on the output value, and the gradients corresponding to the weight parameters are calculated based on the loss function. The weight parameters are updated based on the Adam optimization algorithm and the gradients corresponding to the weight parameters. The highway traffic flow prediction model is then iteratively trained based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. The highway traffic flow prediction model at this point is then taken as the completed highway traffic flow prediction model.

[0030] In this alternative embodiment, the Adam optimization algorithm can accelerate the optimization process, for example by reducing the number of functional evaluations required to reach the optimal state, or improve the functionality of the optimization algorithm, for example by producing better final results.

[0031] As can be seen, this optional embodiment can initialize all weight parameters of the model, input the training dataset into the model, extract the spatial features of traffic flow between target stations through CNN convolutional layers, extract the temporal features of traffic flow based on LSTM layers, output the output values ​​corresponding to the training dataset through fully connected layers, calculate the loss function based on the output values, calculate the gradients corresponding to the weight parameters based on the loss function, update the weight parameters based on the Adam optimization algorithm and the gradients corresponding to the weight parameters, and iteratively train the highway traffic flow prediction model based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. This helps to improve the training accuracy of the highway traffic flow prediction model, thereby improving the prediction accuracy of highway traffic flow.

[0032] In another optional embodiment, the CNN pooling layer of the highway traffic flow prediction model uses average pooling; the activation function of the highway traffic flow prediction model is the ReLU function; and the loss function of the highway traffic flow prediction model is mean squared error.

[0033] In this optional embodiment, the pooling layer utilizes the principle of local connectivity in CNNs to perform pooling operations on the convolutional feature maps, thereby reducing the dimensionality of the features, compressing the data size and the number of parameters, reducing the amount of data processing while maintaining the feature invariance of the original data, and preventing the possibility of model overfitting; average pooling refers to taking the average of all values ​​within the sliding window. Since average pooling can better preserve the information between different ETC gantries or toll stations, the average pooling method is used in this model.

[0034] As can be seen, this optional embodiment can determine the pooling method, activation function, and loss function calculation method of the model, which is beneficial to improving the training accuracy of the highway traffic flow prediction model, and thus improving the prediction accuracy of highway traffic flow.

[0035] In another optional embodiment, the process of predicting highway traffic flow based on the trained highway traffic flow prediction model in step 104 above, to obtain highway traffic flow prediction results, may include: Based on the trained highway traffic flow prediction model, traffic flow prediction is performed on the test dataset to obtain the prediction results corresponding to the test dataset. Based on the test dataset and the corresponding prediction results, the error index of the highway traffic flow prediction model is calculated. When the error index corresponding to the highway traffic flow prediction model meets the preset error index conditions, the highway traffic flow prediction model is determined as the target prediction model. Traffic flow on highways is predicted based on the target prediction model, and the prediction results are obtained.

[0036] As can be seen, this optional embodiment can perform highway traffic flow prediction on the test dataset based on the trained model, obtain the prediction results corresponding to the test dataset, and calculate the error index based on the prediction results. When the error index meets the preset error index conditions, the model is determined as the target prediction model, and then the highway traffic flow is predicted based on the target prediction model to obtain the highway traffic flow prediction results. This is beneficial to improve the accuracy of the target prediction model determination, thereby improving the accuracy of highway traffic flow prediction.

[0037] In yet another alternative embodiment, the error index is calculated by at least one of mean absolute error calculation, root mean square error calculation, and mean absolute percentage error calculation.

[0038] In this optional embodiment, the mean absolute error represents the average absolute deviation between the predicted and actual highway traffic flow; the root mean square error represents the square root of the square mean of the predicted and actual highway traffic flow, which can intuitively show the degree of dispersion between the predicted and actual highway traffic flow; and the mean absolute percentage error reflects the degree of deviation between the predicted and actual passenger flow.

[0039] It is evident that this optional embodiment can determine the calculation method of the error index, which is beneficial to improving the accuracy of the target prediction model and thus improving the accuracy of highway traffic flow prediction.

[0040] In yet another optional embodiment, the method may further include: The system uses monitoring equipment on highways to take photos of the road at preset time intervals, and a pre-trained vehicle detection model to determine the number of vehicles in each photo. The vehicle detection model is a target detection model built and trained based on a CNN model. A traffic flow dataset is constructed based on the number of vehicles in each road photo and the time each photo was taken. The traffic flow dataset is split into a first training set and a first test set; A traffic flow prediction model is constructed based on the LSTM model. The traffic flow prediction model includes an input layer, a hidden layer, and an output layer. The traffic flow prediction model is trained based on the first training set to obtain the trained traffic flow prediction model. Based on the trained traffic flow-assisted prediction model, highway traffic flow is predicted on the test dataset to obtain the first prediction result for the first test set. Based on the first test set and the first prediction results corresponding to the first test set, calculate the error index corresponding to the traffic flow auxiliary prediction model. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Traffic flow on highways is predicted based on a target-assisted prediction model, and the auxiliary prediction results of highway traffic flow are obtained.

[0041] As can be seen, this optional embodiment can determine the number of vehicles in photos taken on highways based on a vehicle detection model, construct a traffic flow dataset, split the traffic flow dataset into a first training set and a first test set, construct a traffic flow auxiliary prediction model, and predict traffic flow on the test dataset based on the trained traffic flow auxiliary prediction model to obtain a first prediction result corresponding to the first test set. Then, the error index corresponding to the traffic flow auxiliary prediction model is calculated. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Based on the target auxiliary prediction model, the traffic flow on the highway is predicted to obtain the highway traffic flow auxiliary prediction result, which helps to improve the accuracy of determining the highway traffic flow auxiliary prediction result, thereby improving the prediction accuracy of highway traffic flow.

[0042] In yet another optional embodiment, the method may further include: Based on the error index of the target-assisted prediction model and the error index of the highway traffic flow prediction model, the weights of the highway traffic flow assisted prediction results and the highway traffic flow prediction results are determined. Based on the auxiliary prediction results of highway traffic flow and their corresponding weights, as well as the prediction results of highway traffic flow and their corresponding weights, the comprehensive prediction results of highway traffic flow are determined.

[0043] In this optional embodiment, it is understood that if the error index of either the target-assisted prediction model or the highway traffic flow prediction model is too large, the weight of that model can be reduced accordingly to improve the accuracy of the comprehensive prediction results of highway traffic flow.

[0044] As can be seen, this optional embodiment can determine the weights of the highway traffic flow auxiliary prediction results and the highway traffic flow prediction results based on the error indices corresponding to the target auxiliary prediction model and the highway traffic flow prediction model, and determine the comprehensive prediction results of highway traffic flow based on the corresponding weights. This is beneficial to improving the accuracy of determining the comprehensive prediction results of highway traffic flow, and thus improving the prediction accuracy of highway traffic flow.

[0045] Example 2 Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of an intelligent traffic flow prediction device for highways disclosed in an embodiment of the present invention. Figure 2The described device can be applied to any scenario involving the detection of electrical equipment faults in highway tunnels, and can also be used for traffic flow prediction in tunnel types such as undersea tunnels, subway tunnels, and urban expressway tunnels. The embodiments of this invention are not limited to this. Figure 2 As shown, the intelligent traffic flow prediction device for highways may include: Module 201 is used to build a highway traffic flow prediction model. The highway traffic flow prediction model includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer. The acquisition module 202 is used to acquire the target dataset and split the target dataset into a training dataset and a test dataset. The target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, as well as spatiotemporal data obtained by recording vehicles passing through manual lanes of toll stations. Training module 203 is used to train the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model. The prediction module 204 is used to predict the traffic flow of the highway based on the trained highway traffic flow prediction model, and obtain the highway traffic flow prediction result.

[0046] As can be seen, the method and apparatus described in this invention construct a highway traffic flow prediction model based on CNN and LSTM; obtain target datasets from highway ETC and toll stations and split them into training datasets and test datasets; train the highway traffic flow prediction model based on the training dataset to obtain a trained highway traffic flow prediction model; and predict highway traffic flow based on the trained highway traffic flow prediction model to obtain highway traffic flow prediction results. This is beneficial for extracting spatial features of traffic flow based on CNN and temporal features of traffic flow based on LSTM layers during model training, and then using the trained model to predict highway traffic flow, which helps improve the training accuracy of the highway traffic flow prediction model and thus improve the prediction accuracy of highway traffic flow.

[0047] In an optional embodiment, the training module 203 trains the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model. The specific methods include: Initialize all weight parameters of the highway traffic flow prediction model; The training dataset is input into the highway traffic flow prediction model. The spatial features of traffic flow between target stations are extracted through CNN convolutional layers, the temporal features of traffic flow are extracted based on LSTM layers, and the output values ​​corresponding to the training dataset are output through fully connected layers. The target stations include ETC gantries and toll stations. The loss function of the highway traffic flow prediction model is calculated based on the output value, and the gradients corresponding to the weight parameters are calculated based on the loss function. The weight parameters are updated based on the Adam optimization algorithm and the gradients corresponding to the weight parameters. The highway traffic flow prediction model is then iteratively trained based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. The highway traffic flow prediction model at this point is then taken as the completed highway traffic flow prediction model.

[0048] As can be seen, this optional embodiment can initialize all weight parameters of the model, input the training dataset into the model, extract the spatial features of traffic flow between target stations through CNN convolutional layers, extract the temporal features of traffic flow based on LSTM layers, output the output values ​​corresponding to the training dataset through fully connected layers, calculate the loss function based on the output values, calculate the gradients corresponding to the weight parameters based on the loss function, update the weight parameters based on the Adam optimization algorithm and the gradients corresponding to the weight parameters, and iteratively train the highway traffic flow prediction model based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. This helps to improve the training accuracy of the highway traffic flow prediction model, thereby improving the prediction accuracy of highway traffic flow.

[0049] In another optional embodiment, the CNN pooling layer of the highway traffic flow prediction model uses average pooling; the activation function of the highway traffic flow prediction model is the ReLU function; and the loss function of the highway traffic flow prediction model is mean squared error.

[0050] As can be seen, this optional embodiment can determine the pooling method, activation function, and loss function calculation method of the model, which is beneficial to improving the training accuracy of the highway traffic flow prediction model, and thus improving the prediction accuracy of highway traffic flow.

[0051] In another optional embodiment, the prediction module 204 predicts the traffic flow of the highway based on the trained highway traffic flow prediction model to obtain the highway traffic flow prediction result. Specifically, this includes: Based on the trained highway traffic flow prediction model, traffic flow prediction is performed on the test dataset to obtain the prediction results corresponding to the test dataset. Based on the test dataset and the corresponding prediction results, the error index of the highway traffic flow prediction model is calculated. When the error index corresponding to the highway traffic flow prediction model meets the preset error index conditions, the highway traffic flow prediction model is determined as the target prediction model. Traffic flow on highways is predicted based on the target prediction model, and the prediction results are obtained.

[0052] As can be seen, this optional embodiment can perform highway traffic flow prediction on the test dataset based on the trained model, obtain the prediction results corresponding to the test dataset, and calculate the error index based on the prediction results. When the error index meets the preset error index conditions, the model is determined as the target prediction model, and then the highway traffic flow is predicted based on the target prediction model to obtain the highway traffic flow prediction results. This is beneficial to improve the accuracy of the target prediction model determination, thereby improving the accuracy of highway traffic flow prediction.

[0053] In yet another alternative embodiment, the error index is calculated by at least one of mean absolute error calculation, root mean square error calculation, and mean absolute percentage error calculation.

[0054] It is evident that this optional embodiment can determine the calculation method of the error index, which is beneficial to improving the accuracy of the target prediction model and thus improving the accuracy of highway traffic flow prediction.

[0055] In yet another alternative embodiment, the device can also be used for: The system uses monitoring equipment on highways to take photos of the road at preset time intervals, and a pre-trained vehicle detection model to determine the number of vehicles in each photo. The vehicle detection model is a target detection model built and trained based on a CNN model. A traffic flow dataset is constructed based on the number of vehicles in each road photo and the time each photo was taken. The traffic flow dataset is split into a first training set and a first test set; A traffic flow prediction model is constructed based on the LSTM model. The traffic flow prediction model includes an input layer, a hidden layer, and an output layer. The traffic flow prediction model is trained based on the first training set to obtain the trained traffic flow prediction model. Based on the trained traffic flow-assisted prediction model, highway traffic flow is predicted on the test dataset to obtain the first prediction result for the first test set. Based on the first test set and the first prediction results corresponding to the first test set, calculate the error index corresponding to the traffic flow auxiliary prediction model. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Traffic flow on highways is predicted based on a target-assisted prediction model, and the auxiliary prediction results of highway traffic flow are obtained.

[0056] As can be seen, this optional embodiment can determine the number of vehicles in photos taken on highways based on a vehicle detection model, construct a traffic flow dataset, split the traffic flow dataset into a first training set and a first test set, construct a traffic flow auxiliary prediction model, and predict traffic flow on the test dataset based on the trained traffic flow auxiliary prediction model to obtain a first prediction result corresponding to the first test set. Then, the error index corresponding to the traffic flow auxiliary prediction model is calculated. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Based on the target auxiliary prediction model, the traffic flow on the highway is predicted to obtain the highway traffic flow auxiliary prediction result, which helps to improve the accuracy of determining the highway traffic flow auxiliary prediction result, thereby improving the prediction accuracy of highway traffic flow.

[0057] In yet another alternative embodiment, the device can also be used for: Based on the error index of the target-assisted prediction model and the error index of the highway traffic flow prediction model, the weights of the highway traffic flow assisted prediction results and the highway traffic flow prediction results are determined. Based on the auxiliary prediction results of highway traffic flow and their corresponding weights, as well as the prediction results of highway traffic flow and their corresponding weights, the comprehensive prediction results of highway traffic flow are determined.

[0058] As can be seen, this optional embodiment can determine the weights of the highway traffic flow auxiliary prediction results and the highway traffic flow prediction results based on the error indices corresponding to the target auxiliary prediction model and the highway traffic flow prediction model, and determine the comprehensive prediction results of highway traffic flow based on the corresponding weights. This is beneficial to improving the accuracy of determining the comprehensive prediction results of highway traffic flow, and thus improving the prediction accuracy of highway traffic flow.

[0059] Example 3 Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of an intelligent traffic flow prediction system for highways disclosed in an embodiment of the present invention. Figure 3 The intelligent traffic flow prediction system for the highway shown may include: Memory 301 storing executable program code; Processor 302 coupled to memory 301; The processor 302 calls the executable program code stored in the memory 301 to execute the steps in the intelligent prediction method for highway traffic flow described in Embodiment 1 of the present invention.

[0060] Example 4 This invention discloses a computer storage medium storing computer instructions, which, when invoked, execute the steps in the intelligent prediction method for highway traffic flow described in Embodiment 1 of this invention.

[0061] Example 5 This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the intelligent prediction method for highway traffic flow described in Embodiment 1.

[0062] The system embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0063] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0064] Finally, it should be noted that the intelligent prediction method and device for highway traffic flow disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for intelligent prediction of highway traffic flow, characterized in that, The method includes: A highway traffic flow prediction model is constructed, which includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer. The target dataset is obtained and split into a training dataset and a test dataset. The target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, as well as spatiotemporal data obtained by recording vehicles passing through manual lanes at toll stations. The highway traffic flow prediction model is trained based on the training dataset to obtain the trained highway traffic flow prediction model. Based on the trained highway traffic flow prediction model, the highway traffic flow is predicted, and the highway traffic flow prediction results are obtained.

2. The intelligent prediction method for highway traffic flow as described in claim 1, characterized in that, The process of training the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model includes: Initialize all weight parameters of the highway traffic flow prediction model; The training dataset is input into the highway traffic flow prediction model. The spatial features of traffic flow between target stations are extracted through CNN convolutional layers, the temporal features of traffic flow are extracted based on LSTM layers, and the output values ​​corresponding to the training dataset are output through fully connected layers. The target stations include ETC gantries and toll stations. The loss function of the highway traffic flow prediction model is calculated based on the output value, and the gradients corresponding to the weight parameters are calculated based on the loss function. The weight parameters are updated based on the Adam optimization algorithm and the gradients corresponding to the weight parameters. The highway traffic flow prediction model is then iteratively trained based on the updated weight parameters until the loss function converges or the number of iterations reaches the preset number. The highway traffic flow prediction model at this point is then taken as the completed highway traffic flow prediction model.

3. The intelligent prediction method for highway traffic flow as described in claim 2, characterized in that, The CNN pooling layer of the highway traffic flow prediction model uses average pooling; the activation function of the highway traffic flow prediction model is the ReLU function; and the loss function of the highway traffic flow prediction model is the mean squared error.

4. The intelligent prediction method for highway traffic flow as described in claim 1, characterized in that, The trained highway traffic flow prediction model predicts highway traffic flow and obtains highway traffic flow prediction results, including: Based on the trained highway traffic flow prediction model, traffic flow prediction is performed on the test dataset to obtain the prediction results corresponding to the test dataset. Based on the test dataset and the corresponding prediction results, the error index of the highway traffic flow prediction model is calculated. When the error index corresponding to the highway traffic flow prediction model meets the preset error index conditions, the highway traffic flow prediction model is determined as the target prediction model. Traffic flow on highways is predicted based on the target prediction model, and the prediction results are obtained.

5. The intelligent prediction method for highway traffic flow as described in claim 4, characterized in that, Error indicators can be calculated in at least one of the following ways: mean absolute error calculation, root mean square error calculation, and mean absolute percentage error calculation.

6. The intelligent prediction method for highway traffic flow as described in claim 4 or 5, characterized in that, The method further includes: The system uses monitoring equipment on highways to take photos of the road at preset time intervals, and a pre-trained vehicle detection model to determine the number of vehicles in each photo. The vehicle detection model is a target detection model built and trained based on a CNN model. A traffic flow dataset is constructed based on the number of vehicles in each road photo and the time each photo was taken. The traffic flow dataset is split into a first training set and a first test set; A traffic flow prediction model is constructed based on the LSTM model. The traffic flow prediction model includes an input layer, a hidden layer, and an output layer. The traffic flow prediction model is trained based on the first training set to obtain the trained traffic flow prediction model. Based on the trained traffic flow-assisted prediction model, highway traffic flow is predicted on the test dataset to obtain the first prediction result for the first test set. Based on the first test set and the first prediction results corresponding to the first test set, calculate the error index corresponding to the traffic flow auxiliary prediction model. When the error index corresponding to the traffic flow auxiliary prediction model meets the preset first error index condition, the traffic flow auxiliary prediction model is determined as the target auxiliary prediction model. Traffic flow on highways is predicted based on a target-assisted prediction model, and the auxiliary prediction results of highway traffic flow are obtained.

7. The intelligent prediction method for highway traffic flow as described in claim 6, characterized in that, The method further includes: Based on the error index of the target-assisted prediction model and the error index of the highway traffic flow prediction model, the weights of the highway traffic flow assisted prediction results and the highway traffic flow prediction results are determined. Based on the auxiliary prediction results of highway traffic flow and their corresponding weights, as well as the prediction results of highway traffic flow and their corresponding weights, the comprehensive prediction results of highway traffic flow are determined.

8. An intelligent traffic flow prediction device for highways, characterized in that, The device includes: The module is used to build a highway traffic flow prediction model, which includes an input layer, a CNN convolutional layer, a CNN pooling layer, an LSTM layer, and an output layer. The acquisition module is used to acquire the target dataset and split it into a training dataset and a test dataset. The target dataset includes spatiotemporal data obtained by ETC identification of vehicles passing through highway ETC gantries and toll station ETC, as well as spatiotemporal data obtained by recording vehicles passing through manual lanes at toll stations. The training module is used to train the highway traffic flow prediction model based on the training dataset to obtain the trained highway traffic flow prediction model. The prediction module is used to predict highway traffic flow based on the trained highway traffic flow prediction model, and obtain highway traffic flow prediction results.

9. An intelligent traffic flow prediction system for highways, characterized in that, The system includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to perform the steps in the intelligent prediction method for highway traffic flow as described in any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, execute the steps in the intelligent prediction method for highway traffic flow as described in any one of claims 1-7.