Urban rail transit multi-step short-term passenger flow prediction method based on attention mechanism
Through the spatiotemporal integrated prediction model based on the attention mechanism, combined with the LSTM network and deep attention module of the Transformer mechanism, the shortcomings of the existing short-term passenger flow prediction model in time and space correlation are solved, high-precision multi-step passenger flow prediction is achieved, and accurate and reliable prediction of urban rail transit systems is supported.
Patent Information
- Application Number
- CN202211660412.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-12-23
AI Technical Summary
The existing short-term passenger flow prediction models have shortcomings in considering the temporal and spatial correlations of passenger flow, resulting in low prediction accuracy and insufficient time span, which cannot effectively meet the accurate and reliable prediction needs of urban rail transit systems.
A spatiotemporal integrated prediction model based on the attention mechanism is adopted. The LSTM network and deep attention module of the Transformer mechanism are used to combine the time series of inflow passenger flow, OD data and POI data to construct a multi-step short-term passenger flow prediction method. The temporal and spatial features are extracted through the inflow, OD and POI branches, and feature fusion is performed to improve the prediction accuracy and time span.
It has achieved the goal of broadening the prediction time span while ensuring high prediction accuracy, and can accurately predict passenger flow information for multiple time steps in the future, thereby improving the passenger flow prediction capability of the urban rail transit system and supporting pedestrian flow control in stations and train schedule optimization.
Smart Images

