Urban road network traffic state prediction method, device, equipment and medium

Through the dynamic spatiotemporal residual convolutional neural network model, combined with the road network density and spatiotemporal attention mechanism, the problem of low efficiency and accuracy of urban traffic prediction in the existing technology is solved, and efficient and accurate traffic state prediction in large-scale urban road networks is achieved.

CN119559785AActive Publication Date: 2025-03-04XIAN TECH UNIV

Patent Information

Application Number
CN202411689373.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-04
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

The existing urban traffic conditions prediction methods are difficult to effectively utilize the dynamic characteristics of traffic data and the complex spatial and temporal correlation between road sections. In large-scale urban road networks, it is expensive to calculate, and the model is difficult to expand, and the prediction efficiency and accuracy are low.

Method used

A method for predicting traffic states of urban road networks is proposed, using dynamic spatiotemporal residual convolution neural network model, including residual convolution module, dynamic convolution module based on road network density, spatiotemporal attention mechanism module and fusion module, to adjust the convolution kernel weight through road network density data, combine dynamic traffic flow and static road structure to enhance the modeling ability of space-time dependence.

Benefits of technology

Efficient and accurate traffic state prediction in large-scale and small-scale urban road networks are achieved, and the limitations of traditional methods in dealing with heterogeneity characteristics and time dependence are overcome, and the flexibility and scalability of prediction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559785A_ABST
    Figure CN119559785A_ABST
Patent Text Reader

Abstract

The invention discloses an urban road network traffic state prediction method and device, equipment and a medium, and relates to the technical field of traffic, and the method comprises the steps: obtaining the basic parameters of a target urban region and the target traffic state data of a historical time period; determining road network density data according to the basic parameters of the target city area by using a road network density calculation formula; inputting the target traffic state data of the historical time period into the trained dynamic space-time residual convolutional neural network model to obtain traffic state prediction data of the next time period of the historical time period; the dynamic space-time residual convolutional neural network model comprises a residual convolution module, a dynamic convolution module based on road network density, a space-time attention mechanism module and a fusion module which are connected in sequence; and the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on the road network density is adjusted according to the road network density data. The prediction efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of traffic technology, and in particular to a method, device, equipment and medium for predicting traffic status of a city-level road network. Background Art

[0002] Accurately predicting urban traffic conditions is crucial to dealing with traffic congestion and improving travel efficiency, and is one of the key technologies involved in smart traffic management. Existing research on urban traffic condition prediction mainly focuses on the prediction of a single road section or a small-scale road network, and usually uses a single deep learning model to predict traffic conditions on a specific road section. However, when predicting traffic conditions at the city level, a large number of deep learning models are often required, which not only increases the computational overhead, but also makes it difficult to expand the model.

[0003] Existing machine learning models often fail to fully utilize the dynamic characteristics of traffic data and the complex spatiotemporal correlations between road segments when predicting urban traffic conditions. Although some studies have adopted multiple graph convolutional networks to capture various spatial dependencies, these methods have extremely high training costs when applied to large-scale and complex urban road networks, and their effectiveness is limited in city-level traffic networks. In addition, existing models are inefficient when processing large-scale urban traffic data. For example, although graph-based AI models are good at capturing complex non-Euclidean spatial relationships, they require more complex graph construction and processing, resulting in significant computational overhead. In complex urban environments, their complexity increases the difficulty of prediction, while simpler methods (such as CNN convolution operations suitable for capturing Euclidean spatial relationships) face challenges such as the vanishing gradient problem when the number of network layers becomes deeper. In addition, the pooling operations in these methods may cause some detailed features to be smoothed or ignored, resulting in subtle changes in traffic flow being ignored, resulting in reduced prediction accuracy.

[0004] Therefore, there is an urgent need for a city-level road network traffic status prediction method that is applicable to large-scale and small-scale urban road networks and has high prediction efficiency and accuracy. Summary of the invention

[0005] The purpose of this application is to provide a method, device, equipment and medium for predicting the traffic status of a city-level road network, which can be applied to large-scale and small-scale urban road networks and has high prediction efficiency and accuracy.

[0006] To achieve the above objectives, this application provides the following solutions:

[0007] In a first aspect, the present application provides a method for predicting traffic status of a city-level road network, comprising:

[0008] Obtaining basic parameters of the target urban area and target traffic status data for a historical time period; the basic parameters include the number and length of roads; the target traffic status data for a historical time period includes target traffic status data for several historical moments within the historical time period;

[0009] Using the road network density calculation formula, determine the road network density data according to the basic parameters of the target urban area;

[0010] Inputting the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain traffic status prediction data for the next time period of the historical time period;

[0011] The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence;

[0012] The residual convolution module is used to: extract features from the target traffic status data at each historical moment to obtain residual convolution features;

[0013] The dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract the residual convolution feature to obtain the dynamic convolution initial feature corresponding to each dynamic convolution kernel; perform weighted summation on the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weight corresponding to each dynamic convolution kernel to obtain the dynamic convolution final feature corresponding to each historical moment;

