A method, device, equipment and medium for predicting urban road network traffic status

Through the dynamic spatiotemporal residual convolutional neural network model and the road network density adjustment convolution kernel weights, the problems of low efficiency and insufficient accuracy of urban traffic prediction in the existing technology are solved, and efficient and accurate urban-level road network traffic status prediction is achieved.

CN119559785BActive Publication Date: 2025-09-02XIAN TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing urban traffic condition prediction methods are highly computationally expensive, inefficient and insufficiently accurate in large-scale urban road networks, and cannot fully utilize the dynamic characteristics of traffic data and the complex spatial and temporal correlation between road sections.

Method used

The dynamic spatiotemporal residual convolution neural network model is adopted, and the convolution kernel weight is dynamically adjusted in combination with the road network density data to capture the spatial and temporal dependence of traffic states and enhance prediction capabilities.

Benefits of technology

It realizes efficient and accurate traffic state prediction in large-scale and small-scale urban road networks, and can handle local and overall traffic conditions at the same time, improves the flexibility and accuracy of prediction, and solves the shortcomings of traditional models in dealing with heterogeneity and time dependence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559785B_ABST
    Figure CN119559785B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and medium for predicting urban road network traffic status, which relates to the field of traffic technology. The method comprises: obtaining basic parameters of a target urban area and target traffic status data of a historical time period; determining road network density data according to the basic parameters of the target urban area using a road network density calculation formula; inputting the target traffic status data of the historical time period into a 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 comprises 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; adjusting 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. The present application improves prediction efficiency and accuracy.
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 for addressing congestion and improving travel efficiency, and is a key technology in smart transportation management. Existing research on urban traffic prediction primarily focuses on single road segments or small-scale road networks, typically using a single deep learning model to predict traffic conditions on a specific road segment. However, predicting traffic conditions across an entire city often requires a large number of deep learning models, which not only increases computational overhead but also makes model scalability difficult.

[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 used 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 in city-level traffic networks is limited. In addition, existing models are inefficient when processing large-scale urban traffic data. For example, while graph-based AI models excel 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, which are suitable for capturing Euclidean spatial relationships) face challenges such as the vanishing gradient problem as the number of network layers increases. In addition, the pooling operations in these methods may smooth or ignore certain detailed features, causing subtle changes in traffic flow to be overlooked, 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 traffic status of urban road networks, which can be applied to large-scale and small-scale urban road networks and have 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 conditions in 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] Use the road network density calculation formula to determine the road network density data based on the basic parameters of the target urban area;

[0010] Inputting the target traffic state data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain traffic state 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 state data at each historical moment to obtain residual convolution features;

[0013] The road network density-based dynamic convolution module is configured to: calculate the weight corresponding to each dynamic convolution kernel in the road network density-based dynamic convolution module according to the road network density data; perform feature extraction on the residual convolution feature using each dynamic convolution kernel to obtain the dynamic convolution initial feature corresponding to each dynamic convolution kernel; and perform weighted summation of 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 configured to: for each historical moment, perform feature extraction on the dynamic convolution final features corresponding to the historical moment in 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; and 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 road network density-based dynamic convolution module 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] Obtaining 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 obtain 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 within 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] A 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 traffic state prediction data for 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 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 features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on 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.

