A method for dynamic prediction and accuracy optimization of traffic flow based on one-hot coding
By combining one-hot encoding and convolutional neural network models with an attention mechanism, the shortcomings of existing traffic flow prediction methods in data processing and dynamic control are addressed. This enables real-time and accurate prediction and automatic adjustment of highway traffic flow, improving the intelligence and safety of traffic management.
Patent Information
- Application Number
- CN202410512673.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-26
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-04-26
AI Technical Summary
Existing traffic flow prediction methods suffer from data processing and accuracy issues when dealing with large-scale real-time data and complex and ever-changing traffic conditions. They also lack real-time performance and dynamic control capabilities, and fail to generalize to different geographical locations and traffic environments.
A traffic flow prediction method based on one-hot encoding is adopted, which combines a convolutional neural network model with spatial feature extraction and time series analysis. Attention mechanism and cross-validation are introduced, data is processed in real time through edge computing, and traffic control measures are automatically adjusted according to the prediction results.
It enables real-time and accurate prediction of highway traffic flow, improves the model's generalization ability and response speed, and can adapt to different geographical locations and complex traffic conditions, effectively alleviating traffic congestion and improving road safety and efficiency.
Smart Images

Figure CN118314728B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction and dynamic control technology, specifically to a method for dynamic prediction and accuracy optimization of traffic flow based on one-hot coding. Background Technology
[0002] With the rapid development of highway networks and the continuous increase in the number of vehicles, highway traffic flow management and forecasting have become an important part of urban traffic management. Highway traffic flow is affected by a variety of factors, including weather conditions, holidays, and special events (such as accidents or road construction). The variability of these factors poses a significant challenge to real-time traffic flow forecasting and dynamic control. Accurate real-time traffic flow forecasting is crucial for alleviating traffic congestion, improving road utilization efficiency, and ensuring traffic safety.
[0003] In existing technologies, traditional traffic flow prediction methods mainly rely on statistical analysis models, such as autoregressive models and moving average models. These methods are relatively effective in handling static or periodic traffic flow prediction problems, but they often fail to accurately predict traffic flow in the face of sudden events and complex, ever-changing traffic conditions due to the inherent limitations of the models. Furthermore, existing traffic control systems largely rely on preset control rules, lacking sufficient flexibility and adaptability, making it difficult to respond in real-time to actual changes in traffic flow. This results in traffic control measures often failing to alleviate traffic congestion problems in a timely and effective manner. Specifically, existing technologies have significant shortcomings in the following aspects:
[0004] 1. Data processing and accuracy issues: Existing prediction models often cannot effectively process and analyze large-scale real-time traffic data and related environmental data, resulting in limited prediction accuracy.
[0005] 2. Real-time and dynamic control issues: Due to the lack of efficient data analysis and processing capabilities, the existing system cannot achieve real-time prediction of traffic flow and dynamic adjustment of control measures based on the prediction results, resulting in a delayed response.
[0006] 3. Model generalization problem: Existing traffic flow prediction models are often designed for specific traffic environments or conditions, lacking sufficient generalization ability and making it difficult to adapt to different geographical locations, different types of highways, and changing traffic conditions.
[0007] 4. Lack of comprehensive analysis capabilities: Traditional traffic flow management systems often overlook the diversity and complexity of factors influencing traffic flow, lack the ability to comprehensively analyze different data sources, and are unable to fully and accurately understand and predict changes in traffic flow.
[0008] Therefore, how to provide a method for dynamic prediction and accuracy optimization of traffic flow based on one-hot coding is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0009] The purpose of this invention is to provide a method for dynamic traffic flow prediction and accuracy optimization based on one-hot encoding. This method fully utilizes expertise in data science and big data technologies, machine learning and deep learning, model evaluation and optimization, and computer vision. It details how a convolutional neural network model combining spatial feature extraction and time series analysis can dynamically predict highway traffic flow and automatically adjust traffic control measures based on the prediction results. This method not only accurately acquires and processes highway traffic data and related environmental data in real time, but also continuously adjusts and optimizes model parameters by introducing attention mechanisms, cross-validation, and real-time feedback mechanisms to improve the prediction accuracy and robustness of the model under different highway environments and complex traffic conditions. This invention possesses the advantages of strong real-time performance, high accuracy, and strong generalization ability.
[0010] To achieve the above functions, this invention designs a method for dynamic traffic flow prediction and accuracy optimization based on one-hot coding. For a target highway, the following steps S1-S6 are executed to complete the traffic flow prediction of the target highway and adjust traffic control measures accordingly:
[0011] Step S1: Real-time collection of traffic data on the highway, including vehicle speed data, environmental data, special event information, vehicle type distribution, and vehicle flow data. Based on the lightning magnetic induction error ablation algorithm, vehicle data errors are ablated. Edge computing technology is introduced to distribute data collection and preliminary analysis tasks on edge nodes along the road.
[0012] Step S2: Preprocess the collected traffic data, including noise filtering and smoothing, outlier detection and correction, encoding conversion, normalization and numerical processing, to transform the traffic data into a data format that is compatible with the requirements of the convolutional neural network model.
[0013] Step S3: For the preprocessed traffic data, a convolutional neural network model combining spatial feature extraction and time series analysis is used. Convolutional layers, pooling layers, and recurrent neural network layers with multi-scale convolutional kernels are introduced to extract spatial features and time-related dynamic change features to obtain predicted traffic flow.
[0014] Step S4: Employ a traffic flow fluctuation impact factor weighting algorithm based on fuzzy attention. Through fuzzy sets and membership functions, convert qualitative traffic flow impact factors into calculable fuzzy values and assign different weights to the traffic flow impact factors.
[0015] Step S5: The convolutional neural network model is trained using cross-validation and real-time feedback mechanisms. During the training process, the model parameters are adaptively adjusted, the model prediction error is analyzed, and the convolutional neural network model is learned and optimized to adapt to different traffic scenarios and environmental conditions.
[0016] Step S6: Deploy the trained convolutional neural network model in the traffic control system to receive traffic data in real time, predict traffic flow, and automatically adjust traffic control measures based on the prediction results.
[0017] Beneficial effects: Compared with the prior art, the advantages of the present invention include:
[0018] 1. This invention employs an improved convolutional neural network (CNN) structure, combined with spatial feature extraction and time series analysis, to accurately process and analyze large-scale highway traffic data and related environmental data in real time. The introduced attention mechanism further enhances the model's sensitivity to key features, resulting in more accurate predictions and providing reliable data support for traffic management.
[0019] 2. This invention can not only predict traffic flow, but also automatically adjust traffic control measures based on the prediction results, such as adjusting lane usage strategies, setting speed limits, and activating traffic diversion plans, effectively alleviating traffic congestion, improving road utilization efficiency, and realizing intelligent and dynamic traffic management.
[0020] 3. By employing cross-validation and real-time feedback mechanisms, this invention can continuously adjust and optimize model parameters, enabling the model to have strong generalization ability and adapt to different geographical locations, different types of highways, and changing traffic conditions, thus having broad application prospects.
[0021] 4. This invention improves the response speed and processing capacity of the traffic control system by real-time monitoring of traffic flow and automatic adjustment of traffic control measures, effectively reducing the probability of traffic accidents and improving road safety. At the same time, the system's real-time feedback and self-optimization functions ensure efficient operation in complex and ever-changing traffic environments. Attached Figure Description
[0022] Figure 1 This is a general framework diagram of a traffic flow dynamic prediction and accuracy optimization method based on one-hot coding according to an embodiment of the present invention;
[0023] Figure 2 This is a flowchart of a method for dynamic prediction and accuracy optimization of traffic flow based on one-hot coding, provided by an embodiment of the present invention.
[0024] Figure 3This is a diagram showing the traffic flow changes of a portion of a highway section, obtained from a model provided in an embodiment of the present invention.
[0025] Figure 4 This is a flowchart of a traffic flow control method based on predicted data obtained from a model according to an embodiment of the present invention. Detailed Implementation
[0026] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0027] This invention provides a method for dynamic traffic flow prediction and accuracy optimization based on one-hot coding, targeting a highway, referring to... Figure 1 , Figure 2 Perform the following steps S1-S6 to complete the traffic flow prediction for the target highway and adjust traffic control measures accordingly:
[0028] Step S1: Real-time collection of traffic data on the highway, including vehicle speed data, environmental data, special event information, vehicle type distribution, and vehicle flow data. Based on the lightning magnetic induction error ablation algorithm, vehicle data errors are ablated. Edge computing technology is introduced to distribute data collection and preliminary analysis tasks on edge nodes along the road.
[0029] The specific steps of step S1 include:
[0030] Step S1.1: Use sensors distributed along the highway at predetermined locations to collect vehicle speed data. Each sensor records the speed v of a vehicle passing the sensor every t seconds, where t is the time interval and v is the vehicle speed.
[0031] Step S1.2: Collect environmental data, including temperature T. e Humidity (H), wind speed (W), and whether it is a holiday (H) d Special event E occurs;
[0032] Step S1.3: Collection of special event information, obtaining special event type E through the information systems of public security and traffic management departments. T and the duration of special events, D;
[0033] Step S1.4: Collect vehicle flow data by setting up traffic monitoring devices at the entrance and exit of the highway, and count the number of vehicles N passing through every t seconds, where N represents the total number of vehicles passing through the monitoring point in a specific time period;
[0034] Step S1.5: Identify and record the vehicle type T that passes by, and the number N of each type of vehicle within a specific time period, using image recognition technology.T The radar magnetic induction error ablation algorithm is applied to ablate vehicle data errors:
[0035]
[0036] Among them, M i (t) represents the data information matrix of the i-th vehicle at time t, and n represents the total number of vehicles at time t. Veh(M) i R(t) represents the precise data information matrix of the i-th vehicle at time t, where R(Veh i ) represents the data information matrix collected by the radar equipment for the i-th vehicle at time t. V(Veh) represents the initial data information matrix collected by the radar equipment for the i-th vehicle at time t. i ) represents the data information matrix collected by the roadside video surveillance equipment for the i-th vehicle at time t. Let δ represent the initial data information matrix collected by the roadside video surveillance equipment for the i-th vehicle at time t, δ represent the accuracy coefficient of the radar equipment, and θ represent the accuracy coefficient of the roadside video surveillance equipment.
[0037] The accuracy coefficient δ of radar equipment depends on the type of radar system used, the working environment, and the expected standards; the accuracy coefficient θ of roadside video surveillance equipment depends on the performance indicators of the equipment, such as resolution, image quality, and recognition capability.
[0038] Step S1.6: Run machine learning models or rule engines on edge nodes to perform preliminary analysis of traffic data, such as vehicle classification, traffic flow estimation, event detection, etc., and optimize the deployment of road segment data collection nodes.
[0039] Step S2: Preprocess the collected traffic data, including noise filtering and smoothing, outlier detection and correction, encoding conversion, normalization and numerical processing, to transform the traffic data into a data format that is compatible with the requirements of the convolutional neural network model.
[0040] The specific steps of step S2 include:
[0041] Step S2.1: Use the moving average method to filter and smooth the noise in the collected vehicle speed data, and calculate the smoothed speed value v′:
[0042]
[0043] Where m is the window size of the moving average, v i Let v' be the speed of the i-th car within the window, where the vehicle speed v′∈{5,105} km / h;
[0044] Step S2.2: Use a Z-score-based method to detect and correct outliers in the vehicle traffic data, and calculate the Z-score for each data point:
[0045]
[0046] Where N is the observed vehicle flow rate over a certain time period, and μ N σ represents the average traffic flow during that time period. N The standard deviation is defined as the absolute value of the Z-score of a data point. If the absolute value of the Z-score exceeds the set threshold, the data point is considered an outlier and is removed.
[0047] Step S2.3: Use one-hot encoding to encode the vehicle type and quantity, and convert the identified vehicle type T and the corresponding vehicle quantity N. T Convert the data into numerical data suitable for processing by convolutional neural network models, and construct a multidimensional data matrix.
[0048] Step S2.4: Normalize the collected environmental data, and normalize the temperature T. e Humidity H and wind speed W are converted to values in the range [0,1].
[0049]
[0050]
[0051]
[0052] Among them, T e(norm) T represents the normalized temperature value. e The original temperature value, T e(min) and T e(max) H represents the minimum and maximum temperature values, respectively. norm This represents the normalized humidity value, where H is the original humidity value. min and H max W represents the minimum and maximum humidity values, respectively. norm This represents the normalized wind speed value, where W is the original wind speed value. min and W max These represent the minimum and maximum wind speeds, respectively.
[0053] List the minimum and maximum values for each value, and the ranges for each value are as follows:
[0054] Temperature T e ∈{-10, 40} degrees Celsius, humidity H∈{30%, 85%}, wind speed W∈{0, 11} m / s;
[0055] Step S2.5: Numericalize the special event type and the duration of the special event, and assign the special event type E... T Converted to numerical labels, the duration D of the special event is directly used as the input variable of the convolutional neural network model.
[0056] Step S3: For the preprocessed traffic data, a convolutional neural network model combining spatial feature extraction and time series analysis is used. Convolutional layers, pooling layers, and recurrent neural network layers with multi-scale convolutional kernels are introduced to extract spatial features and time-related dynamic change features to obtain predicted traffic flow.
[0057] The specific steps of step S3 include:
[0058] Step S3.1: Use a convolutional neural network model to extract features from the highway traffic data. The convolutional layers of the convolutional neural network model use multiple convolutional kernels to filter the traffic data and extract spatial features.
[0059]
[0060] Among them, F out (x,y) represents the pixel value of the output feature map at position (x,y), F in (x+i,y+j) is the pixel value of the input feature map at position (x+i,y+j), K(i,j) is the weight of the convolution kernel at position (i,j), b is the bias term, and k is the radius of the convolution kernel; for example, if a 5*5 convolution kernel is selected, the kernel radius k is 2.
[0061] Step S3.2: Dimensionality reduction is performed on the convolutional feature map using pooling layers to reduce feature dimensionality and computational cost while preserving important features.
[0062] P out (x,y)=max({F in (x+i,y+j)|i∈[-r,r],j∈[-r,r]});
[0063] Among them, P out (x,y) represents the pixel value at position (x,y) in the output feature map, F in (x+i,y+j) represents the pixel value of the input feature map at the relative position (x+i,y+j), and r represents the radius of the pooling window. This operation selects the maximum value as the output within each (2r+1)×(2r+1) window, thereby achieving feature compression while retaining important features in the feature map.
[0064] Step S3.3: Introduce a recurrent neural network layer to process the serialized traffic data, in order to capture time-related dynamic changes and enhance the model's ability to predict future traffic flow changes, thereby obtaining the predicted traffic flow.
[0065] f t =σ(W f ·[h t-1 ,x t ]+b f );
[0066] i t =σ(W i ·[h t-1 ,x t ]+b i ));
[0067] ε t =tanh(W C ·[h t-1 ,x t ]+b C );
[0068] C t =f t *C t-1 +i t *ε t ;
[0069] o t =σ(W o ·[h t-1 ,x t ]+b o );
[0070] h t =o t *tanh(C t );
[0071] Among them, f t The output of the forget gate at time step t determines which historical information should be retained or forgotten when analyzing highway traffic data. f W i W C W o , representing the weight parameters of the forget gate, input gate, cell state update, and output gate, respectively. These weights capture the complex spatial and temporal dependencies in highway traffic data. h t-1 Indicates the hidden state at the previous time step, x t The input features for the current time step include vehicle speed, vehicle type distribution, environmental conditions, and information about special events. f b i bC b o These are the bias terms for the forget gate, input gate, cell state update, and output gate, respectively. t The input-gate output at time step t determines the contribution of the current input to the model state update, reflecting the importance of newly collected traffic data for predicting future traffic flow. ε t C represents the candidate values of the cell state at time step t, which are new information generated by combining the current input and past states. t This represents the cell state after time step t, integrating the results of forgetting old information and adding new information, and represents a comprehensive understanding of the current highway traffic conditions. t The output gate at time step t controls the information flow from the cell state to the final output, directly affecting the traffic flow prediction result. t It represents the hidden state at the current time step, carrying the model's predictions of current and future traffic flow.
[0072] This assumes weight parameters W for the forget gate, input gate, cell state update, and output gate. f =W i =W C =W o =0.25.
[0073] By combining attention mechanisms to optimize the feature selection process of the model, the weights of each feature are automatically adjusted by calculating the contribution of each feature to the prediction task, thereby improving the model's sensitivity to key time series data features.
[0074] Step S4: Employ a traffic flow fluctuation impact factor weighting algorithm based on fuzzy attention. Through fuzzy sets and membership functions, convert qualitative traffic flow impact factors (including environmental data and special event information) into calculable fuzzy values, and assign different weights to traffic flow impact factors.
[0075] The specific steps of step S4 include:
[0076] Step S4.1: Using the trainable weight vector w and the feature vector x, calculate the importance weight of each feature using the softmax function:
[0077]
[0078] Where, α i w represents the importance weight of the i-th feature. i For the weights in the weight vector corresponding to the i-th feature, x i This refers to the i-th feature in the input feature vector;
[0079] Step S4.2: By calculating the importance weight of each feature, the original input features are weighted and combined to generate a weighted feature representation:
[0080] x′=∑ i α i ·x i ;
[0081] Where x′ represents the weighted feature representation, α i x is the importance weight of the i-th feature. i The i-th feature in the original input feature vector;
[0082] Step S4.3: Input the weighted feature representation x′ into the first convolutional layer of the convolutional neural network model. Use this convolutional layer to extract spatial features from the importance-weighted features, thereby improving the model's sensitivity to key features and the accuracy of traffic flow prediction.
[0083] Step S5: The convolutional neural network model is trained using cross-validation and real-time feedback mechanisms. During the training process, the model parameters are adaptively adjusted, the model prediction error is analyzed, and the convolutional neural network model is learned and optimized to adapt to different traffic scenarios and environmental conditions.
[0084] The specific steps of step S5 include:
[0085] Step S5.1: Construct a traffic dataset using the collected traffic data, and divide the traffic dataset into a training set, a validation set, and a test set using a hierarchical cross-validation mechanism;
[0086] Step S5.2: Train the convolutional neural network model using the training set. The loss function during training is the cross-entropy loss.
[0087]
[0088] Where L represents the loss function value over the entire dataset, T is the total length of the time series, and y t p represents the actual traffic flow at time t. t The probability of traffic flow predicted by the model at time t;
[0089] Step S5.3: Implement a real-time feedback adjustment mechanism. By monitoring and analyzing the difference between the model prediction results and the actual traffic flow in real time, adjust the model parameters to improve the accuracy of future predictions.
[0090] Step S5.4: Adjust the model parameters in real time using the gradient descent algorithm based on the prediction error.
[0091]
[0092]
[0093] Among them, W new and b new W represents the updated model weights and biases, respectively. old and b old This represents the model weights and biases before the update, where η represents the learning rate. and represents the partial derivatives of the loss function L with respect to the weights W and the bias term b, respectively, indicating the direction and step size of the model parameter updates.
[0094] Step S6: Deploy the trained convolutional neural network model in the traffic control system to receive traffic data in real time, predict traffic flow, and automatically adjust traffic control measures based on the prediction results.
[0095] The specific steps of step S6 include:
[0096] Step S6.1: Integrate the trained and optimized convolutional neural network model into the highway traffic control system to continuously receive and process real-time highway traffic data;
[0097] Step S6.2: Upon receiving new traffic data, the convolutional neural network model immediately performs traffic flow prediction:
[0098]
[0099] in, This represents the predicted traffic flow value, f represents the function of the convolutional neural network model, X represents the input traffic data, and θ represents the model parameters.
[0100] Step S6.3: Adjust traffic control measures based on the traffic flow prediction results from the convolutional neural network model;
[0101] Step S6.4: Provide real-time feedback of the predicted traffic flow results and adjustment measures to traffic management personnel and drivers.
[0102] The following is an application example of the present invention:
[0103] To verify the practicality and effectiveness of this invention, it was applied to a section of highway in a large city. This highway connects multiple commercial and residential areas, experiencing varying degrees of traffic flow fluctuations daily, especially during morning and evening rush hours and holidays. Because traffic flow is affected by various factors, such as weather conditions, weekends or holidays, and unforeseen events (such as traffic accidents or road construction), traffic management on this highway becomes exceptionally complex. Traditional traffic flow control methods are no longer sufficient to meet the needs for real-time, accurate prediction and dynamic regulation.
[0104] In this scenario, the traffic flow dynamic prediction and accuracy optimization method based on one-hot coding proposed in this invention is applied to the traffic management center of this highway. First, high-precision sensors and cameras are installed at key nodes of the highway to collect data in real time, including vehicle speed, traffic flow, vehicle type, and environmental conditions. Simultaneously, information on special events, such as accidents and road construction, is collected. All this data is transmitted back to the traffic management center for processing in real time.
[0105] Applying the method proposed in this invention, traffic data undergoes preprocessing, including noise filtering, outlier handling, and data normalization, to improve data quality and adapt to the requirements of deep learning models. Subsequently, an improved convolutional neural network model combining spatial feature extraction and time series analysis is used to predict traffic flow. The model incorporates an attention mechanism, automatically identifying and assigning different weights to various traffic flow influencing factors, thus improving prediction accuracy. Through cross-validation and real-time feedback mechanisms, model parameters are continuously adjusted and optimized to improve prediction accuracy and robustness under different highway environments and complex traffic conditions. Specific data are shown in Table 1 below:
[0106] Table 1: Comparison of Traffic Flow Control Effectiveness on Highways
[0107] Before implementation After implementation Improvement rate Prediction accuracy 73% 92% +31.41% Average vehicle speed (peak hours) 32% reduction Increased by 26% +71.43% Traffic accident rate Increased by 24% Down 27% -37.50%
[0108] As shown in Table 1 above, in the embodiments, before implementing the method proposed in this invention, the traffic management and operation center of this section of the highway mainly relied on experience-based judgment and simple historical data analysis to predict traffic flow, with a prediction accuracy of approximately 70%. During peak hours, traffic congestion was severe, with average vehicle speed decreasing by 30% and the traffic accident rate increasing by 20%. After implementing the method proposed in this invention, through analysis of data from May to July 2023, the prediction accuracy increased to 92%. During morning and evening peak hours, by dynamically adjusting traffic control measures, average vehicle speed increased by 20%, and the traffic accident rate decreased by 25%. Especially in the event of emergencies, such as traffic accidents or road construction, the method proposed in this invention can quickly and accurately predict changes in traffic flow, adjust traffic control measures in a timely manner, and significantly reduce the probability of traffic congestion and accidents. The predicted input and output traffic flow of a certain section of the highway is shown in the figure below. Figure 3 As shown, the active traffic flow control flowchart is as follows: Figure 4 As shown, by implementing proactive control strategies on bottleneck sections based on predicted highway traffic flow data, the efficiency of highway traffic and driving safety can be effectively improved.
[0109] Furthermore, the application of this invention improves the efficiency and response speed of traffic management. Traffic management personnel can promptly release traffic information based on real-time forecast results, guiding vehicles to divert rationally, reducing reliance on manual intervention, and enhancing the automation and intelligence of management. This invention not only significantly improves the accuracy of traffic flow forecasting and the efficiency of management, but also enhances the driving experience for drivers, improves road capacity and safety, and effectively alleviates urban traffic congestion.
[0110] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A method for dynamic prediction and precision optimization of traffic flow based on one-hot encoding, characterized in that, For the target expressway, the following steps S1-S6 are performed to complete the traffic flow prediction of the target expressway and adjust the traffic control measures accordingly: Step S1: Real-time collection of traffic data on the expressway, including vehicle speed data, environmental data, special event information, vehicle type distribution, and vehicle flow data, based on the magnetic induction error ablation algorithm to ablate vehicle data errors, and the introduction of edge computing technology to distribute data collection and preliminary analysis tasks on edge nodes along the road; The specific steps of step S1 include: Step S1.1: Collect vehicle speed data along the expressway at predetermined locations using sensors, with each sensor recording the speed v of vehicles passing through the sensor every t seconds, where t is the time interval and v is the vehicle speed; Step S1.2: Collecting environmental data, including temperature T e , humidity H, wind speed W, and whether it is holiday H d , a special event E occurs; Step S1.3: Collection of special event information, special event type E is obtained via information systems of the police and traffic management authorities T and special event duration D; Step S1.4: Collect vehicle flow data by setting flow monitoring devices at the entrances and exits of the expressway, and count the number of vehicles passing through every t seconds, where N represents the total number of vehicles passing through the monitoring point within a certain time period; Step S1.5: Identify and record the type T of the passing vehicle by image recognition technology, and the number N of each type of vehicle in a specific time period T Apply the magnetic induction error ablation algorithm to ablate vehicle data errors: wherein M i (t) represents the data information matrix of the i-th vehicle at time t, n represents the total number of vehicles at time t, Veh(M i (t)) represents the accurate data information matrix of the i-th vehicle at time t, R(Veh i ) represents the data information matrix collected by the radar device of the i-th vehicle at time t, represents the initial data information matrix collected by the radar device of the i-th vehicle at time t, V(Veh i ) represents the data information matrix collected by the roadside video monitoring device of the i-th vehicle at time t, represents the initial data information matrix collected by the roadside video monitoring device of the i-th vehicle at time t, δ represents the radar device accuracy coefficient, represents the roadside video monitoring device accuracy coefficient; Step S1.6: Run a machine learning model or rule engine on the edge node for preliminary analysis of traffic data; Step S2: Preprocess the collected traffic data, including noise filtering and smoothing, outlier detection and correction, encoding conversion, normalization, and numerical processing, to convert the traffic data into a format suitable for the requirements of the convolutional neural network model; Step S3: For the preprocessed traffic data, use a convolutional neural network model that combines spatial feature extraction and time series analysis, introduce convolutional layers with multiple scale kernels, pooling layers, and recurrent neural network layers to extract spatial features and time-dependent dynamic change features, and obtain predicted traffic flow; The specific steps of step S3 include: Step S3.1: Use a convolutional neural network model to extract features from traffic data, with the convolutional layer of the convolutional neural network model using multiple convolutional kernels to filter traffic data and extract spatial features: wherein F out (x, y) represents a pixel value of the output feature map at position (x, y), F in (x+i, y+j) is a pixel value of the input feature map at position (x+i, y+j), K(i, j) is a weight of the convolution kernel at position (i, j), b is a bias term, and k is a radius size of the convolution kernel; Step S3.2: Reduce the dimensionality of the feature map after convolution through the pooling layer to reduce the feature dimension and computational complexity while preserving important features: P out (x,y) = max({F in (x+i,y+j) | i e [-r,r], j e [-r,r]}); wherein P out (x, y) represents a pixel value of a position (x, y) in the output feature map, F in (x+i, y+j) represents a pixel value of a relative position (x+i, y+j) of the input feature map, and r represents a radius of the pooling window, the operation selects a maximum value in each (2r+1) x (2r+1) window as an output, realizing feature compression while retaining important features in the feature map. Step S3.3: Introduce a recurrent neural network layer to capture time-dependent dynamic change features and obtain predicted traffic flow: f t = σ(W f · [h t-1 , x t ]+ b f ); i t = σ(W i · [h t-1 , x t ]+ b i )); ε t = tanh(W C · [h t-1 , x t ] + b C ); C t = f t * C t-1 + i t * ε t ; o t = σ(W o · [h t-1 , x t ]+ b o ); h t = o t tanh(C t ); wherein f t denotes the forget gate output of time step t, W f , W i , W C , W o , respectively, represent the weight parameters of the forget gate, input gate, cell state update, and output gate, h t-1 denotes the hidden state of the previous time step, x t denotes the input feature of the current time step, b f , b i , b C , b o , respectively, are the bias terms of the forget gate, input gate, cell state update, and output gate, i t is the input gate output of time step t, ε t denotes the cell state candidate value of time step t, C t denotes the updated cell state of time step t, o t denotes the output gate output of time step t, h t denotes the hidden state of the current time step; Step S4: Use a fuzzy attention-based traffic flow fluctuation influence factor weighting algorithm to convert qualitative traffic flow influence factors into calculable fuzzy values through fuzzy sets and membership functions, and assign different weights to traffic flow influence factors; The specific steps of step S4 include: Step S4.1: Calculate the importance weight of each feature using the softmax function through the trainable weight vector w combined with the feature vector x: wherein a i represents the importance weight of the i-th feature, w i is the weight in the weight vector corresponding to the i-th feature, x i is the i-th feature in the input feature vector; Step S4.2: Combine the original input features by weighting according to the importance weight of each feature calculated, to generate the weighted feature representation: x ′ = ∑iα i · x i ; where x ′ represents the weighted feature representation, a i is the importance weight of the i-th feature, and x i is the i-th feature in the original input feature vector. Step S4.3: inputting the weighted feature representation x ′ into a first convolutional layer of a convolutional neural network model, and performing spatial feature extraction on the importance-weighted features by using the first convolutional layer. Step S5: Train the convolutional neural network model using a cross-validation and real-time feedback mechanism, adaptively adjust the model parameters during training, analyze the prediction error of the model, and optimize the convolutional neural network model through learning to adapt to different traffic scenarios and environmental conditions. Step S6: Deploy the trained convolutional neural network model in the traffic control system, receive real-time traffic data, predict traffic flow, and automatically adjust traffic control measures based on the prediction results.
2. The traffic flow dynamic prediction and precision optimization method based on one-hot encoding according to claim 1, characterized in that, The specific steps of step S2 include: Step S2.1: Noise filtering and smoothing of the collected vehicle speed data using a moving average method, calculating the smoothed speed value v ′ : where m is the window size of the moving average, v i is the speed of the i-th vehicle within the window. Step S2.2: Detect and correct outliers in vehicle flow data using a Z-score-based method, calculate the Z-score of each data point: where N is the observed value of the vehicle flow in a certain time period, μ N is the average value of the vehicle flow in the time period, σ N is the standard deviation, and when the absolute value of the Z-score of a certain data point exceeds a set threshold value, the data point is considered to be an outlier and is removed. Step S2.3: using the one-hot encoding method to encode and convert the vehicle type and quantity, and the identified vehicle type T and the corresponding vehicle quantity N T Convert into numerical data suitable for convolutional neural network model processing, construct a multi-dimensional data matrix; Step S2.4: Normalization of the collected environmental data, converting the temperature T e , humidity H, wind speed W parameters into values in the [0,1] interval: wherein T e(norm) represents the normalized temperature value, T e is the original temperature value, T e(min) and T e(max) represent the minimum and maximum values of temperature, respectively, H norm represents the normalized humidity value, H is the original humidity value, H min and H max represent the minimum and maximum values of humidity, respectively, W norm represents the normalized wind speed value, W is the original wind speed value, W min and W max represent the minimum and maximum values of wind speed, respectively. Step S2.5: Numerical processing is performed on the special event type and the special event duration, and the special event type E T is converted into a numerical label, and the special event duration D is directly used as an input variable of the convolutional neural network model.
3. The traffic flow dynamic prediction and precision optimization method based on one-hot encoding according to claim 1, characterized in that, The specific steps of step S5 include: Step S5.1: Construct a traffic data set using the collected traffic data, and use a stratified cross-validation mechanism to divide the traffic data set into a training set, a validation set, and a test set; Step S5.2: Train the convolutional neural network model using the training set, and the loss function during training is cross-entropy loss: where L represents the loss function value on the entire data set, T is the total length of the time series, y t represents the actual traffic flow at time t, p t represents the probability of the traffic flow predicted by the model at time t; Step S5.3: Implement a real-time feedback adjustment mechanism by monitoring and analyzing the difference between the model prediction results and the actual traffic flow in real time to adjust the model parameters; Step S5.4: Based on the prediction error, use the gradient descent algorithm to adjust the model parameters in real time: where W new and b new represent the updated model weights and bias terms, respectively, W old and b old represent the model weights and bias terms before updating, and η represents the learning rate, and represent the partial derivatives of the loss function L with respect to the weights W and bias terms b, respectively, and represent the direction and step size of the model parameter update.
4. The traffic flow dynamic prediction and precision optimization method based on one-hot encoding according to claim 1, characterized in that, The specific steps of step S6 include: Step S6.1: Integrate the trained and optimized convolutional neural network model into the highway traffic control system for continuous reception and processing of real-time traffic data on the highway; Step S6.2: When the convolutional neural network model receives new traffic data, it immediately predicts the traffic flow: wherein, represents a predicted traffic flow value, f represents a function of a convolutional neural network model, X represents input traffic data, and θ represents a parameter of the model. Step S6.3: Adjust the traffic control measures based on the convolutional neural network model's prediction of traffic flow results; Step S6.4: Real-time feedback of predicted traffic flow results and adjustment measures to traffic management personnel and drivers.
Citation Information
Patent Citations
Fuzzy comprehensive evaluation method suitable for aircraft structure corrosion damage
CN101853320A
DDos detection method in edge computing environment based on deep learning
CN115712972A
Expressway traffic flow prediction method and device, computer equipment and storage medium
CN117612386A