[0014] The spatiotemporal attention mechanism module is used to: for each historical moment, extract the dynamic convolution final features corresponding to the historical moment in the spatial and temporal dimensions to obtain the spatiotemporal attention features corresponding to the historical moment;

[0015] The fusion module is used to fuse the spatiotemporal attention features corresponding to all historical moments to obtain traffic status prediction data for the next time period of the historical time period.

[0016] Optionally, the residual convolution module includes a first convolution submodule, a residual sequence submodule and a second convolution submodule; the first convolution submodule includes several first convolution layers; the residual sequence submodule includes several residual units; each of the residual units includes several residual convolution layers; the second convolution submodule includes several second convolution layers.

[0017] Optionally, the first convolution submodule includes a first convolution layer; and the second convolution submodule includes a second convolution layer.

[0018] Optionally, each of the residual units includes two residual convolutional layers.

[0019] Optionally, calculating the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data specifically includes:

[0020] Performing global average pooling on the road network density data to obtain a global road network density;

[0021] For each dynamic convolution kernel, a weight corresponding to the dynamic convolution kernel is calculated according to the global road network density and the center value corresponding to the dynamic convolution kernel.

[0022] Optionally, the types of traffic status data include speed, flow rate and congestion index.

[0023] Optionally, before the step of inputting the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model, the city-level road network traffic status prediction method further includes:

[0024] Acquire a training set; the training set includes sample traffic status data of several sample time periods;

[0025] The training set is used to train the dynamic spatiotemporal residual convolutional neural network model to obtain a trained dynamic spatiotemporal residual convolutional neural network model.

[0026] In a second aspect, the present application provides a city-level road network traffic status prediction device, comprising:

[0027] The target traffic status data acquisition module is used to: acquire basic parameters of the target urban area and target traffic status data of a historical time period; the basic parameters include the number and length of roads; the target traffic status data of the historical time period includes target traffic status data of several historical moments in the historical time period;

[0028] A road network density data determination module is used to: determine the road network density data according to the basic parameters of the target urban area using a road network density calculation formula;

[0029] The traffic state prediction module is used to: input the target traffic state data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain the traffic state prediction data of the next time period of the historical time period;

[0030] The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence; wherein the residual convolution module is used to: extract features from the target traffic status data at each historical moment to obtain residual convolution features; the dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract features from the residual convolution features to obtain the weight corresponding to each dynamic convolution kernel Dynamic convolution initial features; performing weighted summation of the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weights corresponding to each dynamic convolution kernel to obtain the dynamic convolution final features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on the spatial and temporal dimensions of the dynamic convolution final features corresponding to the historical moment to obtain the spatiotemporal attention features corresponding to the historical moment; the fusion module is used to: fuse the spatiotemporal attention features corresponding to all historical moments to obtain the traffic status prediction data for the next time period of the historical time period.

[0031] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned city-level road network traffic status prediction method.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned city-level road network traffic status prediction method.

[0033] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0034] The present application provides a method, device, equipment and medium for predicting the traffic status of a city-level road network. The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence. The road network density data is determined by the target traffic status data of the historical time period, and the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density is adjusted according to the road network density data. The present application proposes a dynamic convolution technology for the difference in road network density, and cleverly combines the dynamic traffic flow data (weights corresponding to the dynamic convolution kernel) with the static road structure data, overcomes the limitations of the traditional spatiotemporal residual network in processing the heterogeneous characteristics of the road network, and realizes efficient and accurate spatial feature extraction. Through the spatiotemporal attention mechanism, the inherent deficiencies of the traditional spatiotemporal residual network in capturing the dependency of continuous time unit sequences are effectively solved, and the network's modeling ability for time dependency is enhanced. Compared with the previous combination of recurrent neural networks for time series processing, which is prone to gradient explosion, the attention mechanism can prevent gradient explosion while effectively capturing the time dependency of historical sequences. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 This is an application environment diagram of a city-level road network traffic status prediction method in one embodiment of the present application;

[0037] Figure 2 A schematic diagram of a flow chart of a method for predicting traffic status of a city-level road network provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of the structure of a dynamic spatiotemporal residual convolutional neural network model provided in one embodiment of the present application;

[0039] Figure 4 A schematic diagram of functional modules of a device for predicting traffic status of a city-level road network provided in one embodiment of the present application;

[0040] Figure 5 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

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

