Reversible lane traffic flow prediction method based on edge calculation
Through edge computing and generation of adversarial network models, a dynamic road network map is constructed, which solves the problem of insufficient prediction accuracy of traffic flow in tidal lanes, achieves high-precision and real-time traffic flow prediction, and improves traffic management efficiency.
Patent Information
- Application Number
- CN202510865048.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-26
AI Technical Summary
The existing traffic flow prediction methods are mostly based on static road networks, which cannot effectively reflect the changes in space-time flow caused by dynamic adjustment of tidal lanes, resulting in insufficient prediction accuracy and difficult to meet the needs of intelligent transportation systems for real-time scheduling and optimization.
Multi-source data is obtained through edge computing, a dynamic road network map is built, and a dynamic road network map is combined with the generation of adversarial network models, multi-head attention mechanisms and graph neural networks, and adversarial training is carried out, the model is optimized and deployed to an edge server for prediction.
It improves the accuracy and timeliness of traffic flow prediction, enhances the model's perception of complex traffic states, and improves the real-time and response efficiency of traffic management.
Smart Images

Figure CN120375606A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent transportation, and particularly to a traffic flow prediction method for tidal lanes based on edge computing. Background Art
[0002] With the acceleration of the urbanization process and the continuous expansion of urban scale, traffic demand has grown rapidly, and the problem of urban traffic congestion has become increasingly serious. Especially in the central urban area, road resources are limited, and it is difficult to solve the congestion problem by simply widening the road surface. To improve the traffic efficiency under the existing road network conditions, urban planners have begun to explore more flexible traffic management strategies, and tidal lanes have thus become a feasible solution. During the morning and evening rush hours on weekdays, commuting demands are concentrated, and obvious traffic tidal phenomena occur on some sections. The traffic flow far exceeds the road carrying capacity, resulting in serious congestion. Tidal lanes can effectively relieve the pressure on the main roads by dynamically adjusting the lane traffic direction and reasonably distributing the traffic flow. However, existing traffic flow prediction methods are usually based on static road networks and do not fully consider the road structure changes after the activation of tidal lanes, making it difficult to accurately predict the actual traffic flow and affecting the scientificity and effectiveness of vehicle guidance and scheduling.
[0003] The publication number is CN118280105A, and the name is a dual determination method for opening tidal lanes based on a traffic flow prediction model. This method includes: real-time detecting the road conditions of urban main roads and preprocessing the acquired data; constructing a double exponential smoothing prediction model to predict the number of vehicles arriving in the subsequent time period; and predicting the average vehicle speed, vehicle density value, and vehicle arrival rate in the interval; dividing the road service level. When the parameters are judged to be within the range of road service levels one to three and the vehicle arrival rate follows a Poisson distribution, the tidal lane is in the closed state after dual determination; when the parameters are judged to be within the range of road service levels four to six, the tidal lane is in the open state after dual determination. This method integrates traffic flow prediction and road condition assessment, captures the traffic flow changes at different times based on the double exponential smoothing model, and combines the road service level and the vehicle arrival rate distribution for dual determination to achieve the dynamic control of tidal lanes. By Poisson and binomial distribution modeling, the prediction accuracy and adaptability are improved. This method is difficult to capture complex spatio-temporal correlations, has insufficient response to sudden traffic changes, and lacks the utilization of edge computing resources, resulting in limited real-time performance. Summary of the Invention
[0004] A series of simplified concepts are introduced in the Summary of the Invention section, which will be further elaborated in the Detailed Description section. The Summary of the Invention section of the present invention does not mean to attempt to define the key features and essential technical features of the claimed technical solution, nor does it mean to attempt to determine the protection scope of the claimed technical solution.
[0005] Since traditional traffic flow prediction methods are mostly based on static road networks and cannot effectively reflect the spatio-temporal traffic flow changes brought about by the dynamic adjustment of tidal lanes, resulting in insufficient prediction accuracy and difficulty in meeting the requirements of intelligent transportation systems for real-time scheduling and optimization, the present invention proposes a tidal lane traffic flow prediction method based on edge computing. The above method includes: Obtain service data, tidal lane configuration data, traffic flow data, and road network data through edge servers and cloud servers; Preprocess the service data, tidal lane configuration data, traffic flow data, and road network data; Based on the tidal lane configuration data and the road network data, build a model to obtain a road network diagram; Set time granularity for the service data and the traffic flow data, and divide them through the time granularity; Based on the time granularity, add the service data and the traffic flow data to the road network diagram to obtain a dynamic road network diagram; Construct a generative adversarial network model, and add a multi-head attention mechanism and a graph neural network to the generator of the generative adversarial network model; Input the dynamic road network diagram into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model; Deploy the optimized generative adversarial network model to the edge server and predict the tidal lane traffic flow.
[0006] Further, the service data, tidal lane configuration data, traffic flow data, and road network data include: The service data includes: network bandwidth, storage space, memory usage, CPU utilization, response time, user requests; The tidal lane configuration data includes: tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersections, number of tidal lanes, and traffic direction; The traffic flow data includes: historical traffic flow data and real-time traffic flow data; The historical traffic flow data includes: timestamp, intersection, historical traffic volume, historical average speed, historical congestion index; The real-time traffic flow data includes: timestamp, intersection, real-time traffic volume, real-time average speed, real-time congestion index; The road network data includes: intersections, section starting points, section ending points, number of lanes, and traffic direction.
[0007] Further, the preprocessing of the service data, tidal lane configuration data, traffic flow data, and road network data includes: Using the TimesNet model to fill in the service data and the traffic flow data; Encoding the tidal lane configuration data and the road network data.
[0008] Further, the using of the TimesNet model to fill in the service data and the traffic flow data includes: Inputting the service data and the traffic flow data into the TimesNet model; The TimesNet model performs a fast Fourier transform on the service data and the traffic flow data to obtain a frequency-domain signal; The frequency-domain signal formula is: ; Where is the frequency-domain signal of the th feature channel at the th frequency, is the time step, is the time step index, is the feature channel index, is the number of frequency components, is the frequency-domain component index, is the th feature channel at the th time step of the input data, is the basis function of the discrete Fourier transform, is the imaginary unit; By setting an amplitude threshold for the frequency-domain signal, amplitudes greater than the amplitude threshold are selected to obtain the amplitude frequencies corresponding to the amplitudes; The screening formula is: ; Where is the set of significant frequency indices, is the frequency-domain component index, is the amplitude at the th frequency, is the amplitude threshold; Calculating the period length through the amplitude frequencies, and dividing the frequency-domain signal by the period length to obtain multiple period frequencies; The period frequency set formula is: ; Where is the period length The set of frequencies, is the set of significant frequency indices, is the frequency domain component index, is to round down the period length, is the time step, is the sampling rate; Combine the periodic frequencies into a two-dimensional tensor, perform feature extraction using a convolution kernel, and reconstruct it into a one-dimensional vector.
[0009] Furthermore, the encoding of the tidal lane configuration data and the road network data includes: Use trigonometric function encoding for the tidal lane opening time and the tidal lane closing time in the tidal lane configuration data; The trigonometric function encoding formula is: ; ; where, is the sine encoding of the tidal lane opening time, is the cosine encoding of the tidal lane opening time, is the tidal lane opening time, is the sine encoding of the tidal lane closing time, is the cosine encoding of the tidal lane closing time, is the tidal lane closing time; Use One-Hot encoding for the number of tidal lanes and the traffic direction in the tidal lane configuration data; The One-Hot encoding formula is: ; where, is the encoding vector of the number of tidal lanes and the traffic direction, is the indicator function, is the number of feature category sets of the number of tidal lanes and the traffic direction in the tidal lane configuration data, is the category to be encoded, is the th element in the feature category set, is the feature category set index; Use latitude and longitude encoding for the starting position, ending position, and intersections of tidal lanes in the tidal lane configuration data; Merge the encoded results of the tidal lane configuration data to obtain a tidal lane configuration vector; The tidal lane configuration vector formula is: ; where, Configure a vector for the tidal lane, Encode vectors for the opening time and closing time of the tidal lane, Encode vectors for the number of tidal lanes and the traffic direction, Encode vectors for the starting position, ending position, and intersections of the tidal lane, Perform vector concatenation; Encode the intersections, starting points of road segments, and ending points of road segments in the road network data using longitude and latitude; Perform One-Hot encoding on the number of lanes and traffic direction in the road network data; The One-Hot encoding formula is: ; Among them, is the encoding vector for the number of lanes and traffic direction, is the indicator function, is the number of characteristic category sets of the number of lanes and traffic direction in the road network data, is the category to be encoded, is the th element in the characteristic category set, is the index of the characteristic category set; Merge the encoded results of the road network data to obtain a road network vector; The road network vector formula is: ; Among them, is the road network vector, is the encoding vector for intersections, starting points of road segments, and ending points of road segments in the road network data, is the encoding vector for the number of lanes and traffic direction, is the vector concatenation.
[0010] Furthermore, perform modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram, including: Perform modeling using the tidal lane configuration vector and the road network vector; Construct the nodes and edges in the road network diagram through the longitude and latitude of intersections, starting points of road segments, and ending points of road segments in the road network vector; Use the number of roads and traffic direction in the road network vector as the edge attributes in the road network diagram; Mark the nodes and edges in the road network diagram through the starting position, ending position, and intersections of the tidal lane in the tidal lane configuration vector; Take the number of roads and the traffic direction in the tidal lane configuration vector as the edge attributes in the road network graph.
[0011] Further, setting the time granularity for the service data and the traffic flow data, and dividing them through the time granularity includes: Set the size of the time granularity, and divide the whole day into multiple time windows based on the time granularity; The time window formula is: ; ; Among them, is the set of time windows, is the th time window, is the total number of time windows, is the size of the time granularity; Sample the resource status of the service data within each time window to obtain the service metric set corresponding to each time window; The service metric set formula is: ; ; Among them, is the total set of service metric sets, is the service metric set of the th time window, is to perform the resource status sampling operation, is the th time window, is the th time window's service data; Aggregate the traffic flow data within each time window to obtain the traffic feature vector corresponding to each time window; The traffic feature vector formula is: ; ; Among them, is the traffic feature vector set, is the traffic feature vector of the th time window, is the average aggregation operation, is the th time window, is the th time window's traffic flow data.
[0012] Further, adding the service data and the traffic flow data to the road network graph based on the time granularity to obtain a dynamic road network graph includes: Performing spatio-temporal alignment on the service metric set and the traffic feature vector according to a time window to obtain spatio-temporal features; The spatio-temporal feature formula is: ; Wherein, is the spatio-temporal feature, is the spatio-temporal alignment function, is the service metric set of the th time window, is the traffic feature vector of the th time window, is the total number of time windows; Mapping the spatio-temporal features to the corresponding nodes in the road network graph as the dynamic attributes of the nodes; The mapping formula is: ; Wherein, is the node set under the time window, is the mapping function, is the spatio-temporal feature, is the total number of time windows, is the th time window; Using each time window to update the node attributes in turn to generate the dynamic road network graph that evolves over time; The update formula is: ; Wherein, is the road network graph of the updated time window, is the graph state update function, is the road network graph of the time window, is the th time window.
[0013] Further, constructing the generative adversarial network model includes: Constructing a generative adversarial network model based on a generator and a discriminator; The generator is used to output the predicted traffic flow distribution of several time windows according to the input dynamic road network graph; The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatio-temporal distribution characteristics to the real-time traffic flow data collected in several subsequent time windows.
[0014] Further, adding the multi - head attention mechanism and the graph neural network to the generator of the generative adversarial network model includes: Construct a multi - head attention module inside the generator of the generative adversarial network model to capture the long - range dependencies of traffic flow between multiple time windows; Embed a graph neural network module in the generator of the generative adversarial network model to process the topological structure and its attribute information of nodes and edges in the dynamic road network graph; Fuse the multi - head attention module and the graph neural network module to achieve joint feature extraction of traffic states in the time and space dimensions.
[0015] Further, constructing the multi - head attention module inside the generator includes: Process the input feature vector through the multi - head self - attention mechanism; Construct multiple parallel attention heads, each attention head for learning the association patterns of the input feature vector in different semantic sub - spaces; Perform weighted fusion on the outputs of each attention head to generate an enhanced temporal feature representation.
[0016] Further, embedding the graph neural network module in the generator of the generative adversarial network model includes: Process the input feature vector through the graph neural network; Construct multiple graph neural network layers, each graph neural network layer for capturing the spatial relationships and mutual influences between the input feature vectors; The capture formula is: ; Where, is the feature matrix of the th layer, is the graph neural network, is the adjacency matrix, is the number of graph neural network layers; Perform multi - scale learning on each graph neural network layer using the average aggregation strategy; The average aggregation strategy formula is: ; Where, is the feature matrix after average aggregation of the th layer, is the number of neighbors of node , is the neighbor set of node , is the Node in the layer Characteristic vector of; Construct multiple parallel graph convolutional branches, and generate a comprehensive graph feature representation through the graph convolutional branches; The formula for the comprehensive graph feature representation is: ; Among them, is the comprehensive graph feature representation, is the weight of the th branch, is the graph convolution operation of the th branch, is the input feature matrix of the th branch, is the adjacency matrix, is the total number of branches.
[0017] Furthermore, the inputting the dynamic road network graph into the generative adversarial network for adversarial training includes: Input the dynamic road network graph into the generator to generate the predicted traffic flow distribution within a preset number of time windows; The discriminator receives the predicted traffic flow distribution and collects the real traffic flow distribution from the road network graph; Through minimizing the generator loss function and maximizing the discriminator loss function for adversarial training, make the generator gradually approach the real traffic flow distribution; The training formula is: ; Among them, is the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average value of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, is the average value of the logarithm of the probability that the sample generated by the generator is judged as false by the discriminator.
[0018] Furthermore, the step of making the generator gradually approach the real traffic flow distribution by minimizing the generator loss function and maximizing the discriminator loss function includes: During the adversarial training process, dynamically update the node attributes and edge weights in the dynamic road network graph to reflect the road state changes at different times; Through iterative training, optimize the generator parameters so that it can accurately predict the traffic flow change trend of the tidal lane at different time periods.
[0019] Further, deploying the optimized generative adversarial network model to an edge server and predicting the traffic flow of the tidal lane includes: Extracting the optimized generator parameters from the trained generative adversarial network model; Deploying the generator model and the generator parameters to an edge server with computing capabilities; Collecting real-time data through the edge server to construct a dynamic road network graph under the current time window; Inferring the dynamic road network graph based on the generator model deployed on the edge server and outputting the prediction results of the future traffic flow of the tidal lane within a preset number of time windows.
[0020] The beneficial effects of the present invention are:
[0021] 1. The present invention provides a method for predicting the traffic flow of a tidal lane based on edge computing. By obtaining multi-source data through edge computing and a cloud server and constructing a dynamic road network graph, it effectively captures the spatio-temporal feature changes of the tidal lane, improves the accuracy and timeliness of traffic flow prediction, and provides more reliable data support for intelligent traffic control.
[0022] 2. The present invention provides a method for predicting the traffic flow of a tidal lane based on edge computing. By embedding a multi-head attention mechanism and a graph neural network module in the generative adversarial network generator, it realizes the joint modeling of the long-term temporal dependence relationship and the spatial topological structure of the traffic flow, significantly enhances the model's perception ability of complex traffic states, and improves the accuracy and robustness of the prediction results.
[0023] 3. The present invention provides a method for predicting the traffic flow of a tidal lane based on edge computing. Through adversarial training by dynamically updating the node attributes and edge weights of the graph structure and deploying the optimized model to the edge server, it realizes real-time data-driven traffic flow prediction, promotes the intelligent application of edge resources, and improves the real-time performance and response efficiency of traffic management. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a schematic flowchart of a method for predicting the traffic flow of a tidal lane based on edge computing according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] The exemplary embodiments of the present invention will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the invention and to fully convey the scope of the invention to those skilled in the art.
[0026] The specific implementation of the technical solution of the present invention includes the following content: Reference Figure 1 , a traffic flow prediction method for tidal lanes based on edge computing, the method comprising: S1, obtaining service data, tidal lane configuration data, traffic flow data, and road network data through an edge server and a cloud server; S2, preprocessing the service data, tidal lane configuration data, traffic flow data, and road network data; S3, modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram; S4, setting a time granularity for the service data and the traffic flow data, and dividing them through the time granularity; S5, adding the service data and the traffic flow data to the road network diagram based on the time granularity to obtain a dynamic road network diagram; S6, constructing a generative adversarial network model, and adding a multi-head attention mechanism and a graph neural network to the generator of the generative adversarial network model; S7, inputting the dynamic road network diagram into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model; S8, deploying the optimized generative adversarial network model to an edge server and predicting the traffic flow of the tidal lane.
[0027] For step S1, the service data, tidal lane configuration data, traffic flow data, and road network data include: The service data includes: network bandwidth, storage space, memory usage, CPU utilization, response time, user requests; The tidal lane configuration data includes: tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersections, number of tidal lanes, and traffic direction; The traffic flow data includes: historical traffic flow data and real-time traffic flow data; The historical traffic flow data includes: timestamp, intersection, historical traffic volume, historical average speed, historical congestion index; The real-time traffic flow data includes: timestamp, intersection, real-time traffic volume, real-time average speed, real-time congestion index; The road network data includes: intersections, starting points of road segments, ending points of road segments, number of lanes, and traffic direction.
[0028] In one embodiment of the present invention, the service data, tidal lane configuration data, traffic flow data, and road network data form a set denoted as Data. The service data is used to reflect the operating status and service quality of the edge server, including network bandwidth, storage space, memory usage, CPU utilization, response time, and user requests. The tidal lane configuration data describes the settings and scheduling information of variable lanes in the city, including the opening time, closing time, starting position, ending position, intersections, number of lanes, and traffic direction of the tidal lanes. The traffic flow data is divided into two categories: historical traffic flow data and real-time traffic flow data. The historical data includes timestamp, intersection, historical traffic volume, historical average speed, and historical congestion index, while the real-time data includes timestamp, intersection, real-time traffic volume, real-time average speed, and real-time congestion index. The road network data is used to depict the urban road network structure, including intersections, starting points of road segments, ending points of road segments, number of lanes, and traffic direction.
[0029] In another embodiment of the present invention, Data includes: Service data: The average network bandwidth monitored by the edge server is 50 Mbps, the storage space utilization rate is 60%, the peak memory utilization rate reaches 75%, the CPU utilization rate is 80%, the average response time is 200 milliseconds, and approximately 10,000 user requests per hour are recorded. Tidal lane configuration data: The opening time of the tidal lanes is 7:00 am and 5:00 pm, the closing time is 9:00 am and 8:00 pm, the starting position is at Intersection A, the ending position is at Intersection B, the main intersections passed through are C and D, there are a total of two tidal lanes, and the traffic direction is adjusted according to the time period to adapt to the traffic flow changes during morning and evening rush hours. Traffic flow data: In the past month, the historical data at Intersection E shows that during the morning rush hour on weekdays, the average traffic volume is about 3,000 vehicles per hour, the average speed is 30 km / h, and the congestion index is 0.7. The real-time information at the current timestamp shows that the traffic volume at Intersection F at this moment is 3,200 vehicles per hour, the real-time average speed is 28 km / h, and the real-time congestion index is 0.75. Road network data: Intersection G connects Road Segment H and Road Segment I. Road Segment H starts at Intersection G and ends at Intersection J, has three lanes, and allows two-way driving. Road Segment I is a one-way three-lane design, mainly used to relieve traffic pressure during peak hours.
[0030] For step S2, the preprocessing of the service data, tidal lane configuration data, traffic flow data, and road network data includes: Using the TimesNet model to fill in the service data and the traffic flow data; Encoding the tidal lane configuration data and the road network data.
[0031] Further, the filling of the service data and the traffic flow data by using the TimesNet model includes: Input the service data and the traffic flow data into the TimesNet model; The TimesNet model performs a fast Fourier transform on the service data and the traffic flow data to obtain a frequency-domain signal; The frequency-domain signal formula is: ; where, is the frequency-domain signal of the th feature channel at the th frequency, is the time step, is the time step index, is the feature channel index, is the number of frequency components, is the frequency-domain component index, is the th input data of the th feature channel at the th time step, is the basis function of the discrete Fourier transform, is the imaginary unit; By setting an amplitude threshold for the frequency-domain signal, filter out the amplitudes greater than the amplitude threshold to obtain the amplitude frequencies corresponding to the amplitudes; The screening formula is: ; where, is the set of significant frequency indices, is the frequency-domain component index, is the amplitude at the th frequency, is the amplitude threshold; Calculate the period length through the amplitude frequencies, and divide the frequency-domain signal by the period length to obtain multiple period frequencies; The period frequency set formula is: ; where, is the period length 's frequency set, is the set of significant frequency indices, is the frequency-domain component index, is the floor function of the period length, is the time step, is the sampling rate; Combine the periodic frequencies into a two-dimensional tensor, perform feature extraction using a convolutional kernel, and reconstruct it into a one-dimensional vector.
[0032] In one embodiment of the present invention, the data in Data is input into the TimesNet model, taking real-time traffic flow as an example. The time is hours, and the feature channel index represents the traffic flow. Applying the frequency-domain signal formula, the frequency-domain signal is obtained. Set the amplitude threshold , calculate the amplitudes of all frequency components and filter out the frequency components greater than this threshold. The filtering result is . Calculate the period length and divide the frequency-domain signal through the significant frequency index set . For the frequency component , the sampling rate is indicating sampling once per hour, then the period length is 4.8, rounded down to 4 hours, and the period pattern of the frequency component is 4 hours.
[0033] Furthermore, the encoding of the tidal lane configuration data and the road network data includes: Encoding the opening time and closing time of the tidal lane in the tidal lane configuration data using trigonometric functions; The trigonometric function encoding formula is: ; ; where is the sine encoding of the opening time of the tidal lane, is the cosine encoding of the opening time of the tidal lane, is the opening time of the tidal lane, is the sine encoding of the closing time of the tidal lane, is the cosine encoding of the closing time of the tidal lane, is the closing time of the tidal lane; Encoding the number of tidal lanes and the traffic direction in the tidal lane configuration data using One-Hot encoding; The One-Hot encoding formula is: ; where is the encoding vector of the number of tidal lanes and the traffic direction, is the indicator function, is the number of feature category sets of the number of tidal lanes and the traffic direction in the tidal lane configuration data, is the category to be encoded, is the elements is the index of the feature category set; Encode the starting position, ending position, and intersections of the tidal lanes in the tidal lane configuration data using longitude and latitude; Merge the results of encoding the tidal lane configuration data to obtain a tidal lane configuration vector; The formula for the tidal lane configuration vector is: ; where, is the tidal lane configuration vector, is the encoding vector of the tidal lane opening time and the tidal lane closing time, is the encoding vector of the tidal lane number and the traffic direction, is the encoding vector of the starting position, ending position, and intersections of the tidal lanes, is vector concatenation; Encode the intersections, starting points of road segments, and ending points of road segments in the road network data using longitude and latitude; Encode the number of lanes and the traffic direction in the road network data using One - Hot encoding; The One - Hot encoding formula is: ; where, is the encoding vector of the number of lanes and the traffic direction, is the indicator function, is the number of feature category sets of the number of lanes and the traffic direction in the road network data, is the category to be encoded, is the th element in the feature category set, is the index of the feature category set; Merge the results of encoding the road network data to obtain a road network vector; The formula for the road network vector is: ; where, is the road network vector, is the encoding vector of the intersections, starting points of road segments, and ending points of road segments in the road network data, is the encoding vector of the number of lanes and the traffic direction, is vector concatenation.
[0034] In another embodiment of the present invention, encode the tidal lane opening time at 7:00 am and the tidal lane closing time at 9:00 am, , , The number of tidal lanes is two, and there are two traffic directions, one-way and two-way. It is defined as the characteristic category set. The current configuration is two tidal lanes and two-way traffic, so the corresponding One-Hot encoded vector The coordinates of the starting position A intersection of the tidal lane are (latitude: 31.2304, longitude: 121.4737), the coordinates of the ending position B intersection are (latitude: 31.2281, longitude: 121.4895), and the coordinates of the main passing intersection C are (latitude: 31.2323, longitude: 121.4789), forming an encoded vector Finally, all the encoded results are concatenated to form the tidal lane configuration vector .
[0035] For step S3, performing modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram, including: Performing modeling using the tidal lane configuration vector and the road network vector; The longitude and latitude of intersections, section starting points, and section ending points in the road network vector form the nodes and edges in the road network diagram; Taking the number of roads and traffic directions in the road network vector as the edge attributes in the road network diagram; Marking the nodes and edges in the road network diagram through the starting position of the tidal lane, the ending position of the tidal lane, and the tidal lane intersections in the tidal lane configuration vector; Taking the number of roads and traffic directions in the tidal lane configuration vector as the edge attributes in the road network diagram.
[0036] For step S4, setting a time granularity for the service data and the traffic flow data and dividing them through the time granularity, including: Setting the size of the time granularity and dividing the whole day into multiple time windows based on the time granularity; The time window formula is: ; ; where is the set of time windows, is the th time window, is the total number of time windows, is the size of the time granularity; Sampling the resource status of the service data within each time window to obtain the service metric set corresponding to each time window; The formula for the set of service metrics is: ; ; Among them, is the total set of service metrics, is the set of service metrics for the th time window, is to perform a sampling operation on the execution resource status, is the th time window, is the th time window's service data; Aggregate the traffic flow data within each of the said time windows to obtain a traffic feature vector corresponding to each of the said time windows; The formula for the traffic feature vector is: ; ; Among them, is the set of traffic feature vectors, is the traffic feature vector for the th time window, is the average aggregation operation, is the th time window, is the th time window's traffic flow data.
[0037] In an embodiment of the present invention, the time granularity size minutes is selected, and the whole day is divided into 144 time windows. Sampling the resource status of the service data within each time window to obtain the corresponding set of service metrics. Sampling the first time window in the average value method, obtaining a CPU utilization rate of 75%, a memory usage rate of 60%, and a response time of 200 ms, . Aggregate the traffic flow data according to the time window. The traffic feature vector formed within the first time window is . Five data points are collected within the first time window. The traffic volume is 200 vehicles per hour, 250 vehicles per hour, 300 vehicles per hour, 280 vehicles per hour, and 220 vehicles per hour; the average speed is 30 km / h, 28 km / h, 32 km / h, 31 km / h, and 29 km / h; the congestion index is 0.3, 0.4, 0.2, 0.35, and 0.25. Through aggregation processing, is obtained.
[0038] For step S5, adding the service data and the traffic flow data to the road network graph based on the time granularity to obtain a dynamic road network graph includes: Performing spatio-temporal alignment on the service metric set and the traffic feature vector according to a time window to obtain spatio-temporal features; The spatio-temporal feature formula is: ; Wherein, is the spatio-temporal feature, is the spatio-temporal alignment function, is the service metric set of the th time window, is the traffic feature vector of the th time window, is the total number of time windows; Mapping the spatio-temporal features to the corresponding nodes in the road network graph as the dynamic attributes of the nodes; The mapping formula is: ; Wherein, is the node set under the time window, is the mapping function, is the spatio-temporal feature, is the total number of time windows, is the th time window; Using each time window to update the node attributes in turn to generate the dynamic road network graph that evolves over time; The update formula is: ; Wherein, is the road network graph of the time window after update, is the graph state update function, is the road network graph of the time window, is the th time window.
[0039] In another embodiment of the present invention, the time window is set to 15 minutes, and by using the spatio-temporal alignment function to fuse the service metrics and the traffic feature vector of the first time window, the spatio-temporal feature vector of the first time window is obtained . Next, the spatio-temporal feature vector Map to the nodes in the corresponding road network graph. It is necessary to update the dynamic attributes of the nodes so that they reflect the service status and traffic conditions within the current time window. Based on the updated node attributes, update the status of the entire road network graph. By continuously repeating the above steps, a dynamically evolving road network graph is generated to reflect the changes in traffic conditions and service demands in real time.
[0040] For step S6, constructing the generative adversarial network model and adding the multi-head attention mechanism and graph neural network to the generator of the generative adversarial network model includes: Construct a generative adversarial network model based on the generator and discriminator; The generator is used to output the predicted traffic flow distribution for several time windows according to the input dynamic road network graph; The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatio-temporal distribution characteristics to the real-time traffic flow data collected in subsequent several time windows; Construct a multi-head attention module inside the generator of the generative adversarial network model to capture the long-range dependencies of traffic flow between multiple time windows; Embed a graph neural network module in the generator of the generative adversarial network model to process the topological structure and attribute information of nodes and edges in the dynamic road network graph; Fuse the multi-head attention module and the graph neural network module to achieve joint feature extraction of traffic states in the time and space dimensions.
[0041] In another embodiment of the present invention, there is a dynamic road network graph containing 5 time windows, with 4 nodes in each time window, and each node has 6 feature dimensions. Input the data of the first 3 time windows of the dynamic road network graph into the generator. The generator predicts the traffic flow distribution of the last 2 time windows by learning the dynamic road network graph, and the discriminator needs to evaluate the similarity between these predicted values and the actual traffic flow data.
[0042] Furthermore, constructing the multi-head attention module inside the generator includes: Process the input feature vector through the multi-head self-attention mechanism; Construct multiple parallel attention heads, and each attention head is used to learn the association patterns of the input feature vector in different semantic subspaces; Perform weighted fusion on the outputs of each attention head to generate an enhanced time feature representation.
[0043] Furthermore, embedding the graph neural network module in the generator of the generative adversarial network model includes: Process the input feature vector through a graph neural network; Construct multiple graph neural network layers, each of which is used to capture the spatial relationship and mutual influence between the input feature vectors; The capture formula is: ; Where, is the feature matrix of the th layer, is the graph neural network, is the adjacency matrix, is the number of graph neural network layers; Perform multi-scale learning on each of the graph neural network layers using the average aggregation strategy; The average aggregation strategy formula is: ; Where, is the feature matrix after average aggregation of the th layer, is the number of neighbors of node , is the neighbor set of node , is the feature vector of node in the th layer; Construct multiple parallel graph convolution branches to generate a comprehensive graph feature representation through the graph convolution branches; The comprehensive graph feature representation formula is: ; Where, is the comprehensive graph feature representation, is the weight of the th branch, is the graph convolution operation of the th branch, is the input feature matrix of the th branch, is the adjacency matrix, is the total number of branches.
[0044] For step S7, the inputting the dynamic road network graph into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model includes: Input the dynamic road network graph into the generator to generate the predicted traffic flow distribution within a preset number of time windows; The discriminator receives the predicted traffic flow distribution and collects the real traffic flow distribution from the road network graph; Through adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, the generator is gradually approximated to the true traffic flow distribution; The training formula is: ; Among them, is the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average value of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, is the average value of the logarithm of the probability that the samples generated by the generator are judged as false by the discriminator.
[0045] In an embodiment of the present invention, Furthermore, the adversarial training by minimizing the generator loss function and maximizing the discriminator loss function to make the generator gradually approximate the true traffic flow distribution includes: During the adversarial training process, dynamically update the node attributes and edge weights in the dynamic road network diagram to reflect the road state changes at different times; Through iterative training, optimize the generator parameters so that it can accurately predict the traffic flow change trend of the tidal lane in different time periods.
[0046] In an embodiment of the present invention, termination is performed by setting the number of iterative training times, and there are two termination methods. The first is to terminate when the set number of iterative training times is reached, and the second is that the generator parameters converge during the training process.
[0047] For step S8, the deployment of the optimized generative adversarial network model to the edge server and the prediction of the tidal lane traffic flow include: Extract the optimized generator parameters from the trained generative adversarial network model; Deploy the generator model and the generator parameters to an edge server with computing power; Collect real-time data through the edge server to construct a dynamic road network diagram under the current time window; Based on the generator model deployed on the edge server, perform inference on the dynamic road network diagram and output the prediction results of the future tidal lane traffic flow within a preset number of time windows.
[0048] In one embodiment of the present invention, after the generative adversarial network model completes training and reaches the expected performance, the optimized generator part and its parameters are extracted from the model. As the core module for traffic flow prediction, the generator already has the ability to perform spatio-temporal modeling on the dynamic road network graph and predict the future traffic flow distribution. Subsequently, the extracted generator model and corresponding parameters are deployed to an edge server with computing capabilities. This edge server is deployed at the edge node position of the urban traffic management system and has the capabilities of real-time data collection, model inference, and control instruction issuance. During the deployment process, the model is encapsulated into an executable inference service module to ensure its efficient operation on resource-constrained edge devices.
[0049] In another embodiment of the present invention, the preset number of time windows can be flexibly set according to the actual application scenario. When the time granularity is 15 minutes, during the morning and evening rush hours, the number of prediction time windows is set to 5 to support traffic regulation decisions within a longer time range; while during the off-peak hours, it can be set to 3 time windows to reduce the computational overhead and improve the response efficiency.
[0050] Those skilled in the art can understand that although some embodiments herein include certain features included in other embodiments rather than other features, the combination of features of different embodiments means that it is within the scope of the present invention and forms different embodiments.
[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A traffic flow prediction method for tidal lanes based on edge computing, characterized in that, Including: Obtaining service data, tidal lane configuration data, traffic flow data, and road network data through edge servers and cloud servers; Preprocessing the service data, tidal lane configuration data, traffic flow data, and road network data; Modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram; Setting a time granularity for the service data and the traffic flow data and dividing them through the time granularity; Adding the service data and the traffic flow data to the road network diagram based on the time granularity to obtain a dynamic road network diagram; Constructing a generative adversarial network model and adding a multi-head attention mechanism and a graph neural network to the generator of the generative adversarial network model; Inputting the dynamic road network diagram into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model; Deploying the optimized generative adversarial network model to an edge server and predicting the traffic flow of the tidal lane.
2. The traffic flow prediction method for tidal lanes based on edge computing according to claim 1, wherein The service data, tidal lane configuration data, traffic flow data, and road network data include: The service data includes: network bandwidth, storage space, memory usage, CPU utilization, response time, user requests; The tidal lane configuration data includes: tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersections, number of tidal lanes, and traffic directions; The traffic flow data includes: historical traffic flow data and real-time traffic flow data; The historical traffic flow data includes: timestamp, intersection, historical traffic volume, historical average speed, historical congestion index; The real-time traffic flow data includes: timestamp, intersection, real-time traffic volume, real-time average speed, real-time congestion index; The road network data includes: intersections, start points of road segments, end points of road segments, number of lanes, and traffic directions.
3. The traffic flow prediction method for tidal lanes based on edge computing according to claim 1, wherein The preprocessing of the service data, tidal lane configuration data, traffic flow data, and road network data includes: Using the TimesNet model to fill in the service data and the traffic flow data; Encoding the tidal lane configuration data and the road network data.
4. The traffic flow prediction method for tidal lanes based on edge computing according to claim 3, wherein, The using of the TimesNet model to fill in the service data and the traffic flow data includes: Inputting the service data and the traffic flow data into the TimesNet model; The TimesNet model performs a fast Fourier transform on the service data and the traffic flow data to obtain a frequency domain signal; The frequency domain signal formula is: ; Among them, is the frequency-domain signal of the th feature channel at the th frequency, is the time step, is the time step index, is the feature channel index, is the number of frequency components, is the frequency-domain component index, is the th feature channel at the th time step of the input data, is the basis function of the discrete Fourier transform, is the imaginary unit; By setting an amplitude threshold for the frequency domain signal, screening out the amplitudes greater than the amplitude threshold to obtain the amplitude frequencies corresponding to the amplitudes; The screening formula is: ; Among them, is a set of significant frequency indices, is a frequency domain component index, is the amplitude at the th frequency, and is an amplitude threshold; Calculating the period length through the amplitude frequencies, dividing the frequency domain signal by the period length to obtain multiple period frequencies; The period frequency set formula is: ; wherein, is the cycle length of the frequency set, is the set of significant frequency indices, is the frequency domain component index, is to round down the cycle length, is the time step, is the sampling rate; Combining the period frequencies into a two-dimensional tensor, extracting features using a convolutional kernel, and reconstructing them into a one-dimensional vector.
5. The traffic flow prediction method for tidal lanes based on edge computing according to claim 3, characterized in that Encoding the tidal lane configuration data and the road network data includes: Encoding the opening time and closing time of the tidal lane in the tidal lane configuration data using trigonometric functions; The trigonometric function encoding formula is as follows: ; ; Among them, is the sine encoding of the opening time of the tidal lane, is the cosine encoding of the opening time of the tidal lane, is the opening time of the tidal lane, is the sine encoding of the closing time of the tidal lane, is the cosine encoding of the closing time of the tidal lane, is the closing time of the tidal lane; Encoding the number of tidal lanes and the traffic direction in the tidal lane configuration data using One-Hot encoding; The One-Hot encoding formula is: ; Among them, is the coding vector of the number of tidal lanes and the traffic direction, is the indicator function, is the set number of the number of tidal lanes and the traffic direction feature categories in the tidal lane configuration data, is the category to be coded, is the th element in the set of feature categories, is the index of the set of feature categories; Encoding the starting position, ending position, and intersections of the tidal lane in the tidal lane configuration data using longitude and latitude; Merging the encoded results of the tidal lane configuration data to obtain a tidal lane configuration vector; The tidal lane configuration vector formula is: ; Among them, is the tidal lane configuration vector, is the encoding vector of the tidal lane opening time and the tidal lane closing time, is the encoding vector of the tidal lane number and the traffic direction, is the encoding vector of the starting position of the tidal lane, the ending position of the tidal lane and the tidal lane intersection, is the vector concatenation; Encoding the intersections, starting points, and ending points of the road segments in the road network data using longitude and latitude; Encoding the number of lanes and the traffic direction in the road network data using One-Hot encoding; The One-Hot encoding formula is: ; Among them, is the lane number and traffic direction encoding vector, is the indicator function, is the number of sets of lane number and traffic direction feature categories in the road network data, is the category to be encoded, is the th element in the set of feature categories, is the feature category set index; Merging the encoded results of the road network data to obtain a road network vector; The road network vector formula is: ; Among them, is the road network vector, is the encoding vector of intersections, section start points and section end points in the road network data, is the encoding vector of the number of lanes and traffic directions, is the vector concatenation.
6. The traffic flow prediction method for tidal lanes based on edge computing according to claim 1, wherein, Modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram, including: Using the tidal lane configuration vector and the road network vector for modeling; Constructing the nodes and edges in the road network diagram through the longitudes and latitudes of the intersections, starting points, and ending points of the road segments in the road network vector; Taking the number of roads and the traffic direction in the road network vector as the edge attributes in the road network diagram; Marking the nodes and edges in the road network diagram through the starting position, ending position, and intersections of the tidal lane in the tidal lane configuration vector; Taking the number of roads and the traffic direction in the tidal lane configuration vector as the edge attributes in the road network diagram.
7. The traffic flow prediction method for tidal lanes based on edge computing according to claim 1, characterized in that, Setting a time granularity for the service data and the traffic flow data and dividing them through the time granularity, including: Setting the size of the time granularity and dividing the whole day into multiple time windows based on the time granularity; The time window formula is: ; ; Among them, is a set of time windows, is the th time window, is the total number of time windows, is the time granularity size; Sampling the resource status of the service data within each time window to obtain a service metric set corresponding to each time window; The service metric set formula is: ; ; Among them, is the total set of service metric sets, is the service metric set for the th time window, is to perform an execution resource status sampling operation, is the th time window, is the service data for the th time window; Performing aggregation processing on the traffic flow data within each time window to obtain a traffic feature vector corresponding to each time window; The traffic feature vector formula is: ; ; Among them, is a set of traffic feature vectors, is the traffic feature vector of the th time window, is the average aggregation operation, is the th time window, is the traffic flow data of the th time window.
8. The tidal lane traffic flow prediction method based on edge computing according to claim 1, characterized in that Adding the service data and the traffic flow data to the road network diagram based on the time granularity to obtain a dynamic road network diagram, including: Performing spatio-temporal alignment on the service metric set and the traffic feature vector according to the time window to obtain spatio-temporal features; The spatio-temporal feature formula is: ; Among them, is the spatio-temporal feature, is the spatio-temporal alignment function, is the set of service metrics for the th time window, is the traffic feature vector for the th time window; is the total number of time windows; Mapping the spatio-temporal features to the corresponding nodes in the road network diagram as the dynamic attributes of the nodes; The mapping formula is: ; Among them, is the set of nodes under the time window, is the mapping function, is the spatio-temporal feature, is the total number of time windows, is the th time window; Using each time window to update the node attributes in turn to generate the dynamic road network diagram evolving with time; The update formula is: ; Among them, is the updated road network diagram of the time window, is the graph state update function, is the road network diagram of the time window, is the th time window.
9. The traffic flow prediction method for tidal lanes based on edge computing according to claim 1, characterized in that, Constructing a generative adversarial network model, including: Constructing a generative adversarial network model based on a generator and a discriminator; The generator is used to output the predicted traffic flow distribution for several time windows according to the input dynamic road network diagram; The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatio-temporal distribution characteristics to the real-time traffic flow data collected in subsequent several time windows.
10. A traffic flow prediction method for tidal lanes based on edge computing according to claim 1, characterized in that, Adding the multi-head attention mechanism and the graph neural network to the generator of the generative adversarial network model includes: Constructing a multi-head attention module inside the generator of the generative adversarial network model to capture the long-range dependence relationship of traffic flow between multiple time windows; Embedding a graph neural network module in the generator of the generative adversarial network model to process the topological structure and its attribute information of nodes and edges in the dynamic road network graph; Fusing the multi-head attention module and the graph neural network module to achieve joint feature extraction of traffic states in the time and space dimensions.
11. The traffic flow prediction method for tidal lanes based on edge computing according to claim 10, characterized in that, Constructing the multi-head attention module inside the generator includes: Processing the input feature vector through the multi-head self-attention mechanism; Constructing multiple parallel attention heads, and each attention head is used to learn the association pattern of the input feature vector in different semantic subspaces; Performing weighted fusion on the outputs of each attention head to generate an enhanced time feature representation.
12. The traffic flow prediction method for tidal lanes based on edge computing according to claim 10, characterized in that, Embedding the graph neural network module in the generator of the generative adversarial network model includes: Processing the input feature vector through the graph neural network; Constructing multiple graph neural network layers, and each graph neural network layer is used to capture the spatial relationship and mutual influence between the input feature vectors; The capture formula is: ; Among them, is the layer feature matrix, is a graph neural network, is an adjacency matrix, is the number of layers of the graph neural network; Using the average aggregation strategy for multi-scale learning for each graph neural network layer; The average aggregation strategy formula is: ; Among them, is the feature matrix after average aggregation of the th layer, is the number of neighbors of node , is the neighbor set of node , is the th layer, and is the feature vector of node Constructing multiple parallel graph convolution branches, and generating a comprehensive graph feature representation through the graph convolution branches; The comprehensive graph feature representation formula is: ; Among them, is the comprehensive graph feature representation, is the weight of the -th branch, is the graph convolution operation of the -th branch, is the input feature matrix of the -th branch, is the total number of branches.
13. A traffic flow prediction method for tidal lanes based on edge computing according to claim 1, characterized in that Inputting the dynamic road network graph into the generative adversarial network for adversarial training includes: Inputting the dynamic road network graph into the generator to generate the predicted traffic flow distribution within a preset number of time windows; The discriminator receives the predicted traffic flow distribution and collects the real traffic flow distribution from the road network graph; Performing adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, so that the generator gradually approaches the real traffic flow distribution; The training formula is: ; Among them, is the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average value of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, is the average value of the logarithm of the probability that the samples generated by the generator are judged as false by the discriminator.
14. A traffic flow prediction method for tidal lanes based on edge computing according to claim 13, characterized in that, Performing adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, so that the generator gradually approaches the real traffic flow distribution, including: During the adversarial training process, dynamically updating the node attributes and edge weights in the dynamic road network graph to reflect the road state changes at different moments; Through iterative training, optimizing the generator parameters so that it can accurately predict the traffic flow change trend of the tidal lane in different time periods.
15. A traffic flow prediction method for tidal lanes based on edge computing according to claim 1, characterized in that, Deploying the optimized generative adversarial network model to the edge server and predicting the traffic flow of the tidal lane includes: Extracting the optimized generator parameters from the trained generative adversarial network model; Deploying the generator model and the generator parameters to an edge server with computing power; Collect real-time data through the edge server and construct a dynamic road network graph under the current time window; Based on the generator model deployed on the edge server, infer the dynamic road network graph and output the prediction results of the future tidal lane traffic flow within a preset number of time windows.
Citation Information
Patent Citations
Tidal lane opening dual judgment method based on traffic flow prediction model
CN118280105A
Short-term traffic flow prediction method based on generative confrontation network
CN109493599A
Graph neural network traffic flow prediction method and system based on attention mechanism
CN111161535A
Urban road flow global prediction method based on multi-source data
CN117576918A
Time-space correlation traffic flow prediction method based on deep learning
CN119274345A
Cited By
Route planning method integrating edge calculation and anomaly detection
CN120764814A
A path planning method fusing edge computing and anomaly detection
CN120764814B
Electric vehicle charging pile utilization rate prediction method and device, equipment and medium
CN121860157A
Methods, devices, equipment and media for predicting the utilization rate of electric vehicle charging piles
CN121860157B