Road congestion traceability and flow prediction method and system and storage medium thereof
Through the combination of ETC gantry traffic flow data and Transformer model, highway congestion traceability and flow prediction are realized, solving the problem that the source of traffic congestion cannot be analyzed in depth in the existing technology, and improving the accuracy and effectiveness of alleviating traffic congestion.
Patent Information
- Application Number
- CN202410919944.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-19
AI Technical Summary
The existing traffic congestion identification technology cannot quantify the source and direction of traffic congestion, and cannot deeply understand the travel behavior patterns and evolutionary laws, resulting in a lack of accuracy in the traffic congestion relief plan.
ETC gantry traffic flow data is used to trace congestion and predict traffic flow, and Transformer model is used to combine multi-head attention mechanism and regression model to perform data preprocessing and model training to achieve accurate analysis and prediction of traffic flow.
It improves the accurate perception and prediction of traffic congestion problems, provides more accurate governance plans, and improves the sustainable development capabilities of highways.
Smart Images

Figure CN118982912A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of traffic control, and in particular relates to a highway congestion tracing and flow prediction method, system and storage medium thereof. Background Art
[0002] Under the background of rapid economic and social growth and evolution, most roads in my country are experiencing increasingly serious traffic congestion problems, especially on highways. Once congested, the impact is huge. How to effectively control traffic congestion on highways has become a major topic of common concern and research for traffic managers and researchers. The accuracy and detail of the solution to alleviate traffic congestion largely depends on the accurate perception and cognition of traffic congestion.
[0003] At present, most traffic congestion identification technologies mainly use road sections as the basic unit to collect and refine traffic condition information. This method can only provide basic information such as "Where does the congestion occur? How serious is it?" However, it cannot quantitatively analyze the source and direction of traffic congestion, and thus cannot deeply understand and recognize the travel behavior patterns and their evolution laws that lead to traffic congestion.
[0004] Therefore, in order to truly and effectively alleviate traffic congestion, the ideal solution must include tracing the source of traffic flow and timely and accurate prediction of congestion conditions. For example, the encoder of the existing transformer model performs a global analysis of the fused feature map through position encoding and multi-head attention mechanism. This requires not only the collection of information and data from many aspects, but also an in-depth analysis of the components of traffic flow and the motivations of travel behavior. In this way, traffic managers can have a more comprehensive and in-depth understanding of the real causes of traffic congestion, and thus develop more accurate and practical governance plans, in order to improve this serious social problem in most highways and further enhance the sustainable development capabilities of highways. Summary of the invention
[0005] The core goal of the present invention is to propose a new method, system and storage medium for tracing the source and predicting the traffic flow of highway congestion that relies on ETC gantry traffic flow data. This method takes into account the source information of traffic flow in the congested area, so that it has the ability to alleviate congestion at the network level, providing a new research perspective for alleviating congestion; compared with traditional machine learning algorithms, it can significantly improve the reasoning accuracy.
[0006] The technical solution adopted by the present invention is as follows:
[0007] A method for tracing the source of highway congestion and predicting traffic flow, the method specifically comprising the following steps:
[0008] Obtain ETC gantry traffic flow data within a specific monitoring section;
[0009] Preprocess the collected ETC gantry traffic flow data to construct OD point pairs corresponding to vehicle flow conditions;
[0010] Filter the OD point pairs passing through the monitored road section, set the time for aggregation, and convert them into standard traffic flow;
[0011] The Transformer model is continuously trained based on the gradually accumulated standard traffic flow;
[0012] When the Transformer model reaches the established training standard, the traffic flow is predicted using the real-time ETC gantry traffic flow data within the monitored road section.
[0013] Furthermore, ETC gantry traffic flow data within a specific monitoring section is obtained, including ETC gantry traffic flow data from the monitoring section and toll station data within the monitoring section.
[0014] Furthermore, preprocessing of the acquired ETC gantry traffic flow data includes: segmentation and integration, cleaning and processing of the ETC gantry traffic flow data.
[0015] Furthermore, the segmentation and integration of data includes the following steps:
[0016] Import all relevant ETC gantries and toll station data;
[0017] In each data file, the names of key fields need to be modified as necessary to ensure that they are standardized. Specifically, only four main fields are retained, namely "gantryid" (representing the identification number of the ETC gantry, in string format), "transtime" (indicating the specific time when the vehicle passes through the ETC gantry and toll station, in time format), "vehicleplate" (referring to the vehicle's license plate number, in string format) and "vehicletype" (representing the type of vehicle, in integer format), and the data types of these four fields are ensured to be consistent;
[0018] Encode the ETC gantry position and toll station location information that the vehicle passes through in the data and set it as "odid"; split the data by day according to the vehicle's travel time and save it safely;
[0019] Merge the data from different ETC gantries and toll station entrances and exits, and remove the missing fields.
[0020] Furthermore, data cleaning and processing include the following steps:
[0021] Use "vehicleplate" as the primary key to match the same license plate number. Count the number of pairings. For abnormal license plate numbers, such as "Mo A00000", delete them. Only care about the records with an even number of matches, and then generate OD pairs and set the "odpair" variable to distinguish the traffic flow of different OD paths. Its value is calculated by "1000*odid + did";
[0022] Evaluate the travel time of each vehicle, which is the difference between its entry and exit times, to identify abnormal data. If this time is less than 1 minute or exceeds 60 minutes, determine it as abnormal data and delete it.
[0023] Furthermore, the aggregation of data specifically lies in:
[0024] Set "vehicletype" as the screening criterion and "odpair" as the classification variable. Then, count the same type of vehicles for the same OD pair to obtain the detailed distribution of the traffic flow passing through the target section within the specified time period.
[0025] Furthermore, the training of the Transformer model specifically lies in:
[0026] To improve the prediction accuracy, use the "transtime" field in the ETC gantry traffic flow data as the time feature and the traffic flow count as the flow feature. These two features together provide an ordered, time-dependent data stream for the Transformer model, enabling it to learn the long-term and short-term patterns and dependencies in the traffic flow;
[0027] Use the multi-head attention mechanism to encode the input sequence, enabling the model to capture and consider the dependencies between different time points, which is particularly crucial in traffic flow prediction because the traffic flow at different time points is often affected by the traffic flow at the previous moment.
[0028] Use the linear mapping of the Transformer to map the encoded time and flow features to a continuous space that reflects the changes in traffic flow and the expected traffic state;
[0029] During the model training, regularly evaluate the performance of the Transformer using historical data to ensure that it still has good prediction ability on new, unseen data.
[0030] Furthermore, the traffic flow prediction specifically lies in:
[0031] Use the trained Transformer model to input the time and flow features in the real-time obtained ETC gantry traffic flow data;
[0032] Generate the corresponding traffic flow prediction output through the model's multi-head attention mechanism and linear mapping;
[0033] Post-processing with the regression model can fine-tune the predicted value based on historical data and the output of the Transformer to further improve the accuracy of the prediction. The use of regression models can provide an intuitive perception of the continuous changes in traffic flow and the ability to adjust the model prediction errors.
[0034] A highway congestion tracing and flow prediction system, the system consists of one or more processors and a memory associated with the processor. The main task of the memory is to save ETC gantry traffic flow data. The processor contains program instructions, which include a data screening and processing module, a Transformer model building module, and a model training and prediction module. When these program instructions are read and executed by one or more processors, the traffic flow tracing and prediction method based on ETC gantry traffic flow data described in any of the above technical solutions will be implemented.
[0035] System construction and implementation:
[0036] The system integrates the core modules of data processing and analysis, and integrates multiple subsystems and modules to complete the comprehensive tasks of data collection, processing, analysis and prediction. The system adopts advanced algorithms and technologies to ensure accurate tracing and efficient prediction of traffic flow. Each processor operates according to its internal data screening and processing module, Transformer model building module, and model training and prediction module to ensure efficient task execution. At the same time, the associated memory is specifically used to store ETC gantry traffic flow data, thereby ensuring smooth operation of the system.
[0037] System components include:
[0038] Processor: One or more processors, including data screening and processing modules, Transformer model building modules, and model training and prediction modules, responsible for performing data processing and analysis.
[0039] Memory: connected to the processor, specifically used to store ETC gantry traffic flow data.
[0040] Furthermore, when the program instructions are correctly read and executed by the processor, the system will implement the traffic flow tracing and prediction method based on ETC gantry traffic flow data in accordance with the predetermined technical plan, which will help improve the overall system's understanding of traffic flow and the accuracy of prediction, thereby providing a more scientific and practical traffic management solution.
[0041] The implementation and operation of this system represents a new traffic management solution that combines advanced technology and innovative algorithms. It is expected to provide more powerful and flexible support for traffic management, thereby achieving reasonable scheduling and optimization of traffic flow and alleviating traffic congestion on highways.
[0042] A special storage medium stores a specific computer program. When the program is executed, it implements the above-mentioned traffic flow tracing and prediction method based on ETC gantry traffic flow data.
[0043] The characteristics of the storage medium in the present invention are:
[0044] Flexibility: The storage medium can be any physical or logical device that can store data, such as a hard disk, solid-state drive, USB drive, CD-ROM, DVD, or any other type of memory card;
[0045] Compatibility: The computer programs stored in this storage medium are designed to be compatible with a variety of computer systems and devices, ensuring that the programs can be effectively executed in different environments;
[0046] Practicality: Users only need to connect this storage medium to the corresponding computer or device to directly run or install the computer program above, and then perform the functions of traffic flow tracing and prediction based on ETC gantry traffic flow data;
[0047] Persistence: This storage medium can preserve data for a long time, ensuring the integrity and stability of the data even when the physical environment changes (such as temperature and humidity changes).
[0048] The storage medium provides an effective carrier for realizing the tracing and prediction of traffic flow based on ETC gantry traffic flow data. It provides a simple and direct way for users and related organizations to apply the technical solutions described in this invention on various computers and devices, so as to better manage and predict traffic flow, optimize traffic and improve travel efficiency.
[0049] This invention mainly emphasizes the use of advanced and innovative technologies and methods, combined with real-time ETC data and efficient Transformer models, to more accurately understand and predict the characteristics and trends of traffic flow. This method of combining real-time data and machine learning models may greatly improve the accuracy of predictions and provide new possibilities and directions for solving traffic congestion problems.
[0050] The technical effects achieved by the present invention are:
[0051] The highway congestion tracing and traffic flow prediction method of the present invention realizes the first application of ETC data tracing technology, which is unique in the existing technology. By adopting this innovative data tracing method, not only can the source and trend of data be accurately traced and predicted, but also a solid foundation can be provided for data calibration and processing. This method ensures high quality and high reliability of data, thereby greatly improving the accuracy and efficiency of data processing and analysis.
[0052] The present invention provides a method for tracing the source of highway congestion and predicting traffic flow, and a continuously optimized Transformer model. In the prediction field, the present invention adopts and optimizes the Transformer model. Although the Transformer model has demonstrated superior performance in multiple tasks, the present invention further optimizes and trains it so that the model can continuously learn and adapt to new data. This means that the model will continuously improve its prediction ability and accuracy as the amount of data received increases, thereby achieving dynamic improvement and self-improvement of model performance.
[0053] The highway congestion tracing and traffic flow prediction system of the present invention realizes efficient processing and accurate prediction of data sets of different sizes by applying and optimizing the Transformer model, showing extremely high scalability. Whether processing small-scale data or massive data sets, the present invention can stably and accurately generate prediction outputs to meet the diverse needs of traffic managers in different application scenarios, and effectively ensure that all types of scenarios can obtain satisfactory prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a principle flow chart of the traffic flow tracing and prediction method based on ETC gantry traffic flow data of the present invention;
[0055] Figure 2 It is a structural block diagram of the traffic flow tracing and prediction system based on ETC gantry traffic flow data of the present invention;
[0056] Figure 3 is a schematic diagram of the Transformer attention layer structure of the present invention;
[0057] Figure 4 It is a schematic diagram of the Transformer multi-head attention mechanism structure of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose and advantages of the present invention more clearly understood, the present invention is specifically described below in conjunction with embodiments. It should be understood that the following text is only used to describe one or several specific embodiments of the present invention, and does not strictly limit the scope of protection of the specific claims of the present invention.
[0059] Embodiment 1:
[0060] like Figure 1-4 As shown, a method for tracing the source of highway congestion and predicting traffic flow specifically includes:
[0061] S101: Obtain ETC gantry traffic flow data within the monitored road section;
[0062] S102: pre-processing the acquired ETC gantry traffic flow data to form OD point pairs corresponding to the traffic flow conditions;
[0063] S103: Filtering OD point pairs passing through the monitored road section, aggregating them according to the set time, and converting them into standard traffic flow;
[0064] S104: Based on the accumulated standard traffic flow, the Transformer model is trained continuously;
[0065] S105: When the Transformer model reaches the training standard, the traffic flow is predicted based on the ETC gantry traffic flow data in the monitored section obtained in real time.
[0066] In S101, the ETC gantry traffic flow data in the monitored section is obtained, including the ETC gantry traffic flow data in the monitored section and the toll station data in the monitored section.
[0067] ETC gantries and toll stations are generally set up on expressways. Of course, it is not ruled out that in the future, as society develops, ETC gantries will also be set up on general traffic roads.
[0068] In S102, pre-processing of the acquired ETC gantry traffic flow data includes: segmentation and integration, cleaning and processing of the ETC gantry traffic flow data.
[0069] Furthermore, data segmentation and integration include:
[0070] Import all relevant ETC gantries and toll booth data.
[0071] In each data file, the names of key fields need to be modified as necessary to ensure that they are standardized. Specifically, only four main fields are retained, namely "gantryid" (representing the identification number of the ETC gantry, in string format), "transtime" (indicating the specific time when the vehicle passes through the ETC gantry and toll station, in time format), "vehicleplate" (referring to the vehicle's license plate number, in string format) and "vehicletype" (representing the type of vehicle, in integer format), and the data types of these four fields are ensured to be consistent.
[0072] Encode the ETC gantry positions and toll station position information where the vehicle passes in the data, and set it as "odid"; split the data by days according to the vehicle passing time and save it safely.
[0073] Merge the data of different ETC gantries and the entrances and exits of toll stations, and剔除 the parts with missing fields.
[0074] Further, the cleaning and processing of the data include:
[0075] Use "vehicleplate" as the primary key to match the same license plate number. Count the number of pairings. For abnormal license plate numbers, such as "Mo A00000", delete them. Only care about the records with an even number of matches, and then generate OD pairs and set the "odpair" variable to distinguish the traffic flow of different OD paths. Its value is calculated by "1000*odid+did".
[0076] Evaluate the passing time of each vehicle, that is, the difference between its entry and exit times, to identify abnormal data. If this time is less than 1 minute or more than 60 minutes, determine it as abnormal data and delete it.
[0077] In step S103, filter the OD point pairs passing through the monitored section, aggregate them by setting time, and convert them into standard traffic flow at the same time.
[0078] In the transfer matrix data of step S103, define the flow change rate FCR, and on the basis of the transfer matrix M, accurately evaluate how the change of the upstream section traffic flow affects the traffic conditions of the section under study;
[0079] The potential impact relationship on the downstream section can be predicted by calculating the flow change rate FCR within a certain time window as follows:
[0080]
[0081] Among them, δt is the time window, and flow(t-δt) and flow(t) represent the traffic flows at the start and end times respectively. If FCR is positive, it means the flow is increasing; if it is negative, it means the flow is decreasing.
[0082] The aggregation of the data specifically lies in:
[0083] Set "vehicletype" as the screening criterion and "odpair" as the classification variable. Then, count the same type of vehicles for the same OD pair to obtain the detailed distribution of the traffic flow passing through the target section within the specified time period.
[0084] In S104, based on the accumulated standard traffic flow, the Transformer model is continuously trained.
[0085] In S105, when the Transformer model reaches the training standard, the traffic flow is predicted based on the ETC gantry traffic flow data in the monitored section obtained in real time. Specifically:
[0086] In real traffic systems, the temporal relationships of various traffic flows are very complex and change over time. The Transformer module effectively recognizes this temporal feature in its unique way, among which Scaled Dot-Product Attention is a very important submodule.
[0087] This module can characterize the correlation between different time points based on the input sequence, so as to extract and understand valuable time series characteristics from the input sequence. Assume that the input sequence is Y t =(y t+1 ,y t+2 ,y t+3 ···y t+n )∈T n+F , where Y t ∈T F is the feature vector at time t, and F is the number of input features.
[0088] The Transformer model can extract the relationship between different time points based on the input sequence and extract the temporal features in the sequence. The specific features are as follows:
[0089] Assume that the input sequence is represented as Y t =(y t+1 ,y t+2 ,y t+3 ···y t+n )∈T n+F , where Y t ∈T F is the feature vector at time t, and F is the number of input features.
[0090] Step 7.1: The attention layer performs three linear mappings on the feature vector of each moment of the input sequence:
[0091] A t =Y t M a (2)
[0092] B t =Y t M b (3)
[0093] C t =Y t M c (4)
[0094] In the formula, are the vector matrices composed of query, key, and value at n moments, respectively, and d b is the dimension of the key vector. are three parameter matrices obtained through training.
[0095] In highway traffic flow prediction, the two most critical parameters are usually time and flow. Time provides a reference frame that can provide the changing trend of flow, while flow itself represents the number of vehicles at a specific point in time. By capturing the relationship between time and flow, it is possible to use Transformer to predict future flow and possible congestion.
[0096] Therefore, in the above formula, considering Y t is a time series, where each element is the traffic at a certain point in time. This series will be decomposed into queries (A t ), key(B t ) and value (C t In practical applications, query (A t ) represents the time point to be predicted, or the time point of the required flow; key (B t ) represents a known time point, and their flow is known; the value (C t ) represents the flow value at the above known time point.
[0097] Specifically, given the historical data Y of traffic flow t =(y t+1 ,y t+2 ,y t+3 ···y t+n ) j Each model needs to predict the future K of downstream key nodes based on the upstream historical traffic flow. p Traffic flow at the time Here i ∈T N Represents the traffic flow of the downstream key node at the i-th moment.
[0098] In order to more accurately capture the dynamic changes of traffic flow and the complex temporal relationship between upstream and downstream flows, this embodiment designs a dynamic graph generation module based on an attention mechanism, namely, an Attention-based DynamicGraph Generation module (ADGG module).
[0099] The ADGG module represents traffic flow information at different time points by dynamically constructing a graph structure. It is mainly composed of three components: input transformation, temporal attention, and graph generation.
[0100] The input transformation is used to obtain the abstract features of each moment in the traffic flow sequence; the temporal attention part is used to extract a feature vector by summarizing the traffic information of each node in a period of history through the attention mechanism. This vector can be used to represent the dynamic traffic flow of the corresponding node at the current moment; finally, in the graph generation part, the spatial relationship between each node is calculated based on the flow vectors of any two nodes to obtain a dynamic graph.
[0101] (1) Input transformation part:
[0102] The purpose of this part is to obtain more abstract and high-level features at each moment from the traffic flow sequence. In this part, a fully-connected layer with a ReLU activation function is used to achieve the purpose of extracting high-level features from the original traffic flow data.
[0103] (2) Temporal attention part:
[0104] In the ADGG module, the temporal attention part uses the attention mechanism to extract a feature vector for each road network node by summarizing the traffic information at each time point in the input sequence. This vector effectively represents the dynamic traffic flow situation of the node at the current moment. In this embodiment, a variant attention algorithm of a multi-head scaling dot product attention mechanism is proposed, which is specifically applied to the dynamic graph generation module to achieve the integration and refinement of traffic flow information at each time point. In this variant attention algorithm, the mathematical process of each head is specifically as follows:
[0105] Assume that the input sequence of the i-th node is Where i∈{1,2···N}, this embodiment performs two mappings on the input vector at each moment in the input sequence, as follows:
[0106]
[0107] in, and are the key vector and value vector of the i-th node respectively; in addition, and are two trainable parameter matrices, and the query vector is
[0108] Therefore, the mathematical form of the variant attention algorithm used in this embodiment can be listed as follows:
[0109]
[0110] In the above formula, firstly, the query vector A and The importance score of each moment in the input sequence of the i-th node is calculated by multiplying the score by the product of . The score is calculated by softmax to obtain the weight of each moment in the input sequence. The value vector at each moment is weighted and summed based on the weight. The summation result is the traffic vector of the i-th node at the current moment, which can reflect the traffic flow of the node.
[0111] After obtaining the attention weights, the output is calculated, and the model selects the corresponding value based on the match between the query and the key. The specific mathematical form is as follows:
[0112] Output=Attention(A,B)×C (8)
[0113] The self-attention mechanism of the Transformer model can capture long-range temporal dependencies, which is critical in traffic flow prediction.
[0114] In order to enrich the traffic representation of each node, this embodiment adopts a multi-head attention mechanism, the specific form is as follows:
[0115]
[0116] Here || represents the concatenation of the outputs of each head, L is the number of heads, is the output, i.e. the flow vector of the i-th node at time t, which is a vector with a length of d b ×L one-dimensional vector. In this way, It can comprehensively describe the traffic flow at the i-th node at time t.
[0117] (3) Graph generation:
[0118] This embodiment extracts the dynamic relationship between nodes based on the node flow vector output by the temporal attention part. Assume that the matrix composed of the flow vectors of all nodes at time t is (The flow vector here is the output of the temporal attention part above.) In order to obtain the directed spatial relationship between nodes, two linear mappings are performed on the flow vector of each node, as follows:
[0119] E 1,t =H t M E1 (10)
[0120] Q 1,t =Ht M Q1 (11)
[0121] Here and Represent the matrices composed of source vectors and target vectors of all nodes at time t.
[0122] Based on the above two matrices, the directed relationship between any pair of nodes can be calculated through the following process:
[0123]
[0124] In the above formula, It is the weighted adjacency matrix of the dynamic graph generated by the dynamic graph generation module (ADGG) at time t. This matrix can fully express the spatial relationship between N road network nodes at time t based on the input sequence.
[0125] In order to achieve high efficiency of multi-step prediction, the model also configures a fully connected layer to output the future K in one step. p The prediction results at each moment ensure the prediction accuracy and practicality of the model in different application scenarios.
[0126] In this patent, each "head" captures different relationships between traffic and time. At the same time, in order to improve the model's sensitivity to actual values, the output of the Transformer is fused with the regression model to achieve accurate estimation of continuous traffic flow data. The specific process and formula are as follows:
[0127] The output of the Transformer is further processed using a nonlinear transformation:
[0128] Transformed_Output = σ(W t ×H t +b t ) (13)
[0129] Where W t is the weight matrix, b t is a bias term, and σ is a nonlinear activation function such as ReLU.
[0130] Finally, use the regression model to predict traffic flow:
[0131] Predicted_Flow = W r ×Transformed_Output+b r (14)
[0132] Where W r is the weight matrix of the regression model, b r is the bias term.
[0133] Embodiment 2:
[0134] The Transformer model proposed in Example 1 is adjusted using back propagation and optimization algorithms, and the steps are as follows:
[0135] Step 10.1, define the loss function: For traffic flow prediction, it is necessary to first define a loss function to represent the difference between the predicted traffic flow and the actual traffic flow. This patent uses the mean square error (MSE), and the specific formula is as follows:
[0136]
[0137] Among them, θ is the model parameter, is the predicted value of the ith data point, Its true value, N is the total number of data points;
[0138] Step 10.2: Correct model parameters: Use the backpropagation algorithm to calculate the gradient of the loss function with respect to the model parameters, using the chain rule, and return a gradient value for each parameter in the network.
[0139] Step 10.3, optimize the prediction algorithm: use the gradient of the loss function to update the parameters of the model to reduce the error; use the Adam method to optimize the algorithm, and its update rules are as follows:
[0140] θ t+1 =θ t -η×m t (16)
[0141] Among them, m t =β1×m t-1 +(1-β1)×g t , g t is the gradient of the loss function, η is the learning rate, and β1 is a hyperparameter.
[0142] Embodiment three:
[0143] The present invention provides a highway congestion tracing and flow prediction system, which serves the highway congestion tracing and flow prediction method proposed in the first embodiment. The system is composed of one or more processors and a memory associated with the processor, as follows:
[0144] The main task of the memory is to store the ETC gantry traffic flow data;
[0145] The processor contains program instructions, including data screening and processing modules, Transformer model building modules, and model training and prediction modules. When these program instructions are read and executed by one or more processors, the traffic flow tracing and prediction method based on ETC gantry traffic flow data described in any of the above technical solutions will be implemented.
[0146] 1) System construction and implementation:
[0147] The system integrates the core modules of data processing and analysis, and integrates multiple subsystems and modules to complete the comprehensive tasks of data collection, processing, analysis and prediction. The system adopts advanced algorithms and technologies to ensure accurate tracing and efficient prediction of traffic flow. Each processor operates according to its internal data screening and processing module, Transformer model building module, and model training and prediction module to ensure efficient task execution. At the same time, the associated memory is specifically used to store ETC gantry traffic flow data, thereby ensuring smooth operation of the system.
[0148] 2) System components include:
[0149] Processor: One or more processors, including data screening and processing modules, Transformer model building modules, and model training and prediction modules, responsible for performing data processing and analysis;
[0150] Memory: connected to the processor, specifically used to store ETC gantry traffic flow data.
[0151] Furthermore, when the program instructions are correctly read and executed by the processor, the system will implement the traffic flow tracing and prediction method based on ETC gantry traffic flow data in accordance with the predetermined technical plan, which will help improve the entire system's understanding of traffic flow and the accuracy of prediction, thereby providing a more scientific and practical traffic management solution.
[0152] The implementation and operation of this system represents a new traffic management solution that combines advanced technology and innovative algorithms. It is expected to provide more powerful and flexible support for future traffic management, thereby achieving reasonable scheduling and optimization of traffic flow and alleviating urban traffic congestion.
[0153] Embodiment 4:
[0154] In the example of the present invention, a special storage medium is also provided, in which a specific computer program is stored. When the program is executed, it will implement the highway congestion tracing and flow prediction method proposed in the first embodiment.
[0155] The storage medium in the present invention has the following characteristics:
[0156] Flexibility: The storage medium can be any physical or logical device that can store data, such as a hard disk, solid-state drive, USB drive, CD-ROM, DVD, or any other type of memory card;
[0157] Compatibility: The computer programs stored in this storage medium are designed to be compatible with a variety of computer systems and devices, ensuring that the programs can be effectively executed in different environments;
[0158] Practicality: Users only need to connect this storage medium to the corresponding computer or device to directly run or install the computer program above, and then perform the functions of traffic flow tracing and prediction based on ETC gantry traffic flow data;
[0159] Persistence: This storage medium can preserve data for a long time, ensuring the integrity and stability of the data even when the physical environment changes (such as temperature and humidity changes).
[0160] The storage medium proposed in this invention example provides an effective carrier for realizing traffic flow tracing and prediction based on ETC gantry traffic flow data. It provides a simple and direct way for users and related organizations to apply the technical solution described in this invention on various computers and devices, so as to better manage and predict traffic flow, and achieve the purpose of optimizing traffic and improving travel efficiency.
[0161] The above is only a preferred embodiment of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention. The structures, devices and operating methods not specifically described and explained in the present invention shall be implemented according to the conventional means in the art unless otherwise specified and limited.
Claims
1. A method for tracing the source of highway congestion and predicting traffic flow, characterized by: The following steps are involved: Step 1.1: Based on the traffic flow data of ETC gantries and toll stations on the studied section and its surrounding sections, filter out valid data, exclude outliers and duplicate records, and propose OD point pair analysis to trace the source of traffic flow, including the following steps: Step 1.11, OD point pair generation: For each vehicle, an OD point pair is formed according to its entry and exit positions; Step 1.12, vehicle flow tracing analysis: for the specified studied road section, according to the above OD point pairs, identify and count the sources of all vehicles passing through the road section, and then determine the upstream road section; Step 1.13, transfer matrix construction: Based on all generated OD point pairs, establish a transfer matrix M; assuming there are n traffic nodes, the transfer matrix M is an n×n square matrix, where M ij represents the traffic flow from node i to node j; Step 1.2: Analyze the source composition of the traffic flow through the studied section, and form OD point pairs to trace the source of the traffic flow through the bridge deck, so as to understand the influence of the upstream section on the traffic status of the bridge deck; Step 1.3: Clean up the traffic flow data of ETC gantry and toll station; Step 1.4: Build and train the traffic flow prediction Transformer model; encode the historical traffic flow data into a multi-dimensional feature vector; Transformer model construction module, and build a Transformer model with a multi-head attention mechanism based on the encoded feature vector; Step 1.5: Transformer model training and traffic flow prediction. Use historical data to train the Transformer model so that it can learn the spatiotemporal relationship of traffic flow on the studied road section and optimize the module. Adjust the model parameters through back propagation and optimization algorithms to improve the prediction performance and achieve accurate prediction.
2. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: The step 1.1 can receive traffic flow data from multiple ETC gantries, parse and filter the collected traffic flow data, encode and classify them according to GantryID, and have a status monitoring module that monitors and identifies in real time and automatically removes abnormal data; it can automatically update and store the processed traffic flow data in the database.
3. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: In the transfer matrix data of step 1.13, the flow change rate FCR is defined, and based on the transfer matrix M, how the change of the traffic flow of the upstream section affects the traffic conditions of the studied section is accurately evaluated; The potential impact on the downstream section can be predicted by calculating the flow change rate FCR within a certain time window, as follows: Among them, δt is the time window, flow(t-δt) and flow(t) represent the traffic flow at the start and end time respectively.
4. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: The traffic flow data cleaned in step 1.3 includes removing OD point pairs with abnormal time differences in passing through the road section, filling missing values, and unifying the data format.
5. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: In step 1.3, by comparing the passing time of vehicles at adjacent ETC gantries or toll booths, it is determined whether the traffic flow data is normal or abnormal. The steps are as follows: Step 5.1, remove excessive travel time: if the time it takes for a vehicle to pass through a certain section exceeds the maximum possible time of the section, the OD point pair should be considered as an anomaly and removed from the data set; Step 5.2: Eliminate too short time: If the vehicle's travel time is less than the minimum possible time of the interval, the OD point pair is also considered abnormal; Step 5.3: Fill in missing values: For missing data points, use the average flow rate in the time period or the flow rate in the upper and lower periods as a reference to fill in. Step 5.4, predict missing values: For missing time series missing data points, use interpolation methods to predict the missing data points.
6. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: The Transformer model includes a scaled dot product attention structure that can extract the relationship between different time points according to the input sequence and extract the temporal features in the sequence as follows: Assume that the input sequence is represented as Y t =(y t+1 ,y t+2 ,y t+3 ···y t+n )∈T n+F , where Y t ∈T F is the feature vector at time t, and F is the number of input features. Step 7.1: The attention layer performs three linear mappings on the feature vector of each moment of the input sequence: A t =Y t M a (2) B t =Y t M b (3) C t =Y t M c (4) In the formula, are the vector matrices composed of query, key, and value at n moments, respectively, and d b is the dimension of the key vector; are three parameter matrices obtained through training; In the above formula, considering Y t is a time series, where each element is the flow at a certain point in time; this series will be decomposed into queries (A t ), key(B t ) and value (C t ); In practical applications, query (A t ) represents the time point to be predicted, and their flow is known; the value (C t ) represents the flow value at the above-mentioned known time point; Step 7.2: The attention layer outputs the weighted sum of the value vectors at n moments. The weight is determined by a pair of key-value vectors corresponding to each moment. The specific mathematical form is as follows: The square root in the denominator is for scaling, which helps the model training to be more stable. Step 7.3, after obtaining the attention weight, calculate the output. The model will select the corresponding value based on the match between the query and the key. The specific mathematical form is as follows: Output=Attention(A,B)×C (8) The self-attention mechanism of the Transformer model can capture long-range temporal dependencies, which is critical in traffic flow prediction.
7. A highway congestion tracing and flow prediction method according to claim 6, characterized in that: The scaled dot product attention structure has a multi-head attention mechanism, and the number of features output by the multi-head attention mechanism is F'=d b ×L, and the output sequence has the same length as the input sequence, and its formula is expressed as follows: In the formula, || represents the concatenation operation of multiple head outputs; L is the number of heads in the structure, and is the output corresponding to the i-th node at time t; Each head captures different relationships between traffic and time. At the same time, in order to improve the sensitivity of the Transformer model to actual values, the output of the Transformer model is fused with the regression model to achieve accurate estimation of continuous traffic flow data. The process is as follows: First, the output of the Transformer model is further processed using a nonlinear transformation: Transformed_Output=σ(W t ×H t +b t ) (13) Where W t is the weight matrix, b t is a bias term, and σ is a nonlinear activation function; Finally, use the regression model to predict traffic flow: Predicted_Flow=W r ×Transformed_Output+b r (14) Where W r is the weight matrix of the regression model, b r is the bias term.
8. A highway congestion tracing and flow prediction method according to claim 1, characterized in that: The Transformer model is adjusted using back propagation and optimization algorithms, the steps are as follows: Step 10.1, define the loss function: For traffic flow prediction, you need to first define a loss function to represent the difference between the predicted traffic flow and the actual traffic flow. The loss function is as follows: Among them, θ is the model parameter, is the predicted value of the ith data point, Its true value, N is the total number of data points; Step 10.2: Correct model parameters: Use the backpropagation algorithm to calculate the gradient of the loss function with respect to the model parameters, using the chain rule, and return a gradient value for each parameter in the network. Step 10.3, optimize the prediction algorithm: use the gradient of the loss function to update the parameters of the model to reduce the error; use the Adam method to optimize the algorithm, and its update rules are as follows: i t+1 =θ t -η×m t (16) Among them, m t =β1×m t-1 +(1-β1)×g t , g t is the gradient of the loss function, η is the learning rate, and β1 is a hyperparameter.
9. A highway congestion tracing and flow prediction system, applied to a highway congestion tracing and flow prediction method according to any one of claims 1 to 8, characterized in that: The system is comprised of one or more processors, and memory associated with the processors; The memory is responsible for storing traffic flow data; The processor is responsible for managing program instructions. When these program instructions are read and executed by the processor, steps 1.1 to 1.5 will be implemented.
10. A special storage medium, applied to the traffic flow tracing and prediction system based on ETC gantry traffic flow data as claimed in claim 9, characterized in that: The steps 1.1 to 1.5 are pre-stored in a storage medium through a computer program; when the computer program is loaded and executed, traffic flow tracing and prediction based on ETC gantry traffic flow data will be performed according to the methods described in steps 1.1 to 1.5.
Citation Information
Cited By
Urban road traffic jam identification and detection method for jam prevention
CN119851469A
Data processing method and system based on AI question and answer robot
CN121092677A
Road network flow prediction method based on ETC portal data analysis
CN121305875A
Road network traffic prediction method based on ETC gantry data analysis
CN121305875B