[0042] In large-scale traffic state prediction, deep neural networks are prone to gradient vanishing or gradient exploding problems due to the increase in the number of layers. Residual networks (ResNets) greatly alleviate the gradient vanishing problem by introducing jump connections, allowing the gradient to be directly transferred, thereby allowing the construction of a deeper network structure and ensuring the trainability of the model. This enables residual networks to capture more and more complex features and improve prediction capabilities. In addition, residual networks can be easily combined with advanced architectures such as attention mechanisms to build hybrid models, enhancing their compatibility and scalability in complex traffic state prediction tasks. For example, Zhang et al. (2016) proposed deep spatiotemporal residual networks (ST-ResNets), which modeled the spatiotemporal characteristics of crowd flow through residual convolution units, significantly improving the accuracy of crowd flow prediction within the city. There is a deep spatiotemporal residual network (DeepRTP) that combines residual connections and 3D convolution modules for regional traffic prediction. The residual connection solves the gradient vanishing problem in deep networks, allowing the model to capture more spatiotemporal dependent features and improve the accuracy of regional traffic prediction. A model combining 3D convolution and residual units, and introducing the Pearson correlation coefficient method to extract highly correlated features, aims to improve the ability to predict urban traffic status. By combining spatial and temporal features, the dynamic changes of traffic data can be modeled more comprehensively. The existing model combining 3D residual network and self-attention mechanism efficiently models the spatiotemporal information of traffic congestion data through 3D convolution modules. The model uses the self-attention mechanism to dynamically adjust the weights of spatiotemporal features, thereby improving the prediction accuracy. However, the above ResNets model is only suitable for data sets with low accuracy or small magnitude. Specifically, when processing sequence data, such as time series traffic data, the data usually has a correlation and dependency relationship in the time dimension. The data in the continuous time unit is not completely independent, but there are certain patterns and trends. For example, the traffic conditions at the previous moment may affect the traffic conditions at the next moment. The method of ResNets modeling by connecting the fragmented data into tensors and then using convolutional layers and residual units to model does not fully consider this temporal sequence and dependency. It does not have a special mechanism to capture the intrinsic connection between data at different time points. It only processes the data as a whole without making targeted designs for the characteristics of time series, and thus cannot fully utilize the temporal dynamics, that is, the changing patterns and trends of data in the time dimension. In addition, the ResNets model uses a unified convolution kernel when extracting traffic characteristics in different regions. The function of the convolution kernel is to extract features from the input data. A unified convolution kernel means that the same method and parameters are used when processing data from different regions. This makes it difficult for the network to adapt to the unique characteristics and changes in different regions, and it cannot effectively handle the heterogeneity of the road network.As a result, when extracting spatial features, the specific traffic characteristics of each area cannot be accurately captured, resulting in reduced accuracy of spatial feature extraction.

[0043] Based on the above problems, the present application proposes a method, device, equipment and medium for predicting the traffic status of a city-level road network.

[0044] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0045] The city-level road network traffic state prediction method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the basic parameters of the target city area and the target traffic status data of the historical time period to the server 104. After the server 104 receives the basic parameters and the target traffic status data of the historical time period, the server 104 uses the road network density calculation formula to determine the road network density data according to the basic parameters of the target city area, and inputs the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain the traffic status prediction data for the next time period of the historical time period. The server 104 can feedback the obtained traffic status prediction data for the target city area to the terminal 102. In addition, in some embodiments, the city-level road network traffic status prediction method can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly perform traffic status prediction on the target traffic status data of the historical time period, or the server 104 can obtain the target traffic status data of the historical time period from the data storage system and perform traffic status prediction on the target traffic status data of the historical time period.

[0046] The terminal 102 may be, but is not limited to, various desktop computers and laptop computers. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.

[0047] In an exemplary embodiment, Figure 2 As shown, a method for predicting the traffic status of a city-level road network is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate, including the following steps 201 to 203. Among them:

[0048] Step 201: Obtain basic parameters of a target urban area and target traffic status data for a historical time period; the basic parameters include the number and length of roads; the target traffic status data for a historical time period includes target traffic status data for several historical moments within the historical time period.

[0049] Step 202: using the road network density calculation formula, determine the road network density data according to the basic parameters of the target urban area.

[0050] Step 203: Input the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain traffic status prediction data for the next time period of the historical time period.

[0051] The dynamic spatiotemporal residual convolutional neural network model includes sequentially connected residual convolution modules, dynamic convolution modules based on road network density, spatiotemporal attention mechanism modules and fusion modules.

[0052] The residual convolution module is used to: extract features from the target traffic status data at each of the historical moments to obtain residual convolution features. The dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract features from the residual convolution features to obtain the dynamic convolution initial features corresponding to each dynamic convolution kernel; perform weighted summation on the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weights corresponding to each dynamic convolution kernel to obtain the dynamic convolution final features corresponding to each of the historical moments. The spatiotemporal attention mechanism module is used to: for each historical moment, extract features from the dynamic convolution final features corresponding to the historical moment in the spatial and temporal dimensions to obtain the spatiotemporal attention features corresponding to the historical moment. The fusion module is used to: fuse the spatiotemporal attention features corresponding to all historical moments to obtain the traffic status prediction data for the next time period of the historical time period.

