Big data urban traffic flow prediction method and device based on geographic information and readable storage medium
Through graph convolution adaptive spatial feature extraction model, attention-enhanced long-term memory network and dynamic impact fusion network, combined with spatial features, time series analysis and external factors, the spatial dependence and time dependence in traditional traffic flow prediction methods are solved. The problem of integrating with external factors has achieved high-precision traffic flow forecasting and supported urban traffic management and planning.
Patent Information
- Application Number
- CN202411372413.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-12-31
AI Technical Summary
Traditional traffic flow prediction methods lack comprehensive capture of spatial dependence and time dependence, and it is difficult to dynamically integrate external factors, resulting in inaccurate prediction results and insufficient generalization capabilities of the model.
Using a big data urban traffic flow prediction method based on geographic information, the graph convolution adaptive spatial feature extraction model (GCN-ASFE), attention-enhanced long and short-term memory network (AE-LSTM), and dynamic impact fusion network (DIFN). Fusion of spatial characteristics, time series analysis and dynamic influences of external factors to improve prediction accuracy.
It significantly improves the accuracy and practicality of traffic flow prediction, enhances the ability to capture complex data patterns, improves the adaptability and generalization capabilities of the model, and supports urban traffic management and planning decisions.
Smart Images

Figure CN119229651A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data and deep learning technology, and in particular to a big data urban traffic flow prediction method, device and computer-readable storage medium based on geographic information. Background Art
[0002] With the continuous advancement of urbanization, urban population density has increased dramatically, and the resulting traffic congestion problem has become increasingly serious. This not only affects the travel efficiency and quality of life of citizens, but also poses a huge challenge to the sustainable development of the urban economy. Traffic congestion involves many factors, including road infrastructure, the number of vehicles, the efficiency of the public transportation system, the distribution of social and economic activities, weather conditions, etc. Therefore, how to effectively predict and manage urban traffic flow has become an important issue facing modern city managers.
[0003] Traditional traffic flow prediction methods mainly rely on historical traffic data and statistical models, such as linear regression, time series models (such as ARIMA), etc. Although these methods can reflect the changing patterns of traffic flow to a certain extent, they have significant limitations:
[0004] 1. Lack of consideration of spatial dependence: Traffic flow has obvious spatial dependence. Traffic flows in different areas are interrelated. Traditional methods are difficult to effectively capture this feature.
[0005] 2. Difficulty in handling complex time dependencies: The time series of traffic flow has complex periodicity and trends, and traditional time series models are difficult to fully capture short-term and long-term time dependencies.
[0006] 3. Ignoring the dynamic impact of external factors: Traffic flow is affected by many external factors, such as weather conditions, holidays, major events, etc. Traditional methods usually find it difficult to dynamically integrate the impact of these external factors, resulting in inaccurate prediction results.
[0007] 4. Insufficient model generalization ability: Traditional methods have limited adaptability to new data and it is difficult to maintain good prediction performance in different cities or changing traffic environments.
[0008] In recent years, with the development of big data technology and deep learning technology, the field of traffic flow prediction has ushered in new opportunities. Big data technology can collect and process massive amounts of traffic data, geographic information data, socio-economic data, and environmental data, providing a rich data foundation for traffic flow prediction. Deep learning technology, especially convolutional neural networks (CNN), graph convolutional networks (GCN), long short-term memory networks (LSTM), etc., has powerful feature extraction and pattern recognition capabilities, and can effectively capture the spatial and temporal dependencies in traffic flow. Summary of the invention
[0009] In order to overcome the limitations of traditional methods, this paper proposes a big data urban traffic flow prediction method based on geographic information. This method aims to improve the accuracy and practicality of traffic flow prediction by integrating spatial characteristics, time series analysis and the dynamic influence of external factors.
[0010] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0011] A big data urban traffic flow prediction method based on geographic information, the method includes the following steps:
[0012] 1) Data collection and preprocessing
[0013] Data sources include: traffic data, geographic information data, socio-economic data, and environmental data; data preprocessing, removal of outliers, filling of missing values; integration of data from different sources into a unified framework; and extraction of features that are helpful for prediction from raw data, normalization and standardization of data;
[0014] 2) Spatial feature extraction
[0015] This step adopts the graph convolution adaptive spatial feature extraction model (GCN-ASFE); through the graph convolution network (GCN) and adaptive spatial weight assignment (ASWA) mechanism, the spatial dependencies in the traffic network are captured and the spatial weights between nodes are dynamically adjusted. Specifically, the following steps are included:
[0016] 2.1) The city is divided into multiple regions, each of which is a node in the graph. The characteristics of the node include the road type and traffic capacity of the region. The connection between nodes represents the traffic flow relationship between regions. The weight of the edge can be initialized based on the geographical distance and road connection information.
[0017] 2.2) Use graph convolutional networks (GCNs) to capture spatial dependencies in road networks. First, the features of nodes are aggregated through the adjacency matrix to calculate the feature vector of each node. Then, the feature vector of the node is updated through a learnable weight matrix and activation function to capture the spatial relationship between nodes.
[0018] 2.3) Adopting the adaptive spatial weight assignment (ASWA) mechanism for weight assignment; First, based on the feature vector of the node, a multi-layer perceptron (MLP) is used to calculate the weights between nodes; Then, the weights are normalized by the softmax function to ensure that the sum of the weights of each node is 1; Finally, the updated weight matrix is used to replace the original adjacency matrix and the feature vector of the node is recalculated;
[0019] 3) Time Series Analysis
[0020] The attention-enhanced long short-term memory network (AE-LSTM) is used to capture the temporal dependencies in traffic flow data and enhance the focus on key time steps.
[0021] 3.1) LSTM layer: Input the standardized time series data and calculate the hidden state h of each time step through the LSTM layer t ;
[0022] 3.2) Attention mechanism layer: the output h of the LSTM layer t Weighted, calculate the weighted hidden state h weighted ;
[0023] 3.3) Prediction layer: The weighted hidden state h weighted Pass it to the fully connected layer for traffic flow prediction;
[0024] 4) Integration of external factors
[0025] Apply the Dynamic Impact Fusion Network (DIFN); capture the dynamic changes of external factors and their impact on traffic flow through feature embedding, dynamic impact assessment and fusion prediction;
[0026] 5) Model training and evaluation
[0027] Divide the data set into training set, validation set and test set; the training set is used to train the model, the validation set is used to adjust the model parameters, and the test set is used to evaluate the model performance; select a suitable loss function for model training to minimize the error between the predicted value and the true value; select a suitable optimization algorithm to optimize the model parameters and update the model weights;
[0028] The model performance is evaluated using mean absolute error (MAE) or root mean square error (RMSE) indicators, and the generalization ability of the model is evaluated through cross-validation methods to ensure the stable performance of the model on different data sets; and the dynamic adaptability of the model is tested by changing external factors in the test data set;
[0029] 6) Model deployment and application
[0030] Deploy the trained model to the actual traffic management system to provide real-time traffic flow forecasts; display the forecast results in the form of charts and maps to facilitate decision-making by traffic management departments; use the forecast results to formulate and adjust traffic control measures; use long-term traffic flow forecast results to support the planning and optimization of urban transportation infrastructure.
[0031] Preferably, the traffic data in step 1) includes data from traffic monitoring cameras, traffic flow detectors, GPS vehicle data, etc.; geographic information data includes GIS data such as road network structure, intersections, bus routes, etc.; socio-economic data includes population density, commercial area distribution, major events, etc.; environmental data includes weather conditions, seasonal changes, etc.
[0032] Preferably, the outlier processing in step 1) includes detecting and removing abnormal data points that do not conform to common sense, such as abnormally high or low flow data; for missing data, interpolation, mean filling or machine learning-based methods are used to fill in the missing data;
[0033] Features that are helpful for prediction include time features, weather features, and spatial features. Time features include extracting time features from timestamps, such as hours, days of the week, and whether it is a holiday. Weather feature extraction is to convert weather data into feature vectors, including temperature, rainfall, and wind speed. Spatial feature extraction is to convert road network structure and socioeconomic data into feature vectors, including road types, intersection density, and commercial area density.
[0034] Normalization and standardization of data include scaling the data to the range of 0 to 1 to eliminate the dimensional differences between different features; converting the data into a distribution with a mean of 0 and a standard deviation of 1.
[0035] Preferably, the graph convolutional network (GCN) in step 2.2) is as follows:
[0036] Given an undirected graph G = (V, E), where V is the node set and E is the edge set; the adjacency matrix A represents the connection relationship between nodes, and the node feature matrix X∈R N×D Represents the feature vector of each node, where N is the number of nodes and D is the feature dimension; the basic formula is as follows:
[0037] The basic formula is as follows:
[0038]
[0039] in:
[0040] H (l) is the node feature matrix of the lth layer, initially H (0) =X;
[0041] A′ is the dynamic weight w i The calculated adaptive adjacency matrix;
[0042] D′ is the degree matrix of A′, and the diagonal elements D′ ii =Σ j A′ ij ;
[0043] W(l) is the learnable weight matrix of layer l;
[0044] σ is the activation function.
[0045] Preferably, the core of the ASWA mechanism in step 2.3) is to learn the dynamic weights between nodes through a multi-layer perceptron (MLP); comprising the following steps:
[0046] a) Given the feature vector h of node i and node j i and h j , calculate the weight w between them through MLP ij ;
[0047] For each pair of nodes i and j, the weight wij is calculated by the following formula:
[0048]
[0049] in, Represents the concatenation operation of the feature vector. MLP is a multi-layer perceptron used to calculate the correlation score e of the node pair. ij ;
[0050] b) Normalize the relevance scores of all adjacent nodes through the softmax function to obtain the weight wij:
[0051]
[0052] in, is the set of neighbor nodes of node i; ensure that the calculated weight w ij Satisfy the normalization condition so that it is in the range of [0,1];
[0053] c) Through dynamically calculated weight w ij An adaptive adjacency matrix A′ is constructed, which can replace the fixed adjacency matrix A and dynamically reflect the real-time relationship between nodes. The elements of the adaptive adjacency matrix A′ are defined as:
[0054]
[0055] E is the edge set in the graph, which represents the connection relationship between nodes;
[0056] If there is a connection between i and j, that is, (i, j) ∈ E), then the value of the corresponding position in the adaptive adjacency matrix is w ij ; otherwise 0.
[0057] d) In the calculation process of the graph convolutional network (GCN), we use the adaptive adjacency matrix A' for feature aggregation and update; for each node feature H of layer l(l) , using the adaptive adjacency matrix for propagation, the updated node features are expressed as:
[0058]
[0059] in:
[0060] H (l) is the node feature matrix of the lth layer, initially H (0) =X;
[0061] A′ is the dynamic weight w i The calculated adaptive adjacency matrix;
[0062] D′ is the degree matrix of A′, and the diagonal elements D′ ii =∑ j A′ ij ;
[0063] W(1) is the learnable weight matrix of layer l;
[0064] σ is the activation function.
[0065] Preferably, in step 3), the given time series input {x t} and the initial state (h0, c0), each time of LSTM
[0066] The calculation of the interval is as follows:
[0067] Forget gate: controls the forgetting of the information of the previous time step
[0068] f t =σ(W f ·[h t-1 , x t ]+b f );
[0069] Input gate: controls the information input into the current time step
[0070] i t =σ(W i ·[h t-1 , x t ]+b i );
[0071] Candidate memory cells: Generate new candidate memories
[0072]
[0073] Update memory unit: Update memory unit by combining the information of forget gate and input gate
[0074]
[0075] Output gate: controls output information
[0076] o t =σ(W o ·[h t-1 , x t ]+b o );
[0077] Hidden state: Generates the hidden state of the current time step
[0078] h t =o t *tanh(c t );
[0079] Wherein, σ is the sigmoid activation function, * represents element-by-element multiplication, and W and b are learnable weights and bias parameters. Preferably, the formula model of the attention mechanism in step 3) is as follows:
[0080] Calculate the attention score: for each time step hidden state h t , and calculate its score e through the attention score function t =v T tanh(W h h t +b a );
[0081] Calculate attention weight: Normalize the attention score through the softmax function to get the attention weight
[0082] Calculate the weighted hidden state: perform weighted summation on the output of LSTM to obtain the weighted hidden state
[0083]
[0084] Preferably, the specific steps of the dynamic impact fusion network (DIFN) in step 4) are as follows:
[0085] 4.1) Feature Embedding
[0086] The purpose of the feature embedding step is to convert various external factors into high-dimensional feature vectors for model processing; given an original input data set of external factors in The data representing the i-th external factor are converted into feature vectors;
[0087]
[0088] Among them, f embedis the feature embedding function, which can be a simple linear transformation or a multi-layer perceptron (MLP). are the learnable parameters of the embedding function, is the embedding vector of the i-th external factor.
[0089] 4.2) Dynamic Impact Assessment
[0090] The purpose of the dynamic impact assessment step is to learn the impact weight of each external factor to reflect its dynamic impact on traffic flow; a multi-layer perceptron (MLP) is used to calculate the impact weight of each external factor; given the embedding vector set of external factors First calculate the relevance score for each external factor
[0091]
[0092] Among them, MLP is a multi-layer perceptron, θ mlp is its learnable parameter;
[0093] Then, the relevance scores are normalized by the softmax function to obtain the dynamic influence weight of each external factor.
[0094]
[0095]
[0096] 4.3) Fusion prediction
[0097] First, the weighted external factor embedding vector e is calculated fusion ;
[0098]
[0099] Then, the weighted external factor embedding vector is combined with the internal feature vector h internalh_ Fusion; internal feature vector h internalh_ It is generated by a time series analysis model or a spatial feature extraction model;
[0100]
[0101] Among them, ⊕ represents the concatenation operation of feature vectors;
[0102] Finally, a multi-layer perceptron (MLP) is used to process the combined features and output the traffic flow prediction results.
[0103] Among them, MLP predict is the multi-layer perceptron used for prediction, θ predictis its learnable parameter.
[0104] Furthermore, the present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method.
[0105] Furthermore, the present invention also discloses a computer-readable storage medium, on which a computer program or instruction is stored, and the method is implemented when the computer program or instruction is executed by a processor.
[0106] Due to the adoption of the above technical solution, the method for predicting urban traffic flow based on big data of geographic information realizes high-precision prediction of urban traffic flow through technical means such as multi-source data fusion, spatial feature extraction, time series analysis and dynamic fusion of external factors. The method shows significant technical effects in terms of data quality, multi-source data fusion, spatial feature extraction, time series analysis and real-time performance, provides strong technical support for urban traffic management, planning and decision-making, and has broad application prospects and important social and economic value. BRIEF DESCRIPTION OF THE DRAWINGS
[0107] Figure 1 The figure is a flowchart of the method of the present invention. DETAILED DESCRIPTION
[0108] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0109] With the acceleration of urbanization and the continuous growth of urban population, traffic congestion is becoming more and more serious. Effectively predicting urban traffic flow and formulating reasonable traffic management and optimization plans are important ways to alleviate traffic pressure and improve urban traffic efficiency. Combining geographic information system (GIS), machine learning and deep learning technology, a big data urban traffic flow prediction method based on geographic information is proposed. This method comprehensively considers spatial characteristics, time series analysis and the influence of external factors, aiming to improve the accuracy and practicality of traffic flow prediction.
[0110] like Figure 1 As shown, the method flow steps of the present invention include the following steps:
[0111] 1. Data collection and preprocessing
[0112] 1.1 Data Collection
[0113] In order to predict urban traffic flow, it is necessary to collect data from multiple data sources, including but not limited to:
[0114] Traffic data: including traffic monitoring camera data, traffic flow detector data, GPS vehicle trajectory data, etc. These data provide vehicle flow information at different times and locations.
[0115] Geographic information data: including GIS data such as urban road network structure, intersections, bus routes, etc. These data provide spatial structure information of the urban transportation network.
[0116] Socioeconomic data: This includes population density, distribution of commercial areas, and locations of important facilities such as schools and hospitals. This data provides potential socioeconomic factors that affect traffic flow.
[0117] Environmental data: including weather conditions (temperature, rainfall, wind speed, etc.), seasonal changes, holidays and other external factors. These data provide environmental factors that affect traffic flow.
[0118] 1.2 Data Cleaning
[0119] After data collection is completed, data cleaning is required to ensure data quality and consistency. The main steps include:
[0120] Outlier processing: Detect and remove abnormal data points that do not conform to common sense, such as abnormally high or low flow data. These outliers may be caused by sensor failures, etc.
[0121] Missing value processing: For missing data, interpolation, mean filling or machine learning-based methods can be used to fill in the missing data. For example, linear interpolation can be performed using the values of the previous and next time points, or predictive filling can be performed using related data.
[0122] 1.3 Data Integration
[0123] Integrate data from different data sources to form a unified data framework. The main steps include:
[0124] Data format unification: Convert the data formats of all data sources into a unified standard format to facilitate subsequent processing.
[0125] Time alignment: Align the timestamps of different data sources to ensure the consistency of data in time. For example, all data can be converted to the same time interval, such as minutes or hours.
[0126] 1.4 Feature Engineering
[0127] Feature engineering is to extract features that are helpful for prediction from raw data. The main steps include:
[0128] Time feature extraction: Extract time features from timestamps, such as hours, days of the week, holidays, etc. These features can help the model identify periodicity and regularity in time.
[0129] Weather feature extraction: Convert weather data into feature vectors, including temperature, rainfall, wind speed, etc. These features can help the model identify the impact of the environment on traffic flow.
[0130] Spatial feature extraction: Convert road network structure and socioeconomic data into feature vectors, including road types, intersection density, commercial area density, etc. These features can help the model identify spatial dependencies.
[0131] 1.5 Data Normalization and Standardization
[0132] In order to improve the efficiency of model training and the accuracy of prediction, the data needs to be normalized and standardized. The main steps include:
[0133] Normalization: Scaling the data to a specific range (usually 0 to 1) to eliminate dimensional differences between different features.
[0134] Standardization: Convert the data to a distribution with mean 0 and standard deviation 1. This is very important for some algorithms, especially distance-based algorithms and deep learning models that require initialization of weights.
[0135] 2. Spatial feature extraction
[0136] In order to effectively extract spatial features in urban traffic networks, a graph convolution adaptive spatial feature extraction model (GCN-ASFE) is proposed. This model captures the spatial dependencies in traffic networks and dynamically adjusts the spatial weights between nodes through graph convolutional networks (GCN) and adaptive spatial weight assignment (ASWA) mechanism.
[0137] 2.1 Graph Construction
[0138] The city is divided into multiple regions, each of which is a node in the graph. The characteristics of the node include the road type and traffic capacity of the region. The connection between nodes represents the traffic flow relationship between regions, and the weight of the edge can be initialized based on information such as geographical distance and road connection.
[0139] 2.2 GCN Layer
[0140] Graph Convolutional Network (GCN) is used to capture spatial dependencies in road networks. The main steps of the GCN layer include:
[0141] Feature aggregation: Aggregate the features of nodes through the adjacency matrix and calculate the feature vector of each node.
[0142] Feature update: Update the feature vector of the node through a learnable weight matrix and activation function to capture the spatial relationship between nodes.
[0143] 2.3 Adaptive Spatial Weight Allocation (ASWA) Mechanism
[0144] In order to dynamically adjust the spatial weights between nodes, an adaptive spatial weight allocation mechanism is proposed. The main steps of the ASWA mechanism include:
[0145] Weight calculation: Based on the feature vector of the node, the weights between nodes are calculated through a multi-layer perceptron (MLP).
[0146] Weight normalization: The weights are normalized through the softmax function to ensure that the sum of the weights of each node is 1.
[0147] Weight adjustment: Use the updated weight matrix to replace the original adjacency matrix and recalculate the node's feature vector.
[0148] 3. Time Series Analysis
[0149] In order to capture the temporal dependencies in traffic flow data, an attention-enhanced long short-term memory network (AE-LSTM) is proposed. This model combines the long short-term memory network (LSTM) and the attention mechanism, which can effectively capture the long-term and short-term dependencies in the time series and enhance the attention to the key time steps.
[0150] 3.1 LSTM Layer
[0151] The main steps of the LSTM layer include:
[0152] Input gate: Controls the update amount of input data through the sigmoid activation function.
[0153] Forget gate: The sigmoid activation function is used to control the amount of old data forgotten.
[0154] Output gate: Controls the amount of output data through the sigmoid activation function.
[0155] Cell state update: Through the control of the input gate and the forget gate, the cell state is updated to capture the long-term dependencies in the time series.
[0156] Hidden state update: Through the control of the output gate, the hidden state is updated to capture short-term dependencies in the time series.
[0157] 3.2 Attention Mechanism Layer
[0158] In order to enhance the focus on key time steps, an attention mechanism layer is proposed. The main steps of the attention mechanism layer include:
[0159] Attention weight calculation: Based on the hidden state, the attention weight of each time step is calculated through a multi-layer perceptron (MLP).
[0160] Weight normalization: The attention weights are normalized through the softmax function to ensure that the sum of the weights is 1.
[0161] Weighted hidden state: The hidden state is weighted using the attention weights to obtain a weighted hidden state representation.
[0162] 4. External factors integration
[0163] In order to dynamically evaluate and integrate the impact of external factors on traffic flow, a Dynamic Impact Fusion Network (DIFN) is proposed. This model can effectively capture the dynamic changes of external factors and their impact on traffic flow through feature embedding, dynamic impact evaluation and fusion prediction.
[0164] 4.1 Feature Embedding Layer
[0165] The main steps of the feature embedding layer include:
[0166] Feature vectorization: Convert various external factors (such as weather and holidays) into high-dimensional feature vectors.
[0167] Embedding function: The feature vector is embedded through an embedding function (such as a multi-layer perceptron) to obtain an embedded vector.
[0168] 4.2 Dynamic Impact Assessment Layer
[0169] The main steps of the dynamic impact assessment layer include:
[0170] Weight calculation: Based on the embedding vector, a multi-layer perceptron (MLP) is used to calculate the influence weight of each external factor.
[0171] Weight normalization: The weights are normalized through the softmax function to ensure that the sum of the weights of all external factors is 1.
[0172] Dynamic adjustment: Dynamically adjust weights according to changes in external factors to reflect their real-time impact on traffic flow.
[0173] 4.3 Fusion and Prediction Layer
[0174] The main steps of the fusion and prediction layer include:
[0175] External factor fusion: Use the dynamically evaluated weights to perform weighted fusion on the embedding vectors of external factors to obtain the fused feature vector.
[0176] Internal feature fusion: The fused external factor feature vector is concatenated with the internal feature vector of the urban transportation network to form a comprehensive feature vector.
[0177] Traffic flow prediction: The comprehensive feature vector is processed through a multi-layer perceptron (MLP) to output the predicted traffic flow.
[0178] 5. Model training and evaluation
[0179] In order to verify the effectiveness and performance of the model, model training and evaluation are required. The main steps include:
[0180] 5.1 Model Training
[0181] Data partitioning: Divide the data set into training set, validation set and test set. The training set is used to train the model, the validation set is used to adjust the model parameters, and the test set is used to evaluate the model performance.
[0182] Loss function: Choose an appropriate loss function (such as mean squared error (MSE)) for model training to minimize the error between the predicted value and the true value.
[0183] Optimization algorithm: Select a suitable optimization algorithm (such as Adam, SGD) to optimize model parameters and update model weights.
[0184] 5.2 Model Evaluation
[0185] Evaluation indicators: Use indicators such as mean absolute error (MAE) and root mean square error (RMSE) to evaluate model performance.
[0186] Cross-validation: The generalization ability of the model is evaluated through the cross-validation method to ensure the stable performance of the model on different data sets.
[0187] Dynamic adaptability testing: Testing the dynamic adaptability of the model by changing external factors (such as emergencies) in the test dataset.
[0188] 6. Model deployment and application
[0189] Deploy the trained model to the actual traffic management system to provide real-time traffic flow prediction. The main steps include:
[0190] 6.1 Real-time data access
[0191] Data collection interface: Establish a real-time data collection interface to access traffic monitoring camera data, GPS data, weather data, etc.
[0192] Data preprocessing module: real-time processing of incoming data, including data cleaning, feature extraction, normalization, etc., to ensure data quality and consistency.
[0193] 6.2 Real-time prediction
[0194] Real-time prediction module: Based on real-time processed data, traffic flow prediction is performed using the trained model.
[0195] Visualization of prediction results: Display the prediction results in the form of charts, maps, etc. to facilitate decision-making by traffic management departments.
[0196] 6.3 Decision Support
[0197] Traffic control measures: Use the forecast results to formulate and adjust traffic control measures, such as optimizing traffic signal settings, adjusting traffic flow, issuing traffic warnings, etc.
[0198] Long-term planning support: Use long-term traffic flow forecast results to support the planning and optimization of urban transportation infrastructure.
[0199] Furthermore, spatial feature extraction is a crucial step in urban traffic flow prediction. Urban traffic networks are complex, and traffic flows between different regions have significant spatial dependencies. In order to accurately capture these dependencies, we propose a spatial feature extraction method that combines graph convolutional networks (GCN) and adaptive spatial weight assignment (ASWA) mechanisms, called graph convolution adaptive spatial feature extraction model (GCN-ASFE).
[0200] Graph convolutional network (GCN) is an effective deep learning method for processing graph structure data. GCN can perform convolution operations on node features through adjacency relationships in the graph structure to capture the spatial dependencies between nodes. In a traffic network, each node represents a geographical area, and the edge represents the traffic flow relationship between regions.
[0201] Given an undirected graph G = (V, E), where V is the node set and E is the edge set; the adjacency matrix A represents the connection relationship between nodes, and the node feature matrix X∈R N×D Represents the feature vector of each node, where N is the number of nodes and D is the feature dimension.
[0202] The core idea of GCN is to aggregate and update node features through the adjacency matrix. The basic formula is as follows:
[0203]
[0204] in:
[0205] H (l) is the node feature matrix of the lth layer, initially H (0) =X;
[0206] A′ is the dynamic weight w iThe calculated adaptive adjacency matrix;
[0207] D′ is the degree matrix of A′, and the diagonal elements D′ ii =∑ j A′ ij ;
[0208] W(l) is the learnable weight matrix of layer l; σ is the activation function (such as ReLU).
[0209] In addition, in order to better capture complex spatial dependencies, multiple layers of GCN can be stacked. Each layer of GCN aggregates node features to neighboring nodes and updates node features through nonlinear transformations. The number of layers of multi-layer GCN can be adjusted based on the performance of the validation set to ensure the optimal feature extraction effect.
[0210] In practical applications, the connection relationship between nodes and the weight of edges may not be static, but dynamically adjusted with time and environmental changes. The Adaptive Spatial Weight Assignment (ASWA) mechanism dynamically adjusts the weight of edges through learning to better reflect the actual mutual influence between nodes.
[0211] The core of the ASWA mechanism is to learn the dynamic weights between nodes through a multi-layer perceptron (MLP). It includes the following steps:
[0212] a) Given the feature vector h of node i and node j i and h j , calculate the weight w between them through MLP ij ;
[0213] For each pair of nodes i and j, the weight wij is calculated by the following formula:
[0214]
[0215] in, Represents the concatenation operation of the feature vector. MLP is a multi-layer perceptron used to calculate the correlation score e of the node pair. ij ;
[0216] b) Normalize the relevance scores of all adjacent nodes through the softmax function to obtain the weight wij:
[0217]
[0218] in, is the set of neighbor nodes of node i; ensure that the calculated weight w ij Satisfy the normalization condition so that it is in the range of [0,1];
[0219] c) Through dynamically calculated weight wij An adaptive adjacency matrix A′ is constructed, which can replace the fixed adjacency matrix A and dynamically reflect the real-time relationship between nodes. The elements of the adaptive adjacency matrix A′ are defined as:
[0220]
[0221] E is the edge set in the graph, which represents the connection relationship between nodes;
[0222] If there is a connection between i and j, that is, (i, j) ∈ E), then the value of the corresponding position in the adaptive adjacency matrix is w ij ; otherwise 0.
[0223] d) In the calculation process of the graph convolutional network (GCN), we use the adaptive adjacency matrix A' for feature aggregation and update; for each node feature H of layer l (l) , using the adaptive adjacency matrix for propagation, the updated node features are expressed as:
[0224]
[0225] in:
[0226] H (l) is the node feature matrix of the lth layer, initially H (0) =X;
[0227] A′ is the dynamic weight w i The calculated adaptive adjacency matrix;
[0228] D′ is the degree matrix of A′, and the diagonal elements D′ ii =∑ j A′ ij ;
[0229] W(l) is the learnable weight matrix of layer l;
[0230] σ is the activation function.
[0231] Furthermore, in order to accurately predict the temporal dependencies in urban traffic flow, we use a long short-term memory network (LSTM) combined with an attention mechanism to analyze and extract time series features. This approach can capture short-term and long-term dependencies in traffic flow data and enhance the focus on key time steps through the attention mechanism. The model consists of two parts: the LSTM layer and the attention mechanism layer.
[0232] Long Short-Term Memory (LSTM) networks are recurrent neural networks (RNNs) used to process and predict time series data, and are able to capture both long-term and short-term dependencies in the data.
[0233] LSTM formula model
[0234] 1. In step 3), given the time series input {x t} and the initial state (h0, c0), each time step of LSTM is calculated as follows:
[0235] Forget gate: controls the forgetting of the information of the previous time step
[0236] f t =σ(W f ·[h t-1 , x t ]+b f );
[0237] Input gate: controls the information input into the current time step
[0238] i t =σ(W i ·[h t-1 , x t ]+b i );
[0239] Candidate memory cells: Generate new candidate memories
[0240]
[0241] Update memory unit: Update memory unit by combining the information of forget gate and input gate
[0242]
[0243] Output gate: controls output information
[0244] o t =σ(W o ·[h t-1 , x t ]+b o );
[0245] Hidden state: Generates the hidden state of the current time step
[0246] h t =o t *tanh(c t );
[0247] Where σ is the sigmoid activation function, * denotes element-wise multiplication, and W and b are learnable weight and bias parameters.
[0248] The attention mechanism is used to calculate the importance of each time step and weight the output of the LSTM.
[0249] Formula model of attention mechanism
[0250] Calculate the attention score: for each time step hidden state h t , and its score is calculated by the attention score function
[0251] e t =υ T tanh(W h h t +b a );
[0252] Calculate attention weight: Normalize the attention score through the softmax function to get the attention weight
[0253]
[0254] Calculate the weighted hidden state: perform weighted summation on the output of LSTM to obtain the weighted hidden state
[0255]
[0256] Furthermore, in order to capture the dynamic changes of external factors on traffic flow, we use the Dynamic Impact Fusion Network (DIFN) method. DIFN is implemented through three main steps: feature embedding, dynamic impact evaluation, and fusion prediction. Specifically, it includes the following steps:
[0257] 1. Feature Embedding
[0258] The purpose of the feature embedding step is to convert various external factors into high-dimensional feature vectors for model processing; given an original input data set of external factors in The data representing the i-th external factor are converted into feature vectors;
[0259]
[0260] Among them, f embed is the feature embedding function, which can be a simple linear transformation or a multi-layer perceptron (MLP).
[0261] are the learnable parameters of the embedding function, is the embedding vector of the i-th external factor.
[0262] 2. Dynamic Impact Assessment
[0263] The purpose of the dynamic impact assessment step is to learn the impact weight of each external factor to reflect its dynamic impact on traffic flow. The mathematical formula model is as follows:
[0264] We use a multi-layer perceptron (MLP) to calculate the influence weight of each external factor. We use a multi-layer perceptron (MLP) to calculate the influence weight of each external factor; given the embedding vector set of external factors
[0265]
[0266] First calculate the relevance score for each external factor
[0267]
[0268] Among them, MLP is a multi-layer perceptron, θ mlp is its learnable parameter;
[0269] Then, the relevance scores are normalized by the softmax function to obtain the dynamic influence weight of each external factor.
[0270]
[0271] 4.3) Fusion prediction
[0272] First, the weighted external factor embedding vector e is calculated fusion ;
[0273]
[0274] Then, the weighted external factor embedding vector is combined with the internal feature vector h internalh_ Fusion; internal feature vector h interna1h_ It is generated by a time series analysis model or a spatial feature extraction model;
[0275]
[0276] in, Represents the concatenation operation of feature vectors;
[0277] Finally, a multi-layer perceptron (MLP) is used to process the combined features and output the traffic flow prediction results.
[0278] Among them, MLP predict is the multi-layer perceptron used for prediction, θ predict is its learnable parameter.
[0279] Through the above methods, by deploying a big data urban traffic flow prediction model based on geographic information, the traffic management department can achieve the following effects:
[0280] 1. Optimize traffic signal settings: According to the real-time traffic flow forecast results, dynamically adjust the timing plan of traffic signals to reduce traffic congestion and improve road traffic efficiency.
[0281] 2. Issue traffic warnings: Based on the forecast results, issue traffic warning information in advance to guide citizens to choose the best travel routes, avoid peak congestion periods, and improve travel experience.
[0282] 3. Formulate traffic control measures: Based on the forecast results, formulate and adjust traffic control measures, such as time-limited traffic restrictions, optimized bus routes, etc., to improve the scientificity and effectiveness of urban traffic management.
[0283] In order to demonstrate the effect of adaptive adjacency matrix A′ in traffic flow prediction, we designed a simulation experiment to evaluate the impact of dynamic weight adjustment in graph convolutional network (GCN) through adaptive adjacency matrix on traffic flow prediction.
[0284] 1. Experimental scene setting
[0285] Urban area: We divide a city into 10 major transportation areas, forming a transportation network containing 10 nodes.
[0286] Time span: Traffic flow data for the city is collected over a time span of one month (30 days), with sampling once every hour. A total of 720 time steps.
[0287] External factors: including weather (sunny, rainy, snowy), holidays, etc. These external factors are dynamically evaluated through the Dynamic Impact Fusion Network (DIFN).
[0288] Traffic flow data: The feature vector of each node i represents the traffic flow information of the area, including the current flow, the flow in the past hour, etc.
[0289] 2. Data Preprocessing
[0290] Standardization: The traffic flow data of each area is standardized so that the data values fall within the range of 0 to 1.
[0291] Adjacency matrix A: The initial adjacency matrix A represents the fixed spatial connectivity between each region.
[0292] Adaptive adjacency matrix A′: The dynamic weights wij are calculated according to the node features through a multi-layer perceptron (MLP) to construct an adaptive adjacency matrix.
[0293] 3. Example of simulated traffic flow data
[0294] We collected traffic data from the following 10 nodes. The traffic flow (hourly average flow, unit: vehicle number) of each node is as follows:
[0295]
[0296] 4. Adjacency Matrix Example
[0297] Initial adjacency matrix A (assuming that region 1 is directly connected to region 2, region 3, and region 4, and the connectivity between other regions is similar):
[0298]
[0299] 5. Experimental Setup
[0300] Experimental model:
[0301] Traditional GCN: Use a fixed adjacency matrix A.
[0302] Adaptive GCN: Use adaptive adjacency matrix A′ to dynamically calculate weight w ij .
[0303] Training data: Traffic flow data from the previous 28 days, used to train the model.
[0304] Test data: The data from the last 2 days, used to evaluate the prediction performance of the model.
[0305] Evaluation metrics: mean absolute error (MAE), root mean square error (RMSE).
[0306] 6. Experimental Results
[0307] Model MAE (test set) RMSE (test set) Traditional GCN 150.2 200.8 Adaptive GCN (using A′) 120.5 165.3
[0308] 7. Experimental Analysis
[0309] Traditional GCN model: uses a fixed adjacency matrix A for feature aggregation and updating, which cannot dynamically reflect changes in traffic flow relationships between nodes, resulting in certain errors in the model's predictions and limited performance.
[0310] Adaptive GCN model: through dynamically calculated weights w ij The adaptive adjacency matrix A′ is constructed to capture the dynamic traffic relationship between regions and adjust the weights between nodes in real time. This dynamic adjustment mechanism effectively improves the model's prediction accuracy of traffic flow in different time periods and significantly reduces the error.
[0311] 8. Conclusion
[0312] Experimental results show that the GCN model using the adaptive adjacency matrix A′ shows better prediction performance in traffic flow prediction, especially in dynamically changing scenarios, by adjusting the weights w between nodes. ij,The model can more accurately reflect the real-time changes of traffic flow, and improve the accuracy and robustness of the prediction.,This proves the effectiveness of the dynamic calculation weight mechanism in ,traffic flow prediction.
Claims
1. A big data urban traffic flow prediction method based on geographic information, the method includes the following steps: 1) Data collection and preprocessing Data sources include: Traffic data, geographic information data, socio-economic data, and environmental data; Preprocess the data to remove outliers and fill in missing values; Merge data from different sources into a unified framework; And extract features that are helpful for prediction from the original data, and normalize and standardize the data; 2) Spatial feature extraction This step adopts the graph convolution adaptive spatial feature extraction model (GCN-ASFE); through the graph convolution network (GCN) and adaptive spatial weight assignment (ASWA) mechanism, the spatial dependencies in the traffic network are captured and the spatial weights between nodes are dynamically adjusted. Specifically, the following steps are included: 2.1) The city is divided into multiple regions, each of which is a node in the graph. The characteristics of the node include the road type and traffic capacity of the region. The connection between nodes represents the traffic flow relationship between regions. The weight of the edge can be initialized based on the geographical distance and road connection information. 2.2) Use graph convolutional networks (GCNs) to capture spatial dependencies in road networks. First, the features of nodes are aggregated through the adjacency matrix to calculate the feature vector of each node. Then, the feature vector of the node is updated through a learnable weight matrix and activation function to capture the spatial relationship between nodes. 2.3) Adopting the adaptive spatial weight assignment (ASWA) mechanism for weight assignment; First, based on the feature vector of the node, a multi-layer perceptron (MLP) is used to calculate the weights between nodes; Then, the weights are normalized by the softmax function to ensure that the sum of the weights of each node is 1; Finally, the updated weight matrix is used to replace the original adjacency matrix and the feature vector of the node is recalculated; 3) Time Series Analysis The attention-enhanced long short-term memory network (AE-LSTM) is used to capture the temporal dependencies in traffic flow data and enhance the focus on key time steps. 3.1) LSTM layer: Input the standardized time series data and calculate the hidden state h of each time step through the LSTM layer t ; 3.2) Attention mechanism layer: the output h of the LSTM layer t Weighted, calculate the weighted hidden state h weighted ; 3.3) Prediction layer: The weighted hidden state h weighted Pass it to the fully connected layer for traffic flow prediction; 4) Integration of external factors Apply the Dynamic Impact Fusion Network (DIFN); capture the dynamic changes of external factors and their impact on traffic flow through feature embedding, dynamic impact assessment and fusion prediction; 5) Model training and evaluation Divide the data set into training set, validation set and test set; the training set is used to train the model, the validation set is used to adjust the model parameters, and the test set is used to evaluate the model performance; select a suitable loss function for model training to minimize the error between the predicted value and the true value; select a suitable optimization algorithm to optimize the model parameters and update the model weights; The model performance is evaluated using mean absolute error (MAE) or root mean square error (RMSE) indicators, and the generalization ability of the model is evaluated through cross-validation methods to ensure the stable performance of the model on different data sets; and the dynamic adaptability of the model is tested by changing external factors in the test data set; 6) Model deployment and application Deploy the trained model to the actual traffic management system to provide real-time traffic flow forecasts; display the forecast results in the form of charts and maps to facilitate decision-making by traffic management departments; use the forecast results to formulate and adjust traffic control measures; use long-term traffic flow forecast results to support the planning and optimization of urban transportation infrastructure.
2. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: In step 1), traffic data includes data from traffic monitoring cameras, traffic flow detectors, GPS vehicle data, etc.; geographic information data includes GIS data such as road network structure, intersections, bus routes, etc.; socioeconomic data includes population density, commercial area distribution, major events, etc.; environmental data includes weather conditions, seasonal changes, etc.
3. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: In step 1), outlier processing includes detecting and removing abnormal data points that do not conform to common sense, such as abnormally high or low traffic data; missing data is filled by interpolation, mean filling or machine learning-based methods; Features that are helpful for prediction include time features, weather features, and spatial features. Time features include extracting time features from timestamps, such as hours, days of the week, and whether it is a holiday. Weather feature extraction is to convert weather data into feature vectors, including temperature, rainfall, and wind speed. Spatial feature extraction is to convert road network structure and socioeconomic data into feature vectors, including road types, intersection density, and commercial area density. Normalization and standardization of data include scaling the data to the range of 0 to 1 to eliminate the dimensional differences between different features; converting the data into a distribution with a mean of 0 and a standard deviation of 1.
4. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: In step 2.2), the graph convolutional network (GCN) is as follows: Given an undirected graph G = (V, E), where V is a set of nodes and E is a set of edges; the adjacency matrix A represents the connection relationship between nodes, and the node feature matrix X∈R N×D Represents the feature vector of each node, where N is the number of nodes and D is the feature dimension; the basic formula is as follows: in: H (l) is the node feature matrix of the lth layer, initially H (0) =X; A′ is the dynamic weight w i The calculated adaptive adjacency matrix; D′ is the degree matrix of A′, and the diagonal elements D′ ii =Σ j A′ ij ; W(l) is the learnable weight matrix of layer l; σ is the activation function.
5. The method for predicting urban traffic flow based on big data of geographic information according to claim 4 is characterized in that: The core of the ASWA mechanism in step 2.3) is to learn the dynamic weights between nodes through a multi-layer perceptron (MLP); The steps include: a) Given the feature vector h of node i and node j i and h j , calculate the weight w between them through MLP ij ; For each pair of nodes i and j, the weight wij is calculated by the following formula: Among them, ⊕ represents the concatenation operation of the feature vector, and MLP is a multi-layer perceptron used to calculate the correlation score e of the node pair. ij ; b) Normalize the relevance scores of all adjacent nodes through the softmax function to obtain the weight wij: in, is the set of neighbor nodes of node i; ensure that the calculated weight w ij Satisfy the normalization condition so that it is in the range of [0,1]; c) Through dynamically calculated weight w ij An adaptive adjacency matrix A′ is constructed, which can replace the fixed adjacency matrix A and dynamically reflect the real-time relationship between nodes. The elements of the adaptive adjacency matrix A′ are defined as: E is the edge set in the graph, which represents the connection relationship between nodes; If there is a connection between i and j, that is, (i, j) ∈ E), then the value of the corresponding position in the adaptive adjacency matrix is w ij ; otherwise 0. d) In the calculation process of the graph convolutional network (GCN), we use the adaptive adjacency matrix A' for feature aggregation and update; for each node feature H of layer l (l) , using the adaptive adjacency matrix for propagation, the updated node features are expressed as: in: H (l) is the node feature matrix of the lth layer, initially H (l) =X; A′ is the dynamic weight w i The calculated adaptive adjacency matrix; D′ is the degree matrix of A′, and the diagonal elements D′ ii =∑ j A′ ij ; W(1) is the learnable weight matrix of layer l; σ is the activation function.
6. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: In step 3), given the time series input {x t } and the initial state (h0, c0), the calculation of each time step of LSTM is as follows: Forget gate: controls the forgetting of the information of the previous time step f t =σ(W f ·[h t-1 ,x t ]+b f ); Input gate: controls the information input into the current time step i t =σ(W i ·[h t-1 ,x t ]+b i ); Candidate memory cells: Generate new candidate memories Update memory unit: Update memory unit by combining the information of forget gate and input gate Output gate: controls output information the t =σ(W o ·[h t-1 ,x t ]+b o ); Hidden state: Generates the hidden state of the current time step h t =o t *tanh(c t ); Where σ is the sigmoid activation function, * denotes element-wise multiplication, and W and b are learnable weight and bias parameters.
7. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: The formula model of the attention mechanism in step 3) is as follows: Calculate the attention score: for each time step hidden state h t , and its score is calculated by the attention score function e t =υ T tanh(W h h t +b a ); Calculate attention weight: Normalize the attention score through the softmax function to get the attention weight Calculate the weighted hidden state: perform weighted summation on the output of LSTM to obtain the weighted hidden state 8. The method for predicting urban traffic flow based on big data of geographic information according to claim 1 is characterized in that: The specific steps of the dynamic impact fusion network (DIFN) in step 4) are as follows: 4.1) Feature Embedding The purpose of the feature embedding step is to convert various external factors into high-dimensional feature vectors for model processing; given an original input data set of external factors in The data representing the i-th external factor are converted into feature vectors; Where fembed is the feature embedding function, which is a simple linear transformation or a multi-layer perceptron (MLP). are the learnable parameters of the embedding function, is the embedding vector of the i-th external factor; 4.2) Dynamic Impact Assessment The purpose of the dynamic impact assessment step is to learn the impact weight of each external factor to reflect its dynamic impact on traffic flow; a multi-layer perceptron (MLP) is used to calculate the impact weight of each external factor; given the embedding vector set of external factors First calculate the relevance score for each external factor Among them, MLP is a multi-layer perceptron, θ mlp is its learnable parameter; Then, the relevance scores are normalized by the softmax function to obtain the dynamic influence weight of each external factor. 4.3) Fusion prediction First, the weighted external factor embedding vector e is calculated fusion ; Then, the weighted external factor embedding vector is combined with the internal feature vector h internalh_ Fusion; internal feature vector h internalh_ It is generated by a time series analysis model or a spatial feature extraction model; Among them, ⊕ represents the concatenation operation of feature vectors; Finally, a multi-layer perceptron (MLP) is used to process the combined features and output the traffic flow prediction results. Among them, MLPpredict is a multi-layer perceptron used for prediction, and θpredict is its learnable parameter.
9. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the method described in any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Unmanned toll station traffic flow monitoring method and system based on data fusion
CN119600823A
Interval data processing method and device, terminal equipment and storage medium
CN119694135A
Urban population flow prediction method based on multi-source data
CN120013029A
Multi-dimensional spatial-temporal feature OD path traffic prediction method and device of GCN
CN121684201A
Method and device for predicting od path flow based on multi-dimensional spatio-temporal features of gcn
CN121684201B
