Intelligent traffic flow real-time prediction method

By constructing a hybrid feature network model of parallel convolutional layer-long and short-term memory layer combined with multi-head attention mechanism, and using the Shark and Tuna Alliance optimization algorithm to optimize hyperparameters, the shortcomings of traditional models in traffic flow prediction are solved, and high-precision and high-efficiency real-time traffic prediction are achieved.

CN120148252AActive Publication Date: 2025-06-13NANJING PINGAN TRANSPORTATION TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510636255.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-06-13
Estimated Expiration
2045-05-16

AI Technical Summary

Technical Problem

The traditional single model has shortcomings in the extraction of traffic flow characteristics, the hyperparameter optimization efficiency is low, and the static prediction model based on historical data is difficult to reflect the latest traffic flow trend.

Method used

A hybrid feature network model of parallel convolutional layer-long and short-term memory layer combined with multi-head attention mechanism is adopted, and hyperparameters are optimized through shark and tuna alliance optimization algorithms. Update the model dynamically in real time to adapt to the latest traffic flow data.

Benefits of technology

The accuracy and efficiency of traffic flow prediction are improved, and the local and global characteristics of traffic flow can better reflect the dynamic update mechanism enables the model to adapt to changes in traffic flow in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120148252A_ABST
    Figure CN120148252A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent traffic flow real-time prediction method, and belongs to the field of intelligent traffic, and the method comprises the steps: obtaining online monitored traffic flow data, and carrying out the preprocessing of the data; optimizing hyper-parameters of the mixed feature network model based on a shark and tuna alliance optimization algorithm (STA); secondly, according to the optimized hyper-parameters, training and constructing a mixed feature network model; thirdly, evaluating a prediction result through a moving average error every time the latest monitoring data is acquired, and performing real-time training and fine tuning on the hybrid feature network according to an evaluation result to realize real-time dynamic updating of the hybrid feature network; and finally, predicting the traffic flow of the next time period based on the updated mixed feature network. According to the invention, a basis can be provided for accurate traffic flow, refined traffic management, low-carbon emission reduction and energy optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent transportation, and in particular, to an intelligent traffic flow real-time prediction method. Background Art

[0002] The Intelligent Transportation System (ITS) is an important technical path to improve traffic congestion, enhance traffic safety, and achieve energy conservation, emission reduction, and sustainable development. Through the deep integration of Internet of Things, big data, and artificial intelligence technologies, ITS can perceive the road network status in real time, optimize resource allocation, and predict traffic situations, thereby reducing congestion costs, reducing carbon emissions, and enhancing the travel experience. In the multi-dimensional data ecosystem of intelligent transportation, traffic flow prediction is an important part of the intelligent transportation system (ITS), which helps traffic stakeholders use the traffic network safer and more intelligently, and is of great significance for achieving refined traffic management, tunnel lighting safety collaborative control, low-carbon emission reduction, and energy optimization.

[0003] Traditional model-driven traffic flow prediction methods cannot fully reflect the complexity and non-linear changes of traffic data, and it is difficult to effectively predict traffic flow; while the recently developed prediction methods based on historical data to establish deep learning models can better describe the distributed and hierarchical characteristics of traffic flow data and have better prediction effects. However, the existing methods still have the following problems: First, there are defects in extracting traffic flow characteristics by a single deep learning model, and it cannot fully reflect the local characteristics, global characteristics, and key information of traffic flow; second, the selection of model hyperparameters will directly affect the performance of the model, so high-performance optimization methods are needed to optimize the hyperparameters; third, historical data cannot fully reflect the characteristics of traffic flow changing with the development of the national economy, urban construction, and people's living standards. Therefore, it is crucial to establish a high-performance model that can fully mine traffic flow information, optimize the model, and realize the lightweight dynamic adjustment and update of the model based on the latest traffic flow data for high-precision and high-efficiency intelligent traffic flow real-time prediction. Summary of the Invention

[0004] The purpose of the present invention is to provide an intelligent traffic flow real-time prediction method, which can solve the problems of insufficient feature extraction of traditional single models, insufficient hyperparameter optimization efficiency, and the difficulty of static prediction models based on historical data to reflect the latest traffic flow trends, and proposes a new intelligent traffic flow real-time prediction method to provide reliable technical support for improving the accuracy and efficiency of intelligent traffic flow real-time prediction.