[0053] By implementing the above steps 201 to 203, the present application is not limited to predicting the traffic status of a certain road section or a small-scale road network, but provides a comprehensive traffic condition prediction at the urban area level. By building a powerful traffic prediction model, it is possible to predict the traffic conditions of all areas at the same time, thereby improving the efficiency and accuracy of the overall prediction, while being able to handle the spatiotemporal dependencies of traffic in local areas. It can achieve accurate prediction of traffic conditions at different levels from a single road to the entire city level, with high flexibility and scalability. It can be used to predict the evolution of traffic conditions in urban-level road networks and provide technical support for urban traffic management.

[0054] In another exemplary embodiment of the present application, the city-level road network traffic state prediction method further includes the following steps 301 to 302:

[0055] Step 301: Obtain a training set; the training set includes sample traffic status data of several sample time periods.

[0056] Step 302: The training set is used to train the dynamic spatiotemporal residual convolutional neural network model to obtain a trained dynamic spatiotemporal residual convolutional neural network model. The sample traffic status data within time period t is used as input, and the sample traffic status data within time period t+1 is used as a label to train the dynamic spatiotemporal residual convolutional neural network model to obtain a trained dynamic spatiotemporal residual convolutional neural network model.

[0057] Step 301 reconstructs a grid data set that fits the road network. The types of traffic status data include speed, flow, and congestion index. The specific purpose of this step is to generate a more accurate urban road traffic status data set. The specific implementation process includes the following steps 401 to 406:

[0058] Step 401: Collect urban floating vehicle trajectory dataset.

[0059] Step 402: Data preprocessing, including data cleaning, data screening, and data segmentation by time slices.

[0060] Step 403: Extract OD data and convert point data into linear data.

[0061] Step 404: Divide the urban area into grids to obtain a plurality of grids. Specifically, a grid with a precision of 120m×120m may be used.

[0062] Step 405: Fill the grid according to different prediction tasks (speed, flow or congestion index, etc.).

[0063] Step 406: Stacking into a 3D data set in time series.

[0064] According to step 405, the sample traffic status data at the city level is represented as a two-dimensional matrix, which is represented in the form shown in the following formula (1):

[0065]

[0066] Among them, X t represents the two-dimensional matrix of sample traffic status data within time period t, m and n represent the latitude and longitude range of the urban area, and x in the two-dimensional matrix of sample traffic status data is (m,n) The element represents the traffic status information filling value of a specific area with longitude n and latitude m in time period t. After stacking in time series, the following set is obtained:

[0067]

[0068] Among them, STGVD represents the spatiotemporal grid velocity dataset, and T represents the number of the time series.

[0069] In another exemplary embodiment of the present application, time type data with different characteristics can be extracted. Different types of time data can be extracted according to the size of the sample and the different prediction requirements. For example, the traffic information matrix of the past few hours, i.e., X t , X t-1 , …, X t-h-1 In order to capture the daily cycle pattern of traffic conditions, we extract the traffic information matrix of the same time period in the past few days (assuming that there are T d time period), that is, X t+1 -T d , X t+1 -2×T d , …, X t+1 -d×T d In order to capture the weekly cycle pattern of traffic conditions, the traffic state matrix information of the same time period every week is extracted, namely X t+1 -7×T d , X t+1 -2×7×T d , …, X t+1 -w×7×T d If the forecast demand needs to capture a longer period of time, the above method can also be used as a reference.

[0070] According to different prediction requirements, the dynamic spatiotemporal residual convolutional neural network model first receives different types of sample traffic status data. These sample traffic status data are initially processed by the residual convolution module to generate preliminary residual convolution features. Then, the dynamic spatiotemporal residual convolutional neural network model receives road network density data and further adjusts the residual convolution features through the dynamic convolution module based on road network density. The dynamic convolution module based on road network density dynamically adjusts the weights of dynamic convolution kernels of different sizes according to the input road density data, so that the dynamic spatiotemporal residual convolutional neural network model can adaptively process input data under different road densities.

[0071] The process of determining road network density data is as follows:

[0072] 1. The geographical area for calculating the road network density is determined, which is consistent with the urban area corresponding to the traffic status data.

[0073] 2. Define the size of the grid, which is also consistent with the traffic status data.

[0074] 3. Use the osmnx database to obtain road data in the specified area. The coordinate systems of the road data and grid data may be inconsistent, so both need to be converted into a unified coordinate system for accurate geometric operations (such as calculating road length and determining whether they intersect).

[0075] 4. For each grid, calculate the total length of the roads by checking the roads that intersect with it. First, initialize the road length of the grid to 0, then, for each grid, find the roads that intersect with it and calculate the total length of these roads.

[0076] The grid area is defined as A grid :Assume that the grid width is Δlon, the height is Δlat (unit: meter), the grid area is Δlon×Δlat, and the total length of the road is L total For each grid, the total length of all roads intersecting the grid is calculated to obtain the road network density corresponding to a single grid. The road network density calculation formula is: Among them, ρ represents the road network density corresponding to the grid, represents the total length of all road segments intersecting the grid, L load,i represents the i-th road segment that intersects the grid, and n is the total number of all road segments that intersect the grid.

[0077] 5. The road network density is defined as the ratio of the total length of roads in each grid to the grid area. The calculated road network density data is saved in a file for subsequent use in the dynamic convolution module based on road network density.

