Traffic flow prediction method and device, computer equipment and storage medium

Through the digital twin simulation platform and multi-time dimension fusion technology, combined with weather and traffic light information, the accuracy of existing traffic flow prediction methods in the lack of historical data and complex environments is solved, and the accuracy of traffic flow prediction is achieved. .

CN119495194AActive Publication Date: 2025-02-21湖南工商大学

Patent Information

Application Number
CN202510066056.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-02-21
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

Existing traffic flow prediction methods rely highly on the quality and quantity of historical data, making it difficult to achieve accurate predictions in new cities or regions that lack sufficient historical data, and it is difficult to fully consider nonlinear factors such as seasonal changes, special events and weather conditions, affecting the accuracy of prediction. sex.

Method used

Use digital twin simulation platform to build real urban traffic road scenarios, collect twin traffic data, and perform mixed processing with real traffic data and multi-time fusion, combine weather data and traffic light information for feature extraction and fusion, and then conduct traffic flow prediction .

Benefits of technology

Through multi-dimensional data fusion processing and feature extraction, the accuracy of traffic flow prediction in complex environments is improved, and high prediction accuracy can be achieved in the absence of sufficient historical data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119495194A_ABST
    Figure CN119495194A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic flow prediction method and device, computer equipment and a storage medium, and the method comprises the steps: constructing a real urban traffic road scene through employing a digital twin simulation platform, and carrying out the collection of twin traffic data; the twinborn traffic data and the real traffic data form a mixed data set containing twinborn traffic data and real traffic data according to a mixing proportion alpha, and then multi-time-dimension fusion is carried out to obtain a first fusion feature; performing feature extraction based on the weather data and the traffic light information to obtain weather features and traffic information features; performing feature fusion on the first fusion feature, the weather feature and the traffic information feature to obtain a second fusion feature; and performing traffic prediction according to the second fusion feature to obtain a traffic prediction result. According to the invention, the accuracy of traffic flow prediction in a complex environment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent transportation, and in particular to a traffic flow prediction method, device, computer equipment and storage medium. Background Art

[0002] With the acceleration of urbanization, urban traffic flow prediction has become a key component of intelligent transportation systems. As one of the most important functions of today's intelligent transportation systems, traffic forecasting predicts the future situation of the traffic network based on historical traffic data on the road, which helps to improve the efficiency of the transportation system, improve traffic management and optimize the transportation travel experience. Traditional traffic flow forecasting methods mainly rely on historical traffic data, and use statistical analysis and machine learning techniques to analyze and predict traffic flow trends.

[0003] In the process of realizing the present invention, the inventors realized that the prior art has at least the following technical problems: the existing method is highly dependent on the quality and quantity of historical data. In new cities or regions, due to the lack of sufficient historical data, the prediction accuracy will drop significantly and it is difficult to meet the needs of practical applications. At the same time, urban traffic flow is affected by many nonlinear factors, such as seasonal changes, special events, weather conditions, etc. The existing method is difficult to fully consider the complexity and variability of these factors, which affects the accuracy of the prediction. Summary of the invention

[0004] The embodiments of the present invention provide a traffic flow prediction method, device, computer equipment and storage medium to improve the accuracy of traffic flow prediction.

[0005] In order to solve the above technical problems, the present application provides a traffic flow prediction method, including: Use the digital twin simulation platform to build real urban traffic road scenes and collect twin traffic data; The twin traffic data and the real traffic data are mixed at a ratio of α to form a mixed data set containing twin and real data, and then multi-time dimension fusion is performed to obtain the first fusion feature; Feature extraction is performed based on weather data and traffic light information respectively to obtain weather features and traffic information features; Performing feature fusion on the first fusion feature, the weather feature, and the traffic information feature to obtain a second fusion feature; Traffic prediction is performed according to the second fusion feature to obtain a traffic prediction result.