[0005] The present invention is implemented as follows: The technical solution for achieving the object of the present invention is: an intelligent traffic flow real-time prediction method, comprising the following steps: Step 1: Obtain historical traffic flow data obtained by online monitoring and preprocess the data; Step 2: Construct a hybrid feature network model framework based on a parallel convolutional layer-long short-term memory layer and combined with a multi-head attention mechanism, and set the hyperparameters to be optimized and the optimization range; Step 3: Optimize the hyperparameters of the hybrid feature network model based on the shark and tuna coalition optimization algorithm and historical traffic flow data; Step 4: Based on the optimized hyperparameters and historical traffic flow data, construct and train a hybrid feature network model; Step 5: Set the moving average error window size W 1 and dynamically update the start error E and the dynamic update window size W 2 ; For each newly obtained monitoring data, calculate the average value of the nearest W 1 predicted values, that is, the moving average error P. If P is greater than E, extract the latest W 2 monitoring data to perform real-time training and fine-tuning on the hybrid feature network, and achieve real-time dynamic update of the hybrid feature network; Step 6: Predict the traffic flow in the next time period according to the latest hybrid feature network.

[0006] Further, in Step 1, the historical traffic flow data includes date, time, day of the week, whether it is a holiday, and traffic flow data; the preprocessing of the data includes using the moving average method to smooth the traffic flow data, so as to remove short-term fluctuations and noises and retain the long-term trend; aggregating high-frequency data into low-frequency data to reduce data complexity and improve calculation efficiency; data normalization to eliminate dimension differences and improve the model training effect.

[0007] Further, in step two, the hybrid feature network model framework includes connecting an input layer to a parallel multi-scale convolutional layer and a long short-term memory layer, then splicing the outputs of the parallel branches through a splicing layer into one output, and successively connecting in series through a max pooling layer, a multi-scale self-attention mechanism layer, a random dropout layer, a global pooling layer, a fully connected layer, and an output layer; wherein, the input layer receives historical traffic flow data; in the parallel multi-scale convolutional layer and long short-term memory layer, the multi-scale convolutional layer extracts local features using different convolutional kernel sizes, and the long short-term memory layer captures long-term dependencies in the time series; the splicing layer splices the outputs of the CNN and LSTM branches in the feature dimension; the max pooling layer performs 1D max pooling on the spliced output; the multi-head self-attention mechanism layer uses the multi-head self-attention mechanism to capture the importance of different time steps in the sequence; the random dropout layer applies dropout to the output of the multi-head self-attention layer to prevent overfitting; the global pooling layer globally aggregates the features; the fully connected layer performs non-linear transformation on the selected time step features to further extract features; the output layer uses a fully connected layer to generate the final prediction result.

[0008] Further, in step two, the hyperparameters include the number of filters in the convolutional layer, the learning rate, the random dropout rate, the L2 regularization strength, the number of units in the long short-term memory layer, and the number of heads in the multi-head attention mechanism.