[0078] It should be noted that the road network density data is only used to adjust the size and weight of the convolution kernel, and the actual convolution operation is still only performed on the traffic state matrix.

[0079] The spatiotemporal attention mechanism module in the dynamic spatiotemporal residual convolutional neural network model applies the temporal and spatial attention mechanism to enhance the important spatiotemporal information in the feature map. After being processed by the spatiotemporal attention mechanism module, the feature maps at different times are spliced ​​together and then fused through the fusion module to generate the final fused feature map. The final fused feature map is nonlinearly transformed by the ReLU activation function to generate the final prediction output, that is, the traffic status prediction data for the next time period of the historical time period. The fusion module includes a convolutional layer.

[0080] The structure of the dynamic spatiotemporal residual convolutional neural network model is as follows Figure 3 The dynamic spatiotemporal residual convolutional neural network model is an improved ResNet model. The improved ResNet model introduces a dynamic convolution module based on road network density and a spatiotemporal attention mechanism. The specific structure of each module is as follows:

[0081] (1) Residual convolution module:

[0082] The residual convolution module includes a first convolution submodule, a residual sequence submodule and a second convolution submodule; the first convolution submodule includes a plurality of first convolution layers; the residual sequence submodule includes a plurality of residual units; each residual unit includes a plurality of residual convolution layers; and the second convolution submodule includes a plurality of second convolution layers.

[0083] In a specific example, the first convolution submodule includes a first convolution layer; and the second convolution submodule includes a second convolution layer.

[0084] The first convolution submodule is used to extract local features of the input data of the residual convolution module. Then, multiple residual units further process these features. Finally, the second convolution submodule further convolves the features processed by the residual units to perform feature fusion.

[0085] Y0=Conv2d(Y t i ,W 0 ,b 0 ) (3);

[0086] Where Y0 represents the output of the first convolution submodule; Conv2d represents a two-dimensional convolution operation; Y t i is the input feature map, which represents the traffic status data of location i and its surrounding neighborhood at time t; W 0 is the weight of the convolution kernel of the first convolutional layer; b 0 is the bias term of the initial convolutional layer.

[0087] Each residual unit contains two residual convolutional layers with 3×3 convolution kernels, and uses skip connections to add the input feature map directly to the output of the second residual convolutional layer. After the convolution operation, the ReLU activation function (negative slope = 0.01) is applied to introduce nonlinearity. Through this structure, the residual unit can effectively capture the local features of the input data while maintaining effective information transmission.

[0088] Y k+1 =ReLU(Conv2d(Y k ,W k+1 ,b k+1 ))+Y k (4);

[0089] Among them, Y k+1 is the output feature map after the k+1th residual convolutional layer (or stage), W k+1 is the weight of the convolution kernel of the k+1th residual convolution layer, b k+1is the bias term of the k+1th residual convolutional layer. This embodiment uses a residual sequence submodule containing multiple residual units, each of which is connected in sequence, and the output of the previous residual unit is used as the input of the next residual unit. Specifically, each residual unit ResUnit in the residual sequence submodule performs the following operations:

[0090] Y k+1 =f(Y k )+Y k (5);

[0091] Among them, f() represents the combined operation of convolution and activation function in the above residual unit.

[0092] (2) Dynamic convolution module based on road network density:

[0093] The dynamic convolution module based on road network density can dynamically adjust the weight of the dynamic convolution kernel according to the road density to adapt to the feature extraction requirements under different road conditions. In low-density areas, the module tends to use smaller convolution kernels to reduce the impact of zero-value areas on numerical areas; in high-density areas, the module uses larger convolution kernels to fully capture complex spatial dependencies. The specific process is as follows:

[0094] First, during the initialization process, multiple dynamic convolution kernels of different sizes (3×3, 5×5, and 7×7) are defined and stored in nn.ModuleList.

[0095] During the forward propagation process, the dynamic convolution module based on road network density first calculates the average road density data of the input feature map (i.e., the target traffic status data at the historical moment). This step obtains a scalar value d, which represents the average road density of the current input. Then, based on this average density and the predefined density center position, the dynamic convolution module based on road network density uses a Gaussian function to calculate the dynamic weight of each dynamic convolution kernel. Specifically, these weights are calculated by formulas that reflect the importance of each dynamic convolution kernel under the current road density conditions. The dynamic convolution module based on road network density performs a weighted convolution operation on the residual convolution features: each dynamic convolution kernel performs convolution processing on the residual convolution features respectively to generate multiple dynamic convolution initial features. The dynamic convolution initial features corresponding to each dynamic convolution kernel are then weighted and stacked according to the weights corresponding to each dynamic convolution kernel calculated previously to form the dynamic convolution final features.

[0096] The weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density is calculated according to the road network density data, specifically including: performing global average pooling on the road network density data to obtain the global road network density; for each dynamic convolution kernel, calculating the weight corresponding to the dynamic convolution kernel according to the global road network density and the center value corresponding to the dynamic convolution kernel.