[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 urban-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 urban-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, apparatus, device 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 to address the differences in road network density, cleverly combining dynamic traffic flow data (weights corresponding to dynamic convolution kernels) with static road structure data, overcoming the limitations of traditional spatiotemporal residual networks in processing heterogeneous characteristics of road networks and achieving efficient and accurate spatial feature extraction. Through the spatiotemporal attention mechanism, the inherent deficiencies of traditional spatiotemporal residual networks in capturing the dependencies of continuous time unit sequences are effectively addressed, and the network's ability to model time dependencies 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 effectively capture the time dependencies of historical sequences while preventing gradient explosion. 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 following briefly introduces the drawings required for use in the embodiments. 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 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 flow chart of a method for predicting traffic status of a city-level road network provided in one 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 the functional modules of a device for predicting urban road network traffic status according to an 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 this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0042] In large-scale traffic state prediction, deep neural networks are prone to vanishing or exploding gradients due to the increasing number of layers. Residual networks (ResNets) significantly alleviate the vanishing gradient problem by introducing skip connections, enabling direct gradient transfer. This allows for the construction of deeper network structures and ensures model trainability. This enables residual networks to capture more and more complex features, improving predictive capabilities. Furthermore, residual networks can be easily combined with advanced architectures such as attention mechanisms to construct hybrid models, enhancing their compatibility and scalability for complex traffic state prediction tasks. For example, Zhang et al. (2016) proposed deep spatiotemporal residual networks (ST-ResNets), which model the spatiotemporal characteristics of crowd flow through residual convolutional units, significantly improving the accuracy of crowd flow prediction within cities. A deep spatiotemporal residual network (DeepRTP) combining residual connections with 3D convolutional modules is currently being developed for regional traffic prediction. Residual connections address the vanishing gradient problem in deep networks, enabling the model to capture more spatiotemporal dependencies and improving the accuracy of regional traffic prediction. A model combining 3D convolutions and residual units, and incorporating the Pearson correlation coefficient method to extract highly correlated features, aims to improve the predictive capabilities of urban traffic conditions. By combining spatial and temporal features, it can more comprehensively model the dynamic changes in traffic data. Existing models combining 3D residual networks and self-attention mechanisms efficiently model the spatiotemporal information of traffic congestion data through 3D convolution modules. This model uses a self-attention mechanism to dynamically adjust the weights of spatiotemporal features, improving prediction accuracy. However, these ResNets models are only suitable for datasets with lower precision or smaller magnitudes. Specifically, when processing sequential data, such as time-series traffic data, the data often exhibits sequential correlations and dependencies along the temporal dimension. Data in consecutive time units are not completely independent but rather exhibit patterns and trends. For example, traffic conditions at one moment may affect those at a later moment. The ResNets model, which concatenates data segments into tensors and then models them using convolutional layers and residual units, does not fully account for these temporal sequences and dependencies. It lacks a dedicated mechanism to capture the inherent connections between data at different time points. Instead, it processes the data as a whole, without any specific design tailored to the characteristics of time series. This makes it impossible to fully exploit temporal dynamics, namely the patterns and trends of data changes over time. Furthermore, the ResNets model uses a unified convolution kernel to extract traffic characteristics from different regions. Convolution kernels extract features from input data, and 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 variations of different regions, and it cannot effectively handle the heterogeneity of road networks.As a result, when extracting spatial features, the specific traffic characteristics of each area cannot be accurately captured, resulting in a decrease in the accuracy of spatial feature extraction.

[0043] Based on the above problems, this application proposes a method, device, equipment and medium for predicting urban road network traffic status.

[0044] In order to make the above-mentioned purposes, 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 status 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 urban 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 based on the basic parameters of the target urban 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 urban 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 based 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 based 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, specifically a computer device such as a terminal or a server, or a terminal and a server. In the embodiment of the present application, the method is applied to Figure 1 Taking the server 104 in FIG. 1 as an example, the method includes the following steps 201 to 203. In which:

[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 a sequentially connected residual convolution module, a dynamic convolution module based on road network density, a spatiotemporal attention mechanism module and a fusion module.

[0052] The residual convolution module is used to: perform feature extraction on 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 perform feature extraction on 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, perform feature extraction on 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, this 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 dynamic spatiotemporal residual convolutional neural network model is trained using the training set to obtain a trained dynamic spatiotemporal residual convolutional neural network model. The dynamic spatiotemporal residual convolutional neural network model is trained using sample traffic status data within time period t as input and sample traffic status data within time period t+1 as labels to obtain a trained dynamic spatiotemporal residual convolutional neural network model.

[0057] Step 301 reconstructs a grid dataset 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 dataset. 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 a grid 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 expressed as shown in the following formula (1):

[0065]

[0066] Among them, X t It 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 respectively, and x in the two-dimensional matrix of sample traffic status data is (m,n) The elements represent 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. Depending on the size of the sample and the different forecast requirements, different types of time data can be extracted. 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, the traffic information matrix of the same time period in the past few days is extracted (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 pattern of traffic conditions, the traffic state matrix information of the same time period each 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 demand forecast needs to capture a longer-term cycle model, the above method can also be used as a reference.

[0070] Based on different prediction requirements, the dynamic spatiotemporal residual convolutional neural network model first receives different types of sample traffic status data. This sample traffic status data undergoes preliminary processing by the residual convolution module to generate preliminary residual convolution features. Next, the dynamic spatiotemporal residual convolutional neural network model receives road network density data and further adjusts the residual convolution features using a road network density-based dynamic convolution module. This road network density-based dynamic convolution module dynamically adjusts the weights of dynamic convolution kernels of different sizes based on the input road density data, enabling the dynamic spatiotemporal residual convolutional neural network model to 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 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 road data and grid data may be inconsistent, so both need to be converted to a unified coordinate system to perform 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 road length is L total For each grid, calculate the total length of all roads intersecting the grid 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. Road network density is defined as the ratio of the total length of roads within each grid cell to the grid area. Save the calculated road network density data to 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 module in the dynamic spatiotemporal residual convolutional neural network model applies temporal and spatial attention to enhance important spatiotemporal information in the feature map. After processing by the spatiotemporal attention module, feature maps at different times are concatenated and then fused by the fusion module to generate the final fused feature map. The final fused feature map undergoes a nonlinear transformation using the ReLU activation function to generate the final prediction output, which is the traffic status forecast for the next time period within 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 several first convolution layers; the residual sequence submodule includes several residual units; each residual unit includes several residual convolution layers; the second convolution submodule includes several second convolution layers.

[0083] In a specific example, the first convolution submodule includes a first convolution layer; 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] Among them, Y0 represents the output of the first convolution submodule; Conv2d represents the 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 consists of two residual convolutional layers with 3×3 convolutional kernels. A skip connection is used to directly add the input feature map to the output of the second residual convolutional layer. After the convolution operation, a ReLU activation function (negative slope = 0.01) is applied to introduce nonlinearity. This structure allows the residual unit to effectively capture the local features of the input data while maintaining efficient information transfer.

[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 convolution 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 convolution layer. This embodiment uses a residual sequence submodule containing multiple residual units. Each residual unit is connected in sequence, and the output of the previous residual unit serves 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 road network density-based dynamic convolution module dynamically adjusts the weights of the dynamic convolution kernel according to road density, adapting to 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 areas with values; 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 using a formula that reflects 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 convolves the residual convolution features separately 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, the 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.

[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] Where D is the input road network density data, d is the pooled feature map, i.e., the global road network density; AvgPool is the global average pooling operation. The road network density data is processed through 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 Gaussian-based weight calculation 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 i-th 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 i-th dynamic convolution kernel, which is used to control the "active" range of each dynamic convolution kernel. In this 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 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 shown in the following formula:

[0104]

[0105] Among them, Y is the final feature of dynamic convolution, X is the output of the residual convolution module, K iis the i-th dynamic convolution kernel, X*K i Indicates that the i-th dynamic convolution kernel performs a convolution operation 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 respectively obtain the first dynamic convolution initial feature, the second dynamic convolution initial feature and the third dynamic convolution initial feature, 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 feature 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 time weight A T Perform time weighting on the input tensor X and generate a time weighted output tensor X T . Secondly, the time-weighted output tensor X T Generate spatial weight A through spatial attention mechanism S , and use 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 is designed 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 and 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 use 3D convolution to process it, 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() indicates adding the time dimension in the third position, and T represents the time dimension. First, the input data is globally average pooled along the spatial dimension to compress the features of each time step into a scalar, forming 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 by 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 five-dimensional tensor after temporal weighting is reshaped into a four-dimensional tensor, that is, by merging the time dimension and the batch dimension into a new dimension, 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 the 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, and (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. The time-weighted tensor is multiplied 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] The data set was split into 80% of the samples as a training set and 20% as a test set. The Adam optimizer was used, with an initial learning rate of 0.001. The L1 loss function was used, suitable for regression prediction. The learning rate scheduler used the ReduceLROnPlateau scheduler, which automatically reduces the learning rate when the validation loss no longer decreases. The mode was set to 'min', the reduction factor to 0.1, and the patience value to 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 for 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 existing technology, the urban 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 technique based on road network density and integrates it into the ResNet model. Unlike traditional ResNet models, which do not extract features at different scales based on differences in data density, this application fully considers 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 a spatiotemporal attention mechanism, addressing the model's shortcomings in capturing dependencies between continuous time units and enhancing its ability to model temporal dependencies. Compared to previous approaches that were prone to gradient explosions due to the integration of recurrent neural networks, the attention mechanism effectively captures temporal dependencies between historical sequences while preventing gradient explosions.

[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 based on 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 embodiments of the present application also provide an urban-level road network traffic state prediction device for implementing the aforementioned urban-level road network traffic state prediction method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more embodiments of the urban-level road network traffic state prediction device provided below can be found in the above-mentioned limitations of the urban-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 obtain 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 within 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] Traffic state prediction module T3, 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 traffic state prediction data for 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 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 features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on 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.

[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, abbreviated as I / O) and a communication interface. The processor, memory and 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 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 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 shown in the figure, or combine certain components, or have a different component arrangement.

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

[0138] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the steps in the above-mentioned 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 skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented 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 memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may 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 may 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 databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.

[0142] The technical features of the above embodiments can 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 document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may 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 includes: 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; Use the road network density calculation formula to determine the road network density data based on the basic parameters of the target urban area; Inputting the target traffic state data of the historical time period into the trained dynamic spatiotemporal residual convolutional neural network model to obtain traffic state 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 state data at each historical moment to obtain residual convolution features; The road network density-based dynamic convolution module is configured to: calculate the weight corresponding to each dynamic convolution kernel in the road network density-based dynamic convolution module according to the road network density data; perform feature extraction on the residual convolution feature using each dynamic convolution kernel to obtain the dynamic convolution initial feature corresponding to each dynamic convolution kernel; and perform weighted summation of 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 configured to: for each historical moment, perform feature extraction on the dynamic convolution final features corresponding to the historical moment in 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 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.

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 includes: The target traffic status data acquisition module is used to obtain 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 within 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; A 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 traffic state 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; 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 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 features corresponding to each historical moment; the spatiotemporal attention mechanism module is used to: for each historical moment, perform feature extraction on 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.

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 according to 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 urban road network traffic status according to 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