[0009] Further, in step three, the shark and tuna coalition optimization algorithm includes the following four stages: (I) Population initialization: 1. Generate the initial population: Randomly generate the initial population M i 0 , where each individual M i 0 's position is determined by the following formula: M i 0 = lb + (ub - lb) × rand(1, dim ) where M i 0 represents the position of the i th individual, i represents the individual number, i = 1, 2, …, N , N is the population size, and the superscript represents the iteration number, where 0 represents the initialization stage; lb and ubare the lower and upper limits of the search space, respectively, dim is the dimension of the problem to be optimized, and rand(1 ,dim ) generates a 1× dim random vector, whose elements are in the range [0, 1]; 2. Calculate the initial fitness value: Calculate the fitness value of each individual fitness(i) , fitness(i) = f obj (M i 0 ) , where f obj () is the fitness function; record the position of the historical optimal solution best_M and the historical optimal fitness value best_cost , and mark the individual with the optimal fitness as the shark individual, and other individuals as tuna individuals; (II) Update of shark individuals: Shark individuals perform global search through Levy flight and random perturbation: x shark iter+1 =x shark iter +α×levy(β,dim)+γ×(best_M - x shark iter )+ 0.1 × randn (1, dim) where x shark iter is the position of the shark individual, iter is the current iteration number, levy (β,dim) is the Levy flight function, randn (1,dim) generates a 1× dim matrix, and the elements follow the standard normal distribution. The parameters α、β and γ are calculated as follows: α = 0.1×(1 - iter / T) β = 1.5×(1 - iter / T) γ = 1 - 0.5×(1 - iter / T) where, T is the maximum number of iterations; (III) Update of tuna individuals: The update steps of tuna individuals are as follows: 1. For each tuna individuali , a random number between 0 and 1 at birth R i ; 2. According to R i value, select whether to update directly or update by mirroring: When R i ≥0.5, the tuna is updated directly, and the direct update method is: M i iter+1 = M i iter + C 1 ×rand(1, dim )×( x shark iter - M i iter ); Among them C 1 is the direct update coefficient; When R i <0.5, the tuna is updated by mirroring, which is divided into 3 steps: Step 1: Generate a mirrored individual x mirror,i iter : x mirror,i iter =2×x shark iter -M i iter +0.1× randn (1,dim) Step 2: Determine whether the mirrored individual exceeds the search space boundary in each dimension. If it exceeds the boundary in the j th dimension, correct the position of this dimension: x mirror,i,j iter = ub j - R i ×( ub j -xshark,j iter ) if x mirror,i,j iter >ub j x mirror,i,j iter = lb j + R i ×( x shark,j iter - lb j ) if x mirror,i,j iter <lb j where x mirror,i,j iter is the corrected mirror position of the i -th individual in the j -th dimension, x shark,j iter represents the value of the shark individual in the j -th dimension; j = 1, 2, …, dim ; ub j and lb j represent the search upper limit and lower limit in the j -th dimension respectively; Step 3: Update the tuna individual position according to the position of the mirror individual: M i iter+1 = x mirror,i iter + C 2 ×rand(1, dim )×( x shark iter - x mirror,i iter ); where C 2 is the mirror update coefficient; (4) Fitness update and iteration termination 1. Recalculate the fitness values of the latest positions of all individuals and update best_M andbest_cost ; 2. Determine whether the iteration termination condition is reached. If the iteration termination condition is satisfied, output best_M and best_cost value, and the calculation terminates; if the termination condition is not satisfied, update the individual with the optimal fitness value in this iteration as the shark individual, and define the remaining individuals as tuna individuals, and repeat calculation stages (two) to (four).

[0010] The beneficial effects of the present invention are as follows: The present invention provides an intelligent traffic flow real-time prediction method. Among them, the constructed hybrid feature network model is a parallel CNN-LSTM combined with a multi-head attention mechanism (Parallel CNN-LSTM with MHSA, PCL-MHSA) model. The PCL-MHSA model extracts local features and global temporal dependencies through parallel convolutional layer (CNN) branches and long short-term memory layer (LSTM) branches respectively, then reduces the dimension and extracts key information through a pooling layer, and then uses the multi-head self-attention mechanism Multi-Head Self-Attention model (MHSA) to perform dynamic weight allocation on the fused features, and finally realizes high-precision prediction. In addition, the constructed shark and tuna alliance optimization algorithm (Shark and Tuna Alliance Optimization Algorithm, STAO) is a heuristic optimization algorithm based on the predation behaviors of sharks and tuna in nature. The algorithm combines the advantages of the two strategies by simulating the global search ability of sharks and the local search ability of tuna to achieve efficient solution of complex optimization problems. It can enhance the local search ability and accelerate the convergence speed; finally, by performing real-time training and parameter fine-tuning on the optimized PCL-MHSA model based on the latest monitoring data, the latest change trend of traffic flow can be dynamically updated, so that the model has better prediction accuracy and provides more reliable technical support for traffic flow real-time prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0012] Figure 1 is a flowchart of an intelligent traffic flow real-time prediction method provided by an embodiment of the present invention; Figure 2 is a framework structure diagram of the PCL-MASH model provided by an embodiment of the present invention; Figure 3 It is a comparison chart of the predicted value and the actual value of the method of the present invention provided by the embodiment of the present invention; Figure 4 It is a comparison chart of box plots of R2 values of prediction results of different models provided by the embodiment of the present invention; Specific embodiments