[0097] Global average pooling of road network density: First, perform global average pooling on the input road network density data D to obtain the global road network density d. The formula is as follows:

[0098] d=AvgPool(D)=Avg(x[i,j]) (6);

[0099] Among them, D is the input road network density data, d is the feature map after pooling, that is, the global road network density; AvgPool is the global average pooling operation. The road network density data is processed by global average pooling to calculate a global density mean d, which is used as the basis for dynamically adjusting the convolution kernel weights.

[0100] Weight calculation function: A weight calculation function based on a Gaussian function is used to determine the weights of different dynamic convolution kernels. The formula is defined as follows:

[0101]

[0102] Among them, w i is the weight of the ith dynamic convolution kernel; α is a parameter that controls the steepness of the weight distribution. The larger the value, the steeper the weight distribution. In this embodiment, α is set to 10 to ensure that the weight can be quickly adjusted in areas with different road network densities, making the selection of dynamic convolution kernels more sensitive; N is the total number of dynamic convolution kernels in the dynamic convolution module based on road network density, and μ i is the center value of the ith dynamic convolution kernel, which is used to control the "active" range of each dynamic convolution kernel. In the dynamic convolution module based on road network density, this embodiment sets three dynamic convolution kernels of different sizes (3×3, 5×5, 7×7), that is, N=3, and the center values ​​of the three dynamic convolution kernels are μ1=0.5, μ2=1.5, and μ3=2.5, respectively, focusing on feature extraction in urban areas of different densities.

[0103] Different feature weighted output: When calculating the weight w i After that, the weights are applied to the corresponding dynamic convolution kernels and weighted summed to form the final convolution output, as follows:

[0104]

[0105] Among them, Y is the final feature of dynamic convolution, X is the output of the residual convolution module, and K iis the i-th dynamic convolution kernel, X*K i represents the convolution operation performed by the i-th dynamic convolution kernel on the input residual convolution feature X, w i is the weight of the i-th dynamic convolution kernel.

[0106] When the number of dynamic convolution kernels is 3, the three dynamic convolution kernels obtain the first dynamic convolution initial feature, the second dynamic convolution initial feature and the third dynamic convolution initial feature respectively, and the first dynamic convolution initial feature, the second dynamic convolution initial feature and the third dynamic convolution initial feature are calculated based on the weights w of the three dynamic convolution kernels. i Perform weighted summation to obtain the final features of dynamic convolution.

[0107] (3) Temporal-Spatial Attention Mechanism

[0108] The temporal-spatial attention mechanism module consists of two submodules: the temporal attention mechanism submodule and the spatial attention mechanism submodule. First, the input tensor X (i.e., the final feature of the dynamic convolution) is generated through the temporal attention mechanism to generate the temporal weight A. T , and use the time weight A T Time-weight the input tensor X and generate the time-weighted output tensor X T . Secondly, the time-weighted output tensor X T Generate spatial weight A through spatial attention mechanism S , and adopt the spatial weight A S The output tensor X after time weighting T Perform spatial weighting to generate the final spatiotemporal weighted output X S , the final spatiotemporal weighted output X S That is, the spatiotemporal attention feature.

[0109] The temporal attention mechanism module aims to dynamically adjust the attention of the dynamic spatiotemporal residual convolutional neural network model to different time steps in the input sequence by calculating the importance weight of each time step. In the dynamic spatiotemporal residual convolutional neural network model, the initial shape of the data is a four-dimensional tensor X, whose shape is [B, C, H, W]. Among them, B is the number of samples, C is the number of channels, and in this embodiment, it is single-channel data, so C = 1, H, W are the height and width of the grid data, respectively. Since the initial input lacks a time dimension, in order to enable the temporal attention mechanism to be processed using 3D convolution, it is necessary to insert a time dimension into the above four-dimensional tensor data. After inserting the new time dimension, the shape of the tensor is expressed as shown in the following formula:

[0110] unsqueeze3(X)=[B,C,T,H,W] (9);

[0111] Among them, unsqueeze3() means adding the time dimension in the third position, and T represents the time dimension. First, the input data is globally averaged pooled along the spatial dimension to compress the features of each time step into a scalar to form a new time weight tensor.

[0112] A T =σ(Conv3d(AvgPool(X,(1,H,W)))) (10);

[0113] Among them, A T is the time weight matrix, σ represents the activation function, AvgPool is the global average pooling operation, and Conv3d is the three-dimensional convolution operation. Multiply the original input tensor with the time weight to generate the time-weighted output:

[0114] X T =X⊙A T (11);

[0115] Among them, ⊙ represents the bit-by-bit multiplication of elements, A T is the temporal weight matrix, and X is the input tensor of the temporal attention mechanism module. The time-weighted five-dimensional tensor is reshaped into a four-dimensional tensor, that is, by merging the time dimension and the batch dimension into a new dimension, so that its shape is converted from [B, C, T, H, W] to [(B×T), C, H, W]. The purpose of this reshaping operation is to apply a two-dimensional convolution operation in the spatial attention mechanism module to calculate the attention weight in the spatial dimension. The formula is as follows:

[0116] A S =σ(Conv2d(X T ,(C,C,3,3))) (12);

[0117] Among them, A S is the spatial weight matrix, Conv2d is the two-dimensional convolution operation, σ represents the activation function, (C,C,3,3) represents the parameters of the two-dimensional convolution operation, where C is the number of input and output channels, and 3×3 is the size of the convolution kernel. Multiply the time-weighted tensor by the spatial weight to generate the final spatiotemporal weighted output:

[0118] X S =X T ⊙A S (13);

[0119] Among them, ⊙ represents the bit-by-bit multiplication of elements, A s is the time weight matrix, X T is a time-weighted tensor.

[0120] Data set division: 80% of the samples are used as training sets and 20% as test sets. The optimizer uses the Adam method and the initial learning rate is set to 0.001. The loss function uses the L1 loss function suitable for the prediction task of regression problems. The learning rate scheduler uses the ReduceLROnPlateau scheduler, which automatically reduces the learning rate when the validation loss no longer decreases. The mode is set to 'min', the reduction factor is 0.1, and the patience value is 5.

[0121] This example uses mean square error (MSE), mean absolute error (MAE), mean absolute percentage error (MAPE) and R 2 These four evaluation indicators evaluate the dynamic spatiotemporal residual convolutional neural network model. The calculation formulas of each evaluation indicator are as follows:

[0122]

[0123] in, Represents the predicted value, y i represents the true value, Represents the mean.

[0124] Compared with the prior art, the city-level road network traffic status prediction method provided by this application has the following advantages:

[0125] First, this application divides the urban area into grids, which is a macro traffic prediction model. It can also be applied to traffic condition prediction in small areas and is highly flexible and scalable.

[0126] Second, this application proposes a dynamic convolution technology based on road network density and integrates it into the ResNet model. Unlike the traditional ResNet model, which does not extract features of different scales based on data sparseness and density, this application fully considers the differences in road network density and can capture feature differences in local areas at multiple scales.

[0127] Third, this application combines the ResNets model with the spatiotemporal attention mechanism, which makes up for the model's shortcomings in capturing the dependencies of continuous time unit sequences and enhances the ability to model time dependencies. Compared with the previous combination of recurrent neural networks, which is prone to gradient explosion, the attention mechanism can effectively capture the time dependencies of historical sequences while preventing gradient explosion.

[0128] The present application also provides an application scenario, which applies the above-mentioned city-level road network traffic status prediction method. Specifically: the city-level road network traffic status prediction method provided in this embodiment can be applied in the traffic status prediction scenario. The traffic status prediction scenario includes a data acquisition link and a traffic status prediction link; the target traffic status data of the historical time period of the target urban area enters the traffic status prediction link from the data acquisition link, and the traffic status prediction data of the next time period of the historical time period is obtained through human-computer collaboration. The city-level road network traffic status prediction method provided in this embodiment belongs to the traffic status prediction link. Specifically, in the process of the traffic status prediction link for the target urban area, the road network density calculation formula can be used to determine the road network density data according to the basic parameters of the target urban area, and the target traffic status data of the historical time period can be input into the trained dynamic spatiotemporal residual convolutional neural network model to obtain the traffic status prediction data of the next time period of the historical time period.

[0129] Based on the same inventive concept, the embodiment of the present application also provides a city-level road network traffic state prediction device for implementing the above-mentioned city-level road network traffic state prediction method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more city-level road network traffic state prediction device embodiments provided below can refer to the above-mentioned limitations on the city-level road network traffic state prediction method, and will not be repeated here.

[0130] In an exemplary embodiment, Figure 4 As shown, a city-level road network traffic status prediction device is provided, which includes the following modules:

[0131] The target traffic status data acquisition module T1 is used to: acquire basic parameters of the target urban area and target traffic status data of a historical time period; the basic parameters include the number and length of roads; the target traffic status data of the historical time period includes target traffic status data of several historical moments in the historical time period;

[0132] The road network density data determination module T2 is used to: determine the road network density data according to the basic parameters of the target urban area using the road network density calculation formula;

[0133] The traffic state prediction module T3 is used to: input the target traffic state data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain the traffic state prediction data of the next time period of the historical time period;

[0134] The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence; wherein the residual convolution module is used to: extract features from the target traffic status data at each historical moment to obtain residual convolution features; the dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract features from the residual convolution features to obtain the weight corresponding to each dynamic convolution kernel Dynamic convolution initial features; performing weighted summation of the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weights corresponding to each dynamic convolution kernel to obtain the dynamic convolution final features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on the spatial and temporal dimensions of the dynamic convolution final features corresponding to the historical moment to obtain the spatiotemporal attention features corresponding to the historical moment; the fusion module is used to: fuse the spatiotemporal attention features corresponding to all historical moments to obtain the traffic status prediction data for the next time period of the historical time period.