[0006] Optionally, the collecting of twin traffic data includes: Through Carla's API interface, the status and duration of traffic lights and weather data of the current simulation scene are collected in real time; Utilize the scenario generation capability provided by Carla to generate common scenarios and target-specific scenarios based on different urban traffic environments by adjusting parameters such as traffic flow, weather conditions, and signal light timing. The target-specific scenarios include simulating harsh environment scenarios, urban morning rush hour scenarios, and urban road traffic accident scenarios. Based on various scenarios, the built-in sensors of the Carla simulation platform are used to collect traffic data. The real traffic scenarios are simulated by changing the number and type of vehicles, weather and traffic light configuration schemes in the scene. The point cloud data obtained by the RGB camera and lidar sensor is used to record the trajectory data of the vehicles in the scene, including the position coordinates, speed and deviation angle of the vehicle in each timestamp, to obtain the twin traffic data.

[0007] Optionally, the twin traffic data and the real traffic data are mixed at a ratio α to form a mixed data set including twin and real data, and then multi-time dimension fusion is performed to obtain the first fusion feature including: The following formula is used to represent the traffic data characteristics of different time dimensions: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; Normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Using the feature pyramid network, the normalized feature matrix The fusion is performed to obtain the first fusion feature.

[0008] Optionally, the feature pyramid network is used to normalize the normalized feature matrix The fusion is performed to obtain the first fusion feature including: By setting different time extraction windows, the normalized feature matrix The moment feature graphs are obtained by respectively passing through the extraction layer ResNet network of the feature pyramid network , day feature graph , periodic characteristic diagram , the feature map extraction formula is as follows: ;

[0009] in Represents the feature map extracted by the L-th layer ResNet network, where L is 0, 1, 2, Extract feature map function for ResNet, is the weight matrix of each layer; The moment feature map , day feature graph , periodic characteristic diagram As feature pyramid networks layer, Layer and layer; design The third layer is used as the feature fusion layer, and its fusion formula is as follows: ; in represents the fusion result of the previous layer, for , is the extraction layer feature map corresponding to the current fusion layer, is the Hadamard product operation; The obtained fusion result is converted into a feature vector through a global average pooling layer to retain the existing feature information in the feature map, thereby obtaining the first fusion feature.

[0010] Optionally, the performing feature fusion on the first fusion feature, the weather feature, and the traffic information feature to obtain a second fusion feature includes: The weather feature matrix The feature map is obtained through the above ResNet network .

[0011] right The ROIAlign method is used to extract weather features, and the ; calculate The attention matrix between the flow feature map in the feature fusion layer of the feature pyramid , Attention feature map based on traffic features , the calculation formula is as follows: ; ; in represents the feature map input by the i-th fusion layer, i=0, 1, 2, and C represents the feature dimension of the current self-attention fusion; The attention feature map based on traffic features With the original Add to get the previous layer of fusion features ; The previous layer fusion feature F is used as the input feature of the next layer feature fusion layer of the feature pyramid for iterative fusion.

[0012] Optionally, performing traffic prediction according to the second fusion feature to obtain a traffic prediction result includes: Using the adjacency matrix and the second fused feature as inputs of a generator in a generative adversarial network, and judging the truth or falsity of a prediction result based on a discriminator in the generative adversarial network; When the discriminator identifies the prediction result as true, the flow prediction result is obtained.

[0013] In order to solve the above technical problems, the embodiment of the present application further provides a traffic flow prediction device, comprising: Data acquisition module, used to build real urban traffic road scenes using the digital twin simulation platform and collect twin traffic data; The first fusion module is used to form a mixed data set containing twin and real traffic data at a mixing ratio α, and then perform multi-time dimension fusion to obtain the first fusion feature; A feature extraction module, used for extracting features based on weather data and traffic light information to obtain weather features and traffic information features; The second fusion module is used to fuse the first fusion feature, the weather feature and the traffic information feature to obtain a second fusion feature; The traffic prediction module is used to perform traffic prediction based on the second fusion feature to obtain a traffic prediction result.

[0014] Optionally, the first fusion module includes: The data representation unit is used to represent the traffic data characteristics of different time dimensions using the following formula: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; The normalization unit is used to normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Fusion unit, used to use feature pyramid network to normalize the feature matrix The fusion is performed to obtain the first fusion feature.

[0015] In order to solve the above technical problems, an embodiment of the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above traffic flow prediction method when executing the computer program.

[0016] In order to solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above traffic flow prediction method are implemented.