[0013] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the implementation cases and drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0014] The method of the present invention will be described below by taking a specific case of real-time prediction of landslide displacement as an example.

[0015] Such as Figure 1 , an intelligent real-time traffic flow prediction method, including the following steps: Step 1: Obtain historical traffic flow data obtained by online monitoring and preprocess the data; Step 2: Construct a hybrid feature network model framework based on a parallel convolutional layer-long short-term memory layer combined with a multi-head attention mechanism, and set the hyperparameters to be optimized and the optimization range; Step 3: Optimize the hyperparameters of the hybrid feature network model based on the shark and tuna coalition optimization algorithm and historical traffic flow data; Step 4: Based on the optimized hyperparameters and historical traffic flow data, construct and train a hybrid feature network model; Step 5: Set the moving average error window size W 1 , dynamic update start error E, and dynamic update window size W 2 ; Every time the latest monitoring data is obtained, calculate the average value of the nearest W 1 predicted values, that is, the moving average error P. If P is greater than E, extract the latest W 2 monitoring data to perform real-time training and fine-tuning on the hybrid feature network, and realize the real-time dynamic update of the hybrid feature network; Step 6: Predict the traffic flow in the next time period based on the latest hybrid feature network.

[0016] Further, in Step 1, the historical traffic flow data includes date, time, day of the week, whether it is a holiday, and traffic volume data; the preprocessing of the data includes using the moving average method to smooth the traffic volume data, thereby removing short-term fluctuations and noise and retaining the long-term trend; aggregating high-frequency data into low-frequency data to reduce data complexity and improve calculation efficiency; data normalization to eliminate dimension differences and improve model training effects.

[0017] Further, in Step 2, the hybrid feature network model framework includes connecting the input layer to a parallel multi-scale convolutional layer and a long short-term memory layer, and then splicing the outputs of the parallel layers into one output through a splicing layer and sequentially connecting them through a max pooling layer, a multi-scale self-attention mechanism layer, a random dropout (Dropout) layer, a global pooling layer, a fully connected layer, and an output layer; among them, the input layer receives historical traffic flow data; in the parallel multi-scale convolutional layer and long short-term memory layer, the multi-scale convolutional layer uses different convolutional kernel sizes to extract local features, and the long short-term memory layer captures long-term dependencies in the time series; the splicing layer splices the outputs of the CNN and LSTM branches in the feature dimension; the max pooling layer performs 1D max pooling on the spliced output; the multi-head self-attention mechanism layer uses the multi-head self-attention mechanism to capture the importance of different time steps in the sequence; the random dropout (Dropout) layer applies Dropout to the output of the multi-head self-attention layer to prevent overfitting; the global pooling layer globally aggregates the features; the fully connected layer performs a non-linear transformation on the selected time step features to further extract features; the output layer uses the fully connected layer to generate the final prediction result.

[0018] Further, in Step 2, the hyperparameters include the number of filters in the convolutional layer, the learning rate, the random dropout rate, the L2 regularization strength, the number of units in the long short-term memory layer, and the number of heads in the multi-head attention mechanism.

