A tidal lane traffic flow prediction method based on edge computing
Through edge computing and generative adversarial network model combining multi-head attention mechanism and graph neural network, a dynamic road network map is constructed, which solves the problem of insufficient accuracy of traffic flow prediction in tidal lane, realizes real-time and accurate traffic flow prediction, and improves the real-time and response efficiency of traffic management.
Patent Information
- Application Number
- CN202510865048.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-26
AI Technical Summary
The existing traffic flow prediction methods fail to effectively capture 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 generative adversarial network model is used to combine multi-head attention mechanisms and graph neural networks to predict traffic flow, dynamically update the node attributes and edge weights of graph structures, and deploy them to edge servers for real-time prediction.
It improves the accuracy and timeliness of traffic flow prediction, enhances the model's perception of complex traffic states, and promotes the real-time and response efficiency of traffic management.
Smart Images

Figure CN120375606B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and in particular to a tidal lane traffic flow prediction method based on edge computing. Background Art
[0002] With the acceleration of urbanization and the continued expansion of cities, transportation demand is rapidly increasing, and urban traffic congestion is becoming increasingly serious. This is especially true in city centers, where road resources are limited, making it difficult to resolve congestion simply by widening roads. To improve traffic efficiency within existing road networks, urban planners are exploring more flexible traffic management strategies, with tidal lanes emerging as a viable solution. During weekday morning and evening rush hours, when commuting demand is concentrated, some sections of roads experience significant traffic surges, with traffic volumes significantly exceeding road carrying capacity and leading to severe congestion. Tidal lanes dynamically adjust lane directions to rationally distribute traffic flow, effectively alleviating pressure on arterial roads. However, existing traffic flow prediction methods are typically based on static road networks and fail to fully consider the changes in road structure after the implementation of tidal lanes. This makes it difficult to accurately predict actual traffic flows, hindering the scientific and effective nature of vehicle guidance and scheduling.
[0003] Publication number CN118280105A, titled "A Dual Determination Method for Opening Tidal Lanes Based on a Traffic Flow Prediction Model." The method includes: real-time monitoring of urban trunk road conditions and preprocessing of the acquired data; constructing a quadratic exponential smoothing prediction model to predict the number of vehicle arrivals in subsequent time periods; and predicting the interval average speed, vehicle density, and vehicle arrival rate; and classifying road service levels. 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 closed after the dual determination; when the parameters are judged to be within the range of road service levels four to six, the tidal lane is open after the dual determination. This method integrates traffic flow prediction with road condition assessment, capturing traffic flow changes at different times based on a quadratic exponential smoothing model. Dual determination is performed based on the road service level and vehicle arrival rate distribution to achieve dynamic control of tidal lanes. Through modeling with Poisson and binomial distributions, prediction accuracy and adaptability are improved. This method has difficulty capturing complex spatiotemporal correlations, is insufficiently responsive to sudden traffic changes, and lacks the utilization of edge computing resources, resulting in limited real-time performance. Summary of the Invention
[0004] The Summary of the Invention introduces a series of simplified concepts that will be further described in the Detailed Description of the Invention. The Summary of the Invention is not intended to limit the key features and essential features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.
[0005] Since traditional traffic flow prediction methods are mostly based on static road networks, they cannot effectively reflect the spatiotemporal traffic changes caused by the dynamic adjustment of tidal lanes, resulting in insufficient prediction accuracy and difficulty in meeting the real-time scheduling and optimization requirements of intelligent transportation systems. This paper proposes a tidal lane traffic flow prediction method based on edge computing, which includes:
[0006] Obtain service data, tidal lane configuration data, traffic flow data, and road network data through edge servers and cloud servers;
[0007] pre-processing the service data, tidal lane configuration data, traffic flow data, and road network data;
[0008] Performing modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram;
[0009] Setting a time granularity for the service data and the traffic flow data, and dividing the data according to the time granularity;
[0010] 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;
[0011] Build 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;
[0012] Inputting the dynamic road network graph into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model;
[0013] The optimized generative adversarial network model is deployed on the edge server to predict the traffic flow in the tidal lane.
[0014] Furthermore, the service data, tidal lane configuration data, traffic flow data and road network data include:
[0015] The service data includes: network bandwidth, storage space, memory usage, CPU utilization, response time, and user requests;
[0016] The tidal lane configuration data includes: tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersection, tidal lane number and traffic direction;
[0017] The traffic flow data includes: historical traffic flow data and real-time traffic flow data;
[0018] The historical traffic flow data includes: timestamp, intersection, historical traffic flow, historical average speed, and historical congestion index;
[0019] The real-time traffic flow data includes: timestamp, intersection, real-time traffic flow, real-time average speed, and real-time congestion index;
[0020] The road network data includes: intersections, section starting points, section ending points, number of lanes, and travel directions.
[0021] Furthermore, the pre-processing of the service data, tidal lane configuration data, traffic flow data and road network data includes:
[0022] Filling the service data and the traffic flow data using a TimesNet model;
[0023] The tidal lane configuration data and the road network data are encoded.
[0024] Furthermore, the use of the TimesNet model to fill the service data and the traffic flow data includes:
[0025] Inputting the service data and the traffic flow data into a TimesNet model;
[0026] The TimesNet model performs fast Fourier transform on the service data and the traffic flow data to obtain a frequency domain signal;
[0027] The frequency domain signal formula is:
[0028] ;
[0029] in, For the The feature channel is The frequency domain signal at a 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, For the The feature channel is The input data of time steps, is the basis function of discrete Fourier transform, is an imaginary unit;
[0030] By setting an amplitude threshold for the frequency domain signal, filtering out amplitudes greater than the amplitude threshold, and obtaining an amplitude frequency corresponding to the amplitude;
[0031] The screening formula is:
[0032] ;
[0033] in, is a set of significant frequency indices, is the frequency domain component index, For the The amplitude at the frequency, is the amplitude threshold;
[0034] Calculating a cycle length using the amplitude frequency, and dividing the frequency domain signal by the cycle length to obtain a plurality of cycle frequencies;
[0035] The period frequency set formula is:
[0036] ;
[0037] in, is the cycle length The frequency set, is a set of significant frequency indices, is the frequency domain component index, To round down the period length, is the time step, is the sampling rate;
[0038] The periodic frequencies are combined into a two-dimensional tensor, and feature extraction is performed using a convolution kernel, which is then reconstructed into a one-dimensional vector.
[0039] Furthermore, encoding the tidal lane configuration data and the road network data includes:
[0040] The tidal lane opening time and the tidal lane closing time in the tidal lane configuration data are coded using trigonometric functions;
[0041] The trigonometric function encoding formula is:
[0042] ;
[0043] ;
[0044] in, is the sinusoidal code of the tidal lane opening time, is the cosine code of the tidal lane opening time, Opening time for tidal lanes, is the sinusoidal code of the tidal lane closing time, is the cosine code of the tidal lane closure time, for tidal lane closure times;
[0045] One-hot encoding is used for the number of tidal lanes and the direction of travel in the tidal lane configuration data;
[0046] The One-Hot encoding formula is:
[0047] ;
[0048] in, is the encoding vector for the number of tidal lanes and the direction of travel, is the indicator function, The number of tidal lanes and the number of travel direction feature category sets in the tidal lane configuration data, is the category to be coded, is the first in the feature category set elements, is the feature category set index;
[0049] The tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration data are encoded with longitude and latitude;
[0050] Merging the encoded results of the tidal lane configuration data to obtain a tidal lane configuration vector;
[0051] The formula for tidal lane configuration vector is:
[0052] ;
[0053] in, Configure vectors for tidal lanes, Encoding vectors for tidal lane opening time and tidal lane closing time, is the encoding vector for the number of tidal lanes and the direction of travel, is the encoding vector of the tidal lane starting position, tidal lane ending position and tidal lane intersection, For vector splicing;
[0054] Using longitude and latitude coding for intersections, section starting points and section ending points in the road network data;
[0055] One-hot encoding is used for the number of lanes and travel directions in the road network data;
[0056] The One-Hot encoding formula is:
[0057] ;
[0058] in, is the encoding vector for the number of lanes and the direction of travel, is the indicator function, is the number of lanes and travel direction feature category sets in the road network data, is the category to be coded, is the first in the feature category set elements, is the feature category set index;
[0059] Merging the encoded results of the road network data to obtain a road network vector;
[0060] The road network vector formula is:
[0061] ;
[0062] in, is the road network vector, Encode vectors for intersections, segment start points, and segment end points in road network data, is the encoding vector for the number of lanes and the direction of travel, Vector stitching.
[0063] Furthermore, the modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram includes:
[0064] Modeling using tidal lane configuration vectors and road network vectors;
[0065] The nodes and edges in the road network graph are formed by the longitude and latitude of the intersections, the starting points of the road sections and the ending points of the road sections in the road network vector;
[0066] Using the number of roads and the travel directions in the road network vector as edge attributes in the road network graph;
[0067] Marking nodes and edges in the road network graph by the tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration vector;
[0068] The number of roads and the travel directions in the tidal lane configuration vector are used as edge attributes in the road network graph.
[0069] Furthermore, the setting of time granularity for the service data and the traffic flow data, and the division by the time granularity, includes:
[0070] Set the time granularity and divide the whole day into multiple time windows based on the time granularity;
[0071] The time window formula is:
[0072] ;
[0073] ;
[0074] in, is a set of time windows, For the time window, is the total number of time windows, is the time granularity;
[0075] Performing resource status sampling on the service data within each of the time windows to obtain a service indicator set corresponding to each of the time windows;
[0076] The service indicator set formula is:
[0077] ;
[0078] ;
[0079] in, is the total set of service indicator sets, For the A set of service indicators for a time window, To perform resource status sampling operations, For the time window, For the Service data for a time window;
[0080] Aggregating the traffic flow data within each time window to obtain a traffic feature vector corresponding to each time window;
[0081] The traffic characteristic vector formula is:
[0082] ;
[0083] ;
[0084] in, is the set of traffic feature vectors, For the Traffic feature vector of time windows, is the average aggregation operation, For the time window, For the Traffic flow data for a time window.
[0085] Furthermore, the 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:
[0086] According to the time window, the service indicator set and the traffic feature vector are temporally and spatially aligned to obtain the spatiotemporal features;
[0087] The spatiotemporal characteristic formula is:
[0088] ;
[0089] in, is the spatiotemporal feature, is the spatiotemporal alignment function, For the A set of service indicators for a time window, For the Traffic feature vector of time windows, is the total number of time windows;
[0090] Mapping the spatiotemporal features to corresponding nodes in the road network graph as dynamic attributes of the nodes;
[0091] The mapping formula is:
[0092] ;
[0093] in, for The set of nodes under the time window, is the mapping function, is the spatiotemporal feature, is the total number of time windows, For the time windows;
[0094] Using each time window to update node attributes in sequence, generating the dynamic road network graph that evolves over time;
[0095] The update formula is:
[0096] ;
[0097] in, For the updated Time window road network diagram, is the graph state update function, for Time window road network diagram, For the A time window.
[0098] Furthermore, the constructing of a generative adversarial network model includes:
[0099] Build a generative adversarial network model based on the generator and discriminator;
[0100] The generator is used to output predicted traffic flow distribution in a number of time windows based on the input dynamic road network graph;
[0101] The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatiotemporal distribution characteristics to the real-time traffic flow data collected in several subsequent time windows.
[0102] Furthermore, the adding of the multi-head attention mechanism and the graph neural network to the generator of the generative adversarial network model includes:
[0103] A multi-head attention module is constructed within the generator of the generative adversarial network model to capture the long-range dependency of traffic flow across multiple time windows;
[0104] Embedding 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;
[0105] The multi-head attention module is integrated with the graph neural network module to realize joint feature extraction of traffic status in time and space dimensions.
[0106] Furthermore, the multi-head attention module is constructed within the generator, including:
[0107] Process the input feature vector through a multi-head self-attention mechanism;
[0108] Constructing multiple parallel attention heads, each of which is used to learn the association pattern of the input feature vector in different semantic subspaces;
[0109] The outputs of each attention head are weightedly fused to generate an enhanced temporal feature representation.
[0110] Furthermore, embedding a graph neural network module in the generator of the generative adversarial network model includes:
[0111] Process the input feature vector through the graph neural network;
[0112] Constructing multiple graph neural network layers, each of which is used to capture the spatial relationship and mutual influence between the input feature vectors;
[0113] The capture formula is:
[0114] ;
[0115] in, For the Layer feature matrix, is a graph neural network, is the adjacency matrix, is the number of graph neural network layers;
[0116] Performing multi-scale learning on each graph neural network layer using an average aggregation strategy;
[0117] The average aggregation strategy formula is:
[0118] ;
[0119] in, For the The feature matrix after the average aggregation of the layer, For nodes The number of neighbors, For nodes The neighbor set of For the Nodes in the layer The eigenvector of
[0120] Constructing multiple parallel graph convolution branches to generate comprehensive graph feature representations through the graph convolution branches;
[0121] The formula for comprehensive graph feature representation is:
[0122] ;
[0123] in, is a comprehensive graph feature representation, For the branch weights, For the The graph convolution operation of the branches, For the The input feature matrix of each branch, is the adjacency matrix, is the total number of branches.
[0124] Furthermore, inputting the dynamic road network graph into the generative adversarial network for adversarial training includes:
[0125] Inputting the dynamic road network graph into the generator to generate predicted traffic flow distribution within a preset number of time windows;
[0126] The discriminator receives the predicted traffic flow distribution and collects the actual traffic flow distribution from the road network graph;
[0127] By performing adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, the generator is gradually approximated to the real traffic flow distribution;
[0128] The training formula is:
[0129] ;
[0130] in, For the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, The mean of the logarithm of the probability that the discriminator judges the samples generated by the generator to be fake.
[0131] Furthermore, the adversarial training is performed by minimizing the generator loss function and maximizing the discriminator loss function, so that the generator gradually approaches the real traffic flow distribution, including:
[0132] During the adversarial training process, node attributes and edge weights in the dynamic road network graph are dynamically updated to reflect changes in road states at different times;
[0133] Through iterative training, the generator parameters are optimized so that it can accurately predict the traffic flow change trend of tidal lanes in different time periods.
[0134] Furthermore, the optimized generative adversarial network model is deployed on the edge server, and traffic flow in the tidal lane is predicted, including:
[0135] Extract optimized generator parameters from the trained GAN model;
[0136] Deploying the generator model and the generator parameters to an edge server with computing power;
[0137] Collecting real-time data through the edge server to build a dynamic road network graph in the current time window;
[0138] The dynamic road network graph is inferred based on the generator model deployed on the edge server, and the prediction results of future tidal lane traffic flow within a preset number of time windows are output.
[0139] The beneficial effects of the present invention are:
[0140] 1. The present invention provides a tidal lane traffic flow prediction method based on edge computing. It obtains multi-source data through edge computing and cloud servers, and constructs a dynamic road network diagram, effectively capturing the changes in the spatiotemporal characteristics of tidal lanes, improving the accuracy and timeliness of traffic flow prediction, and providing more reliable data support for intelligent traffic control.
[0141] 2. The present invention provides a tidal lane traffic flow prediction method based on edge computing. By embedding a multi-head attention mechanism and a graph neural network module in a synthetic adversarial network generator, it realizes the joint modeling of the long-range temporal dependency and spatial topological structure of traffic flow, significantly enhances the model's perception of complex traffic conditions, and improves the accuracy and robustness of the prediction results.
[0142] 3. The present invention provides a tidal lane traffic flow prediction method based on edge computing. By dynamically updating the graph structure node attributes and edge weights for adversarial training, and deploying the optimized model to the edge server, real-time data-driven traffic flow prediction is realized, which promotes the intelligent application of edge resources and improves the real-time and response efficiency of traffic management. BRIEF DESCRIPTION OF THE DRAWINGS
[0143] Figure 1 It is a flow chart of a tidal lane traffic flow prediction method based on edge computing in the present invention. DETAILED DESCRIPTION
[0144] Exemplary embodiments of the present invention will now be described in greater detail with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention may be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to facilitate a more thorough understanding of the invention and to fully convey the scope of the invention to those skilled in the art.
[0145] The specific implementation of the technical solution of the present invention includes the following contents:
[0146] refer to Figure 1 , a tidal lane traffic flow prediction method based on edge computing, the method comprising:
[0147] S1, obtains service data, tidal lane configuration data, traffic flow data, and road network data through edge servers and cloud servers;
[0148] S2, preprocessing the service data, tidal lane configuration data, traffic flow data and road network data;
[0149] S3, performing modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram;
[0150] S4, setting a time granularity for the service data and the traffic flow data, and dividing the data according to the time granularity;
[0151] 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;
[0152] S6, building a generative adversarial network model, adding a multi-head attention mechanism and a graph neural network to the generator of the generative adversarial network model;
[0153] S7, inputting the dynamic road network graph into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model;
[0154] S8: Deploy the optimized generative adversarial network model to the edge server and predict the traffic flow in the tidal lane.
[0155] For step S1, the service data, tidal lane configuration data, traffic flow data and road network data include:
[0156] The service data includes: network bandwidth, storage space, memory usage, CPU utilization, response time, and user requests;
[0157] The tidal lane configuration data includes: tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersection, tidal lane number and traffic direction;
[0158] The traffic flow data includes: historical traffic flow data and real-time traffic flow data;
[0159] The historical traffic flow data includes: timestamp, intersection, historical traffic flow, historical average speed, and historical congestion index;
[0160] The real-time traffic flow data includes: timestamp, intersection, real-time traffic flow, real-time average speed, and real-time congestion index;
[0161] The road network data includes: intersections, section starting points, section ending points, number of lanes, and travel directions.
[0162] In one embodiment of the present invention, the service data, tidal lane configuration data, traffic flow data, and road network data form a collection denoted as Data. 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; tidal lane configuration data describes the setting and scheduling information of variable lanes in the city, including tidal lane opening time, tidal lane closing time, tidal lane starting position, tidal lane ending position, tidal lane intersection, number of tidal lanes, and travel direction; traffic flow data is divided into historical traffic flow data and real-time traffic flow data. Historical data includes timestamps, intersections, historical traffic flow, historical average speed, and historical congestion index, while real-time data includes timestamps, intersections, real-time traffic flow, real-time average speed, and real-time congestion index; road network data is used to characterize the urban road network structure, including intersections, section starting points, section ending points, number of lanes, and travel direction.
[0163] In another embodiment of the present invention, Data includes service data: the average network bandwidth monitored by the edge server is 50Mbps, the storage space utilization rate is 60%, the memory utilization rate peaks at 75%, the CPU utilization rate is 80%, the response time is 200 milliseconds on average, and approximately 10,000 user requests are recorded per hour; tidal lane configuration data: the tidal lane is open at 7 a.m. and 5 p.m., and closed at 9 a.m. and 8 p.m., starting at intersection A and ending at intersection B. The main intersections passed are C and D. There are two tidal lanes in total, and the direction of travel is adjusted according to the time period to adapt to the morning and evening peak traffic. Traffic flow changes; Traffic flow data: Over the past month, historical data from Intersection E shows that during the morning rush hour on weekdays, the average traffic volume was approximately 3,000 vehicles per hour, with an average speed of 30 km / h and a congestion index of 0.7. Real-time information at the current timestamp shows that the traffic volume at Intersection F at this moment is 3,200 vehicles per hour, with a real-time average speed of 28 km / h and a real-time congestion index of 0.75; Road network data: Intersection G connects Section H and Section I. Section H starts at Intersection G and ends at Intersection J. It has three lanes and allows two-way travel. Section I is a one-way three-lane design, mainly used to alleviate traffic pressure during peak hours.
[0164] Regarding step S2, the pre-processing of the service data, tidal lane configuration data, traffic flow data and road network data includes:
[0165] Filling the service data and the traffic flow data using a TimesNet model;
[0166] The tidal lane configuration data and the road network data are encoded.
[0167] Furthermore, the use of the TimesNet model to fill the service data and the traffic flow data includes:
[0168] Inputting the service data and the traffic flow data into a TimesNet model;
[0169] The TimesNet model performs fast Fourier transform on the service data and the traffic flow data to obtain a frequency domain signal;
[0170] The frequency domain signal formula is:
[0171] ;
[0172] in, For the The feature channel is The frequency domain signal at a 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, For the The feature channel is The input data of time steps, is the basis function of discrete Fourier transform, is an imaginary unit;
[0173] By setting an amplitude threshold for the frequency domain signal, filtering out amplitudes greater than the amplitude threshold, and obtaining an amplitude frequency corresponding to the amplitude;
[0174] The screening formula is:
[0175] ;
[0176] in, is a set of significant frequency indices, is the frequency domain component index, For the The amplitude at the frequency, is the amplitude threshold;
[0177] Calculating a cycle length using the amplitude frequency, and dividing the frequency domain signal by the cycle length to obtain a plurality of cycle frequencies;
[0178] The period frequency set formula is:
[0179] ;
[0180] in, is the cycle length The frequency set, is a set of significant frequency indices, is the frequency domain component index, To round down the period length, is the time step, is the sampling rate;
[0181] The periodic frequencies are combined into a two-dimensional tensor, and feature extraction is performed using a convolution kernel, which is then reconstructed into a one-dimensional vector.
[0182] 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. Hour, feature channel index Represents the traffic flow, and applies the frequency domain signal formula to obtain the frequency domain signal. Set the amplitude threshold , calculate the amplitude of all frequency components And filter out the frequency components greater than the threshold, the screening result is . Index the set by significant frequency Calculate the cycle length and divide the frequency domain signal, for the frequency components , the sampling rate is If the sampling is done once per hour, the cycle length is 4.8, which is rounded down to 4 hours to obtain the frequency component. The cycle mode is 4 hours.
[0183] Furthermore, encoding the tidal lane configuration data and the road network data includes:
[0184] The tidal lane opening time and the tidal lane closing time in the tidal lane configuration data are coded using trigonometric functions;
[0185] The trigonometric function encoding formula is:
[0186] ;
[0187] ;
[0188] in, is the sinusoidal code of the tidal lane opening time, is the cosine code of the tidal lane opening time, Opening time for tidal lanes, is the sinusoidal code of the tidal lane closing time, is the cosine code of the tidal lane closure time, for tidal lane closure times;
[0189] One-hot encoding is used for the number of tidal lanes and the direction of travel in the tidal lane configuration data;
[0190] The One-Hot encoding formula is:
[0191] ;
[0192] in, is the encoding vector for the number of tidal lanes and the direction of travel, is the indicator function, The number of tidal lanes and the number of travel direction feature category sets in the tidal lane configuration data, is the category to be coded, is the first in the feature category set elements, is the feature category set index;
[0193] The tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration data are encoded with longitude and latitude;
[0194] Merging the encoded results of the tidal lane configuration data to obtain a tidal lane configuration vector;
[0195] The formula for tidal lane configuration vector is:
[0196] ;
[0197] in, Configure vectors for tidal lanes, Encoding vectors for tidal lane opening time and tidal lane closing time, is the encoding vector for the number of tidal lanes and the direction of travel, is the encoding vector of the tidal lane starting position, tidal lane ending position and tidal lane intersection, For vector splicing;
[0198] Using longitude and latitude coding for intersections, section starting points and section ending points in the road network data;
[0199] One-hot encoding is used for the number of lanes and travel directions in the road network data;
[0200] The One-Hot encoding formula is:
[0201] ;
[0202] in, is the encoding vector for the number of lanes and the direction of travel, is the indicator function, is the number of lanes and travel direction feature category sets in the road network data, is the category to be coded, is the first in the feature category set elements, is the feature category set index;
[0203] Merging the encoded results of the road network data to obtain a road network vector;
[0204] The road network vector formula is:
[0205] ;
[0206] in, is the road network vector, Encode vectors for intersections, segment start points, and segment end points in road network data, is the encoding vector for the number of lanes and the direction of travel, Vector stitching.
[0207] In another embodiment of the present invention, the tidal lane opening time is 7:00 am and the tidal lane closing time is 9:00 am. , , If there are two tidal lanes with one-way and two-way traffic directions, it is defined as The current configuration is two tidal lanes and two-way driving, so the corresponding One-Hot encoding vector The coordinates of the starting position of the tidal lane, intersection A, are (latitude: 31.2304, longitude: 121.4737), the coordinates of the ending position, intersection B, are (latitude: 31.2281, longitude: 121.4895), and the coordinates of the main intersection C are (latitude: 31.2323, longitude: 121.4789), forming a coding vector Finally, all the encoding results are concatenated to form the tidal lane configuration vector .
[0208] Regarding step S3, the modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram includes:
[0209] Modeling using tidal lane configuration vectors and road network vectors;
[0210] The nodes and edges in the road network graph are formed by the longitude and latitude of the intersections, the starting points of the road sections and the ending points of the road sections in the road network vector;
[0211] Using the number of roads and the travel directions in the road network vector as edge attributes in the road network graph;
[0212] Marking nodes and edges in the road network graph by the tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration vector;
[0213] The number of roads and the travel directions in the tidal lane configuration vector are used as edge attributes in the road network graph.
[0214] Regarding step S4, setting a time granularity for the service data and the traffic flow data, and dividing the data by the time granularity, includes:
[0215] Set the time granularity and divide the whole day into multiple time windows based on the time granularity;
[0216] The time window formula is:
[0217] ;
[0218] ;
[0219] in, is a set of time windows, For the time window, is the total number of time windows, is the time granularity;
[0220] Performing resource status sampling on the service data within each of the time windows to obtain a service indicator set corresponding to each of the time windows;
[0221] The service indicator set formula is:
[0222] ;
[0223] ;
[0224] in, is the total set of service indicator sets, For the A set of service indicators for a time window, To perform resource status sampling operations, For the time window, For the Service data for a time window;
[0225] Aggregating the traffic flow data within each time window to obtain a traffic feature vector corresponding to each time window;
[0226] The traffic characteristic vector formula is:
[0227] ;
[0228] ;
[0229] in, is the set of traffic feature vectors, For the Traffic feature vector of time windows, is the average aggregation operation, For the time window, For the Traffic flow data for a time window.
[0230] In one embodiment of the present invention, the time granularity is selected The whole day is divided into 144 time windows. The service data in each time window is sampled for resource status to obtain the corresponding service indicator set. The first time window is sampled using the average value method, and the CPU utilization is 75%, the memory utilization is 60%, and the response time is 200ms. Traffic flow data is aggregated according to the time window, and the traffic feature vector formed in the first time window is , 5 data points were collected in the first time window, with traffic volumes of 200 vehicles per hour, 250 vehicles per hour, 300 vehicles per hour, 280 vehicles per hour, and 220 vehicles per hour; average speeds of 30km / h, 28km / h, 32km / h, 31km / h, and 29km / h; and congestion indices of 0.3, 0.4, 0.2, 0.35, and 0.25. Through aggregation processing, we can obtain .
[0231] Regarding step S5, the adding of 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:
[0232] According to the time window, the service indicator set and the traffic feature vector are temporally and spatially aligned to obtain the spatiotemporal features;
[0233] The spatiotemporal characteristic formula is:
[0234] ;
[0235] in, is the spatiotemporal feature, is the spatiotemporal alignment function, For the A set of service indicators for a time window, For the Traffic feature vector of time windows, is the total number of time windows;
[0236] Mapping the spatiotemporal features to corresponding nodes in the road network graph as dynamic attributes of the nodes;
[0237] The mapping formula is:
[0238] ;
[0239] in, for The set of nodes under the time window, is the mapping function, is the spatiotemporal feature, is the total number of time windows, For the time windows;
[0240] Using each time window to update node attributes in sequence, generating the dynamic road network graph that evolves over time;
[0241] The update formula is:
[0242] ;
[0243] in, For the updated Time window road network diagram, is the graph state update function, for Time window road network diagram, For the A time window.
[0244] In another embodiment of the present invention, the time window is set to 15 minutes, and the service index and traffic feature vector of the first time window are fused by using the spatiotemporal alignment function to obtain the spatiotemporal feature vector under the first time window. Next, the spatiotemporal feature vector Map the nodes to the corresponding road network graph. The node's dynamic attributes need to be updated to reflect the service status and traffic conditions within the current time window. Based on the updated node attributes, the entire road network graph is updated. By repeating these steps, a dynamic road network graph that evolves over time is generated, reflecting changes in traffic conditions and service demands in real time.
[0245] Regarding step 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 include:
[0246] Build a generative adversarial network model based on the generator and discriminator;
[0247] The generator is used to output predicted traffic flow distribution in a number of time windows based on the input dynamic road network graph;
[0248] The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatiotemporal distribution characteristics to the real-time traffic flow data collected in several subsequent time windows;
[0249] A multi-head attention module is constructed within the generator of the generative adversarial network model to capture the long-range dependency of traffic flow across multiple time windows;
[0250] Embedding 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;
[0251] The multi-head attention module is integrated with the graph neural network module to realize joint feature extraction of traffic status in time and space dimensions.
[0252] In another embodiment of the present invention, a dynamic road network graph is presented, comprising five time windows, each with four nodes and six feature dimensions. Data from the first three time windows of the dynamic road network graph are fed into a generator, which then learns from the dynamic road network graph to predict traffic flow distributions for the last two time windows. A discriminator then evaluates the similarity between these predictions and actual traffic flow data.
[0253] Furthermore, the multi-head attention module is constructed within the generator, including:
[0254] Process the input feature vector through a multi-head self-attention mechanism;
[0255] Constructing multiple parallel attention heads, each of which is used to learn the association pattern of the input feature vector in different semantic subspaces;
[0256] The outputs of each attention head are weightedly fused to generate an enhanced temporal feature representation.
[0257] Furthermore, embedding a graph neural network module in the generator of the generative adversarial network model includes:
[0258] Process the input feature vector through the graph neural network;
[0259] Constructing multiple graph neural network layers, each of which is used to capture the spatial relationship and mutual influence between the input feature vectors;
[0260] The capture formula is:
[0261] ;
[0262] in, For the Layer feature matrix, is a graph neural network, is the adjacency matrix, is the number of graph neural network layers;
[0263] Performing multi-scale learning on each graph neural network layer using an average aggregation strategy;
[0264] The average aggregation strategy formula is:
[0265] ;
[0266] in, For the The feature matrix after the average aggregation of the layer, For nodes The number of neighbors, For nodes The neighbor set of For the Nodes in the layer The eigenvector of
[0267] Constructing multiple parallel graph convolution branches to generate comprehensive graph feature representations through the graph convolution branches;
[0268] The formula for comprehensive graph feature representation is:
[0269] ;
[0270] in, is a comprehensive graph feature representation, For the branch weights, For the The graph convolution operation of the branches, For the The input feature matrix of each branch, is the adjacency matrix, is the total number of branches.
[0271] Regarding step S7, inputting the dynamic road network graph into the generative adversarial network for adversarial training to obtain an optimized generative adversarial network model includes:
[0272] Inputting the dynamic road network graph into the generator to generate predicted traffic flow distribution within a preset number of time windows;
[0273] The discriminator receives the predicted traffic flow distribution and collects the actual traffic flow distribution from the road network graph;
[0274] By performing adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, the generator is gradually approximated to the real traffic flow distribution;
[0275] The training formula is:
[0276] ;
[0277] in, For the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, The mean of the logarithm of the probability that the discriminator judges the samples generated by the generator to be fake.
[0278] In one embodiment of the present invention,
[0279] Furthermore, the adversarial training is performed by minimizing the generator loss function and maximizing the discriminator loss function, so that the generator gradually approaches the real traffic flow distribution, including:
[0280] During the adversarial training process, node attributes and edge weights in the dynamic road network graph are dynamically updated to reflect changes in road states at different times;
[0281] Through iterative training, the generator parameters are optimized so that it can accurately predict the traffic flow change trend of tidal lanes in different time periods.
[0282] In one embodiment of the present invention, termination is performed by setting the number of iterative training times. There are two termination methods: the first is to terminate when the set number of iterative training times is reached, and the second is when the generator parameters converge during the training process.
[0283] In step S8, the optimized generative adversarial network model is deployed on the edge server, and traffic flow in the tidal lane is predicted, including:
[0284] Extract optimized generator parameters from the trained GAN model;
[0285] Deploying the generator model and the generator parameters to an edge server with computing power;
[0286] Collecting real-time data through the edge server to build a dynamic road network graph in the current time window;
[0287] The dynamic road network graph is inferred based on the generator model deployed on the edge server, and the prediction results of future tidal lane traffic flow within a preset number of time windows are output.
[0288] In one embodiment of the present invention, after the generative adversarial network model completes training and achieves the expected performance, the optimized generator part and its parameters are extracted from the model. As the core module of traffic flow prediction, the generator has the ability to perform spatiotemporal modeling of dynamic road network graphs and predict future traffic distribution. Subsequently, the extracted generator model and corresponding parameters are deployed to an edge server with computing capabilities. The edge server is deployed at the edge node location of the urban traffic management system and has the ability to collect real-time data, perform model reasoning, and issue control instructions. During the deployment process, the model is encapsulated as an executable reasoning service module to ensure that it can run efficiently on resource-constrained edge devices.
[0289] In another embodiment of the present invention, the preset number of time windows can be flexibly set based on the actual application scenario. When the time granularity is 15 minutes, during peak hours in the morning and evening, the number of prediction time windows is set to five to support traffic control decisions over a longer timeframe; during off-peak hours, the number of time windows can be set to three to reduce computational overhead and improve response efficiency.
[0290] Those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is intended to be within the scope of the present invention and to form different embodiments.
[0291] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A tidal lane traffic flow prediction method based on edge computing, characterized in that: include: Obtain service data, tidal lane configuration data, traffic flow data, and road network data through edge servers and cloud servers; pre-processing the service data, tidal lane configuration data, traffic flow data, and road network data; Performing 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 the data according to the time granularity; 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; Build 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; Inputting the dynamic road network graph 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 traffic flow in the tidal lane; The modeling based on the tidal lane configuration data and the road network data to obtain a road network diagram includes: Modeling using tidal lane configuration vectors and road network vectors; The nodes and edges in the road network graph are formed by the longitude and latitude of the intersections, the starting points of the road sections and the ending points of the road sections in the road network vector; Using the number of roads and the travel directions in the road network vector as edge attributes in the road network graph; Marking nodes and edges in the road network graph by the tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration vector; The number of roads and the travel direction in the tidal lane configuration vector are used as edge attributes in the road network graph; 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 predicted traffic flow distribution within a preset number of time windows; The discriminator receives the predicted traffic flow distribution and collects the actual traffic flow distribution from the road network graph; By performing adversarial training by minimizing the generator loss function and maximizing the discriminator loss function, the generator is gradually approximated to the real traffic flow distribution; The training formula is: ; in, For the generator, is the discriminator, is the adversarial training objective function, is the real data feature, is the average of the logarithm of the probability output by the discriminator, is the input noise vector of the generator, The average of the logarithm of the probability that the discriminator judges the samples generated by the generator to be fake; The adversarial training is performed by minimizing the generator loss function and maximizing the discriminator loss function, so that the generator gradually approaches the actual traffic flow distribution, including: During the adversarial training process, node attributes and edge weights in the dynamic road network graph are dynamically updated to reflect changes in road states at different times; Through iterative training, the generator parameters are optimized so that it can accurately predict the traffic flow change trend of tidal lanes in different time periods.
2. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: 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, and 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 intersection, tidal lane number 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 flow, historical average speed, and historical congestion index; The real-time traffic flow data includes: timestamp, intersection, real-time traffic flow, real-time average speed, and real-time congestion index; The road network data includes: intersections, section starting points, section ending points, number of lanes, and travel directions.
3. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: The pre-processing of the service data, tidal lane configuration data, traffic flow data and road network data includes: Filling the service data and the traffic flow data using a TimesNet model; The tidal lane configuration data and the road network data are encoded.
4. The method for predicting tidal lane traffic flow based on edge computing according to claim 3, characterized in that: The method of using the TimesNet model to fill the service data and the traffic flow data includes: Inputting the service data and the traffic flow data into a TimesNet model; The TimesNet model performs fast Fourier transform on the service data and the traffic flow data to obtain a frequency domain signal; The frequency domain signal formula is: ; in, For the The feature channel is The frequency domain signal at a 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, For the The feature channel is The input data of time steps, is the basis function of discrete Fourier transform, is an imaginary unit; By setting an amplitude threshold for the frequency domain signal, filtering out amplitudes greater than the amplitude threshold, and obtaining an amplitude frequency corresponding to the amplitude; The screening formula is: ; in, is a set of significant frequency indices, is the frequency domain component index, For the The amplitude at the frequency, is the amplitude threshold; Calculating a cycle length using the amplitude frequency, and dividing the frequency domain signal by the cycle length to obtain a plurality of cycle frequencies; The period frequency set formula is: ; in, is the cycle length The frequency set, is a set of significant frequency indices, is the frequency domain component index, To round down the period length, is the time step, is the sampling rate; The periodic frequencies are combined into a two-dimensional tensor, and feature extraction is performed using a convolution kernel, which is then reconstructed into a one-dimensional vector.
5. The method for predicting tidal lane traffic flow based on edge computing according to claim 3, characterized in that: The encoding of the tidal lane configuration data and the road network data comprises: The tidal lane opening time and the tidal lane closing time in the tidal lane configuration data are coded using trigonometric functions; The trigonometric function encoding formula is: ; ; in, is the sinusoidal code of the tidal lane opening time, is the cosine code of the tidal lane opening time, Opening time for tidal lanes, is the sinusoidal code of the tidal lane closing time, is the cosine code of the tidal lane closure time, for tidal lane closure times; One-hot encoding is used for the number of tidal lanes and the direction of travel in the tidal lane configuration data; The One-Hot encoding formula is: ; in, is the encoding vector for the number of tidal lanes and the direction of travel, is the indicator function, The number of tidal lanes and the number of travel direction feature category sets in the tidal lane configuration data, is the category to be coded, is the first in the feature category set elements, is the feature category set index; The tidal lane starting position, the tidal lane ending position and the tidal lane intersection in the tidal lane configuration data are encoded with longitude and latitude; Merging the encoded results of the tidal lane configuration data to obtain a tidal lane configuration vector; The formula for tidal lane configuration vector is: ; in, Configure vectors for tidal lanes, Encoding vectors for tidal lane opening time and tidal lane closing time, is the encoding vector for the number of tidal lanes and the direction of travel, is the encoding vector of the tidal lane starting position, tidal lane ending position and tidal lane intersection, For vector splicing; Using longitude and latitude coding for intersections, section starting points and section ending points in the road network data; One-hot encoding is used for the number of lanes and travel directions in the road network data; The One-Hot encoding formula is: ; in, is the vector encoding the number of lanes and the direction of travel, is the indicator function, is the number of lanes and travel direction feature category sets in the road network data, is the category to be coded, is the first in the feature category set elements, 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: ; in, is the road network vector, Encode vectors for intersections, segment start points, and segment end points in road network data, is the encoding vector for the number of lanes and the direction of travel, Vector stitching.
6. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: The setting of time granularity for the service data and the traffic flow data, and dividing the data by the time granularity, includes: Set the time granularity and divide the whole day into multiple time windows based on the time granularity; The time window formula is: ; ; in, is a set of time windows, For the time window, is the total number of time windows, is the time granularity; Performing resource status sampling on the service data within each of the time windows to obtain a set of service indicators corresponding to each of the time windows; The service indicator set formula is: ; ; in, is the total set of service indicator sets, For the A set of service indicators for a time window, To perform resource status sampling operations, For the time window, For the Service data for a time window; Aggregating the traffic flow data within each time window to obtain a traffic feature vector corresponding to each time window; The traffic characteristic vector formula is: ; ; in, is the set of traffic feature vectors, For the Traffic feature vector of time windows, is the average aggregation operation, For the time window, For the Traffic flow data for a time window.
7. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: 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: According to the time window, the service indicator set and the traffic feature vector are temporally and spatially aligned to obtain the spatiotemporal features; The spatiotemporal characteristic formula is: ; in, is the spatiotemporal feature, is the spatiotemporal alignment function, For the A set of service indicators for a time window, For the Traffic feature vector of time windows, is the total number of time windows; Mapping the spatiotemporal features to corresponding nodes in the road network graph as dynamic attributes of the nodes; The mapping formula is: ; in, for The set of nodes under the time window, is the mapping function, is the spatiotemporal feature, is the total number of time windows, For the time windows; Using each time window to update node attributes in sequence, generating the dynamic road network graph that evolves over time; The update formula is: ; in, For the updated Time window road network diagram, is the graph state update function, for Time window road network diagram, For the A time window.
8. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: The constructing of a generative adversarial network model includes: Build a generative adversarial network model based on the generator and discriminator; The generator is used to output predicted traffic flow distribution in a number of time windows based on the input dynamic road network graph; The discriminator is used to determine whether the predicted traffic flow distribution output by the generator has similar spatiotemporal distribution characteristics to the real-time traffic flow data collected in several subsequent time windows.
9. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: The method of adding a multi-head attention mechanism and a graph neural network to the generator of the generative adversarial network model includes: A multi-head attention module is constructed within the generator of the generative adversarial network model to capture the long-range dependency of traffic flow across multiple time windows; Embedding 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; The multi-head attention module is integrated with the graph neural network module to realize joint feature extraction of traffic status in time and space dimensions.
10. The method for predicting tidal lane traffic flow based on edge computing according to claim 9, characterized in that: Build a multi-head attention module inside the generator, including: Process the input feature vector through a multi-head self-attention mechanism; Constructing multiple parallel attention heads, each of which is used to learn the association pattern of the input feature vector in different semantic subspaces; The outputs of each attention head are weightedly fused to generate an enhanced temporal feature representation.
11. The method for predicting tidal lane traffic flow based on edge computing according to claim 9, characterized in that: The embedding of a graph neural network module in the generator of the generative adversarial network model includes: Process the input feature vector through the graph neural network; Constructing 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: ; in, For the Layer feature matrix, is a graph neural network, is the adjacency matrix, is the number of graph neural network layers; Performing multi-scale learning on each graph neural network layer using an average aggregation strategy; The average aggregation strategy formula is: ; in, For the The feature matrix after the average aggregation of the layer, For nodes The number of neighbors, For nodes The neighbor set of For the Nodes in the layer The eigenvector of Constructing multiple parallel graph convolution branches to generate comprehensive graph feature representations through the graph convolution branches; The formula for comprehensive graph feature representation is: ; in, is a comprehensive graph feature representation, For the The branch weights, For the The graph convolution operation of the branches, For the The input feature matrix of each branch, is the adjacency matrix, is the total number of branches.
12. The method for predicting tidal lane traffic flow based on edge computing according to claim 1, characterized in that: The optimized generative adversarial network model is deployed on the edge server and traffic flow in the tidal lane is predicted, including: Extract optimized generator parameters from the trained GAN model; Deploying the generator model and the generator parameters to an edge server with computing power; Collecting real-time data through the edge server to build a dynamic road network graph in the current time window; The dynamic road network graph is inferred based on the generator model deployed on the edge server, and the prediction results of future tidal lane traffic flow within a preset number of time windows are output.
Citation Information
Patent Citations
Tidal lane opening dual judgment method based on traffic flow prediction model
CN118280105A
Urban road flow global prediction method based on multi-source data
CN117576918A
Time-space correlation traffic flow prediction method based on deep learning
CN119274345A