Figure CN116227668B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of traffic passenger flow prediction, and more specifically, to a multi-step short-term passenger flow prediction method for urban rail transit based on an attention mechanism. Background Art
[0002] Urban rail transit, with its large capacity, high punctuality, and high speed, has become a vital means of transportation in large cities. Accurate and reliable passenger flow forecasting can support pedestrian flow control within stations. For example, pedestrian flow guidance measures can effectively alleviate station congestion and reduce the probability of accidents. They can also provide a strong basis for the development and optimization of train timetables.
[0003] Traditional short-term passenger flow forecasting solutions mainly include: traditional forecasting models based on mathematical statistics, ARIMA models (autoregressive moving average models), SARIMA models (seasonal time series models), Kalman filter models (KalmanFilter), historical average models (HAModel), etc. In recent years, passenger flow forecasting models based on machine learning and deep learning have also been widely used in urban rail transit systems, such as support vector machines (SVM), dynamic Bayesian methods, wavelet analysis methods (Wavelet), and BP neural networks (Back Propagation).
[0004] Deep learning-based models can capture complex temporal and spatial correlations from large amounts of data, significantly improving network-wide prediction accuracy. However, some current deep learning models only consider the temporal correlations of passenger flows, ignoring the topological structure between subway stations. Furthermore, most prediction models only consider single-step predictions, resulting in a smaller total prediction time span when the time granularity is fine, while some detailed information is lost when the time granularity is too large.
[0005] After analysis, the existing short-term passenger flow prediction models mainly have the following problems: (1) Traditional mathematical statistics-based models have weak ability to depict the characteristics of traffic passenger flow that are full of uncertainty and complexity, and have problems such as poor real-time performance and low prediction accuracy. (2) Although machine learning-based models have improved the accuracy of short-term passenger flow prediction to a certain extent, they usually cannot take into account the spatial correlation between stations during the prediction process, and such models have limited capabilities when dealing with high-dimensional problems and complex spatiotemporal attribute data. (3) Deep learning-based models can better consider the spatiotemporal characteristics of network passenger flow and network topology, but existing deep learning models are too complex and do not significantly improve the results compared to some simple models. At the same time, the prediction values obtained by the single-step prediction they use are also limited in the time dimension, which to a certain extent will lead to a smaller total prediction time span when the time granularity is fine, or some detailed information will be lost when the time granularity is too large. Summary of the Invention
[0006] The purpose of the present invention is to overcome the above-mentioned shortcomings of the prior art and provide a method for predicting urban rail transit passenger flow in a multi-step short-term manner based on an attention mechanism. The method comprises the following steps:
[0007] Obtain passenger flow data information for the target area, including the inbound passenger flow time series matrix P(t), the inbound and outbound information matrix OD(t) based on the time step, and the passenger flow matrix POI of the points of interest. P(t) reflects the observed inbound passenger flow at each station within a set time interval, OD(t) reflects the number of inbound and outbound passengers between different stations within a set time interval, and POI reflects the location and category information of the points of interest.
[0008] The passenger flow data information is input into the trained spatiotemporal integrated prediction model to predict the short-term passenger flow information of the next k time steps. The nonlinear relationship between the input data and the predicted value of the spatiotemporal integrated prediction model is expressed as:
[0009] [Y(t+1)…Y(t+k)]=f(P(t),OD(t),POI)
[0010] Among them, the spatiotemporal comprehensive prediction model contains three branch structures, namely the Inflow branch, the OD branch and the POI branch. The Inflow branch processes the time series data of incoming passenger flow based on the multi-head attention mechanism to capture the time dimension characteristics; the OD branch is used to extract the time and space correlation carried by the entry and exit information matrix; the POI branch is used to use the passenger flow matrix of the point of interest to capture spatial features and enhance the connection between spatial features and temporal features; the outputs of the three branch structures are fused through the feature fusion layer, and then the prediction results are obtained after passing through the fully connected layer.
[0011] Compared with the existing technology, the advantage of the present invention is that it constructs a practical and effective deep learning framework, which, with the help of attention mechanism and deep attention module, fully mines the temporal and spatial correlations in different data and organically integrates them, while using multi-step prediction methods to improve prediction accuracy, and broadens the prediction time span while ensuring that the model prediction accuracy is sufficiently high.
[0012] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0014] Figure 1 is a schematic diagram of the architecture of a spatiotemporal integrated prediction model according to one embodiment of the present invention;
[0015] Figure 2 1 is a diagram of a Transformer-based LSTM network structure in an Inflow branch according to an embodiment of the present invention;
[0016] Figure 3 is an architectural diagram of a multi-head self-attention mechanism according to one embodiment of the present invention;
[0017] Figure 4 is a schematic diagram of a road traffic network according to an embodiment of the present invention;
[0018] Figure 5 Schematic diagram of an urban rail transit network according to an embodiment of the present invention
[0019] Figure 6 2 is a schematic diagram of the structure of the deep attention module in the Time-based OD branch according to one embodiment of the present invention;
[0020] Figure 7 3. This is a schematic diagram of RMSE error comparison under different numbers of time steps according to an embodiment of the present invention;
[0021] Figure 8 2. This is a schematic diagram of a comparison curve between predicted and actual passenger flow at subway station A according to an embodiment of the present invention;
[0022] Figure 9 2. This is a schematic diagram of a comparison curve between predicted and actual passenger flow at subway station B according to an embodiment of the present invention;
[0023] Figure 10 3 is a schematic diagram of a comparison curve between the predicted value and the actual value of the passenger flow at subway station C according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention.
[0025] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0026] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0027] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0028] It should be noted that like reference numerals and letters refer to like items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0029] In order to provide accurate and reliable short-term passenger flow forecasts and expand the prediction time span, this paper takes the LSTM network based on the Transformer mechanism, the deep attention module and the CNN network as the model basis, and takes time series passenger flow, time-step-based OD data and POI data as data input, and proposes a multi-step short-term passenger flow prediction model for urban rail transit network (STIPM, or simply the spatiotemporal integrated prediction model).
[0030] In the following, we first define the scientific problem to be solved in detail. We then introduce the proposed deep learning framework and further describe the attention-based LSTM network and deep attention module used in this framework.
[0031] 1. Problem Definition
[0032] The goal of this paper is to predict urban rail transit system passenger flow over several future time steps based on historical AFC (Automated Ticketing and Checking) data and POI (Point of Interest) data. The core problem is to calculate the nonlinear relationship between the two. Using AFC data with a 10-minute time granularity, we extract time-series passenger flow and OD (Origin Destination) data.
[0033] The passenger flow is taken as the attribute feature of the subway station in the urban rail transit system, and is represented as p(i, t), i.e., the in-station passenger flow observation value of station i in the tth time interval. represents all time series data in the entire time period. ij (t) represents the number of ODs from station i to station j in the tth time interval, and the OD matrix OD0(t) is represented as m×m which can be represented as At the same time, poi(i, c) represents the number of the cth POI near station i, and the POI matrix POI is represented as m×C which can be represented as
[0034] In an embodiment, three time modes are used to predict the state in the next k time steps, i.e., a real-time mode, a day mode and a week mode, which correspond to the state data before the prediction time step, the state data in the same period of the previous day and the state data in the same period of the previous week, respectively; each mode contains a plurality of time steps. Based on this, the data input used for each training is represented as P(t), OD(t) and POI.
[0035] At the tth time step, all AFC data and POI data are known, and after a certain data processing process, the in-station passenger flow time series matrix P(t), the time step-based OD matrix OD(t) and the POI matrix POI are extracted. Using the extracted data as input, the short-term passenger flow prediction from Y(t+1) to Y(t+k) for k time steps is completed, and the problem can be defined as formula (1). Wherein f is the network-level multi-step short-term passenger flow prediction model to be constructed by the present application, i.e., the nonlinear relationship between the input data and the predicted value.
[0036] [Y(t+1)…Y(t+k)]=f(P(t),OD(t),POI) (1)
[0037] II. Structure of the spatiotemporal integrated prediction model
[0038] The structure of the spatiotemporal integrated prediction model (STIPM) constructed by the present application is shown in Figure 1As shown in the figure, the model consists of three branches, namely the inflow branch, the OD branch, and the POI branch. The inflow branch processes the time series data of incoming passenger flow and captures the temporal dimension of the data. The OD branch extracts the temporal and spatial correlations carried by the time-step-based OD data. The POI branch uses POI data to support the capture of spatial features and strengthens the connection between spatial and temporal features. The features extracted by the three branches are sequentially fused through weighted features and a fully connected network layer to obtain the final model prediction results.
[0039] exist Figure 1 In
[15] , the Inflow branch includes a multi-modal stacking layer, a Transformer-based LSTM network layer, a flattening layer, and a fully connected network layer. The OD branch includes multiple deep attention modules, a flattening layer, and a fully connected network layer. The POI branch includes a POI graph stacking layer, a CNN network, a flattening layer, and a fully connected network layer.
[0040] 3. LSTM Network Based on Attention Mechanism
[0041] The LSTM neural network can effectively extract the temporal features and improve the prediction accuracy when processing the time series of passenger flow entering the station. The multi-head attention mechanism in the Transformer model can make the model better focus on the main features and improve the prediction efficiency. Therefore, the present invention constructs an LSTM network layer based on the Transformer mechanism to extract the temporal features in the data. The network structure of this branch is shown in Figure 2 shown.
[0042] In the inflow branch, the inbound passenger flow time series matrix P(t) is processed through position encoding and a Transformer-based LSTM network layer. After flattening, it is input into a fully connected layer, ultimately outputting a certain number of neurons carrying temporal features and passing them into the weight feature fusion layer. To accelerate training and improve network stability, layer normalization is incorporated into the network. To prevent gradient vanishing or gradient exploding during deep neural network training, residual connections are used at corresponding locations in the network. Furthermore, the feedforward network in the original Transformer model is replaced with an LSTM network to more deeply capture medium- and long-term dependencies and temporal correlations in the data. Finally, the data in the feature matrix is further processed using the nonlinear activation function ReLu. The following is a detailed introduction to the Transformer model.
[0043] The data in the Transformer model is not naturally ordered, and when performing parallel calculations, the impact of the order between time series data is not taken into account. Therefore, the position encoding layer can characterize the time features at different time steps and different time modes, and record their time series information. At the same time, since a single-head self-attention network is difficult to capture sufficient and accurate global spatiotemporal features in complex data, the present invention uses a multi-head attention network to achieve the corresponding effect. The network aims to parallel calculate n times based on the self-attention mechanism, splice the obtained n results, and obtain the final feature matrix through the fully connected layer. Its principle is as follows Figure 3 In each attention head, the time series vector after position encoding is passed through three learnable weight matrices W Q ,W K ,W V The query vector Q, key vector K and value vector V are mapped respectively, see formula (2)-(4), where b Q ,b K ,b V is the corresponding bias hyperparameter. After obtaining three different vectors, the self-attention mechanism is realized to complete the nonlinear affine transformation. Its function expression is as shown in formula (5), where is the scaling factor, and Softmax(·) represents the activation function.
[0044] Q=P(t)W Q +b Q (2)
[0045] K=P(t)W K +b K (3)
[0046] V=P(t)W V +b V (4)
[0047]
[0048] 4. Deep Attention Module
[0049] When obtaining spatial correlation and topological structure information in urban rail transit networks, the present invention does not use the GCN model that considers adjacency matrix and Laplace transform, but uses OD data to express the spatial characteristics of the network. In a road traffic network, vehicles travel between adjacent road sections, and adjacent road sections often have strong spatial correlation and coherence because they are connected by lanes. Figure 4As shown in the road traffic network diagram, the inflow and outflow between adjacent road sections conform to formula (6); at the same time, according to traffic flow theory, the various parameters in the road section have a fixed relationship (7), where q represents the traffic volume, ρ represents the traffic density, and v represents the traffic speed. The urban rail transit network is different from the road traffic network. The inflow and outflow of passengers at each station have little influence on each other. Therefore, compared with the spatial adjacency between stations, the passenger inflow and outflow data (OD data) is more conducive to reflecting the connection between two stations and the global spatial correlation, see Figure 5 At the same time, the aggregated OD data in units of days or weeks can only reflect the static spatial correlation between stations, while the OD data based on time steps can not only obtain dynamic spatial correlation, but also carry dynamic temporal dependence. For example, the morning and evening peaks and weekend passenger flow phenomena can be reflected in the OD data. Therefore, the OD branch selects the time-step-based OD data OD0(t) as input.
[0050]
[0051] q=ρ·v (7)
[0052] In detail, the present invention constructs a deep attention module composed of a channel attention unit and a depth separation convolution unit. Its specific structure is as follows Figure 6 As shown, assuming the input data size is (3, w, h), 3 is the number of channels, w and h represent the dimensions of the OD matrix. Among them, the channel attention unit compresses the input data into spatial dimensions through pooling operations, and pools each two-dimensional feature matrix into a real number a c , achieving the effect of global pooling, as expressed in (8); then, an excitation weighting operation is used to generate the weight corresponding to each feature channel, specifically using two fully connected layers and the Sigmoid function, as expressed in (9); after obtaining the weight vector W, the importance between different channels is modeled through corresponding linear operations, as expressed in (10). OD(t) data corresponds to different time steps in the depth dimension, and embedding an attention mechanism into it can capture the spatiotemporal information at different time steps and focus on extracting the main features of the data.
[0053] The depth-wise separation convolution unit can be well connected with the former. Its core idea is to decompose the complete convolution operation into two steps: depth-wise convolution and point-wise convolution. This unit takes the feature map embedded with channel attention obtained by the former as input, and the data size is still (3, w, h); when performing depth-wise convolution, each input channel corresponds to a filter, and the number of filters is the same as the number of channels, which is 3, and the same number of intermediate feature matrices are obtained after the convolution operation; subsequently, point-by-point convolution operation is performed, and the feature matrix of each channel corresponds to a convolution kernel of size (3, 1, 1), and the final result is obtained by weighting in the depth dimension after the convolution operation. The input data of this branch carries both temporal and spatial features, and is highly complex, while the convolutional neural network has good parallel processing capabilities and fast running speed, which is conducive to processing complex feature information. The deep attention module extracts the spatiotemporal features in each channel to a greater extent, and focuses on its main features based on the attention mechanism; at the same time, compared with the traditional convolutional network, the deep separation convolution can greatly reduce the number of parameters in the model. Figure 6 For example, if conventional convolution is used, the number of parameters required is 54, while the number of parameters required for depthwise separable convolution is 33, which is only about 60% of the number of parameters of conventional convolution.
[0054]
[0055] W=Sigmoid(FullConnected(a c )) (9)
[0056]
[0057] To further validate the effectiveness of the present invention, experiments were conducted using five consecutive weeks of subway card AFC data from a Chinese city's rail transit network. The resulting predictions were compared with those of ten baseline models and four ablation models. The test results demonstrate that the proposed model can effectively extract sufficient spatiotemporal features, thereby improving prediction accuracy and demonstrating its superiority and robustness.
[0058] The following section will introduce in detail the dataset used by the model, evaluation indicators, benchmark models, model parameter settings, and experimental results analysis.
[0059] 1) Dataset
[0060] This study uses AFC (Automatic Fare Collection) card swiping datasets from a city's rail transit system, covering two time periods: November 2, 2020, and December 6, 2020, and May 31, 2021, and July 4, 2021. Dataset 1 considers 64 rail transit stations, while Dataset 2 considers 85 rail transit stations. Each dataset contains five weeks of data, and each record includes passenger ID, entry time, entry station, exit time, and exit station. Due to random errors introduced by recording tools or during data collection, data cleaning is required based on specific criteria. These criteria primarily include "meaningless data," such as entry times significantly prior to the start of rail transit operations; "blank data," such as missing entry time or entry station data; and "erroneous data," such as entry times later than exit times. After data cleaning, the first dataset contains 17,790,319 valid data points, and the second dataset contains 18,232,887 valid data points.
[0061] For POI (Point of Interest) data, two datasets were used, one corresponding to the time period of the two AFC datasets. Each POI data mainly includes the name, code, location, and category information of the point of interest. The experiment mainly considers its first-level classification and coordinates, and ultimately obtained 23 first-level categories, including "catering services", "living services", "healthcare services", "shopping services", "science and education and cultural services", and "companies and enterprises".
[0062] 2) Model configuration
[0063] The STIPM model proposed in this invention is implemented based on the Pytorch library. Each data set contains 5 weeks of data. 80% of the data is selected as the training set to train the model, 10% of which is used as the validation set during the training process; and the remaining 20% of the data is used as the test set of the model.
[0064] In the inflow branch, the input data is passenger flow data entering the station. A Transformer-based LSTM network extracts temporal features. This branch includes three temporal patterns, each consisting of 10 time steps. The Transformer-based LSTM network has five hidden layers. After passing through the network, the data passes through two fully connected layers, outputting 512 neurons to store the data features.
[0065] In the OD branch, the input data is time-step-based OD data, and the deep attention module extracts spatiotemporal features. The number of input time steps in this branch is 30, and the format of the OD data is (30, number of sites). Two layers of deep attention modules are set up to model the spatiotemporal features of this data. In the first deep attention module, the depthwise convolution layer has 30 input channels, 30 output channels, a 3×3 convolution kernel size, a padding parameter of 1, and 30 groupings; the pointwise convolution layer has 30 input channels, 6 output channels, and a convolution kernel size of 1. In the second deep attention module, the depthwise convolution layer has 6 input channels, 6 output channels, a 3×3 convolution kernel size, a padding parameter of 1, and 6 groupings; the pointwise convolution layer has 6 input channels, 2 output channels, and a convolution kernel size of 1. After the two layers of deep attention modules, 512 neurons carrying spatiotemporal features are output.
[0066] In the POI branch, the input data is the POI data that has been extracted and stacked according to the batch size. The CNN network extracts spatial features. The CNN network has 1 input channel, 2 output channels, a 3×3 convolution kernel size, and a padding parameter of 1. A max pooling layer of size (2, 2) is added after the CNN network. The result is passed through a fully connected layer and outputs 512 neurons with spatial features.
[0067] The neurons obtained from the three branches complete feature fusion in the feature fusion layer, where the weights are set as learnable parameters. The fused features are passed through the fully connected layer and the dimension is changed to obtain the final prediction result. In order to balance the learning speed and prediction accuracy, after multiple experiments, the batch size of 32, the learning rate of 0.0005, and the optimizer of Adam were selected. To reduce the impact of random initialization parameters, the model was repeatedly trained several times. During the training process, the mean square error (MSE) was selected as the loss function and saved, see formula (11); at the same time, the Model Checkpoint technology was added to save the optimized model during the training process, and the Early Stopping technology was added to terminate the training task in time to avoid overfitting.
[0068]
[0069] 3) Evaluation criteria
[0070] The root mean square error (RMSE), mean absolute error (MAE) and weighted mean absolute percentage error (WMAPE) are selected as the prediction effect evaluation indicators. The calculation formulas of each indicator are as shown in (12)-(14). i represents the true value, represents the predicted value, and n represents the number of samples.
[0071]
[0072]
[0073]
[0074] 4) Model comparison
[0075] The proposed STIPM model is compared with the following benchmark models to demonstrate the effectiveness of the model.
[0076] SVR (Support Vector Regression): The support vector regression model has been used in traffic forecasting for a long time. Use the kernel 'rbf', set the parameter epsilon to 0.005, and the regularization parameter C to 3.
[0077] CNN (Convolutional Neural Network): Set the convolution kernel size to 2×2, set 3 layers of fully connected layers, and use the ReLU function to activate the first two layers.
[0078] GCN (Graph Convolutional Network): A graph convolutional neural network can be seen as an extension of a convolutional neural network on a topological graph G = (V, E, A). Its convolutional layer has a kernel size of 3×3, and there are three fully connected layers. The first two layers use the ReLU activation function.
[0079] LSTM (Long Short-Term Memory): This model has one LSTM layer with 4 hidden layers and 3 fully connected layers. The first two layers are activated by ReLU function.
[0080] Conv-LSTM (Convolutional LSTM Network): In the Conv-LSTM layer, convolution operations are used to replace the feedforward calculations of the traditional LSTM network. The number of Conv-LSTM hidden layers is 3; the number of fully connected layers is 3, and the first two layers use the ReLU function for activation.
[0081] ST-ResNet (Spatial Temporal Residual Network): This model has two convolutional layers with a convolution kernel size of 3×3. The output of the ST-ResNet layer is obtained after mapping through the tanh activation function; the final prediction value is obtained through three fully connected layers, and only the first layer uses the ReLU function for activation.
[0082] T-GC: The temporal graph convolution model is an extension of the traditional GCN model. The convolution kernel size in the GCN layer of the model is set to 3×3, and the number of layers is 1; the GRU also has only one layer, of which the number of hidden layers is 4; there are 3 fully connected layers in the model, and the first two layers are activated by the ReLU function.
[0083] ST-GCN (Spatiotemporal Graph Convolutional Model): This model uses two time-gated convolutions and one intermediate graph convolution structure; finally, it passes through three layers of fully connected layers to obtain the required prediction value, and the first two layers use ReLU function for activation.
[0084] DCRNN: This model uses two RNN layers with 64 hidden neurons and two fully connected layers. The first layer uses the ReLU function for activation.
[0085] Graph WaveNet: The CNN layer in this model has a convolution kernel size of 2×2, 32 residual channels, and 3 dilated channels.
[0086] 5) Result analysis
[0087] (1) Network-wide prediction performance
[0088] The prediction performance of the STIPM model and all baseline models is shown in Tables 1 and 2. As shown in the tables, deep learning-based prediction models (such as the ConvLSTM model) generally outperform traditional machine learning models (such as the SVR model). Overall, the SVR model achieved the worst prediction performance, but its performance was not significantly worse than the other models when performing single-step predictions. This may be because the SVR model only performs "direct multi-step predictions" when performing multi-step predictions. Therefore, while it has high prediction performance for the first time step, it exhibits higher errors for the second and third time steps due to the discontinuity between the input and output time series. Among all deep learning models, models using LSTM neural networks, such as the LSTM and ConvLSTM models, achieve relatively good prediction results. This result demonstrates the superiority of LSTM networks in processing medium- and long-term time series data. CNN models, however, lack sufficient spatial and temporal features directly captured through convolution operations, resulting in poor prediction performance. While the ST-ResNet and DCRNN models are strong at capturing spatial correlations, they are relatively weak at capturing temporal dependencies, and thus perform poorly in prediction. The GCN, T-GCN, ST-GCN, and GWN models use graph convolutional networks as their underlying logic. As mentioned above, these models are more suitable for road traffic and therefore lack significant performance in predicting urban rail transit networks, which have different network structures.
[0089] The proposed STIPM model also achieves higher accuracy across all evaluation metrics and at any prediction time step. This is because it considers multiple factors, including the time series of incoming passenger flow, the subway network topology, and points of interest around the station, and uses an appropriate neural network model to extract sufficient temporal and spatial features. Furthermore, the model consistently demonstrates the highest prediction accuracy across different datasets, demonstrating its robustness across diverse datasets and further demonstrating the superiority and feasibility of the proposed prediction model.
[0090] Table 1: Prediction accuracy of each model
[0091]
[0092]
[0093] Table 2: Prediction accuracy of each model
[0094]
[0095] As can be seen from Tables 1 and 2, the proposed STIPM model achieves higher prediction accuracy across all evaluation metrics and at any prediction time step. This is because it considers multiple factors, including the time series of incoming passenger flow, the subway network topology, and points of interest around the station, and uses an appropriate neural network model to extract sufficient temporal and spatial features. Furthermore, the model exhibits the highest prediction accuracy across different datasets, demonstrating its robustness across diverse datasets and further demonstrating the superiority and feasibility of the proposed prediction model. A comparison of prediction results across different time steps reveals that the prediction accuracy of all models decreases with increasing number of prediction time steps. This phenomenon is consistent with reality, as increasing the number of prediction time steps increases the total prediction time, the number of predicted values, and the difficulty of prediction. However, the proposed STIPM model exhibits a relatively small error change, demonstrating the applicability of multi-step prediction within the proposed model structure. A comparison of the prediction performance of the models across different station types shows that the STIPM model not only achieves excellent prediction results across the entire urban rail transit network, but also achieves good prediction results at each station.
[0096] (2) Analysis of prediction effects based on different numbers of prediction time steps
[0097] All prediction models, except the SVR model, which uses a "direct multi-step prediction" approach, employ a "neural network multi-output" strategy. When the number of prediction time steps reaches three, the prediction time increases to 30 minutes. Compared to simply performing medium- and long-term predictions at 30-minute intervals, multi-step short-term predictions further divide the prediction timeframe, yielding more detailed and complete forecast information. This provides more reliable and effective support for rail transit operations and decision-making.
[0098] In order to explore the effect of multi-step prediction and the relationship between the number of prediction time steps and prediction accuracy, the RMSE indicator in the first dataset is taken as an example. The accuracy comparison of each prediction model at different time steps is shown in Figure 7 As shown in the figure, overall, the prediction accuracy of each model decreases as the number of prediction time steps increases. This phenomenon is consistent with reality, as the total prediction time gradually increases with the increase in the prediction time step, the number of predicted values gradually increases, and the prediction difficulty also increases. However, the error changes are all within an acceptable range, indicating that the combination of multi-step prediction and short-term passenger flow prediction has a certain feasibility. At the same time, the error change of the STIPM model is relatively small, indicating the applicability of multi-step prediction in the proposed model structure.
[0099] (3) Comparison of model prediction performance at a single station
[0100] In order to verify the specific prediction effect of the model at the level of a single station, three typical subway stations were selected. The comparison between the predicted passenger flow and the actual passenger flow of these three stations at different prediction time steps is shown in Figures 8-10 As shown in the figure, there are passenger flow prediction value-actual value comparison curves for subway station A, subway station B and subway station C respectively. The prediction results include data for about 5 days from Wednesday to the weekend.
[0101] The first subway station, A, is a commuter-type station. Based on satellite maps and POI data, the area surrounding this station is primarily populated by medium- to large-sized residential communities, supplemented by a small number of commercial office areas. Therefore, there are significant morning and evening rush hour arrivals on weekdays, but not on non-weekdays. Figure 8 As shown, the station's passenger flow exhibits strong regularity. At all prediction time steps, the predicted value curves roughly coincide with the true values, regardless of whether they are weekdays or weekends, demonstrating good prediction results. Peak arrival times occur twice daily on weekdays: the morning peak is approximately 350 passengers per 10 minutes, and the evening peak is approximately 250 passengers per 10 minutes. This characteristic is less pronounced on weekends.
[0102] The second subway station, B, is an office station. Satellite maps and POI data show that the station is located in the political, cultural, and economic center of Nanning City. The surrounding area is mainly commercial office areas and a small number of residential and educational areas. Therefore, it has a significant evening peak period and a large difference in passenger flow between weekends and weekdays. Figure 9 As shown, it exhibits strong regularity, and the predicted value curve roughly coincides with the true value at any number of prediction time steps, especially during peak periods. During weekdays, there is an evening peak in passenger flow. Although morning and afternoon peaks are also present, the peaks are relatively low, reaching as high as 400 passengers per 10 minutes. Weekends only have one significant peak period, with a peak of approximately 200 passengers per 10 minutes.
[0103] The third subway station C is a large intercity and urban transportation hub, where railways, urban rail transit, and ground public transportation converge. Figure 10 As shown in the figure, unlike the previous two subway stations, the passenger flow at this station does not show strong regularity and fluctuates significantly and violently over time. However, the proposed STIPM model can still capture the general trend of passenger flow and respond promptly, demonstrating its strong robustness and adaptability.
[0104] In summary, the STIPM model proposed in this paper has achieved good prediction results in real data applications under different scenarios, reflecting the effectiveness and practical application value of the model, which is sufficient to meet the needs of multi-step prediction of short-term passenger flow at the urban rail transit network level.
[0105] (4) Ablation experiment
[0106] In order to further verify the effectiveness and superiority of each deep learning module in the proposed STIPM model, a series of ablation experiments were established based on the STIPM model. A comparison model was established by changing the model structure, modifying the model parameters, and changing the input data, as described below. The final prediction results of the first dataset were analyzed as shown in Table 3.
[0107] STIPM-No OD: The OD branch is removed based on the proposed model, and the rest of the configuration remains basically unchanged.
[0108] STIPM-No POI: The POI branch is removed based on the proposed model, and the rest of the configuration remains basically unchanged.
[0109] STIPM-LSTM: In the Inflow branch of the proposed model, the basic LSTM network is used to replace the original LSTM network based on the Transformer mechanism to complete the extraction of temporal features.
[0110] STIPM-Accumulated OD: In the OD branch of the proposed model, the data input uses the accumulated OD data of the entire period.
[0111] Table 3: Prediction accuracy of ablation experiments
[0112]
[0113] Analysis of the prediction results for the STIPM-No OD model reveals a significant decrease in the model's prediction accuracy, demonstrating the positive impact of the OD branch within the STIPM model and the effective extraction of the temporal and spatial correlations contained in the OD data. Furthermore, in the STIPM-No POI model, the removal of the POI branch also resulted in a decrease in prediction accuracy, demonstrating that it provides a certain amount of spatiotemporal features within the overall model, or serves as a link between temporal and spatial features. The greater decrease in the STIPM-No OD model suggests that the OD branch carries more spatiotemporal features and plays a more significant role in the prediction process than the POI branch.
[0114] Analysis of the prediction results based on STIPM-LSTM shows that the prediction accuracy of the model has decreased slightly, indicating that the Transformer-based LSTM network, compared with its traditional LSTM network, enables the model to better focus on the main features during the feature extraction process of this type of data, thereby improving the prediction accuracy.
[0115] Analysis of the prediction results based on STIPM-Accumulated OD shows that the model's prediction accuracy also decreases. The decrease is relatively small when the number of prediction time steps is 1, but it is more significant when the number of prediction time steps is 2 or 3. Therefore, the model effectively extracts the numerous temporal and spatial features contained in the time-step-based OD data, significantly improving the model's prediction performance, especially when performing multi-step predictions.
[0116] At the same time, compared with Table 1, it can be seen that even though the prediction accuracy of the STIPM ablation experimental model has decreased, it is still higher than most of the benchmark models used in the experiment, indicating the robustness of STIPM at the model structure level.
[0117] In summary, compared with the prior art, the present invention has the following technical effects:
[0118] 1) The present invention is dedicated to high-precision passenger flow prediction under normal subway network conditions, and is not limited to passenger flow prediction under special circumstances (during holidays), nor is it limited to traffic volume prediction between different areas / stations in a certain period of time.
[0119] 2) This invention uses time-step-based OD data to provide temporal correlation while mining network spatial features and employs a multi-step prediction approach. Furthermore, in constructing the deep model, the invention analyzes the specific problem to be solved and the input data, and experimentally adjusts the internal structure and parameters of the neural network to obtain the final optimized model.
[0120] 3) The model framework proposed in this invention not only improves the model prediction accuracy, but also uses a multi-step prediction method to expand the short-term passenger flow prediction to the medium- and long-term prediction time span, which has important guiding significance for engineering practice.
[0121] 4) The proposed multi-step short-term urban rail transit passenger flow prediction model based on an attention mechanism and deep learning module is original and novel in its structure and data input. Compared with the commonly used adjacency matrix based on the GCN model, the time-step-based OD data can better reflect the closeness of connections between stations and the global information of the network, and also carries a certain degree of temporal correlation.
[0122] 5) This paper uses a Transformer-based LSTM network and a deep attention module consisting of a channel attention unit and a deep separable convolutional unit to efficiently mine the temporal and spatial dependencies in urban rail transit networks. It also exhibits high prediction accuracy and strong structural robustness.
[0123] 6) The present invention adopts a multi-step prediction method of "multi-input and multi-output", which can obtain the prediction values of multiple time steps at one time, complete the passenger flow time series prediction at a fine-grained level, expand the short-term passenger flow prediction to the time span of medium- and long-term prediction, and obtain more detailed prediction information at the same time.
[0124] In summary, by analyzing the strengths and weaknesses of existing models, this paper proposes a deep learning framework based on an attention mechanism and a deep attention module. This framework effectively extracts temporal and spatial correlations from diverse data and performs network-level short-term urban rail transit passenger flow forecasting, thereby improving the model's prediction accuracy. Furthermore, it utilizes multi-step prediction, which involves predicting multiple time steps into the future to achieve the final prediction goal. This framework also broadens the prediction time span while ensuring sufficiently high model prediction accuracy. For example, when predicting passenger flow 30 minutes in the future, a multi-step prediction can use a 10-minute time granularity and obtain prediction values for three time steps simultaneously. Compared to a single-step prediction using a 30-minute time granularity, multi-step prediction is more significant in practical applications. For transportation network managers and operators, multi-step prediction information helps develop more effective traffic management and control strategies, alleviate station congestion, reduce the probability of accidents, and improve resource allocation efficiency. For passengers, it can help them more effectively choose travel routes and transportation methods.
[0125] The present invention may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present invention.
[0126] Computer-readable storage medium can be a tangible device that can keep and store the instructions used by the instruction execution device.Computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device or any suitable combination thereof.More specific examples (non-exhaustive list) of computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove having instructions stored thereon, and any suitable combination thereof.Computer-readable storage medium used herein is not interpreted as a transient signal itself, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagated by waveguides or other transmission media (for example, light pulses by fiber optic cables), or electrical signals transmitted by wires.
[0127] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0128] The computer program instructions for performing the operation of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, Python, and conventional procedural programming languages such as "C" language or similar programming languages. The computer readable program instructions can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), is personalized by utilizing the state information of the computer readable program instructions, and the electronic circuit can execute the computer readable program instructions, thereby realizing various aspects of the present invention.
[0129] Various aspects of the present invention are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0130] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0131] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0132] The flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment or part of an instruction, and the module, program segment or part of the instruction contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, implementation by software, and implementation by a combination of software and hardware are all equivalent.
[0133] While various embodiments of the present invention have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the present invention is defined by the appended claims.
Claims
1. A multi-step short-term passenger flow prediction method for urban rail transit based on an attention mechanism, comprising the following steps: Obtain passenger flow data information for the target area, including the inbound passenger flow time series matrix P(t), the inbound and outbound information matrix OD(t) based on the time step, and the passenger flow matrix POI of the points of interest. P(t) reflects the observed inbound passenger flow at each station within a set time interval, OD(t) reflects the number of inbound and outbound passengers between different stations within a set time interval, and POI reflects the location and category information of the points of interest. The passenger flow data information is input into the trained spatiotemporal integrated prediction model to predict the short-term passenger flow information of the next k time steps. The nonlinear relationship between the input data and the predicted value of the spatiotemporal integrated prediction model is expressed as: [Y(t+1)…Y(t+k)]=f(P(t),OD(t),POI) The spatiotemporal integrated prediction model consists of three branches: the inflow branch, the OD branch, and the POI branch. The inflow branch processes the time series data of incoming passenger flow based on a multi-head attention mechanism to capture temporal dimension features. The OD branch is used to extract the temporal and spatial correlations carried by the inbound and outbound information matrix. The POI branch is used to capture spatial features using the passenger flow matrix of points of interest and enhance the connection between spatial and temporal features. The outputs of the three branches are fused through a feature fusion layer, and then passed through a fully connected layer to obtain the prediction results. For the Inflow branch, the inbound passenger flow time series matrix P(t) is processed through position encoding and the Transformer-based LSTM network layer, and then passes through the flattening layer and into the fully connected layer. The fully connected layer outputs a set number of neurons carrying time features and passes them to the feature fusion layer. The Transformer-based LSTM network layer includes a position encoding layer, a multi-head attention layer, a first addition and normalization layer, an LSTM network, and a second addition and normalization layer, wherein a residual connection is provided between the output of the position encoding layer and the output of the first addition and normalization layer, and a residual connection is provided between the output of the first addition and normalization layer and the output of the second addition and normalization layer; The OD branch includes multiple deep attention modules, flattening layers, and fully connected network layers. The deep attention modules perform the following steps: The channel attention unit compresses the input data into spatial dimensions through pooling operations, pooling each two-dimensional feature matrix into a real number a c , expressed as: The excitation weighted operation is used to generate the weight corresponding to each feature channel, which is expressed as: W=Sigmoid(FullConnected(a c )) The importance degree between different channels is modeled through corresponding linear operations and expressed as: Where w and h represent the dimensions of the OD matrix, OD0(t) represents the OD matrix at time step t, and OD0(t) c (i,j) represents the element corresponding to the i-th row and j-th column of the OD0(t) matrix; The POI branch structure includes a POI graph stacking layer, a CNN network, a flattening layer and a fully connected network layer.
2. The method according to claim 1, characterized in that The multi-head attention layer performs the following process: In each attention head, the position-encoded time series vector is passed through three learnable weight matrices W Q ,W K ,W V The query vector Q, key vector K and value vector V are mapped respectively, expressed as: Q=P(t)W Q +b Q K=P(t)W K +b K V=P(t)W V +b V Perform a nonlinear affine transformation, expressed as: Among them, b Q ,b K ,b V is the corresponding bias hyperparameter, is the scaling factor, and Softmax(·) represents the activation function.
3. The method according to claim 1, characterized in that The deep attention modules are set to two. In the first deep attention module, the number of input channels of the depth-wise convolution layer is 30, the number of output channels is 30, the convolution kernel size is 3×3, the number of input channels of the point-by-point convolution layer is 30, the number of output channels is 6, and the convolution kernel size is 1; in the second deep attention module, the number of input channels of the depth-wise convolution layer is 6, the number of output channels is 6, the convolution kernel size is 3×3, the number of input channels of the point-by-point convolution layer is 6, the number of output channels is 2, and the convolution kernel size is 1.
4. A computer-readable storage medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
5. A computer device comprising a memory and a processor, wherein a computer program capable of being executed on the processor is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Method for training time series prediction model and time series prediction method and device
CN111612215A
Urban OD (Origin-Destination) people flow prediction method based on gravity multi-layer three-dimensional residual network
CN114139836A