[0019] Further, in Step 3, the shark and tuna coalition optimization algorithm includes the following four stages: (I) Population initialization: 1. Generate the initial population: Randomly generate the initial population M i 0 , where each individual M i 0 's position is determined by the following formula: M i 0 = lb +(ub - lb) ×rand(1, dim ) where M i 0 represents the position of the i -th individual, i represents the serial number of the individual, i = 1, 2, …, N , N is the population size, the superscript represents the iteration number, where 0 represents the initialization stage; lb and ub are the lower and upper bounds of the search space respectively, dim is the dimension of the problem to be optimized, rand(1 ,dim ) generates a 1× dim random vector, and the elements of it are in the range of [0, 1]; 2. Calculate the initial fitness value: Calculate the fitness value of each individual fitness(i) , fitness(i) = f obj (M i 0 ) where f obj () is the fitness function; record the position of the historical optimal solution best_M and the historical optimal fitness value best_cost , and mark the individual with the optimal fitness as the shark individual, and other individuals as tuna individuals; (II) Update of shark individuals: Shark individuals perform global search through Levy flight and random perturbation: x shark iter+1 =x shark iter +α×levy(β,dim)+γ×(best_M - x shark iter )+ 0.1 × randn (1, dim) where x shark iter is the position of the shark individual, iter is the current iteration number, levy (β,dim) is the Levy flight function, randn (1,dim) generates a 1× dimmatrix, the elements follow the standard normal distribution, parameters α、β and γ The calculation formula is: α = 0.1×(1 - iter / T) β = 1.5×(1 - iter / T) γ = 1 - 0.5×(1 - iter / T) where T is the maximum number of iterations; (3) Update of tuna individuals: The steps for updating tuna individuals are as follows: 1. For each tuna individual i , generate a random number between 0 and 1 R i ; 2. According to R i value, select whether to update directly or by mirror update: When R i ≥0.5, this tuna is updated directly, and the direct update method is: M i iter+1 = M i iter + C 1 ×rand(1, dim )×( x shark iter - M i iter ); where C 1 is the direct update coefficient; When R i <0.5, this tuna is updated by mirror, which is divided into 3 steps: Step 1: Generate a mirror individual x mirror,i iter : x mirror,i iter =2×x shark iter -M i iter +0.1× randn(1,dim) Step 2: Determine whether the mirrored individual exceeds the search space boundary in each dimension. If it exceeds the boundary in the j th dimension, correct the position in this dimension: x mirror,i,j iter = ub j - R i ×( ub j -x shark,j iter ) if x mirror,i,j iter >ub j x mirror,i,j iter = lb j + R i ×( x shark,j iter - lb j ) if x mirror,i,j iter <lb j where x mirror,i,j iter is the corrected mirror position of the i th individual in the j th dimension, x shark,j iter represents the value of the shark individual in the j th dimension; j = 1, 2, …, dim ; ub j and lb j respectively represent the upper and lower limits of the search in the j th dimension; Step 3: Update the position of the tuna individual according to the position of the mirrored individual: M i iter+1 = x mirror,i iter + C 2×rand(1, dim )×( x shark iter - x mirror,i iter ); wherein C 2 is the mirror update coefficient; (4) Fitness update and iteration termination 1. Recalculate the fitness values of the latest positions of all individuals and update best_M and best_cost ; 2. Determine whether the iteration termination condition is reached. If the iteration termination condition is satisfied, output the best_M and best_cost values and terminate the calculation. If the termination condition is not satisfied, update the individual with the optimal fitness value in this iteration as the shark individual, and define the remaining individuals as tuna individuals, and repeat the calculation from phase (2) to phase (4).

[0020] The test data comes from the measured traffic flow monitoring data of a certain expressway, with a total of 5000 groups.

[0021] The specific implementation process is as follows: For example Figure 1 , an intelligent real-time traffic flow prediction method includes the following steps: Step 1: Obtain the historical traffic flow data obtained from online monitoring and preprocess the data; Step 2: Construct a hybrid feature network model framework based on a parallel convolutional layer-long short-term memory layer and combined with a multi-head attention mechanism. The model framework is as shown in Figure 2 and set the hyperparameters to be optimized and the optimization range; The hyperparameters to be optimized and the optimization range are respectively: the number of filters in the convolutional layer (16~128), the learning rate (0.0001~0.1), the random dropout rate (0~0.5), the L2 regularization strength (0~0.01), the number of units in the long short-term memory layer (16~128), the number of heads in the multi-head attention mechanism (1~8); Step 3: Based on the shark and tuna coalition optimization algorithm and the historical traffic flow data, optimize the hyperparameters of the hybrid feature network model, where the number of training times of the model is set to 500 times, the population size N of the tuna coalition optimization algorithm is 10, the number of iterations T is 10, C 1 = 1.5, C 2 = 1.5; Step 4: Based on the optimized hyperparameters and the historical traffic flow data, construct and train a hybrid feature network model; Step 5: Set the moving average error window size W1 =5. Dynamically update the startup error E = 2 and the dynamic update window size W 2 =10. Every time the latest monitoring data is obtained, calculate the average value P of the last W 1 predicted values. If P is greater than E, extract the latest W 2 monitoring data to perform real-time training and fine-tuning on the hybrid feature network, realizing the real-time dynamic update of the hybrid feature network, where the number of iterations of the dynamic update is set to 10; Step Six: Predict the traffic flow in the next time period based on the latest hybrid feature network.

