A holiday highway traffic flow prediction method based on deep learning
By constructing a deep learning model optimized with multi-dimensional feature vectors and genetic algorithms, the problems of highway congestion propagation and sample scarcity during holidays were solved, achieving high-precision congestion prediction and decision support.
Patent Information
- Application Number
- CN202611301849.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-27
AI Technical Summary
Existing methods for predicting short-term travel time on highways struggle to capture the characteristics of congestion propagation between adjacent road segments during holidays, and the scarcity of holiday samples leads to overfitting or poor generalization ability of the models.
By constructing multi-dimensional feature vectors for holidays, screening similar samples and generating an enhanced training set, combining convolutional neural networks to extract local spatiotemporal features, and optimizing the hyperparameters of the long short-term memory network model through a genetic algorithm, the congestion situation on highways during holidays can be predicted.
It significantly improves the accuracy and practicality of highway congestion prediction during holidays, providing traffic management departments with quantitative decision-making basis and reducing prediction fluctuations caused by manual parameter settings.
Smart Images

Figure CN123182408A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of highway operation status prediction technology, and in particular to a method for predicting highway traffic flow during holidays based on deep learning. Background Technology
[0002] During holidays, highway travel demand surges dramatically within a short period. Factors such as intercity family visits, tourist returns, toll-free policies, service area stops, and disturbances around toll stations and interchanges combine to create highly random, non-linear, and sudden fluctuations in travel times. Once congestion forms on a localized section, it easily spreads to adjacent sections, triggering further queues and impacting regional road network efficiency and road safety. With the widespread deployment of ETC gantry systems, precise segment-level vehicle travel times can be obtained based on gantry traffic data, providing high-precision data support for short-term traffic forecasting. Therefore, timely and reliable congestion forecasting for highways during holidays is necessary and urgent for issuing advance guidance information, organizing traffic diversion and control, allocating emergency resources, and reducing the risk of secondary congestion.
[0003] However, existing methods for predicting short-term travel times on highways still have many shortcomings when facing holiday scenarios. Traditional methods such as the historical average method and the Autoregressive Differential Integrated Moving Average (ARIMA) model are based on linear assumptions and have limited ability to characterize sudden fluctuations during holidays. Although machine learning models such as support vector machines and random forests can handle nonlinear relationships, they are insufficient in mining the spatiotemporal coupling features between adjacent road segments. Although the Long Short-Term Memory (LSTM) model can handle long-term dependencies in time series, it is essentially only a time-dimensional model and lacks the ability to explicitly model the direction and speed of congestion propagation between consecutive road segments. Although some studies have attempted to combine convolutional neural networks (CNN) with LSTM, most methods are not specifically designed for the scarce sample characteristics of holidays. The limited frequency of holidays and insufficient available training samples lead to models that are prone to overfitting or have poor generalization ability. In addition, the hyperparameters of LSTM models (such as the number of neurons and the number of training rounds) usually rely on manual experience to set, and the prediction results fluctuate greatly under different road segments and different holiday periods, making it difficult to adaptively adjust. Summary of the Invention
[0004] To address the challenges of concentrated traffic demand, strong spatiotemporal fluctuations, and the difficulty of conventional short-term prediction models in capturing congestion propagation between adjacent road segments during holidays, as well as the scarcity of holiday samples, this application proposes a deep learning-based method for predicting highway traffic flow during holidays.
[0005] Firstly, this application provides a method for predicting highway traffic flow during holidays based on deep learning, employing the following technical solution:
[0006] A deep learning-based method for predicting highway traffic flow during holidays, the method comprising:
[0007] S1. Collect historical and predicted highway gantry traffic data and holiday attribute data for holidays;
[0008] S2. Clean the gantry traffic data and calculate the average travel time for each predicted road segment at the corresponding time granularity;
[0009] S3. Construct a multi-dimensional feature vector for holidays, filter historical similar samples that match the holidays to be predicted through similarity measurement, assign training weights to similar samples and supplement them with generative augmentation samples to form an augmentation training sample set;
[0010] S4. Construct holiday prediction samples based on the enhanced training sample set to form an input feature matrix containing prediction road segment dimension, time window dimension and feature channel dimension;
[0011] S5. Extract local spatiotemporal features of the input feature matrix through a convolutional neural network module;
[0012] S6. Predict the average travel time of road segments during the holiday prediction period using a genetic algorithm-long short-term memory network module;
[0013] S7. Output the predicted results of highway congestion during holidays.
[0014] By adopting the above technical solution, historical similar holiday samples are screened through multi-dimensional similarity measurement and training weights are assigned. An enhanced training sample set is constructed by combining generative sample expansion. Local spatiotemporal features are extracted using CNN. The average travel time is predicted by the genetic algorithm-long short-term memory network module, and the holiday highway congestion prediction results are output.
[0015] Optionally, in step S1, the road section between adjacent gantries of the target highway is used as the predicted road segment;
[0016] The collected gantry passage data includes upstream gantry identifier, downstream gantry identifier, vehicle identifier, vehicle passage time, and vehicle type;
[0017] The collected holiday attribute data includes holiday type, holiday period, holiday day number, time from holiday start, and time from holiday end;
[0018] The predicted road segment is a single adjacent gantry section, or multiple consecutive adjacent gantry sections arranged in an upstream-downstream order;
[0019] The time granularity is a preset short-term prediction granularity.
[0020] By adopting the above technical solution, adjacent gantry sections are used as predicted road segments. Gantry traffic data and holiday attribute data are collected. The predicted road segment can be a single road segment or multiple consecutive road segments. The time granularity is a preset short-term prediction granularity, ensuring the integrity and standardization of data collection.
[0021] Optionally, in step S2, vehicle passage records for the same predicted road segment are filtered according to vehicle identifier, upstream gantry identifier, downstream gantry identifier and time interval, and duplicate records, records with missing key fields and logical error records where the downstream gantry passage time is earlier than the upstream gantry passage time are deleted.
[0022] When travel time data is missing within a time granularity, interpolation is performed to complete the data using the average travel time of adjacent time granularities.
[0023] For predicted road segments The first For each vehicle, the travel time is determined by the difference between the time it takes for the vehicle to pass through the downstream gantry and the time it takes to pass through the upstream gantry.
[0024] For predicted road segments At time granularity The predicted road segment is obtained by averaging the single-vehicle travel time of each effective vehicle within the set of effective vehicles at that time granularity. At time granularity Average travel time within the area;
[0025] The anomaly removal range is determined by combining the predicted road segment length, speed limit, and the mean and standard deviation of the single-vehicle travel time samples, so as to remove abnormal travel time records;
[0026] The formulas for calculating single-ride trip time and average trip time are as follows:
[0027]
[0028]
[0029] in, Indicates the predicted road segment. Indicates time granularity. Indicates the vehicle serial number. and They represent the first The time it takes for a vehicle to pass through the downstream and upstream gantries. Indicates road segment At time granularity The number of valid vehicles within the area.
[0030] By adopting the above technical solution, data cleaning is performed by deleting duplicate, missing, and logically erroneous records. When missing records are found, interpolation is performed using the mean of adjacent time granularity. The calculation formulas and parameter definitions for single-vehicle travel time and average travel time are also given to ensure data quality.
[0031] Optionally, in step S3, multi-dimensional attribute features of each historical holiday and the holiday to be predicted are extracted, corresponding holiday feature vectors are constructed, weighted comprehensive similarity coefficients of each historical holiday and the holiday to be predicted are calculated, and historical samples whose similarity coefficients meet preset conditions are selected as similar samples.
[0032] The formula for calculating the weighted composite similarity coefficient is:
[0033]
[0034] in, Indicates the first The comprehensive similarity coefficient between historical holidays and the holidays to be predicted. This represents the total number of feature dimensions for holidays. Indicates the first The first historical holiday 3D eigenvalues This indicates the number of holidays to be predicted. 3D eigenvalues Indicates the first Weight coefficients of dimensional features.
[0035] By adopting the above technical solution, a multi-dimensional feature vector of holidays is constructed, the weighted comprehensive similarity coefficient between each historical holiday and the holiday to be predicted is calculated, the calculation formula and the meaning of each symbol are given, and a set of similar samples is obtained by setting screening conditions.
[0036] Optionally, in step S3, the training weight of the sample is calculated based on the comprehensive similarity coefficient corresponding to each similar sample, and the sample with higher similarity has a larger training weight.
[0037] Simultaneously, sample pairs are selected from the similar sample set to perform feature interpolation to generate new enhanced samples, and the training weights of the generated samples are determined according to the interpolation ratio.
[0038] The weighted historical similar samples and the generative augmented samples are combined to form the augmented training sample set;
[0039] The formulas for calculating the training weights of historically similar samples, the feature vectors of generatively augmented samples, and the training weights are as follows:
[0040]
[0041]
[0042]
[0043] in, Indicates the first Training weights for similar samples, Indicates the first The comprehensive similarity coefficient is calculated from a number of similar samples. This represents the set of similar samples obtained through filtering. This represents the generated enhanced sample feature vector. , These are the feature vectors of two parent samples selected from a set of similar samples. These are the interpolation coefficients whose values are within a preset range. This represents the training weights corresponding to the generated augmented samples. , These are the training weights corresponding to the two parent samples.
[0044] By adopting the above technical solution, the training weight of the samples is calculated based on the similarity coefficient. The higher the similarity, the greater the weight. Enhanced samples are generated through feature interpolation. The weighted historical similar samples and the generated samples are combined to form an enhanced training sample set.
[0045] Optionally, in step S4, the average travel time of multiple consecutive historical time granularities and holiday attribute features are jointly organized into an input feature matrix, so that the holiday prediction sample includes prediction road segment dimension, time window dimension and feature channel dimension.
[0046] For single-segment prediction, the predicted segment dimension is 1;
[0047] For multi-segment prediction, the predicted segment dimensions are arranged in the upstream and downstream order of the predicted segments;
[0048] Each training sample corresponds to its own training weights, which are used for loss weighting calculations during the model training phase.
[0049] By adopting the above technical solution, an input feature matrix is constructed that includes the predicted road segment dimension, time window dimension, and feature channel dimension. When predicting a single road segment, the road segment dimension is 1. When predicting multiple road segments, they are arranged in the order of upstream and downstream. Each sample is matched with its own training weight.
[0050] Optionally, in step S5, the convolutional neural network module performs a two-dimensional convolution operation on the input feature matrix, causing the convolution kernel to slide in the time window dimension and the predicted road segment dimension. After activation operation, local spatiotemporal features are obtained, which are used to extract the travel time fluctuation features of adjacent time periods and the congestion propagation features of adjacent predicted road segments during holidays.
[0051] The convolutional output of the convolutional neural network module is activated, pooled, or flattened to form a local spatiotemporal feature sequence.
[0052] The formula for calculating two-dimensional convolution is:
[0053]
[0054] in, Indicates the first Local spatiotemporal features output by each convolutional kernel This represents the activation function. Indicates the convolution kernel weights, Indicates the bias term. , , These represent the dimensions of the convolution kernel in the road segment dimension, time window dimension, and feature channel dimension, respectively.
[0055] By adopting the above technical solution, CNN performs two-dimensional convolution operation on the input feature matrix. The convolution kernel slides in the time window and road segment dimensions to extract local spatiotemporal features. The calculation formula for two-dimensional convolution and the definition of each symbol are given.
[0056] Optionally, in step S6, the genetic algorithm encodes the hyperparameters of the long short-term memory network model into individual genes and generates a parameter population. Each decoded individual is fed into the long short-term memory network model for training. The weighted mean square error is used as the fitness evaluation index, and the minimum weighted mean square error is used as the optimization objective.
[0057] The formulas for calculating the weighted mean square error and the optimal parameter individual are as follows:
[0058]
[0059]
[0060] in, Represents the first in population P Individual parameters Indicates the number of samples involved in the calculation. Indicates the first The training weights corresponding to each training sample This represents the actual average travel time. Indicates by individual The predicted average travel time is obtained from the corresponding parameters. This represents the individual with the optimal objective parameters.
[0061] By adopting the above technical solution, the genetic algorithm encodes LSTM hyperparameters into individual genes and generates a population. Using weighted mean square error as the fitness evaluation index, it provides the MSE and the optimal individual calculation formula, and realizes the automatic optimization of model parameters.
[0062] Optionally, in step S6, the genetic algorithm performs selection, crossover, and mutation operations on the parameter population. When the number of iterations reaches a preset number or the fitness meets the convergence condition, the optimal target parameter individual is output, and the optimal target parameter individual is decoded into long short-term memory network model parameters.
[0063] A time-series prediction model is established using the parameters of the Long Short-Term Memory network model to perform time-series prediction on local spatiotemporal feature sequences, thereby obtaining the predicted average travel time for holiday prediction periods.
[0064] The gating formula for a Long Short-Term Memory (LSTM) network unit is:
[0065]
[0066]
[0067]
[0068]
[0069]
[0070] in, This indicates that the convolutional neural network module is at time 1000. Output local spatiotemporal features, , , These represent the forget gate, input gate, and output gate, respectively. Indicates the cell state. This indicates a hidden state. This indicates element-wise multiplication.
[0071] In the model evaluation phase, the mean absolute error and mean absolute percentage error are used to evaluate the prediction performance. The calculation formula is as follows:
[0072]
[0073]
[0074] in, This represents the actual average travel time. This indicates the predicted average travel time.
[0075] By adopting the above technical solution, the genetic algorithm performs selection, crossover, mutation, and iteration until convergence, and outputs the optimal parameters to establish an LSTM model to predict travel time. The LSTM gating formula and the calculation formulas for MAE and MAPE evaluation indicators are given.
[0076] Optionally, in step S7, the predicted average travel time is compared with the congestion discrimination threshold corresponding to the predicted road segment to determine the congestion status or congestion level of the predicted road segment during the predicted holiday period.
[0077] The congestion judgment threshold is determined based on at least one of the following: predicted road segment length, speed limit, historical holiday average travel time distribution, or thresholds set by the management department.
[0078] The output includes predicted road segment identification, predicted time period, predicted average travel time, and congestion status or congestion level;
[0079] For the continuous road segment prediction scenario, steps S1 to S7 are executed for each predicted road segment, and the predicted average travel time and congestion prediction results of each predicted road segment are spliced together in the upstream and downstream order to form the congestion situation of continuous road segments on highways during holidays, which is used to identify the congestion starting point, congestion spread direction, congestion duration and key control road segments.
[0080] The formula for determining congestion is:
[0081]
[0082] in, Indicates predicted road segment The corresponding congestion detection threshold, Indicates predicted road segment During the forecast period The congestion within the area. Indicates predicted road segment During the forecast period The predicted average travel time within the area.
[0083] By adopting the above technical solution, the congestion status is determined by comparing the predicted travel time with the congestion threshold. The threshold can be determined based on road segment length, speed limit, historical distribution or management settings. Continuous road segments can be spliced to form a situation map and a congestion status discrimination formula can be given.
[0084] In summary, this application includes at least one of the following beneficial technical effects:
[0085] (1) This invention constructs multi-dimensional feature vectors for holidays and calculates weighted comprehensive similarity coefficients to select the most similar samples that match the holidays to be predicted from limited historical holiday data. Combined with similar sample weighting and generative feature interpolation expansion strategy, it effectively solves the problems of insufficient model training and overfitting caused by the scarcity of holiday traffic samples, and significantly improves the diversity and representativeness of training samples.
[0086] (2) The present invention sets up a convolutional neural network module, which enables the convolutional kernel to slide simultaneously in the time window dimension and the predicted road segment dimension to extract local spatiotemporal features, thereby enhancing the model's ability to express sudden congestion during holidays, queue spread and linkage changes between adjacent road segments, making up for the shortcomings of using the LSTM model alone in explicitly modeling spatial correlation, and improving the accuracy of predicting congestion situation of continuous road segments.
[0087] (3) This invention uses a genetic algorithm to automatically search and optimize key hyperparameters such as the number of training rounds and the number of neurons in the LSTM model, and introduces sample training weights in fitness evaluation, so that highly similar samples can play a greater role in parameter optimization, effectively reducing the prediction fluctuations caused by manual parameter setting, and enabling the model parameters to adapt to the traffic operation characteristics of different road sections and different holiday scenarios.
[0088] (4) This invention organically combines similar sample enhancement, CNN local spatiotemporal feature extraction and genetic algorithm-long short-term memory network temporal prediction to form a complete technical closed loop from data enhancement, feature extraction to parameter optimization. The output results cover the predicted travel time of road segments, congestion status and congestion situation of continuous road segments. It can provide quantitative decision-making basis for traffic management departments to release guidance information in advance, implement diversion control and allocate emergency resources, and significantly improve the accuracy and practicality of highway congestion prediction during holidays. Attached Figure Description
[0089] Figure 1 This is a framework diagram of a deep learning-based method for predicting highway traffic flow during holidays, as proposed in this invention.
[0090] Figure 2 This is a flowchart of the genetic algorithm-long short-term neural network parameter optimization proposed in this invention. Detailed Implementation
[0091] The embodiments of this application are described in detail below, and examples of the embodiments are shown in the accompanying drawings.
[0092] In the description of this specification, the references to "certain embodiments," "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples" refer to specific features, structures, materials, or characteristics described in connection with the described embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0093] This application discloses a method for predicting highway traffic flow during holidays based on deep learning, referring to... Figure 1 The method filters historical similar holiday samples through multi-dimensional similarity measurement and performs weighted enhancement. It combines generative sample expansion to construct an enhanced training sample set, uses a convolutional neural network module to extract local spatiotemporal features, and uses a genetic algorithm-long short-term memory network module to predict the average travel time of road segments within the holiday prediction period, thereby outputting the holiday highway congestion prediction results.
[0094] The method is implemented by the following steps:
[0095] S1. Collect historical and predicted highway gantry traffic data and holiday attribute data for holidays.
[0096] Using the road section between adjacent gantries of the target highway as the predicted road segment, gantry traffic data, including historical holidays and holidays to be predicted, is collected. The ETC gantry system records the travel trajectory of each ETC-equipped vehicle, providing a data foundation for accurate calculation of road segment travel time. The collected gantry traffic data includes: upstream gantry identifier, downstream gantry identifier, vehicle identifier (such as license plate number or OBU number), vehicle passage time, and vehicle type. The collected holiday attribute data includes: holiday type (such as Spring Festival, National Day, Qingming Festival, Labor Day, etc.), holiday stage (such as before holiday, during holiday, after holiday), holiday day sequence (such as the first day of holiday, the second day of holiday, etc.), time from the start of holiday, and time from the end of holiday.
[0097] The predicted road segment is denoted as It can be a single adjacent gantry interval or multiple consecutive adjacent gantry intervals arranged in an upstream-downstream order. For multi-segment prediction scenarios, the order of the predicted road segments should be consistent with the upstream-downstream direction of the actual road to preserve the spatial adjacency relationship between consecutive road segments; the fixed time granularity is denoted as... The granularity of short-term predictions can be set to 5 minutes, 10 minutes, 15 minutes, or other short-term prediction granularities required by traffic management departments. The choice of granularity directly affects the timeliness and data stability of the prediction: the smaller the granularity (e.g., 5 minutes), the higher the temporal resolution of the prediction results, but the number of effective vehicles in a single time window may be lower, leading to greater fluctuations in the average travel time statistics; the larger the granularity (e.g., 15 minutes), the more stable the data, but the more precise the prediction becomes, and the weaker the ability to respond to short-term sudden congestion. In practical applications, 10 minutes is usually chosen as the baseline granularity for short-term traffic prediction on highways. In sections with high traffic volume, it can be shortened to 5 minutes, and in sections with low traffic volume, it can be relaxed to 15 minutes.
[0098] S2. Clean the gantry traffic data and calculate the average travel time for each predicted road segment at the corresponding time granularity.
[0099] During the collection process, gantry passage data may contain issues such as duplicate records, missing fields, and time logic errors. Systematic data cleaning is required. Specifically, vehicle passage records for the same predicted road segment are filtered according to vehicle identifier, upstream gantry identifier, downstream gantry identifier, and time interval. The following three types of abnormal records are deleted: (1) Duplicate records: the same vehicle has multiple identical passage records at the same gantry; (2) Records with missing key fields: records that are missing any of the key fields of upstream gantry identifier, downstream gantry identifier, or vehicle passage time; (3) Logical error records: records where the downstream gantry passage time is earlier than the upstream gantry passage time.
[0100] For the cleaned and valid data, aggregation is performed according to a fixed time granularity. At a certain time granularity... When travel time data is missing, the average travel time of adjacent time granularities is used for mean interpolation. If multiple time granularities are missing consecutively, linear interpolation or a combination of forward and backward filling is used. In addition, the range of outliers should be determined by combining the predicted road segment length, road segment design speed limit, and the mean and standard deviation of single vehicle travel time samples. Travel time records outside the range are considered outliers and are removed. These outliers usually come from vehicles stopping for a long time in service areas, abnormal driving behavior, or gantry equipment reading errors.
[0101] The calculation of single-bike trip time and average trip time is as follows:
[0102]
[0103]
[0104] in, Indicates the predicted road segment number. Indicates a fixed time granularity (e.g., 10 minutes). Indicates the vehicle serial number. and They represent the first The time it takes for a vehicle to pass through the downstream gantry and the upstream gantry (both timestamps are directly recorded by the ETC gantry system). Indicates road segment At time granularity The number of valid vehicles within the area directly determines the reliability of the average travel time statistics. When the time granularity is too small (e.g., less than 3 vehicles), the average travel time statistics at this time granularity are not representative enough, and smoothing processing is required by combining data from adjacent time granularities. When the sample size is large (e.g., more than 30 vehicles), the standard error of the sample mean decreases significantly, and the confidence level of the statistical results is high.
[0105] S3. Construct multi-dimensional feature vectors for holidays, filter historical similar samples that match the holidays to be predicted through similarity measurement, assign training weights to similar samples and supplement them with generative augmentation samples to form an augmented training sample set.
[0106] Traffic flow patterns during holidays are influenced by a variety of factors, and there are both commonalities and significant differences between different holidays. In order to select the most valuable training samples for current prediction from limited historical holiday data, this invention constructs a multi-dimensional holiday feature vector.
[0107] Specifically, multi-dimensional attribute features are extracted for each historical holiday and the holiday to be predicted, including but not limited to: holiday type (e.g., Spring Festival, National Day, Qingming Festival), holiday phase (before, during, and after the holiday), total number of holiday days, holiday day number, time from holiday start (in hours), time from holiday end (in hours), and whether it is a toll-free holiday. These features are then organized into a holiday feature vector. subscript Indicates the first A historical holiday, Indicates the total number of feature dimensions. The value is determined based on the available attribute fields, usually 5 to 10 dimensions. Each feature needs to be standardized before input similarity calculation to eliminate differences in units. For numerical features (such as the time since the start of the holiday), Z-score standardization is used; for categorical features (such as holiday type), One-Hot encoding is used or ordered values are assigned according to business importance.
[0108] Calculate the weighted comprehensive similarity coefficient between each historical holiday and the holiday to be predicted:
[0109]
[0110] in, Indicates the first The comprehensive similarity coefficient between historical holidays and the holidays to be predicted is used, with values closer to 1 indicating greater similarity and values closer to 0 indicating greater difference. Indicates the first The first historical holiday 3D eigenvalues This indicates the number of holidays to be predicted. 3D eigenvalues Indicates the first The weight coefficients of the dimensional features are used to characterize the importance of different holiday attributes on traffic patterns. For example, the impact of holiday type (Spring Festival vs. National Day) is usually greater than the impact of holiday day sequence (day 1 vs. day 2). Therefore, holiday type should be given a higher weight. The determination methods can be: (1) Analytic Hierarchy Process (AHP), where experts in the transportation field compare the importance of each feature pairwise, construct a judgment matrix, and then calculate the weight; (2) Entropy weight method, where the weight is objectively calculated based on the information entropy of each feature in historical data. The smaller the information entropy (i.e., the greater the degree of variation of the feature between different holidays), the greater the weight; (3) Combination weighting method, where subjective weights and objective weights are combined and weighted, and the sum of all dimension weights is usually normalized to 1.
[0111] Filtering similarity coefficients Historical samples that meet preset conditions are considered similar samples. These preset conditions can be: A value greater than a certain threshold (typically 0.7~0.85) is also acceptable. Sort by first Bit( Typically, a threshold of 5-15 is used. The threshold setting needs to balance sample quantity and similarity quality: a threshold that is too high (e.g., >0.9) may result in insufficient selected similar samples, making it difficult to support subsequent model training; a threshold that is too low (e.g., <0.6) may introduce samples that differ significantly from the traffic patterns of the holidays to be predicted, reducing the relevance of the training data. The selected similar samples constitute a similar sample set. .
[0112] For the selected similar sample set The training weights of the samples are calculated based on the comprehensive similarity coefficients corresponding to each similar sample.
[0113]
[0114] in, This represents the set of similar samples obtained through filtering. Indicates the first The comprehensive similarity coefficient calculated above for each similar sample This is the weight coefficient of the m-th similar sample in subsequent model training. The sum of the weights of all selected samples is 1. The design principle of this weight coefficient is that the more similar the historical sample is to the holiday features to be predicted, the more valuable its traffic flow change pattern is, and it should be given a greater influence weight in model training.
[0115] To further enrich the diversity of training samples and alleviate the problem of insufficient sample quantity, this invention also employs a generative sample augmentation strategy, drawing from similar sample sets... Two feature vectors of the mother sample are randomly selected. and Perform feature interpolation to generate new enhanced samples:
[0116]
[0117]
[0118] in, This represents the generated enhanced sample feature vector. , These are the feature vectors of two parent samples selected from a set of similar samples. These are interpolation coefficients, with values within a preset range. Inside, The value can be obtained in the following ways: (1) In (1) Generate enhanced samples by random uniform sampling within the interval, so that the enhanced samples are evenly distributed among the parent samples; (2) Generate multiple enhanced samples with a specific ratio by discrete sampling at a fixed step size (such as 0.1, 0.25 or 0.5); (3) Use Beta distribution sampling to concentrate the interpolation coefficients around 0.5, so as to generate samples that are closer to the central region of the parent sample. This represents the training weights corresponding to the generated augmented samples. , These are the training weights corresponding to the two parent samples. Through the above generation strategy, the training sample size can be expanded to 2 to 5 times the original size without introducing additional experimental data, effectively alleviating the model overfitting problem caused by the scarcity of samples during holidays.
[0119] S4. Construct holiday prediction samples based on the enhanced training sample set to form an input feature matrix containing prediction road segment dimension, time window dimension, and feature channel dimension.
[0120] The average travel time data in the enhanced training sample set is combined with holiday attribute features to form the input feature matrix, which contains three core dimensions:
[0121] (1) Predicted road segment dimension, which corresponds to the travel time series of different predicted road segments. When predicting a single road segment, this dimension takes the value of 1; when predicting multiple road segments, it takes the value of the actual number of consecutive road segments (usually 3 to 10). The road segments are arranged in the order of upstream and downstream. The design of this dimension allows the convolution kernel of the convolutional neural network to slide between adjacent road segments, thereby capturing the propagation characteristics of congested road segments.
[0122] (2) The time window dimension corresponds to the number of historical time granularities covered by the input sequence. Its value directly affects the model's utilization of historical information: if the value is too small (e.g., 6 time steps, corresponding to 60 minutes), the model may be unable to capture the complete trend of congestion evolution; if the value is too large (e.g., 36 time steps, corresponding to 360 minutes), too much historical noise may be introduced, and the computational burden of the model may be increased. In practical applications, the time window dimension is usually taken as 12 to 24 time steps (corresponding to a historical window of 2 to 4 hours). This window length can cover the complete process of congestion from formation to spread, and will not dilute the weight of recent data due to the excessive length of the sequence.
[0123] (3) Feature channel dimension, corresponding to the travel time value and holiday attribute feature encoding at each time granularity. The number of channels is usually 5 to 10, including: average travel time channel, holiday type encoding channel, holiday stage encoding channel, holiday day sequence channel, time from holiday start channel, time from holiday end channel, etc. The design of multi-dimensional feature channels enables the model to learn the temporal evolution law of travel time and the influence mechanism of holiday attributes at the same time.
[0124] Each training sample corresponds to its own set of training weights. It is used for loss weighting calculation during the model training phase.
[0125] S5. Extract local spatiotemporal features of the input feature matrix through a convolutional neural network module.
[0126] Convolutional Neural Networks (CNNs) have powerful local feature extraction capabilities and can automatically learn meaningful feature patterns in local regions of input data. This invention sets up a convolutional neural network module to perform two-dimensional convolution operations on the input feature matrix, so that the convolution kernel slides simultaneously in the time window dimension and the predicted road segment dimension, thereby simultaneously extracting travel time fluctuation features in the time neighborhood and congestion propagation features in the spatial neighborhood.
[0127] The form of two-dimensional convolution operation is as follows:
[0128]
[0129] in, Indicates the first Each convolutional kernel is located at... Output local spatiotemporal features, The convolution kernel number (or filter number) is typically set to 16-64 to extract spatiotemporal features from different modes. A higher number of kernels results in stronger feature extraction capabilities, but also increases computational cost and the risk of overfitting. In practice, 16, 32, and 64 are typical values, and adjustments are made on the validation set based on performance. The activation function is typically represented by ReLU, which introduces non-linearity and mitigates the vanishing gradient problem. The advantages of ReLU are its computational simplicity and ability to generate sparse activations, which improves model training efficiency and generalization ability. Indicates the first Each convolutional kernel is located at... The weight value, Indicates the first The bias terms corresponding to each convolution kernel and These are all parameters automatically learned during model training through backpropagation and gradient descent algorithms (such as the Adam optimizer). Initial values can be randomly generated using Xavier initialization (for ReLU activation functions, He initialization is also possible) to maintain stable gradient variance during forward and backward propagation. This represents the size of the convolution kernel in the predicted road segment dimension, i.e., the number of adjacent road segments covered in one convolution operation. A typical value is 3-5. Values that are too small (e.g., 1) degenerate into single-segment feature extraction, failing to capture the congestion propagation relationship between road segments; values that are too large (e.g., >7) introduce too much irrelevant noise from distant road segments and increase the number of parameters. When the total number of predicted road segments is insufficient... In this case, a zero-padding strategy can be used to keep the spatial dimensions of the convolution output unchanged. This represents the size of the convolution kernel in the time window dimension, i.e., the number of historical time granularities covered by a single convolution operation. Typical values are 3 to 7, corresponding to a time range of 30 to 70 minutes (calculated with a time granularity of 10 minutes). B=3 can capture short-term (within half an hour) traffic fluctuation patterns, while B=7 can capture medium-term (approximately 1 hour) congestion evolution trends. Similar to the road segment dimension, a zero-padding strategy is also used in the time dimension to maintain the length of the time series. The dimension represents the size in the feature channel dimension, which is the total number of channels in the input feature matrix. Its value is automatically equal to the number of feature channels (usually 5 to 10). The convolution kernel does not slide in the channel dimension, but instead performs a weighted summation on all channels at the same position to achieve the fusion of multi-source features.
[0130] S6. Predict the average travel time of road segments during the holiday prediction period using a genetic algorithm-long short-term memory network module.
[0131] Long Short-Term Memory (LSTM) networks effectively solve the gradient vanishing and gradient exploding problems of traditional recurrent neural networks through gating mechanisms, making them suitable for handling strong nonlinear temporal dependencies in holiday travel times. However, the prediction performance of LSTM is highly dependent on hyperparameter settings, and manual parameter tuning is difficult to guarantee optimality for different road segments and holiday scenarios. This invention uses a genetic algorithm to automatically optimize the hyperparameters of LSTM. The genetic algorithm efficiently searches for the global optimum in the parameter space by simulating a natural evolutionary process. The specific process is as follows:
[0132] (1) Encoding and Population Initialization: The hyperparameters to be optimized in the LSTM model are encoded into individual genes to form chromosomes. In this invention, each individual... The encoded content includes: the number of neurons in the LSTM hidden layer (usually an integer between 32 and 256) and the number of training rounds (usually an integer between 50 and 500). In some implementations, the encoding learning rate and batch size can also be expanded (typically 16, 32, or 64). The population P consists of N individuals, and the population size N is usually set to 20-50. If the size is too small, it is easy to get trapped in local optima, and if the size is too large, it will significantly increase the computation time. Individuals in the initial population are randomly generated within their respective value ranges to ensure the diversity of the population.
[0133] (2) Fitness evaluation; each individual After decoding, the data is fed into the LSTM model for training, and the weighted mean square error between the predicted value and the actual average travel time is used as the fitness evaluation metric.
[0134]
[0135] Where M is the total number of training samples, which is usually in the hundreds to thousands; For the first The training weights of each training sample are introduced so that samples with higher similarity to the holiday to be predicted contribute more gradient information in hyperparameter optimization, guiding the genetic algorithm to search for the optimal parameter combination that is more suitable for the characteristics of the holiday to be predicted. This represents the actual average travel time. For individuals For the predicted values under the corresponding parameters, the smaller the weighted mean square error, the better the fitness of the individual.
[0136] (3) Selection operation: Select superior individuals from the current population to enter the next generation based on fitness value. This invention adopts roulette wheel selection (the higher the fitness, the greater the probability of being selected) or tournament selection strategy, and combines it with elite retention strategy to directly retain the top 10%~20% of individuals with the best fitness to the next generation, ensuring that the optimal solution will not be lost in the evolution process.
[0137] (4) Crossover operation: Randomly pair up selected individuals and exchange some gene segments according to the crossover probability (usually 0.6~0.9) to generate new offspring individuals. The crossover operation combines the superior genes of two parent individuals to explore new regions in the parameter space that may contain better solutions. Commonly used crossover methods include single-point crossover, multi-point crossover and uniform crossover.
[0138] (5) Mutation operation: Randomly change the values of certain genes in individual individuals with a small mutation probability (usually 0.01~0.1) to maintain the diversity of the population and prevent it from getting trapped in local optima. For genes encoded with integers (such as the number of neurons), the mutation is to add a random integer offset to the current value; for genes encoded with real numbers (such as the learning rate), a random increment that follows a normal distribution is added.
[0139] (6) Iterative optimization and model building; repeatedly perform selection, crossover and mutation operations until the number of iterations reaches a preset value (usually 50~200 generations) or the fitness meets the convergence condition (e.g., fitness improvement is less than 1% for 10 consecutive generations), then stop the optimization and output the individual with the optimal target parameters:
[0140]
[0141] Will The optimal hyperparameter configuration for decoding into LSTM is used to establish an LSTM time series prediction model;
[0142] The gating operation of the LSTM unit is as follows:
[0143]
[0144]
[0145]
[0146]
[0147]
[0148] in, For the convolutional neural network module at time 1 The output local spatiotemporal feature vector is the input of the LSTM at the current time step; , , These are the forget gate, input gate, and output gate, respectively, and are gating vectors with values between 0 and 1, which control the degree of retention of historical information, the degree of writing of new information, and the degree of output of the current hidden state, respectively. For the unit state, long-term dependency information from the start time to the current time is stored; It is a hidden state, serving as both the output at the current moment and the input at the next moment; This indicates element-wise multiplication.
[0149] During the model evaluation phase, the data is divided into training, validation, and test sets in chronological order (the ratio is typically 6:2:2 or 7:1.5:1.5). The mean absolute error (MAE) and mean absolute percentage error (MAPE) are used to evaluate the prediction performance.
[0150]
[0151]
[0152] Among them, MAE has the same dimension as travel time, which is convenient for business understanding and threshold comparison; MAPE is a dimensionless relative error, which is suitable for comparing the prediction accuracy between road segments of different magnitudes. Usually, MAPE less than 15%~20% is used as the acceptance reference standard for good model prediction effect.
[0153] S7. Output the predicted results of highway congestion during holidays.
[0154] Predict average travel time With predicted road sections Corresponding congestion threshold By comparing the predicted road segments, the congestion status during the predicted holiday period can be determined:
[0155]
[0156] in, Indicates congestion. Indicates smooth flow. For predicted road sections The congestion detection threshold;
[0157] The congestion detection threshold The determination is based on at least one of the following: predicted road segment length, speed limit, historical average travel time distribution during holidays, or thresholds set by management departments. One method or a combination of methods can be selected. The combination method is a weighted sum of the results of the above methods.
[0158] The output includes predicted road segment identifiers, predicted time periods, predicted average travel time, and congestion status or congestion level. The congestion level can be determined based on... and The ratio is used to classify congestion, for example, a ratio <1 indicates smooth traffic, 1~1.3 indicates mild congestion, 1.3~1.8 indicates moderate congestion, and >1.8 indicates severe congestion;
[0159] For the continuous road segment prediction scenario, steps S1 to S7 are executed for each predicted road segment. The predicted average travel time and congestion prediction results of each predicted road segment are then concatenated in upstream and downstream order to form the congestion situation of continuous road segments on highways during holidays. This is used to identify the congestion starting point (the earliest spatially occurring point). The location of the road segment, corresponding to traffic bottlenecks such as toll stations and hub interchanges; the direction of congestion spread (by comparing the order in which adjacent road segments set their congestion status to 1 to identify whether congestion is queuing back upstream or impacting and propagating downstream); and the duration of congestion (by statistically analyzing the duration of each road segment that meets the criteria). The continuous time length) and key controlled road sections (high-frequency congestion with a congestion probability greater than 50%), or meet the following conditions and (Road sections with a ratio > 1.5).
[0160] This application also discloses a computer device, including a processor, wherein the processor runs a program of any one of the above-described deep learning-based method for predicting traffic flow on highways during holidays.
[0161] This application also discloses a storage medium storing a program for a deep learning-based method for predicting highway traffic flow during holidays, as described in any one of the above embodiments.
[0162] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A method for predicting highway traffic flow during holidays based on deep learning, characterized in that, The method includes: S1. Collect historical and predicted highway gantry traffic data and holiday attribute data for holidays; S2. Clean the gantry traffic data and calculate the average travel time for each predicted road segment at the corresponding time granularity; S3. Construct a multi-dimensional feature vector for holidays, filter historical similar samples that match the holidays to be predicted through similarity measurement, assign training weights to similar samples and supplement them with generative augmentation samples to form an augmentation training sample set; S4. Construct holiday prediction samples based on the enhanced training sample set to form an input feature matrix containing prediction road segment dimension, time window dimension and feature channel dimension; S5. Extract local spatiotemporal features of the input feature matrix through a convolutional neural network module; S6. Predict the average travel time of road segments during the holiday prediction period using a genetic algorithm-long short-term memory network module; S7. Output the predicted results of highway congestion during holidays.
2. The method for predicting highway traffic flow during holidays based on deep learning according to claim 1, characterized in that, In step S1, the road section between adjacent gantries of the target highway is used as the predicted road segment; The collected gantry passage data includes upstream gantry identifier, downstream gantry identifier, vehicle identifier, vehicle passage time, and vehicle type; The collected holiday attribute data includes holiday type, holiday period, holiday day number, time from holiday start, and time from holiday end; The predicted road segment is a single adjacent gantry section, or multiple consecutive adjacent gantry sections arranged in an upstream-downstream order; The time granularity is a preset short-term prediction granularity.
3. The method for predicting highway traffic flow during holidays based on deep learning according to claim 2, characterized in that, In step S2, vehicle passage records for the same predicted road segment are filtered according to vehicle identifier, upstream gantry identifier, downstream gantry identifier and time interval, and duplicate records, records with missing key fields and logical error records where the downstream gantry passage time is earlier than the upstream gantry passage time are deleted. When travel time data is missing within a time granularity, interpolation is performed to complete the data using the average travel time of adjacent time granularities. For predicted road segments The first For each vehicle, the travel time is determined by the difference between the time it takes for the vehicle to pass through the downstream gantry and the time it takes to pass through the upstream gantry. For predicted road segments At time granularity The predicted road segment is obtained by averaging the single-vehicle travel time of each effective vehicle within the set of effective vehicles at that time granularity. At time granularity Average travel time within the area; The anomaly removal range is determined by combining the predicted road segment length, speed limit, and the mean and standard deviation of the single-vehicle travel time samples, so as to remove abnormal travel time records; The formulas for calculating single-ride trip time and average trip time are as follows: ; ;in, Indicates the predicted road segment. Indicates time granularity. Indicates the vehicle serial number. and They represent the first The time it takes for a vehicle to pass through the downstream and upstream gantries. Indicates road segment At time granularity The number of valid vehicles within the area.
4. The method for predicting highway traffic flow during holidays based on deep learning according to claim 3, characterized in that, In step S3, multi-dimensional attribute features of each historical holiday and the holiday to be predicted are extracted, corresponding holiday feature vectors are constructed, weighted comprehensive similarity coefficients of each historical holiday and the holiday to be predicted are calculated, and historical samples whose similarity coefficients meet preset conditions are selected as similar samples. The formula for calculating the weighted composite similarity coefficient is: ;in, Indicates the first The comprehensive similarity coefficient between historical holidays and the holidays to be predicted. This represents the total number of feature dimensions for holidays. Indicates the first The first historical holiday 3D eigenvalues This indicates the number of holidays to be predicted. 3D eigenvalues Indicates the first Weight coefficients of dimensional features.
5. The method for predicting highway traffic flow during holidays based on deep learning according to claim 4, characterized in that, In step S3, the training weight of the sample is calculated based on the comprehensive similarity coefficient corresponding to each similar sample. The higher the similarity, the greater the training weight of the sample. Simultaneously, sample pairs are selected from the similar sample set to perform feature interpolation to generate new enhanced samples, and the training weights of the generated samples are determined according to the interpolation ratio. The weighted historical similar samples and the generative augmented samples are combined to form the augmented training sample set; The formulas for calculating the training weights of historically similar samples, the feature vectors of generatively augmented samples, and the training weights are as follows: ; ; ;in, Indicates the first Training weights for similar samples, Indicates the first The comprehensive similarity coefficient is calculated from a number of similar samples. This represents the set of similar samples obtained through filtering. This represents the generated enhanced sample feature vector. , These are the feature vectors of two parent samples selected from a set of similar samples. These are the interpolation coefficients whose values are within a preset range. This represents the training weights corresponding to the generated augmented samples. , These are the training weights corresponding to the two parent samples.
6. The method for predicting highway traffic flow during holidays based on deep learning according to claim 5, characterized in that, In step S4, the average travel time of multiple consecutive historical time granularities and holiday attribute features are organized together into an input feature matrix, so that the holiday prediction sample includes prediction road segment dimension, time window dimension and feature channel dimension. For single-segment prediction, the predicted segment dimension is 1; For multi-segment prediction, the predicted segment dimensions are arranged in the upstream and downstream order of the predicted segments; Each training sample corresponds to its own training weights, which are used for loss weighting calculations during the model training phase.
7. The method for predicting highway traffic flow during holidays based on deep learning according to claim 6, characterized in that, In step S5, the convolutional neural network module performs a two-dimensional convolution operation on the input feature matrix, causing the convolution kernel to slide in the time window dimension and the predicted road segment dimension. After activation operation, local spatiotemporal features are obtained, which are used to extract the travel time fluctuation features of adjacent time periods and the congestion propagation features of adjacent predicted road segments during holidays. The convolutional output of the convolutional neural network module is activated, pooled, or flattened to form a local spatiotemporal feature sequence. The formula for calculating two-dimensional convolution is: ;in, Indicates the first Local spatiotemporal features output by each convolutional kernel This represents the activation function. Indicates the convolution kernel weights, Indicates the bias term. , , These represent the dimensions of the convolution kernel in the road segment dimension, time window dimension, and feature channel dimension, respectively.
8. The method for predicting highway traffic flow during holidays based on deep learning according to claim 7, characterized in that, In step S6, the genetic algorithm encodes the hyperparameters of the long short-term memory network model into individual genes and generates a parameter population. Each decoded individual is fed into the long short-term memory network model for training. The weighted mean square error is used as the fitness evaluation index, and the minimum weighted mean square error is used as the optimization objective. The formulas for calculating the weighted mean square error and the optimal parameter individual are as follows: ; ;in, Represents the first in population P Individual parameters Indicates the number of samples involved in the calculation. Indicates the first The training weights corresponding to each training sample This represents the actual average travel time. Indicates by individual The predicted average travel time is obtained from the corresponding parameters. This represents the individual with the optimal objective parameters.
9. A method for predicting highway traffic flow during holidays based on deep learning according to claim 8, characterized in that, In step S6, the genetic algorithm performs selection, crossover, and mutation operations on the parameter population. When the number of iterations reaches a preset number or the fitness meets the convergence condition, it outputs the optimal target parameter individual and decodes the optimal target parameter individual into long short-term memory network model parameters. A time-series prediction model is established using the parameters of the Long Short-Term Memory network model to perform time-series prediction on local spatiotemporal feature sequences, thereby obtaining the predicted average travel time for holiday prediction periods. The gating formula for a Long Short-Term Memory (LSTM) network unit is: ; ; ; ; ;in, This indicates that the convolutional neural network module is at time 1000. Output local spatiotemporal features, , , These represent the forget gate, input gate, and output gate, respectively. Indicates the cell state. This indicates a hidden state. This indicates element-wise multiplication. In the model evaluation phase, the mean absolute error and mean absolute percentage error are used to evaluate the prediction performance. The calculation formula is as follows: ; ;in, This represents the actual average travel time. This indicates the predicted average travel time.
10. A method for predicting highway traffic flow during holidays based on deep learning according to claim 9, characterized in that, In step S7, the predicted average travel time is compared with the congestion discrimination threshold corresponding to the predicted road segment to determine the congestion status or congestion level of the predicted road segment during the predicted holiday period. The congestion judgment threshold is determined based on at least one of the following: predicted road segment length, speed limit, historical holiday average travel time distribution, or thresholds set by the management department. The output includes predicted road segment identification, predicted time period, predicted average travel time, and congestion status or congestion level; For the continuous road segment prediction scenario, steps S1 to S7 are executed for each predicted road segment, and the predicted average travel time and congestion prediction results of each predicted road segment are spliced together in the upstream and downstream order to form the congestion situation of continuous road segments on highways during holidays, which is used to identify the congestion starting point, congestion spread direction, congestion duration and key control road segments. The formula for determining congestion is: ;in, Indicates predicted road segment The corresponding congestion detection threshold, Indicates predicted road segment During the forecast period The congestion within the area. Indicates predicted road segment During the forecast period The predicted average travel time within the area.