[0017] The traffic flow prediction method, device, computer equipment and storage medium provided by the embodiment of the present invention construct a real urban traffic road scene through a digital twin simulation platform, and collect twin traffic data; form a mixed data set containing twin and real data with a mixing ratio of α for the twin traffic data and the real traffic data, and then perform multi-time dimension fusion to obtain a first fusion feature; perform feature extraction based on weather data and traffic light information respectively to obtain weather features and traffic information features; perform feature fusion on the first fusion feature, weather features and traffic information features to obtain a second fusion feature; perform traffic flow prediction based on the second fusion feature to obtain a traffic flow prediction result. It realizes multi-level fusion processing of multi-dimensional traffic data, and further fuses it with weather data and traffic light data to obtain multi-dimensional feature data, thereby improving the accuracy of traffic flow prediction in complex environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0019] Figure 1 is an exemplary system architecture diagram to which the present application may be applied; Figure 2 is a flow chart of an embodiment of the traffic flow prediction method of the present application; Figure 3 This is a schematic diagram of a feature pyramid network for feature fusion in an embodiment of the present application; Figure 4 is a schematic structural diagram of an embodiment of a traffic flow prediction device according to the present application; Figure 5 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0021] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] See also Figure 1 ,like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0024] Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages, etc.

[0025] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.

[0026] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0027] It should be noted that the traffic flow prediction method provided in the embodiment of the present application is executed by a server, and accordingly, the traffic flow prediction device is arranged in the server.

[0028] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. The terminal devices 101, 102, 103 in the embodiment of the present application may specifically correspond to application systems in actual production.

[0029] See also Figure 2 , Figure 2 A traffic flow prediction method provided by an embodiment of the present invention is shown. Figure 1 The server in is used as an example to illustrate the details as follows: S201: Use the digital twin simulation platform to build real urban traffic road scenes and collect twin traffic data.

[0030] In a specific optional implementation, collecting twin traffic data includes: Through Carla's API interface, the status and duration of traffic lights and weather data of the current simulation scene are collected in real time; Utilizing the scenario generation capability provided by Carla, by directional adjustment of parameters such as traffic flow, weather conditions, and signal light timing, common scenarios and target-specific scenarios based on different urban traffic environments are generated. Target-specific scenarios include simulating harsh environment scenarios, urban morning rush hour scenarios, and urban road traffic accident scenarios. Based on various scenarios, the built-in sensors of the Carla simulation platform are used to collect traffic data. The real traffic scenarios are simulated by changing the number and type of vehicles, weather and traffic light configuration schemes in the scene. The point cloud data obtained by the RGB camera and lidar sensor is used to record the trajectory data of the vehicles in the scene, including the position coordinates, speed and deviation angle of the vehicle in each timestamp, to obtain twin traffic data.

[0031] Specifically, the digital twin module in this embodiment adopts a digital twin simulation platform based on Carla to build a real urban traffic road scene, sets the sensor object of the simulation platform, and communicates with the python API interface to collect twin scene traffic data.

[0032] Furthermore, the steps to build a real urban traffic road scene based on Carla's digital twin simulation platform are as follows: Step 1: Map data collection. Collect high-precision real-time map data of the current city, including road networks, traffic signs, etc.; obtain regional radar data to obtain more accurate 3D spatial information.

[0033] Step 2: Scene generation and optimization. In the Roadrunner simulation tool, build a basic road network scene based on the above map dataset, including intersections, viaducts, sidewalks, traffic signs, etc.; export the files generated by roadrunner into FBX format or datasmith format scene files compatible with the Carla simulation platform to generate a Carla-based urban road twin scene, in which fine lighting effects, traffic light signal systems, sensor equipment, vehicle and pedestrian initial traffic twin behavior models, etc. are added to enhance the visual authenticity of the urban traffic road scene.

[0034] Step 3: Scenario simulation. Based on the Python API provided by Carla, develop a client program to interact with the simulation environment to achieve real-time control and optimization of dynamic factors such as weather, traffic lights, and areas of interest. By comparing the simulation results with actual traffic data, continuously optimize the simulation model parameters to improve the accuracy and credibility of the digital twin scenario.

[0035] Furthermore, the traffic data collection of the traffic twin scenario includes the following steps: Step 1: Use the built-in sensors of the Carla simulation platform to collect traffic data. Simulate real traffic scenarios by changing the number and type of vehicles in the scene, weather, and traffic light timing settings. Use the point cloud data obtained by the RGB camera and lidar sensor to record the trajectory data of the vehicles in the scene, including the position coordinates, speed, and deviation angle of the vehicle at each timestamp.