[0022] Figure 3 shows the comparison between the predicted results and the true values. It can be seen that the present invention can accurately predict the traffic flow. To verify the advantages of the method of the present invention, several related models were calculated separately and the results were compared. The several related models are: LSTM-CNN model, CNN-LSTM model, PCL-MHSA model, PCL-MHSA model optimized by particle swarm optimization (PSO-PCL-MHSA), STAO-PCL-MHSA model. The above models are all static models and do not add a real-time prediction mechanism. Among them, for the LSTM-CNN model, CNN-LSTM model and PCL-MHSA model, the number of filters in the convolutional layer, the number of units in the LSTM, the learning rate, the Dropout rate, the L2 regularization strength, and the number of multi-head attention heads are 64, 64, 0.01, 0.25, 0.005 and 4 respectively. Other related model parameters are the same as those set in the model proposed in this article.

[0023] To fully compare the performance of each model, the mean absolute error (MAE), mean absolute percentage error (MAPE), root mean square error (RMSE) and goodness of fit R 2 a total of 4 indicators were used to quantitatively evaluate each model. Each model was calculated ten times, and the average value of each indicator was obtained. The evaluation results of each model are shown in Table 1:

[0024] As shown in Table 1, the method of the present invention reached 1.063, 8.063, 1.499, and 0.9997 respectively in the four indicators of MAE, MAPE, RMSE and goodness of fit R 2 which are the best values among all methods, fully reflecting the advantages of this model in traffic flow prediction. At the same time, in order to more carefully observe the performance of the model, box plots of the R 2 values of each model in ten calculations were drawn, as Figure 4 shown.

[0025] As can be seen from Figure 4It can be seen that the model of the present invention not only outperforms the comparative model in terms of the median, but also has a smaller interquartile range and range, good symmetry and no outliers, indicating that the prediction results of the method of the present invention are more concentrated and the performance is more stable, verifying its superiority and robustness. In summary, the results of the present invention can effectively improve the accuracy of traffic flow prediction and provide a basis for realizing refined traffic management, low-carbon emission reduction and energy optimization.

[0026] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. An intelligent real-time traffic flow prediction method, characterized in that: The following steps are involved: Step 1: Obtain historical traffic flow data through online monitoring and pre-process the data; Step 2: Build a hybrid feature network model framework based on parallel convolutional layer-long short-term memory layer and combined with multi-head attention mechanism, and set the hyperparameters to be optimized and the optimization range; Step 3: Optimize the hyperparameters of the hybrid feature network model based on the shark and tuna alliance optimization algorithm and historical traffic flow data; Step 4: Based on the optimized hyperparameters and historical traffic flow data, a hybrid feature network model is constructed and trained; Step 5: Set the moving average error window size W1, the dynamic update start error E and the dynamic update window size W2; Every time the latest monitoring data is obtained, the average value of the most recent W1 prediction values, i.e., the moving average error P, is calculated. If P is greater than E, the latest W2 monitoring data is extracted to perform real-time training and fine-tuning on the hybrid feature network to achieve real-time dynamic update of the hybrid feature network. Step 6: Predict the traffic flow in the next time period based on the latest hybrid feature network.

2. The intelligent real-time traffic flow prediction method according to claim 1, characterized in that: In step one, the historical traffic flow data includes date, time, day of the week, whether it is a holiday, and traffic flow data; the data preprocessing includes smoothing the traffic flow data using a moving average method, aggregating high-frequency data into low-frequency data, and normalizing the data.

3. The intelligent real-time traffic flow prediction method according to claim 1, characterized in that: In step 2, the hybrid feature network model framework includes connecting the input layer to parallel multi-scale convolutional layers and long short-term memory layers, and then splicing the parallel outputs into one output through a splicing layer, and sequentially connecting them in series through a maximum pooling layer, a multi-scale self-attention mechanism layer, a random dropout layer, a global pooling layer, a fully connected layer and an output layer.

4. The intelligent real-time traffic flow prediction method according to claim 1, characterized in that: In step 2, the hyperparameters include the number of filters of the convolutional layer, the learning rate, the random dropout rate, the L2 regularization strength, the number of units of the long short-term memory layer, and the number of heads of the multi-head attention mechanism.