[0135] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store traffic status prediction data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for predicting the traffic status of a city-level road network is implemented.

[0136] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0137] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0138] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0140] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0141] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0142] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0143] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for predicting traffic status of a city-level road network, characterized in that: The city-level road network traffic state prediction method comprises: Obtaining basic parameters of the target urban area and target traffic status data for a historical time period; the basic parameters include the number and length of roads; the target traffic status data for a historical time period includes target traffic status data for several historical moments within the historical time period; Using the road network density calculation formula, determine the road network density data according to the basic parameters of the target urban area; Inputting the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain traffic status prediction data for the next time period of the historical time period; The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence; The residual convolution module is used to: extract features from the target traffic status data at each historical moment to obtain residual convolution features; The dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract the residual convolution feature to obtain the dynamic convolution initial feature corresponding to each dynamic convolution kernel; perform weighted summation on the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weight corresponding to each dynamic convolution kernel to obtain the dynamic convolution final feature corresponding to each historical moment; The spatiotemporal attention mechanism module is used to: for each historical moment, extract the dynamic convolution final features corresponding to the historical moment in the spatial and temporal dimensions to obtain the spatiotemporal attention features corresponding to the historical moment; The fusion module is used to fuse the spatiotemporal attention features corresponding to all historical moments to obtain traffic status prediction data for the next time period of the historical time period.

2. The method for predicting urban road network traffic status according to claim 1, characterized in that: The residual convolution module includes a first convolution submodule, a residual sequence submodule and a second convolution submodule; the first convolution submodule includes a plurality of first convolution layers; the residual sequence submodule includes a plurality of residual units; each of the residual units includes a plurality of residual convolution layers; the second convolution submodule includes a plurality of second convolution layers.

3. The method for predicting urban road network traffic status according to claim 2, characterized in that: The first convolution submodule includes a first convolution layer; the second convolution submodule includes a second convolution layer.

4. The method for predicting urban road network traffic status according to claim 2, characterized in that: Each of the residual units includes two residual convolutional layers.

5. The method for predicting urban road network traffic status according to claim 1, characterized in that: Calculating the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data specifically includes: Performing global average pooling on the road network density data to obtain a global road network density; For each dynamic convolution kernel, a weight corresponding to the dynamic convolution kernel is calculated according to the global road network density and the center value corresponding to the dynamic convolution kernel.

6. The method for predicting urban road network traffic status according to claim 1, characterized in that: Types of traffic status data include speed, flow, and congestion index.

7. The method for predicting urban road network traffic status according to claim 1, characterized in that: Before the step of inputting the target traffic status data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model, the city-level road network traffic status prediction method further includes: Obtaining a training set; the training set includes sample traffic status data of several sample time periods; The training set is used to train the dynamic spatiotemporal residual convolutional neural network model to obtain a trained dynamic spatiotemporal residual convolutional neural network model.

8. A city-level road network traffic status prediction device, characterized in that: The city-level road network traffic state prediction device comprises: The target traffic status data acquisition module is used to: acquire basic parameters of the target urban area and target traffic status data of a historical time period; the basic parameters include the number and length of roads; the target traffic status data of the historical time period includes target traffic status data of several historical moments in the historical time period; A road network density data determination module is used to: determine the road network density data according to the basic parameters of the target urban area using a road network density calculation formula; The traffic state prediction module is used to: input the target traffic state data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain the traffic state prediction data of the next time period of the historical time period; The dynamic spatiotemporal residual convolutional neural network model includes a residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module connected in sequence; wherein the residual convolution module is used to: extract features from the target traffic status data at each historical moment to obtain residual convolution features; the dynamic convolution module based on road network density is used to: calculate the weight corresponding to each dynamic convolution kernel in the dynamic convolution module based on road network density according to the road network density data; use each dynamic convolution kernel to extract features from the residual convolution features to obtain the weight corresponding to each dynamic convolution kernel Dynamic convolution initial features; performing weighted summation of the dynamic convolution initial features corresponding to all dynamic convolution kernels and the weights corresponding to each dynamic convolution kernel to obtain the dynamic convolution final features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on the spatial and temporal dimensions of the dynamic convolution final features corresponding to the historical moment to obtain the spatiotemporal attention features corresponding to the historical moment; the fusion module is used to: fuse the spatiotemporal attention features corresponding to all historical moments to obtain the traffic status prediction data for the next time period of the historical time period.

9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the urban-level road network traffic status prediction method described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for predicting the traffic status of a city-level road network described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Traffic flow prediction method based on multi-scale space-time dynamic interaction network

    CN117456736A

  • Urban traffic flow prediction method based on dynamic adaptive convolutional neural network

    CN118587893A

  • Context based vehicular traffic prediction

    US20200372322A1

  • KR20240159723A

Cited By

  • Urban area attribute determination method and device, equipment, medium and program product

    CN120578975A

  • Urban area attribute determination method, apparatus, device, medium, and program product

    CN120578975B