[0036] Step 2: Through Carla's API interface, real-time data such as the status and duration of traffic lights and weather information of the current simulation scene are collected.

[0037] Step 3: Using the scenario generation capability provided by Carla, by directional adjustment of parameters such as traffic flow, weather conditions, and signal light timing, target-specific scenarios based on different urban traffic environments are generated, including simulated harsh environment scenarios, urban morning rush hour scenarios, and urban road traffic accident scenarios. The collected raw data is processed and integrated to form a structured traffic data set.

[0038] S202: The twin traffic data and the real traffic data are mixed in a ratio of α to form a mixed data set containing twin and real data, and then multi-time dimension fusion is performed to obtain a first fusion feature.

[0039] Specifically, this embodiment adopts a multi-source data fusion module to fuse the data collected by the digital twin module with the real traffic data at multiple levels. Based on the simulated vehicle position data of the above-mentioned traffic digital twin platform, the number of vehicles in each intersection area in each time interval is calculated to obtain the traffic flow data. , obtain the current state duration characteristic data of the simulated traffic light , traffic light status data S of the target intersection and scene weather parameter data , obtain the city intersection traffic flow data obtained by real city sensors and use Enhance the data set and finally obtain the final fusion feature matrix through the multi-source fusion model .

[0040] The mixing ratio α is defined according to actual application requirements, such as 3:2, and is not specifically limited here.

[0041] Furthermore, the simulated traffic flow data obtained by the digital twin It is designed based on actual urban traffic congestion conditions, by setting different weather rendering options (such as rainy days, snowy days, foggy days, etc.), regional passenger flow in different urban areas, and actual morning rush hour scenes. This part of the data can fully reflect the changes in urban area traffic flow under today's special traffic scenarios.

[0042] Furthermore, the weather data collected based on the simulation platform in this embodiment is as follows: The simulation platform is designed to simulate sunlight by defining the offset angle of the sun parameters relative to the scene world coordinates. To simulate the changes in the day: daytime refers to , among which The sun is directly above the sky, which is 12 noon; the night refers to , Represents 12 o'clock at night.

[0043] The following parameters and ranges are defined to simulate various weather conditions in real-life scenarios: cloud cover C (0% to 90%), rainfall R (0% to 80%), humidity W (0% to 100%), water accumulation P (0% to 85%), wind speed F (5% to 90%), snowfall S (0% to 80%), and visibility O (0% to 30%).

[0044] Therefore, the weather data collected by the simulation platform is , where the weather at the i-th timestamp is Expressed as , which can represent the complexity of the traffic environment under different lighting scenarios and weather conditions.

[0045] Furthermore, the dataset enhancement in this embodiment refers to the fusion of the real dataset and the simulated dataset to create a more comprehensive and diverse dataset. In order to reflect the randomness, the real dataset and the simulated dataset are mixed at a ratio of α to form a synthetic training dataset, which ensures that the model is exposed to both real data and synthetic data during the training process, thereby learning a more comprehensive data distribution and feature representation.

[0046] In a specific optional implementation, the twin traffic data and the real traffic data are mixed at a ratio of α to form a mixed data set including the twin and the real data, and then multi-time dimension fusion is performed to obtain the first fusion feature including: The following formula is used to represent the traffic data characteristics of different time dimensions: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; Normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Using the feature pyramid network, the normalized feature matrix The fusion is performed to obtain the first fusion feature.

[0047] Specifically, given the periodicity of traffic flow, not only does the traffic flow at the previous few moments have an impact on the current moment, but the traffic flow at the same moment in the previous few days or weeks is also relevant. 、A few days ago and the previous weeks Three dimensions of traffic data to predict future traffic The prediction is expressed as follows: ; ; ; in They represent the number of timestamps selected from hours, days, and weeks, respectively, that is, predictions are made every h timestamps, d timestamps, and w timestamps.

[0048] The above three-dimensional data are normalized, and the formula is as follows: ; in is the normalized traffic flow data, X is the original data, , is the minimum and maximum value in X, and the normalized feature matrix is ​​obtained .