5. The intelligent real-time traffic flow prediction method according to claim 1, characterized in that: In step 3, the shark and tuna alliance optimization algorithm includes the following four stages:

1. Population initialization:

1. Generate initial population: randomly generate initial population M i 0 , where each individual M i 0 The position is determined by the following formula: M i 0 = lb + (ub-lb) ×rand(1, dim ) in M i 0 Representative i The location of an individual, i The serial number representing the individual, i =1,2,…, N , N is the population size, the superscript represents the number of iterations, where 0 represents the initialization stage; lb and ub are the lower and upper bounds of the search space, respectively. dim is the dimension of the problem to be optimized, rand(1 ,dim ) generates a 1× dim A random vector whose elements range from [0,1]; 2. Calculate the initial fitness value: Calculate the fitness value of each individual fitness(i) , fitness(i)=f obj (M i 0 ) ,in f obj () is the fitness function; records the historical optimal solution position best_M and the historical optimal fitness value best_cost , and mark the individuals with the best fitness as shark individuals, and the other individuals as tuna individuals; (II) Shark individual updates: Shark individuals perform global search via Lévy flights and random perturbations: x shark iter+1 =x shark iter +α×levy(β,dim)+γ×(best_M-x shark iter )+ 0.1 × rand (1, dim) in x shark iter is the position of the individual shark, iter is the current iteration number, levy (β,dim) is the Levy flight function, randn (1, dim) Generate a 1× dim A matrix whose elements follow a standard normal distribution with parameters α、β and γ The calculation formula is: α=0.1×(1-iter / T) β = 1.5 × (1-iter / T) γ=1-0.5×(1-iter / T) in, T is the maximum number of iterations; (III) Tuna individual update: The steps for updating tuna individuals are as follows:

1. For each tuna individual i , a random number between 0 and 1 at birth R i ; 2. According to R i The value selects whether to update directly or mirror: when R i ≥0.5, the tuna is directly updated, and the direct update method is: M i iter+1 = M i iter + C 1 ×rand(1, dim )×( x shark iter - M i iter ); in C 1 is the direct update coefficient; when R i <0.5, the tuna is a mirror update, divided into 3 steps: Step 1: Generate a mirror image x mirror,i iter : x mirror,i iter =2×x shark iter -M i iter +0.1× rand (1, dim) Step 2: Determine whether the mirror image individual exceeds the search space boundary in each dimension. j If a dimension exceeds the boundary, the position of the dimension is corrected: x mirror,i,j iter = ub j - R i ×( ub j -x shark,j iter ) if x mirror,i,j iter >ub j x mirror,i,j iter = lb j + R i ×( x shark,j iter - lb j ) if x mirror,i,j iter <lb j in x mirror,i,j iter For the i The individual in j The corrected mirror position in dimensions, x shark,j iter Representing shark individuals in j The value of the dimension; j =1,2,…, dim ; ub j and lb j Respectively represented in j The upper and lower limits of the search in each dimension; Step 3: Update the position of the tuna individual according to the position of the mirror individual: M i iter+1 = x mirror,i iter + C 2 ×rand(1, dim )×( x shark iter - x mirror,i iter ); in C 2 is the mirror update coefficient; (IV) Fitness Update and Iteration Termination 1. Recalculate the fitness values ​​of all individuals at their latest positions and update best_M and best_cost ; 2. Determine whether the iteration termination condition is met. If the iteration termination condition is met, output best_M and best_cost value, the calculation terminates; if the termination condition is not met, the individual with the best fitness value in this iteration is updated to the shark individual, and the remaining individuals are defined as tuna individuals, and the calculation of stage (ii) to stage (iv) is repeated.

Citation Information

Patent Citations

  • Short-term wind speed prediction method based on IMPA-GRU

    CN117521878A

  • Integrated transmission device fault prediction algorithm based on ITSOBP

    CN117708771A

  • Soft measurement method of improved TSO optimized deep learning model

    CN118228613A

  • Short-term traffic flow prediction method and system based on CEEEMDAN-SVR-SMA

    CN118865660A

  • Passenger flow prediction method based on CS optimization composite neural network

    CN119514786A