Passenger flow prediction method, device and equipment and storage medium
By combining DNN and PatchTST models and using a fusion prediction method based on passenger flow, weather data, and holiday data, the problem of insufficient accuracy in passenger flow prediction in existing technologies has been solved, achieving more efficient and accurate passenger flow prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2024-11-20
- Publication Date
- 2026-05-29
AI Technical Summary
Existing passenger flow forecasting methods cannot effectively capture the complex patterns and long-term dependencies in passenger flow data, resulting in insufficient forecast accuracy.
A prediction method combining DNN and PatchTST models is used to train a target parameter matrix by acquiring passenger flow, weather data, and holiday data for a preset area. This method integrates features from different types of data to improve prediction accuracy.
It improves the accuracy and comprehensiveness of passenger flow forecasting, enabling it to better capture the patterns of passenger flow changes and enhance forecasting efficiency and accuracy.
Smart Images

Figure CN122114236A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and more particularly to a method, apparatus, device, and storage medium for predicting passenger flow. Background Technology
[0002] With the rapid development of the tourism industry, the number of visitors to scenic spots has increased significantly, making accurate prediction of visitor flow at various locations within the scenic area increasingly important. Predicting visitor flow at different locations within a scenic area allows for better management and optimization of visitor traffic, helping scenic spots better cope with peak periods and enhancing the visitor experience.
[0003] Existing technologies mainly use simple time series models to analyze historical passenger flow data to predict future passenger flow, and employ self-supervised learning methods to train the prediction model.
[0004] However, existing forecasting methods often fail to effectively capture the complex patterns and long-term dependencies in passenger flow data, resulting in insufficient forecast accuracy. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for predicting passenger flow, in order to solve the problem of insufficient accuracy in passenger flow prediction.
[0006] Firstly, this application provides a method for predicting passenger flow, comprising:
[0007] Obtain first data from a preset area, the first data including: first passenger flow data of the previous time period of the time period to be predicted in the preset area, first weather data and first holiday data corresponding to the time period to be predicted;
[0008] The first data is input into a pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
[0009] In one or more embodiments, the method further includes:
[0010] The PatchTST model is trained based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model.
[0011] The DNN model is trained based on the second weather data and second holiday data corresponding to the previous time period of the historical time period to obtain the second parameter matrix corresponding to the DNN model.
[0012] The target parameter matrix in the prediction model is determined based on the first parameter matrix and the second parameter matrix.
[0013] In one or more embodiments, determining the target parameter matrix in the prediction model based on the first parameter matrix and the second parameter matrix includes:
[0014] According to the preset weight coefficients, the weights of the first parameter matrix and the second parameter matrix are set to obtain the weighted parameter matrix;
[0015] The weighted parameter matrix is used as the target parameter matrix in the prediction model;
[0016] The prediction model includes the PatchTST model and the DNN model.
[0017] In one or more embodiments, training the DNN model based on the second weather data and second holiday data corresponding to the previous time period of the historical time period to obtain the second parameter matrix corresponding to the DNN model includes:
[0018] Feature extraction is performed on the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean value corresponding to the second holiday data. The Boolean value is used to replace holidays and weekends in the second holiday data.
[0019] The DNN model is trained based on the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday day data to obtain the second parameter matrix corresponding to the DNN model.
[0020] In one or more embodiments, the preset area includes: at least one monitoring point under a closed road section;
[0021] The second passenger flow data includes: the passenger flow corresponding to the monitoring points under the at least one closed road section.
[0022] In one or more embodiments, the prediction model includes: channels corresponding to different monitoring points under the PatchTST model;
[0023] Accordingly, the step of training the PatchTST model based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model includes:
[0024] Based on the passenger flow corresponding to the monitoring points under different closed road sections, the PatchTST model is trained by inputting the corresponding channels of different monitoring points to obtain the sub-parameter matrix of different channels under the PatchTST model.
[0025] The first parameter matrix includes sub-parameter matrices corresponding to different channels.
[0026] Secondly, this application provides a passenger flow prediction device, comprising:
[0027] The acquisition module is used to acquire first data in a preset area. The first data includes: first passenger flow data of the previous time period of the time period to be predicted in the preset area, first weather data and first holiday data corresponding to the time period to be predicted;
[0028] The processing module is used to input the first data into a pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
[0029] In one or more embodiments, the processing module is further configured to:
[0030] The PatchTST model is trained based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model.
[0031] The DNN model is trained based on the second weather data and second holiday data corresponding to the previous time period of the historical time period to obtain the second parameter matrix corresponding to the DNN model.
[0032] The target parameter matrix in the prediction model is determined based on the first parameter matrix and the second parameter matrix.
[0033] In one or more embodiments, the processing module determines the target parameter matrix in the prediction model based on the first parameter matrix and the second parameter matrix, specifically for:
[0034] According to the preset weight coefficients, the weights of the first parameter matrix and the second parameter matrix are set to obtain the weighted parameter matrix;
[0035] The weighted parameter matrix is used as the target parameter matrix in the prediction model;
[0036] The prediction model includes the PatchTST model and the DNN model.
[0037] In one or more embodiments, the processing module trains the DNN model based on the second weather data and second holiday data corresponding to the previous time period of the historical time period to obtain a second parameter matrix corresponding to the DNN model, specifically for:
[0038] Feature extraction is performed on the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean value corresponding to the second holiday data. The Boolean value is used to replace holidays and weekends in the second holiday data.
[0039] The DNN model is trained based on the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday day data to obtain the second parameter matrix corresponding to the DNN model.
[0040] In one possible implementation, the preset area includes: at least one monitoring point under a closed road section;
[0041] The second passenger flow data includes: the passenger flow corresponding to the monitoring points under the at least one closed road section.
[0042] In one or more embodiments, the prediction model includes: channels corresponding to different monitoring points under the PatchTST model;
[0043] Accordingly, the processing module trains the PatchTST model based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model, specifically for:
[0044] Based on the passenger flow corresponding to the monitoring points under different closed road sections, the PatchTST model is trained by inputting the corresponding channels of different monitoring points to obtain the sub-parameter matrix of different channels under the PatchTST model.
[0045] The first parameter matrix includes sub-parameter matrices corresponding to different channels.
[0046] Thirdly, this application provides an electronic device, comprising:
[0047] Processor; memory communicatively connected to the processor;
[0048] The memory stores computer-executed instructions;
[0049] The processor executes computer execution instructions stored in the memory to implement the method described in the first aspect and any of the embodiments above.
[0050] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the first aspect and any of the embodiments above.
[0051] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, is used to implement the passenger flow prediction method as described in the first aspect and various possible implementations of the first aspect.
[0052] The method, apparatus, device, and storage medium for predicting passenger flow provided in this application first acquire first data in a preset area. This first data includes: first passenger flow data of the previous time period in the preset area, first weather data corresponding to the time period to be predicted, and first holiday data. Then, the first data is input into a pre-trained prediction model to obtain target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training a DNN model and a PatchTST model based on second data from the preset area. The second data includes: second passenger flow data of historical time periods in the preset area, second weather data corresponding to the previous historical time period, and second holiday data. In the above method, by acquiring the first passenger flow data of the previous time period in the preset area, the first weather data corresponding to the time period to be predicted, and the first holiday data, different types of data affecting the passenger flow prediction results are fused. Furthermore, based on the second data from the preset area, the DNN model and the PatchTST model are trained to obtain the target parameter matrix in the prediction model, thereby obtaining the pre-trained prediction model. By pre-training the prediction model, passenger flow prediction is achieved, improving the accuracy of passenger flow prediction. Finally, the first data was input into the pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted, thus completing the prediction of passenger flow. Attached Figure Description
[0053] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0054] Figure 1 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 1 ;
[0055] Figure 2 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 2 ;
[0056] Figure 3 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 3 ;
[0057] Figure 4 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 4 ;
[0058] Figure 5 A schematic diagram of the structure of the passenger flow prediction device provided in the embodiments of this application;
[0059] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0060] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0061] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0062] First, let me explain the terms used in this application:
[0063] PatchTST model: refers to a Transformer-based time series forecasting model that can divide time series into small patches and uses independent channels and a self-supervised processing method;
[0064] Deep Neural Network (DNN) model: refers to a computational model that simulates the structure and function of the human brain's neural network. The basic unit is the neuron. Each neuron receives input from other neurons and changes the influence of the input on the neuron by adjusting the weights.
[0065] With the rapid development of the tourism industry, tourist traffic at scenic spots is showing a rapid growth trend, especially during holidays and peak tourist seasons, when fluctuations in visitor flow become more drastic. Therefore, visitor flow management and forecasting within scenic areas has become a crucial task in their operation. Accurately predicting visitor flow at various locations not only helps scenic spots to manage resources in advance and improve the visitor experience, but also effectively addresses safety issues and management pressures caused by dense crowds during peak periods.
[0066] Currently, many scenic area management methods still rely on traditional forecasting methods, primarily using time series models to analyze historical visitor flow data and predict future visitor flow based on this data. Self-supervised learning methods are then used to train the forecasting model. Existing methods typically use models that identify certain trends and periodic changes through the analysis of past data, and then use this as a basis for predicting future visitor flow.
[0067] However, existing prediction methods are significantly inadequate in capturing complex nonlinear relationships and long-term dependencies, resulting in predictions that often fail to meet practical requirements in terms of accuracy.
[0068] The passenger flow prediction method provided in this application aims to solve the aforementioned technical problems of the prior art. The inventive concept of this application is as follows: Target passenger flow data for a predicted time period may be affected by multiple types of data, and the degree of influence of different data types on the target passenger flow data for the predicted time period varies. Therefore, first data from a preset area is obtained, including: first passenger flow data from the previous time period in the preset area, first weather data corresponding to the predicted time period, and first holiday data. Predicting the target passenger flow data for the predicted time period based on multiple types of data can improve the comprehensiveness and accuracy of the prediction results. Subsequently, based on second data from the preset area, a DNN model and a PatchTST model are trained. The parameter matrices of the two models are fused to obtain the target parameter matrix in the prediction model, further obtaining the passenger flow prediction model. This model combines the advantages of the DNN model and the PatchTST model, capturing different data features affecting passenger flow changes while processing different data features in the first data according to the two models, thus improving the accuracy of passenger flow prediction. Finally, the first data is input into the pre-trained prediction model to obtain the target passenger flow data for the predicted time period, completing the prediction of passenger flow for the predicted time period and improving prediction efficiency.
[0069] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0070] Figure 1 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 1 .like Figure 1 As shown, the method for predicting passenger flow includes the following steps:
[0071] S110, Obtain the first data in the preset area;
[0072] The first data includes: the first passenger flow data of the previous time period in the preset area, the first weather data and the first holiday data corresponding to the time period to be predicted.
[0073] In this step, the preset area is first determined, and the time period to be predicted is determined. The previous time period is found based on the time period to be predicted, and the first passenger flow data of the previous time period in the preset area is obtained. In addition, the first weather data and the first holiday data corresponding to the time period to be predicted are obtained based on the time period to be predicted.
[0074] The preset area refers to the area that is pre-defined and where the first passenger flow data can be obtained.
[0075] In one possible implementation, the aforementioned time period to be predicted can be a day, a week, or a month; the first passenger flow data can be the specific number of passengers; the first weather data can be temperature, humidity, ultraviolet intensity, etc.; and the first holiday data can be holidays, weekends, etc.
[0076] In one possible implementation, the first passenger flow data of the previous time period in the preset area to be predicted can be obtained through historical passenger flow data records, the first weather data corresponding to the time period to be predicted can be obtained based on the predicted weather data of the public weather information platform, and the first holiday data corresponding to the time period to be predicted can be obtained through calendar query.
[0077] For example, a scenic area may have a pre-defined area for acquiring first data. If it is necessary to predict the visitor flow data for the next day, the first data can be acquired through the equipment set up in the pre-defined area. This could be based on monitoring to obtain the first visitor flow data for the first day in the pre-defined area, i.e., the specific number of visitors, and then obtaining the predicted weather data for the next day, such as temperature and humidity data, from a public weather information platform. Finally, the system can be checked through a calendar to see if the next day is a holiday or weekend.
[0078] S120. Input the first data into the pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted;
[0079] The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
[0080] In this step, the prediction model includes a DNN model and a PatchTST model. After determining the time period to be predicted, the first data obtained in the preset area in the above steps is input into the pre-trained prediction model. The PatchTST model is used to process the first passenger flow data of the previous time period in the first data to obtain the time series features of the passenger flow data. The DNN model is used to process the first weather data and the first holiday data corresponding to the time period to be predicted in the first data to obtain the weather and holiday features. Then, the features of the first data obtained after processing are combined with the target parameter matrix of the prediction model to predict the passenger flow data. The prediction model outputs the target passenger flow data for the time period to be predicted.
[0081] The target parameter matrix refers to the matrix or tensor structure used in the prediction model to describe the internal parameters of the prediction model.
[0082] In one possible implementation, the second passenger flow data for a historical time period in a preset area, the second weather data corresponding to the previous time period in the historical period, and the second holiday data are first obtained, i.e., the second data. Then, based on the second data of the preset area, the DNN model and the PatchTST model are trained to obtain the target parameter matrix in the prediction model. After that, the pre-trained prediction model is obtained according to the target parameter matrix. Finally, the first data is input into the pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted.
[0083] In one possible implementation, the first visitor flow data of the previous time period in the preset area can be obtained by obtaining the historical visitor flow data records. The first weather data corresponding to the historical time period, such as temperature and humidity data, can be obtained based on the historical weather data of the public weather information platform or based on the temperature and humidity sensor equipment set up in the scenic area.
[0084] In one possible implementation, the pre-trained prediction model can be obtained by combining a DNN model and a PatchTST model. The second data of the preset region is input into the DNN model and the PatchTST model. The DNN model and the PatchTST model are trained according to the specific content of the second data to obtain the corresponding parameter matrices. The obtained parameter matrices are shared to obtain a final parameter matrix, which is the target parameter matrix in the prediction model.
[0085] The passenger flow prediction method provided in this application embodiment obtains first data in a preset area. The first data includes: first passenger flow data of the previous time period in the preset area, first weather data corresponding to the time period to be predicted, and first holiday data. Then, the first data is input into a pre-trained prediction model to obtain target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training a DNN model and a PatchTST model based on second data from the preset area. The second data includes: second passenger flow data of historical time periods in the preset area, second weather data corresponding to the previous historical time period, and second holiday data. In this embodiment, the obtained first data includes first passenger flow data of the previous time period in the preset area, first weather data corresponding to the time period to be predicted, and first holiday data. Combining different types of data improves the accuracy and comprehensiveness of passenger flow prediction. Furthermore, by inputting the first data into the pre-trained prediction model, and processing the different data features in the first data using the DNN model and PatchTST model respectively, the passenger flow for the time period to be predicted can be accurately predicted effectively. Meanwhile, building a prediction model based on a combination of DNN and PatchTST models can better capture the patterns of passenger flow changes and improve prediction accuracy.
[0086] Based on the above embodiments, Figure 2 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 2 .like Figure 2 As shown, the method for predicting passenger flow also includes the following steps:
[0087] S210. Based on the second passenger flow data of the historical time period in the preset area, train the PatchTST model to obtain the first parameter matrix corresponding to the PatchTST model.
[0088] In this step, the preset area and historical time period are first determined, and then the second passenger flow data of the historical time period in the preset area is obtained. The second passenger flow data is input into the PatchTST model for training, and the first parameter matrix corresponding to the PatchTST model can be obtained.
[0089] In one possible implementation, before inputting the second passenger flow data into the PatchTST model, the second passenger flow data is formatted according to the input requirements of the model and preprocessed, such as dividing the second passenger flow data into fixed-length time windows, or standardizing or normalizing the second passenger flow data to ensure that all features in the second passenger flow data have the same format.
[0090] In one possible implementation, the PatchTST model is used to capture local features and long-term dependencies in the second passenger flow data. The training process for the PatchTST model can involve first encoding the second passenger flow data through patch segmentation and embedding, with each patch representing data within a certain time range. The PatchTST model uses a self-attention mechanism to model the temporal and spatial dimensions, and trains the model parameters by optimizing a loss function (e.g., mean squared error loss). During training, the PatchTST model adjusts its internal weights based on the input second passenger flow data, ultimately obtaining a set of trained first parameter matrices. These first parameter matrices may include attention weights, weights of the feedforward neural network, etc.
[0091] In one possible implementation, the preset area includes: at least one monitoring point under a closed road section; the second passenger flow data includes: the passenger flow corresponding to the monitoring point under at least one closed road section.
[0092] Among them, a closed road section refers to a complete road section that does not include intersections, and a monitoring point refers to a data collection point used to monitor and obtain passenger flow data for the closed road section.
[0093] In one possible implementation, the preset area may include multiple monitoring points under closed road sections, and the passenger flow of the closed road sections is monitored based on the monitoring points. For example, for closed road section 1 in the preset area, two monitoring points are set at both ends of closed road section 1, namely monitoring point 1 and monitoring point 2. Monitoring point 1 can monitor the number of tourists entering and leaving closed road section 1. Similarly, monitoring point 2 can also monitor the number of tourists entering and leaving closed road section 1. Then, the passenger flow corresponding to the monitoring point under closed road section 1 can be the difference between the number of tourists entering closed road section 1 at monitoring point 1 and the number of tourists leaving closed road section 1 at monitoring point 2, or it can be the difference between the number of tourists entering closed road section 1 at monitoring point 2 and the number of tourists leaving closed road section 1 at monitoring point 1.
[0094] In one possible implementation, the prediction model includes: channels corresponding to different monitoring points under the PatchTST model. Accordingly, one possible implementation of step S210 above is as follows:
[0095] Based on the passenger flow corresponding to the monitoring points under different closed road sections, the PatchTST model is trained by inputting the corresponding channels of different monitoring points, and the sub-parameter matrix corresponding to different channels under the PatchTST model is obtained.
[0096] The first parameter matrix includes sub-parameter matrices corresponding to different channels.
[0097] In one possible implementation, the PatchTST model sets up independent channels, inputting the passenger flow corresponding to the monitoring points under different closed road sections into the PatchTST model through the corresponding channels of different monitoring points. The input passenger flow corresponding to the monitoring points under different closed road sections is divided into several patches, and a self-attention mechanism is used to capture the correlation between different channels. By training the PatchTST model, the sub-parameter matrix corresponding to different channels under the PatchTST model is obtained.
[0098] S220. Based on the second weather data and second holiday data corresponding to the previous time period in the historical time period, train the DNN model to obtain the second parameter matrix corresponding to the DNN model.
[0099] In this step, we first obtain the weather data and holiday data corresponding to the previous time period in the historical time period. The obtained data is then input into the DNN model for training, thereby obtaining the second parameter matrix corresponding to the DNN model.
[0100] In one possible implementation, before inputting the second weather data and the second holiday data into the DNN model, the second weather data and the second holiday data are formatted according to the input requirements of the model, and the second weather data and the second holiday data are preprocessed, such as supplementing missing data, deleting outliers, or standardizing or normalizing the second passenger flow data, to ensure that all features in the second weather data and the second holiday data have the same format.
[0101] In one possible implementation, the DNN model is used to process other types of features related to passenger flow data, such as weather indicators and holiday information. The input layer of the DNN model can be used to receive feature information from the second weather data and the second holiday data. After multiple layers of nonlinear transformation and activation function processing, the final output is the second parameter matrix corresponding to the DNN model.
[0102] S230. Determine the target parameter matrix in the prediction model based on the first parameter matrix and the second parameter matrix.
[0103] In this step, based on the first parameter matrix and the second parameter matrix, the two parameter matrices are fused to obtain a new parameter matrix, which is then used as the target parameter matrix in the prediction model.
[0104] In one possible implementation, the prediction model can be a multi-layer neural network model, which can be composed of a PatchTST model and a DNN model. The first parameter matrix and the second parameter matrix represent the weights or biases of the two models, respectively. The first parameter matrix and the second parameter matrix are combined, which can be a weighted combination of the first parameter matrix and the second parameter matrix. Finally, the combined overall parameter matrix is used as the target parameter matrix of the prediction model.
[0105] In one possible implementation, the parameters of the prediction model can be updated using the backpropagation algorithm.
[0106] The passenger flow prediction method provided in this application first trains a PatchTST model based on second passenger flow data from a historical time period in a preset area, obtaining a first parameter matrix corresponding to the PatchTST model. Then, it trains a DNN model based on the second weather data and second holiday data corresponding to the previous historical time period, obtaining a second parameter matrix corresponding to the DNN model. Finally, it determines the target parameter matrix in the prediction model based on the first and second parameter matrices. In this embodiment, by training the PatchTST model based on second passenger flow data from a historical time period in a preset area, the prediction model can learn long-term temporal dependencies and local features (such as seasonal fluctuations and periodic changes) from the time-series data of passenger flow, thereby improving its ability to predict passenger flow. By training the DNN model based on the second weather data and second holiday data from the previous historical time period in the preset area, the prediction model can learn the impact of external factors (such as weather changes and holiday arrangements) on passenger flow, capturing the nonlinear relationships of these external features, thereby enhancing the accuracy of passenger flow prediction. Furthermore, the PatchTST model and the DNN model are used to capture different types of data features, and then they are merged through the target parameter matrix, which can effectively enhance the generalization ability of the prediction model.
[0107] Based on the above embodiments, Figure 3 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 3 .like Figure 3 As shown, one possible implementation of step S230 above includes the following steps:
[0108] S310. According to the preset weight coefficients, the weights of the first parameter matrix and the second parameter matrix are set to obtain the weighted parameter matrix.
[0109] In this step, the weight coefficients of the first parameter matrix and the second parameter matrix are preset. Then, the first parameter matrix and the second parameter matrix are weighted according to the preset weight coefficients, and the weighted parameter matrix is obtained based on the weight settings.
[0110] The preset weight coefficient refers to the ratio of the first parameter matrix and the second parameter matrix, with a value range of 0 to 1. The weight setting refers to the calculation of the weight coefficient by combining it with the first parameter matrix and the second parameter matrix according to the set rules.
[0111] For example, if the weight coefficient of the first parameter matrix is set to 0.6 and the weight coefficient of the second parameter matrix is set to 0.4, then the weight setting of the first parameter matrix and the second parameter matrix can be: first parameter matrix * 0.6 + second parameter matrix * 0.4. The weighted result, i.e., the result of first parameter matrix * 0.6 + second parameter matrix * 0.4, is used as the weighted parameter matrix.
[0112] S320. Use the weighted parameter matrix as the target parameter matrix in the prediction model;
[0113] The prediction models include the PatchTST model and the DNN model.
[0114] In one possible implementation, the first parameter matrix can be obtained from the PatchTST model, and the second parameter matrix can be obtained from the DNN model. The weighted parameter matrix obtained by setting the first parameter matrix and the second parameter matrix with different weights is different, and the target parameter matrix of the corresponding prediction model is also different.
[0115] For example, based on the above example, the weighted parameter matrix, i.e., the result of the first parameter matrix * 0.6 + the second parameter matrix * 0.4, can be used as the target parameter matrix in the prediction model. Alternatively, the weighted parameter matrix, i.e., the result of the first parameter matrix * 0.5 + the second parameter matrix * 0.5, can also be used as the target parameter matrix in the prediction model.
[0116] The passenger flow prediction method provided in this application first sets weights for a first parameter matrix and a second parameter matrix according to preset weight coefficients to obtain a weighted parameter matrix. Then, the weighted parameter matrix is used as the target parameter matrix in the prediction model, which includes a PatchTST model and a DNN model. In this embodiment, the first parameter matrix and the second parameter matrix are weighted and fused according to preset weight coefficients, allowing the prediction model to be adjusted according to the specific characteristics of the data and its impact on the prediction results, thereby optimizing the overall model's prediction performance and improving prediction accuracy. Furthermore, by weighting the first parameter matrix and the second parameter matrix with preset weight coefficients, dynamic optimization of the prediction model can be achieved. The weight coefficients can be flexibly adjusted according to changes in data or prediction requirements, thus adapting to different prediction scenarios. Simultaneously, the weighted target parameter matrix not only considers different historical data types but also effectively integrates the advantages of the PatchTST model and the DNN model in handling different types of features. Multi-level feature fusion enhances the model's generalization ability and ensures the stability and accuracy of the prediction results.
[0117] Based on the above embodiments, Figure 4 A flowchart illustrating the passenger flow prediction method provided in the embodiments of this application. Figure 4 .like Figure 4 As shown, one possible implementation of step S220 above includes the following steps:
[0118] S410. Extract features from the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean value corresponding to the second holiday data. The Boolean value is used to replace the holidays and weekends in the second holiday data.
[0119] In this step, features are first extracted from the second weather data and the second holiday data to obtain the features in the second weather data and the second holiday data. Then, the temperature data corresponding to the second weather data and the holidays and weekends in the second holiday data are extracted. Finally, Boolean values are used to replace the holidays and weekends in the second holiday data to obtain the Boolean values corresponding to the second holiday data.
[0120] The Boolean value corresponding to the second holiday day data refers to determining whether a date is a holiday day based on the second holiday day data.
[0121] In one possible implementation, the temperature data corresponding to the second weather data mentioned above can be obtained by extracting a specific field of temperature from the second weather data. The boolean value corresponding to the second holiday date data can be used to indicate whether the date is a holiday or a weekend. A boolean value of True indicates that the date is a holiday or a weekend, and False indicates that it is not. For example, if October 1st is a holiday, the corresponding boolean value is True.
[0122] In one possible implementation, the aforementioned temperature data could be a specific temperature value obtained from a particular field of temperature in the second day's weather data, or it could be different ranges divided according to a certain temperature step size. For example, with a temperature step size of 5 degrees Celsius, temperature range 1 could be divided into 0-5 degrees Celsius, temperature range 2 into 5-10 degrees Celsius, temperature range 3 into 10-25 degrees Celsius, and so on.
[0123] S420. Based on the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday data, train the DNN model to obtain the second parameter matrix corresponding to the DNN model.
[0124] In this step, the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday data are first input into the DNN model. The DNN model is trained based on the input data, and finally the second parameter matrix corresponding to the DNN model is obtained.
[0125] In one possible implementation, temperature data extracted from the second day's weather data and Boolean values extracted from the second holiday data can be used. The temperature data is standardized by dividing and standardizing temperature data with similar temperature ranges, while the Boolean values corresponding to the second holiday data are directly converted to 0 or 1. Then, an activation function is used as the hidden layer of the DNN model, and the mean squared error loss function is used to train the DNN model. After training, the second parameter matrix of the DNN model is obtained.
[0126] The passenger flow prediction method provided in this application first extracts features from the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday data. These Boolean values are used to replace holidays and weekends in the second holiday data. Then, based on the temperature data and the Boolean values, the DNN model is trained to obtain the second parameter matrix of the DNN model. In this embodiment, by extracting features from the second weather data and the second holiday data, the original data can be transformed into more representative and interpretable features. Using Boolean values to represent the second holiday data and replacing holidays and weekends in the second holiday data reflects the direct impact of the second holiday data on passenger flow prediction. Furthermore, converting the second holiday data into a representable data form facilitates the recognition and processing by the DNN model. Subsequently, training the DNN model based on the temperature data and the Boolean values effectively improves the DNN model's ability to capture complex nonlinear relationships, thereby improving the performance of the DNN model and ultimately increasing the prediction accuracy of the entire prediction model.
[0127] Based on the above embodiments, the following are embodiments of the apparatus involved in this application:
[0128] Figure 5 A schematic diagram of the passenger flow prediction device provided in an embodiment of this application. Figure 5 As shown, the passenger flow prediction device 500 includes:
[0129] The acquisition module 510 is used to acquire the first data in the preset area. The first data includes: the first passenger flow data of the previous time period of the time period to be predicted in the preset area, the first weather data and the first holiday data corresponding to the time period to be predicted.
[0130] The processing module 520 is used to input the first data into the pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
[0131] In an optional embodiment, the processing module 520 is further configured to:
[0132] The PatchTST model is trained based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model.
[0133] The DNN model is trained based on the second weather data and second holiday data corresponding to the previous historical time period to obtain the second parameter matrix of the DNN model.
[0134] The target parameter matrix in the prediction model is determined based on the first parameter matrix and the second parameter matrix.
[0135] In an optional embodiment, the processing module 520 determines the target parameter matrix in the prediction model based on the first parameter matrix and the second parameter matrix, specifically for:
[0136] Based on the preset weighting coefficients, the weights of the first parameter matrix and the second parameter matrix are set to obtain the weighted parameter matrix;
[0137] The weighted parameter matrix is used as the target parameter matrix in the prediction model;
[0138] The prediction models include the PatchTST model and the DNN model.
[0139] In an optional embodiment, the processing module 520 trains the DNN model based on the second weather data and second holiday data corresponding to the previous time period in the historical time period, to obtain the second parameter matrix corresponding to the DNN model, specifically for:
[0140] Feature extraction is performed on the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean value corresponding to the second holiday data. The Boolean value is used to replace the holidays and weekends in the second holiday data.
[0141] The DNN model is trained based on the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday data, to obtain the second parameter matrix of the DNN model.
[0142] In one possible implementation, the preset area includes: at least one monitoring point under a closed road section;
[0143] The second passenger flow data includes: passenger flow at at least one monitoring point under a closed road section.
[0144] In one optional embodiment, the prediction model includes: channels corresponding to different monitoring points under the PatchTST model;
[0145] Correspondingly, the processing module 520 trains the PatchTST model based on the second passenger flow data of the historical time period in the preset area, obtaining the first parameter matrix corresponding to the PatchTST model, which is specifically used for:
[0146] Based on the passenger flow corresponding to the monitoring points under different closed road sections, the PatchTST model is trained by inputting the corresponding channels of different monitoring points, and the sub-parameter matrix corresponding to different channels under the PatchTST model is obtained.
[0147] The first parameter matrix includes sub-parameter matrices corresponding to different channels.
[0148] Based on the above embodiments, Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 600 includes: a processor 610, a memory 620, and a bus 630;
[0149] The memory 620 is used to store the computer-executed instructions of the processor 610;
[0150] The processor 610 is configured to execute the technical solutions of any of the foregoing method embodiments by executing computer execution instructions.
[0151] Optionally, the memory 620 can be either standalone or integrated with the processor 610.
[0152] Optionally, memory 620 may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0153] Bus 630 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one thick line is used to represent a bus in the accompanying drawings of this application, but this does not imply that there is only one bus or one type of bus.
[0154] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0155] The electronic device is used to execute the technical solution of any of the foregoing method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.
[0156] This application also provides a computer-readable storage medium storing computer-executable instructions thereon, which, when executed by a processor, are used to implement the technical solutions provided in any of the above method embodiments.
[0157] This application also provides a computer program product, including a computer program, which includes computer instructions stored in a computer-readable storage medium. When the computer program is executed by a processor, it is used to implement the technical solutions provided in any of the above method embodiments.
[0158] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0159] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0160] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0161] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0162] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0163] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0164] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not contradict each other, they should be considered within the scope of this specification.
[0165] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0166] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for predicting passenger flow, characterized in that, The method includes: Obtain first data from a preset area, the first data including: first passenger flow data of the previous time period of the time period to be predicted in the preset area, first weather data and first holiday data corresponding to the time period to be predicted; The first data is input into a pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
2. The method according to claim 1, characterized in that, The method further includes: The PatchTST model is trained based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model. The DNN model is trained based on the second weather data and second holiday data corresponding to the previous time period of the historical time period to obtain the second parameter matrix corresponding to the DNN model. The target parameter matrix in the prediction model is determined based on the first parameter matrix and the second parameter matrix.
3. The method according to claim 2, characterized in that, Determining the target parameter matrix in the prediction model based on the first parameter matrix and the second parameter matrix includes: According to the preset weight coefficients, the weights of the first parameter matrix and the second parameter matrix are set to obtain the weighted parameter matrix; The weighted parameter matrix is used as the target parameter matrix in the prediction model; The prediction model includes the PatchTST model and the DNN model.
4. The method according to claim 2, characterized in that, The DNN model is trained based on the second weather data and second holiday data corresponding to the previous time period in the historical time period to obtain the second parameter matrix corresponding to the DNN model, including: Feature extraction is performed on the second weather data and the second holiday data to obtain the temperature data corresponding to the second weather data and the Boolean value corresponding to the second holiday data. The Boolean value is used to replace holidays and weekends in the second holiday data. The DNN model is trained based on the temperature data corresponding to the second weather data and the Boolean values corresponding to the second holiday day data to obtain the second parameter matrix corresponding to the DNN model.
5. The method according to any one of claims 2-4, characterized in that, The preset area includes: at least one monitoring point under a closed road section; The second passenger flow data includes: the passenger flow corresponding to the monitoring points under the at least one closed road section.
6. The method according to claim 5, characterized in that, The prediction model includes: channels corresponding to different monitoring points under the PatchTST model; Accordingly, the step of training the PatchTST model based on the second passenger flow data of the historical time period in the preset area to obtain the first parameter matrix corresponding to the PatchTST model includes: Based on the passenger flow corresponding to the monitoring points under different closed road sections, the PatchTST model is trained by inputting the corresponding channels of different monitoring points to obtain the sub-parameter matrix of different channels under the PatchTST model. The first parameter matrix includes sub-parameter matrices corresponding to different channels.
7. A passenger flow prediction device, characterized in that, include: The acquisition module is used to acquire first data in a preset area. The first data includes: first passenger flow data of the previous time period of the time period to be predicted in the preset area, first weather data and first holiday data corresponding to the time period to be predicted; The processing module is used to input the first data into a pre-trained prediction model to obtain the target passenger flow data for the time period to be predicted. The target parameter matrix in the prediction model is obtained by training the DNN model and the PatchTST model based on the second data of the preset area. The second data includes: the second passenger flow data of the historical time period in the preset area, the second weather data corresponding to the previous time period of the historical time period, and the second holiday data.
8. An electronic device, characterized in that, include: Processor; memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-6.