[0049] In a specific optional implementation, the feature fusion layer of the feature pyramid network is three layers, such as Figure 3 As shown, Figure 3 This is a schematic diagram of the feature fusion using the feature pyramid network in this embodiment. The feature pyramid network is used to normalize the feature matrix After fusion, the first fusion feature includes: By setting different time extraction windows, the normalized feature matrix Through the extraction layer ResNet network of the feature pyramid network, the moment feature map is obtained , day feature graph , periodic characteristic diagram , the feature map extraction formula is as follows: ;

[0050] in Represents the feature map extracted by the L-th layer ResNet network, where L is 0, 1, 2, Extract feature map function for ResNet, is the weight matrix of each layer; The moment feature map , day feature graph , periodic characteristic diagram As feature pyramid networks layer, Layer and layer; design The third layer is used as the feature fusion layer, and its fusion formula is as follows: ;

[0051] in represents the fusion result of the previous layer, for , is the extraction layer feature map corresponding to the current fusion layer, is the Hadamard product operation; The obtained fusion result is converted into a feature vector through a global average pooling layer to retain the existing feature information in the feature map and obtain the first fusion feature.

[0052] It should be noted that placing the moment feature map at the bottom layer can capture traffic changes and trends within a short time range; placing the day feature map in the middle layer can capture periodic patterns within a longer time range; and placing the week feature map at the top layer can capture seasonal or trend patterns within a longer time range.

[0053] Further, The final result of the fusion layer , is converted into a feature vector through a global average pooling layer to retain the existing feature information in the feature map. The formula is as follows: ;

[0054] in is the global average pooling function, expressed as , H, W, C are the height, width and number of channels of the input feature map respectively, Represented as the feature value of the input feature map at position (i, j) in channel C.

[0055] S203: Extract features based on weather data and traffic light information respectively to obtain weather features and traffic information features.

[0056] The traffic light status data S of the target road network in this embodiment includes three types of status information: red light, green light, and yellow light. According to historical experience, the red light status has an inhibitory effect on traffic flow, the green light status has a promoting effect on traffic flow, and the yellow light status has a relatively small impact on traffic flow. Therefore, the three types of data contained in S are converted into three types of weights: , are the weights assigned to the red, green, and yellow states, respectively, and the weights decrease in sequence. Perform feature product crossover with the traffic light signal status data, that is, .

[0057] Furthermore, the traffic light duration data After normalization, After splicing, 1D convolution fusion is used to complete the final fusion feature matrix , the fusion formula is: ;

[0058] in is the concatenation function, is a one-dimensional convolutional layer to obtain the interaction relationship between the two data sources.

[0059] S204: Fusing the first fusion feature, the weather feature, and the traffic information feature to obtain a second fusion feature.

[0060] In a specific optional implementation manner, the first fusion feature, the weather feature, and the traffic information feature are fused to obtain a second fusion feature including: The weather feature matrix The feature map is obtained through the above ResNet network .

[0061] right The ROIAlign method is used to extract weather features, and the ; calculate The attention matrix between the flow feature map in the feature fusion layer of the feature pyramid , Attention feature map based on traffic features , the calculation formula is as follows: ;

[0062] ;

[0063] in represents the feature map input by the i-th fusion layer, i=0, 1, 2, and C represents the feature dimension of the current self-attention fusion; The attention feature map based on traffic features With the original Add to get the previous layer of fusion features ; The fused features F of the previous layer are used as the input features of the next feature fusion layer of the feature pyramid for iterative fusion.

[0064] S205: Perform traffic prediction based on the second fusion feature to obtain a traffic prediction result.

[0065] In a specific optional implementation manner, traffic prediction is performed according to the second fusion feature, and the traffic prediction result obtained includes: The adjacency matrix and the second fusion feature are used as the input of the generator in the generative adversarial network, and the truth or falsity of the prediction results is judged based on the discriminator in the generative adversarial network; When the discriminator identifies the prediction result as true, the traffic prediction result is obtained.

[0066] Specifically, the prediction module of this embodiment adopts a generative adversarial network model based on a spatiotemporal feature extraction unit. This prediction model is conducive to improving the generalization of the data captured by the above-mentioned digital twins.

[0067] Furthermore, the spatiotemporal feature extraction unit consists of a multi-layer graph convolutional neural network (GCN), a gated unit (GRU), and a multi-view graph attention layer. The graph convolutional neural network accepts the original node feature matrix And the fusion adjacency matrix A is taken as input, and a new low-dimensional feature representation is generated for each node by aggregating and propagating the features of neighboring nodes. The propagation formula for each node in the second layer is: ;

[0068] in , is the self-connection matrix, is the degree matrix, is the weight matrix of the first and second layers.

[0069] Furthermore, the gated unit GRU, as a variant of recurrent neural network (RNN), has the ability to process time series data. This layer uses memory units, update gates, and forget gates to capture and manage long-term dependencies, effectively controlling the transmission and retention of information. The formulas of its components are as follows: ; in is the weight matrix corresponding to the gate component, , is the activation function.

[0070] The overall architecture of the generative adversarial model in this embodiment consists of a generator (G) and a discriminator (D), which represents the traffic graph network as a set of (V, E), where It is represented as a set of nodes, i.e., the traffic nodes in the network; It is represented as a set of edges, that is, the connection or path between nodes, so K=(V,E) is used to represent the topological structure of the transportation network. The prediction model is designed as follows: Step 1: Design the distance adjacency matrix To represent the spatial proximity of two roads in the traffic graph network K, the calculation formula is: ; Where c represents two nodes The Euclidean distance.

[0071] Calculate similarity adjacency matrix Represents the traffic similarity of different roads, and the calculation formula is: ; in represents the normalized feature vector of node i at time T, represents the normalized feature vector of node j at time T, softmax and ReLU are activation functions, is a learnable weight matrix. The above two adjacency matrices are normalized to obtain the final fused adjacency matrix ,in , is the normalized adjacency matrix.

[0072] Step 2: The feature matrix And the fusion matrix A is used as the input of the generator, and the loss function of the generator is as follows: ; in The distribution function of the synthetic traffic data is unknown during the training process, and it is necessary to continuously adjust the parameters through adversarial training to minimize the gap with the real distribution. Refers to generating data.

[0073] This loss function encourages the generator to generate samples that can be judged as real samples by the discriminator with a higher probability by maximizing the logarithmic probability that the generated samples are judged as real samples.

[0074] The input of the discriminator is true and false samples and distance matrix The true sample is composed of real historical traffic flow data, and the false sample is composed of real historical traffic flow data and future historical traffic flow data synthesized by the generator. The loss function of the discriminator is as follows: ; Where S refers to the real data, is the real data distribution function, which is obtained by analyzing the real sampled data.

[0075] The goal of this loss function is to enable the discriminator to accurately distinguish between generated samples and real samples, so the function is set to maximize the probability of real samples being judged as true and the probability of generated samples being judged as false.

[0076] Step 3: For the graph convolution generative adversarial network model, an overall loss function that comprehensively considers MAE and RMSE is designed. The MAE function is used to improve the prediction accuracy of small areas, and the RMSE function can be used to capture the traffic changes and fluctuations of the entire urban area. The calculation formula is as follows: ; in They represent predicted traffic data and real traffic data respectively.

[0077] The overall loss function of the model is obtained by weighted summation of MAE loss and RMSE loss. The calculation formula is as follows: ; By design parameters Taking the values ​​of MAE and RMSE into consideration comprehensively can provide a more comprehensive evaluation in traffic forecasting, balance outliers and overall fluctuations, and make personalized trade-offs based on task requirements.

[0078] Furthermore, the goal of the generative adversarial model is to achieve adversarial training of the generator and the discriminator by minimizing the generator loss and maximizing the discriminator loss. The generator attempts to generate traffic samples that are similar to the real traffic distribution to reduce the probability that the discriminator identifies them as generated samples. The discriminator attempts to accurately distinguish between real traffic and generated samples to increase the probability that the discriminator identifies generated samples as generated samples. Finally, the mean absolute error and RSME error are combined to adjust the model's need for the difference between generated data and real data. The parameter adjustment function of the model is as follows: ;

[0079] in are the generator and discriminator parameters respectively.

[0080] In this embodiment, a digital twin simulation platform is used to construct a real urban traffic road scene, and twin traffic data is collected; the twin traffic data and the real traffic data are mixed at a ratio of α to form a mixed data set containing twins and real data, and then multi-time dimension fusion is performed to obtain the first fusion feature; feature extraction is performed based on weather data and traffic light information respectively to obtain weather features and traffic information features; feature fusion is performed on the first fusion feature, weather features and traffic information features to obtain the second fusion feature; flow prediction is performed based on the second fusion feature to obtain flow prediction results. Multi-level fusion processing of multi-dimensional traffic data is achieved, and multi-dimensional feature data is further fused with weather data and traffic light data, thereby improving the accuracy of traffic flow prediction in complex environments.

[0081] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0082] Figure 4 FIG. 1 is a block diagram showing a functional block diagram of a traffic flow prediction device corresponding to the traffic flow prediction method in the above embodiment. Figure 4 As shown, the traffic flow prediction device includes a data acquisition module 31, a first fusion module 32, a feature extraction module 33, a second fusion module 34 and a traffic flow prediction module 35. The functional modules are described in detail as follows: The data acquisition module 31 is used to construct a real urban traffic road scene using the digital twin simulation platform and collect twin traffic data; The first fusion module 32 is used to form a mixed data set including twin and real data at a mixing ratio α for the twin traffic data and the real traffic data, and then perform multi-time dimension fusion to obtain a first fusion feature; A feature extraction module 33, used to extract features based on weather data and traffic light information, respectively, to obtain weather features and traffic information features; The second fusion module 34 is used to perform feature fusion on the first fusion feature, the weather feature and the traffic information feature to obtain a second fusion feature; The traffic prediction module 35 is used to perform traffic prediction according to the second fusion feature to obtain a traffic prediction result.

[0083] Optionally, the first fusion module 32 includes: The data representation unit is used to represent the traffic data characteristics of different time dimensions using the following formula: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; The normalization unit is used to normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Fusion unit, used to use feature pyramid network to normalize the feature matrix The fusion is performed to obtain the first fusion feature.

[0084] For the specific definition of the traffic flow prediction device, please refer to the definition of the traffic flow prediction method above, which will not be repeated here. Each module in the above-mentioned traffic flow prediction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0085] To solve the above technical problems, the present application also provides a computer device. Figure 5 , Figure 5 This is a basic structural block diagram of the computer device in this embodiment.

[0086] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components connected to the memory 41, the processor 42, and the network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0087] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0088] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or D interface display memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as the program code of the traffic flow prediction method, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0089] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the program code stored in the memory 41 or process data, such as running the program code of the traffic flow prediction method.

[0090] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0091] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores an interface display program, and the interface display program can be executed by at least one processor so that the at least one processor performs the steps of the traffic flow prediction method as described above.

[0092] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0093] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A traffic flow prediction method, characterized in that: include: Use the digital twin simulation platform to build real urban traffic road scenes and collect twin traffic data; The twin traffic data and the real traffic data are mixed at a ratio of α to form a mixed data set containing twin and real data, and then multi-time dimension fusion is performed to obtain the first fusion feature; Feature extraction is performed based on weather data and traffic light information respectively to obtain weather features and traffic information features; Performing feature fusion on the first fusion feature, the weather feature, and the traffic information feature to obtain a second fusion feature; Traffic prediction is performed according to the second fusion feature to obtain a traffic prediction result.

2. The traffic flow prediction method according to claim 1, characterized in that: The twin traffic data collection includes: Through Carla's API interface, the status and duration of traffic lights and weather data of the current simulation scene are collected in real time; Utilize the scenario generation capability provided by Carla to generate common scenarios and target-specific scenarios based on different urban traffic environments by adjusting parameters such as traffic flow, weather conditions, and signal light timing. The target-specific scenarios include simulating harsh environment scenarios, urban morning rush hour scenarios, and urban road traffic accident scenarios. Based on various scenarios, the built-in sensors of the Carla simulation platform are used to collect traffic data. The real traffic scenarios are simulated by changing the number and type of vehicles, weather and traffic light configuration schemes in the scene. The point cloud data obtained by the RGB camera and lidar sensor is used to record the trajectory data of the vehicles in the scene, including the position coordinates, speed and deviation angle of the vehicle in each timestamp, to obtain the twin traffic data.

3. The traffic flow prediction method according to claim 1, characterized in that: The twin traffic data and the real traffic data are mixed at a ratio of α to form a mixed data set containing twin and real data, and then multi-time dimension fusion is performed to obtain the first fusion feature including: The following formula is used to represent the traffic data characteristics of different time dimensions: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; Normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Using the feature pyramid network, the normalized feature matrix The fusion is performed to obtain the first fusion feature.

4. The traffic flow prediction method according to claim 3, characterized in that: The feature pyramid network is used to normalize the feature matrix The fusion is performed to obtain the first fusion feature including: By setting different time extraction windows, the normalized feature matrix The moment feature graphs are obtained by respectively passing through the extraction layer ResNet network of the feature pyramid network , day feature graph , periodic characteristic diagram , the feature map extraction formula is as follows: ; in Represents the feature map extracted by the L-th layer ResNet network, where L is 0, 1, 2, Extract feature map function for ResNet, is the weight matrix of each layer; The moment feature map , day feature graph , periodic characteristic diagram As feature pyramid networks layer, Layer and layer; design The third layer is used as the feature fusion layer, and its fusion formula is as follows: ; in represents the fusion result of the previous layer, for , is the extraction layer feature map corresponding to the current fusion layer, is the Hadamard product operation; The obtained fusion result is converted into a feature vector through a global average pooling layer to retain the existing feature information in the feature map, thereby obtaining the first fusion feature.

5. The traffic flow prediction method according to claim 1, characterized in that: The performing feature fusion on the first fusion feature, the weather feature and the traffic information feature to obtain a second fusion feature comprises: The weather feature matrix Get the feature map through the ResNet network ; right The ROIAlign method is used to extract weather features, and the ; calculate The attention matrix between the flow feature map in the feature fusion layer of the feature pyramid , Attention feature map based on traffic features , the calculation formula is as follows: ; ; in represents the feature map input by the i-th fusion layer, i=0, 1, 2, and C represents the feature dimension of the current self-attention fusion; The attention feature map based on traffic features With the original Add to get the previous layer of fusion features ; The previous layer fusion feature F is used as the input feature of the next layer feature fusion layer of the feature pyramid for iterative fusion.

6. The traffic flow prediction method according to claim 1, characterized in that: The performing flow prediction according to the second fusion feature to obtain a flow prediction result includes: Using the adjacency matrix and the second fused feature as inputs of a generator in a generative adversarial network, and judging the truth or falsity of a prediction result based on a discriminator in the generative adversarial network; When the discriminator identifies the prediction result as true, the flow prediction result is obtained.

7. A traffic flow prediction device, characterized in that: include: Data acquisition module, used to build real urban traffic road scenes using the digital twin simulation platform and collect twin traffic data; The first fusion module is used to form a mixed data set containing twin and real traffic data at a mixing ratio α, and then perform multi-time dimension fusion to obtain the first fusion feature; A feature extraction module, used for extracting features based on weather data and traffic light information to obtain weather features and traffic information features; The second fusion module is used to fuse the first fusion feature, the weather feature and the traffic information feature to obtain a second fusion feature; The traffic prediction module is used to perform traffic prediction based on the second fusion feature to obtain a traffic prediction result.

8. The traffic flow prediction device according to claim 7, characterized in that: The first fusion module includes: The data representation unit is used to represent the traffic data characteristics of different time dimensions using the following formula: ; ; ; in, Represents the number of timestamps selected from hours, days, and weeks, respectively, and predictions are made every h timestamps, d timestamps, and w timestamps; The normalization unit is used to normalize the traffic data features in three dimensions to obtain the normalized feature matrix ; Fusion unit, used to use feature pyramid network to normalize the feature matrix The fusion is performed to obtain the first fusion feature.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the traffic flow prediction method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the traffic flow prediction method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • City-level intelligent traffic simulation system

    CN110164128A

  • Intelligent system updating method and device based on digital twinning

    CN111461338A

  • Complex traffic visual saliency prediction method and system guided by target detection

    CN112016476A

  • Traffic flow prediction method and device

    CN112991741A

  • Traffic jam prediction method and device based on multiple signal sources and medium

    CN114023074A

Cited By

  • Tunnel traffic risk prediction method and system

    CN120011936A

  • Traffic violation detection method, device and equipment based on UV-KGNN network and medium

    CN120636171A