Pedestrian flow prediction method, device and equipment and computer storage medium

By constructing a historical spatiotemporal pedestrian flow matrix and training a variational inference algorithm that combines a deep probabilistic autoregressive model with a spatially dependent factor model, the problem of weak data correlation and insufficient prediction accuracy in existing pedestrian flow prediction technologies has been solved. This achieves high-precision short-term and long-term predictions, supporting scenic area management and safety assurance.

CN121745402APending Publication Date: 2026-03-27CHINA MOBILE COMM GRP SHAANXI CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-26
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing technologies have weak data correlation in pedestrian flow prediction, making it difficult to uncover multi-dimensional spatiotemporal high-order potential dependencies. They also suffer from insufficient short-term prediction accuracy and poor long-term prediction reliability, thus failing to achieve effective early warning.

Method used

A historical spatiotemporal pedestrian flow matrix is ​​constructed. By combining a deep probabilistic autoregressive model and a spatially dependent factor model, the model is trained using a variational inference algorithm to capture the temporal and spatial patterns of pedestrian flow. Through product fitting of the temporal weight matrix and the spatially dependent factor matrix, high-precision short-term and long-term pedestrian flow prediction is achieved.

Benefits of technology

It significantly improves the accuracy and robustness of visitor flow forecasting, provides a scientific basis for scenic area management and safety assurance, supports precision marketing and facility optimization, and enhances scenic area management and visitor experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121745402A_ABST
    Figure CN121745402A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a people flow prediction method and device, equipment and a computer storage medium. The invention relates to the technical field of computers. The method comprises the following steps: acquiring historical people flow data in a target area; based on the historical people flow data, constructing a historical space-time people flow matrix; the historical space-time people flow matrix is input into a people flow prediction model, the people flow prediction model is trained, and the people flow prediction model comprises a depth probability autoregression model and a spatial dependence factor model; the depth probability autoregression model generates a time sequence weight matrix, the spatial dependency factor model generates a spatial dependency factor matrix, and the time-space constraint condition is that a historical time-space people flow matrix can be obtained by fitting a product of the time sequence weight matrix and the spatial dependency factor matrix; and when a training stop condition is satisfied, obtaining a trained people flow prediction model. According to the method, the complex rule of people flow change can be captured, and high-precision short-term and long-term prediction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and computer storage medium for predicting pedestrian traffic. Background Technology

[0002] With the continuous development of the economy and society and the continuous improvement of people's living standards, holiday travel has become a popular lifestyle. The concentrated travel during holidays leads to a surge in crowds at tourist destinations, which not only seriously affects the travel experience but also greatly increases the risk of accidents such as stampedes, threatening the lives and property of travelers. Therefore, identifying the flow trends of people within target areas such as shopping malls and scenic spots and predicting their destinations can provide a scientific basis for crowd dispersal and management, effectively reducing safety risks.

[0003] Existing technologies for predicting pedestrian flow in target areas primarily collect data through IoT devices (such as cameras and smart trash cans) and base station equipment. These data are then used to build predictive models based on variable feature extraction and data correlation analysis to forecast future pedestrian flow. However, some solutions infer pedestrian flow from indirect data, resulting in weak correlations between data and pedestrian flow and inaccurate predictions. Furthermore, traditional machine learning algorithms struggle to uncover high-order potential dependencies across different locations and dimensions in multi-dimensional spatiotemporal sequences, leading to limited short-term prediction accuracy and insufficient long-term reliability. Moreover, existing solutions only trigger alarms after pedestrian flow reaches saturation, failing to provide pre-emptive trend prediction and hindering efforts to mitigate the risk of pedestrian congestion at its source.

[0004] Therefore, improving the accuracy of population flow forecasting in target areas, especially long-term forecasting accuracy, has become an urgent technical challenge.

[0005] Application content This application provides a method, device, equipment, and computer storage medium for predicting visitor flow. The purpose is to solve the problems of weak data correlation, difficulty in mining multi-dimensional spatiotemporal high-order potential dependencies, insufficient short-term prediction accuracy, poor long-term prediction reliability, and inability to achieve effective early warning in existing scenic area visitor flow prediction technologies. It provides an accurate prediction scheme to provide a scientific basis for visitor flow management and safety assurance.

[0006] In a first aspect, embodiments of this application provide a method for predicting pedestrian traffic, the method comprising: Acquire historical pedestrian traffic data from multiple monitoring points within the target area; Based on the historical pedestrian flow data of the multiple monitoring points, a historical spatiotemporal pedestrian flow matrix is ​​constructed for each monitoring point; The historical spatiotemporal pedestrian flow matrix is ​​input into the initial pedestrian flow prediction model, and the pedestrian flow prediction model is trained based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model. The deep probabilistic autoregressive model generates a temporal weight matrix for capturing pedestrian flow time patterns based on temporal and spatial constraints during training. The spatial dependency factor model generates a spatial dependency factor matrix for capturing pedestrian flow spatial patterns based on the temporal and spatial constraints during training. The temporal and spatial constraints are the historical spatiotemporal pedestrian flow matrix for each monitoring point. The historical spatiotemporal pedestrian flow matrix can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

[0007] In one feasible embodiment, after obtaining the trained pedestrian flow prediction model, the method further includes: By inputting historical pedestrian flow data from one or more target monitoring points during a reference historical period into the pedestrian flow prediction model, the pedestrian flow prediction model can be used to predict the pedestrian flow for the one or more target monitoring points during a preset future period.

[0008] In one feasible embodiment, before constructing the historical spatiotemporal pedestrian flow matrix for each of the multiple monitoring points based on historical pedestrian flow data, the method further includes: The negative and missing values ​​in the historical pedestrian flow dataset are set to zero, and data points exceeding the preset road capacity threshold are regarded as noise data points. The noise data points are replaced by the average data of adjacent time points to obtain the noise-reduced historical pedestrian flow dataset in order to construct the historical spatiotemporal pedestrian flow matrix.

[0009] In one feasible embodiment, the historical pedestrian traffic data includes one or more of the following: average pedestrian traffic, pedestrian traffic variance, pedestrian traffic mean difference, and statistics on the number of days of events or holidays.

[0010] In one feasible embodiment, the initial deep probabilistic autoregressive model contains a discrete sequence of hidden states, each of which is controlled by a Markov chain for its state transitions. The process of generating the time-series weight matrix by the deep probabilistic autoregressive model includes: For each time point in the input historical spatiotemporal human flow matrix, the conditional probability distribution of the current time-series weight is determined by the first parameterized network based on the current hidden state of the Markov chain and the time-series weight of the previous specific time point. Sample from the conditional probability distribution to generate the weight vector for the corresponding time point in the time-series weight matrix.

[0011] In one feasible embodiment, the first parameterized network is a multi-head multilayer perceptron, comprising multiple parallel fully connected sub-networks, each of which corresponds to a hidden state, for estimating the parameters of the conditional probability distribution in the current hidden state based on the temporal weights at the preceding specific time points.

[0012] In one feasible embodiment, the initial spatial dependency factor model includes the generative relationship between spatial dependency factors and low-dimensional latent variables. The process of generating the spatial dependency factor matrix using the spatial dependency factor model includes: Based on the relationship between the spatial dependence factor and the generation of low-dimensional latent variables, shared low-dimensional latent variables are sampled from a preset prior distribution. Based on the shared low-dimensional latent variables, the probability distribution parameters of the spatial dependence factors are learned through the second parameterized network. The spatial dependence factor matrix is ​​generated based on the probability distribution parameters.

[0013] In one feasible embodiment, the step of training the pedestrian flow prediction model based on the variational inference algorithm for pedestrian flow prediction includes: An intermediate probability function is introduced for the latent variables of the deep probabilistic autoregressive model and the spatially dependent factor model; The posterior probabilities of the latent variables in the deep probabilistic autoregressive model and the spatially dependent factor model are solved by the intermediate probability function, so as to train the deep probabilistic autoregressive model and the spatially dependent factor model.

[0014] Secondly, embodiments of this application provide a pedestrian flow prediction device, the device comprising: The acquisition module is used to acquire historical pedestrian traffic data from multiple monitoring points within the target area; The matrix construction module is used to construct a historical spatiotemporal pedestrian flow matrix for each of the multiple monitoring points based on the historical pedestrian flow data of the multiple monitoring points; The training module is used to input the historical spatiotemporal pedestrian flow matrix into the initial pedestrian flow prediction model, and to train the pedestrian flow prediction model to predict pedestrian flow based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model. The deep probabilistic autoregressive model generates a temporal weight matrix for capturing pedestrian flow time patterns based on temporal and spatial constraints during training. The spatial dependency factor model generates a spatial dependency factor matrix for capturing pedestrian flow spatial patterns based on the temporal and spatial constraints during training. The temporal and spatial constraints are the historical spatiotemporal pedestrian flow matrix for each monitoring point. The historical spatiotemporal pedestrian flow matrix can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

[0015] Thirdly, this application provides a pedestrian flow prediction device, which includes a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement any of the pedestrian flow prediction methods in the above embodiments.

[0016] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement any of the pedestrian flow prediction methods described in the above embodiments.

[0017] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements any of the pedestrian flow prediction methods described in the above embodiments.

[0018] The pedestrian flow prediction method, apparatus, device, and computer storage medium of this application address the problems of weak data correlation, difficulty in uncovering multivariate spatiotemporal high-order potential dependencies, insufficient prediction accuracy, and inability to provide early warnings in existing technologies. By constructing a historical spatiotemporal pedestrian flow matrix, combining a deep probabilistic autoregressive model and a spatial dependency factor model, and training the model using a variational inference algorithm, it accurately captures the temporal and spatial patterns of pedestrian flow. This not only improves short-term prediction accuracy but also significantly optimizes long-term prediction reliability. It effectively uncovers potential correlations between different monitoring points, providing a scientific basis for visitor flow management and safety assurance in scenic areas. Simultaneously, it supports precision marketing and facility optimization, helps improve scenic area management and visitor experience, and promotes the development of smart tourism. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating a method for predicting pedestrian traffic provided in an embodiment of this application; Figure 2 This is a schematic diagram of a DSARF model structure provided in an embodiment of this application; Figure 3 This is a schematic diagram of DSARF matrix / tensor decomposition modeling provided in an embodiment of this application; Figure 4 This is a schematic diagram of the DSARF Temporal Weight modeling process provided in the embodiments of this application; Figure 5 This is a schematic diagram of DSARF Spatial Factor modeling provided in an embodiment of this application; Figure 6 This is a schematic diagram of the MLP sublayer structure provided in the embodiments of this application; Figure 7 This is a schematic diagram of the overall structure of the multihead MLP provided in the embodiments of this application; Figure 8 This is a schematic diagram of the structure of a pedestrian flow prediction device provided in an embodiment of this application; Figure 9 This is a schematic diagram of the hardware structure of the pedestrian flow prediction device provided in the embodiments of this application. Detailed Implementation

[0021] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit the present invention. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.

[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0023] To address the problems in existing technologies, this application provides a method, apparatus, device, and computer storage medium for predicting visitor flow. This technical solution addresses the problem of visitor flow prediction in scenic areas. First, it selects visitor flow data from multiple cameras at various time points as a training set. After preprocessing and sliding window feature enhancement to optimize the data, a modified DSARF deep generation model is employed. Through matrix factorization, the data is decomposed into temporal weights and spatial dependency factors. The model is then trained using Markov chain-controlled hidden states, multi-head multilayer perceptron parameterization, and variational inference algorithms. Ultimately, this achieves high-precision short-term and long-term visitor flow prediction, providing support for scenic area management and crowd control.

[0024] The pedestrian flow prediction method provided in the embodiments of this application will be introduced first below.

[0025] Figure 1 A flowchart illustrating a pedestrian flow prediction method according to an embodiment of this application is shown. Figure 1 As shown, the method may include the following steps: S101, acquire historical pedestrian traffic data from multiple monitoring points within the target area; The target area can be a specific area that requires traffic flow prediction, such as a tourist attraction, urban business district, or transportation hub. For example, a 5A-level scenic area or the core business district of the city center.

[0026] Monitoring points refer to specific locations within a target area for collecting data related to pedestrian flow, such as major intersections in scenic areas, entrances to attractions, passageways in commercial districts, and transfer areas of transportation hubs. Each monitoring point can be equipped with corresponding pedestrian flow data collection devices.

[0027] Historical visitor flow data refers to data related to the movement of people recorded by various monitoring points in the target area over a period of time. For example, from January 1, 2023 to December 31, 2023, the number of people entering and leaving the scenic area at different times each day at the entrance monitoring points of various attractions.

[0028] This solution can collect data through IoT devices deployed at monitoring points, such as smart cameras, infrared counters, and base station equipment. Alternatively, it can obtain authorized historical pedestrian flow data through third-party data platforms. For example, high-definition smart cameras deployed at various scenic spots can capture and record pedestrian flow in real time to form historical data, or pedestrian flow data can be obtained from telecommunications operators by associating the location trajectories of users in the area.

[0029] S102, Based on the historical pedestrian flow data of the multiple monitoring points, construct a historical spatiotemporal pedestrian flow matrix for each monitoring point; A historical spatiotemporal pedestrian flow matrix is ​​a matrix data structure that integrates time and space dimensions. It is used to intuitively present the pedestrian flow situation of a single monitoring point at different time points. The rows of the matrix can correspond to the time dimension, such as hours or days, and the columns can correspond to the pedestrian flow values. For example, in the historical spatiotemporal pedestrian flow matrix of a certain monitoring point, the rows represent each natural day in 2023, and the columns represent the pedestrian flow values ​​of the corresponding dates. The elements in the matrix are the specific pedestrian flow of the monitoring point on the corresponding dates.

[0030] The construction can be achieved by technicians using data processing tools, such as the NumPy and Pandas libraries in Python programming software, to organize and arrange historical visitor flow data from multiple monitoring points, and construct the data according to time order and spatial location. For example, the daily visitor flow data of three monitoring points in a scenic area over the past six months can be organized into three historical spatiotemporal visitor flow matrices of 6 rows × 30 columns, with each row corresponding to one month and each column corresponding to one day of that month, and the elements representing the visitor flow on that day.

[0031] S103, input the historical spatiotemporal pedestrian flow matrix into the initial pedestrian flow prediction model, and train the pedestrian flow prediction model based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model. The initial pedestrian flow prediction model can refer to a model framework for predicting pedestrian flow that has not been trained or has not been fully trained. It includes two core components: a deep probabilistic autoregressive model and a spatially dependent factor model. The initial parameters of the model can be set based on empirical values ​​or conventional parameters in the relevant field.

[0032] The Deep Probabilistic Autoregressive Model (DPAM) is a deep learning model based on probability statistics and autoregressive mechanisms. It can capture the time-series dependencies of data and predict future data trends through the probability distribution characteristics of historical data.

[0033] The Spatial Dependence Factor Model (SDFM) is a model used to mine spatial correlation features of data. It can identify potential spatial dependencies between different monitoring points and extract spatial factors that affect the distribution of pedestrian traffic.

[0034] Variational inference (VI) is an algorithm used to approximate the posterior distribution of complex probability models. It simplifies the calculation of posterior probabilities by introducing an intermediate probability distribution, thereby improving the efficiency and accuracy of model training.

[0035] The input can be that technicians use model training platforms, such as TensorFlow and PyTorch frameworks, to import the constructed historical spatiotemporal pedestrian flow matrix into the initial pedestrian flow prediction model. The import process can be achieved by matching and transmitting data formats through programming instructions.

[0036] Training can be achieved by model trainers setting hyperparameters such as the number of training iterations and the learning rate, and using variational inference algorithms to optimize model parameters. This allows the model to gradually learn the spatiotemporal characteristics and potential patterns in the historical spatiotemporal flow matrix. For example, if the number of training iterations is set to 1000 and the learning rate is 0.001, the parameters of the deep probabilistic autoregressive model and the spatial dependence factor model can be continuously adjusted through variational inference algorithms to reduce prediction errors.

[0037] The deep probabilistic autoregressive model generates a temporal weight matrix for capturing pedestrian flow time patterns based on temporal and spatial constraints during training. The spatial dependency factor model generates a spatial dependency factor matrix for capturing pedestrian flow spatial patterns based on the temporal and spatial constraints during training. The temporal and spatial constraints are the historical spatiotemporal pedestrian flow matrix for each monitoring point. The historical spatiotemporal pedestrian flow matrix can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

[0038] The temporal and spatial constraints here can refer to the basis used to constrain the generation of the temporal weight matrix and spatial dependency factor matrix of the model, specifically the historical spatiotemporal pedestrian flow matrix of each monitoring point, to ensure that the generated matrix can accurately reflect the spatiotemporal characteristics of pedestrian flow.

[0039] A time-series weight matrix is ​​a matrix used to quantify the influence of pedestrian flow time patterns. The elements in the matrix represent the weight percentage of different time points on future pedestrian flow predictions. It can capture the changing patterns of pedestrian flow over time. For example, in the time-series weight matrix of a certain monitoring point, the weight of time points corresponding to holidays is higher than that of weekdays, reflecting that the impact of holiday pedestrian flow on the prediction results is greater.

[0040] The time pattern of pedestrian flow can refer to the regular characteristics of pedestrian flow in the time dimension, such as the concentration of pedestrian flow during the morning and evening peak hours, the greater pedestrian flow on weekends than on weekdays, and the surge in pedestrian flow on holidays.

[0041] A spatial dependence factor matrix can be used to quantify the degree of spatial correlation between different monitoring points. The elements in the matrix represent the spatial influence coefficients between each monitoring point, which can capture the distribution pattern of people flow in the spatial dimension. For example, if the spatial dependence factor values ​​of monitoring points of adjacent scenic spots are high, it reflects that the people flow of adjacent scenic spots has a significant mutual influence.

[0042] The spatial pattern of pedestrian flow can refer to the regular characteristics of pedestrian flow in the spatial dimension, such as the higher pedestrian density in the core scenic spots of a tourist area than in the peripheral scenic spots, and the greater pedestrian flow in areas with convenient transportation than in remote areas.

[0043] This scheme can be implemented during training by calculating the temporal weight matrix based on the temporal characteristics of the historical spatiotemporal pedestrian flow matrix using the neural network within the model. Similarly, the spatial dependency factor model can be generated during training by using a feature extraction algorithm within the model to obtain the spatial dependency factor matrix based on the spatial characteristics of the historical spatiotemporal pedestrian flow matrix. For example, a deep probabilistic autoregressive model can automatically calculate the weight values ​​for each time period to form the temporal weight matrix by analyzing the changing trends of pedestrian flow in historical data. Then, mathematical calculations can be used to make the product of the temporal weight matrix and the spatial dependency factor matrix as close as possible to the actual values ​​of the historical spatiotemporal pedestrian flow matrix. The degree of fit can be measured by an error index; for example, a good fit is considered achieved if the mean squared error (MSE) of the product WF (temporal weight matrix W and spatial dependency factor matrix F) between its elements and the corresponding elements of the historical spatiotemporal pedestrian flow matrix X is less than 0.01.

[0044] Training stopping conditions refer to the criteria for judging whether model training is complete. For example, the Evidence Lower Bound (ELBO) of the model converges to a preset threshold, such as the ELBO value being stable below -500 and showing no significant change for 10 consecutive iterations, or the number of training iterations reaching a preset maximum number of iterations, such as 1000.

[0045] This solution is fully trained and can accurately learn the spatiotemporal characteristics and potential patterns of historical pedestrian flow data, enabling it to predict future pedestrian flow with an acceptable prediction error. When the training stopping condition is met, the system automatically outputs the trained model file (e.g., a .pth format file), which technicians can use for subsequent pedestrian flow prediction tasks.

[0046] This technical solution combines the synergistic effect of deep probabilistic autoregressive models and spatial dependency factor models, and utilizes variational inference algorithms and matrix product fitting mechanisms to effectively uncover the spatiotemporal potential dependencies of pedestrian flow data. It solves the problem that existing technologies are unable to capture multivariate spatiotemporal high-order potential dependencies, significantly improves the accuracy and robustness of pedestrian flow prediction, and provides a scientific basis for pedestrian flow management and safety assurance in target areas.

[0047] In one feasible embodiment, after obtaining the trained pedestrian flow prediction model, the method further includes: By inputting historical pedestrian flow data from one or more target monitoring points during a reference historical period into the pedestrian flow prediction model, the pedestrian flow prediction model can be used to predict the pedestrian flow for the one or more target monitoring points during a preset future period.

[0048] The reference historical period refers to a specific past period used as the basis for prediction. For example, when predicting the flow of people from October 1 to 7, 2024, the reference historical period can be the same period data from October 1 to 7, 2023 and October 1 to 7, 2022.

[0049] Target monitoring points can refer to specific monitoring points where future visitor flow needs to be predicted. One or more can be selected according to actual needs. For example, if a scenic spot wants to focus on the visitor flow at its core attraction A and entrance plaza B, these two monitoring points are the target monitoring points.

[0050] Preset future time periods refer to the future time periods for which it is necessary to predict the flow of people, such as the next 7 days, the next month, or future holidays. The specific time period can be determined according to the application scenario.

[0051] This solution allows users to import historical pedestrian traffic data from target monitoring points for reference historical periods into a trained pedestrian traffic prediction model via a prediction terminal, following the model's required data format. Importing can be achieved through a programming interface or a visual user interface. After receiving the input data, the internal prediction algorithm processes the data and automatically outputs the predicted pedestrian traffic for the target monitoring points in the preset future time period. The prediction results can be presented in numerical, tabular, or graphical form.

[0052] This technical solution clarifies the specific application process of the trained model. By selecting reasonable reference historical time periods and target monitoring points, it can accurately predict the flow of people in the future, providing a direct basis for decision-making on pre-emptive traffic management and resource allocation in the target area. It solves the problem that existing technologies cannot achieve effective pre-emptive prediction and further expands the practical application value of the method.

[0053] In one feasible embodiment, before constructing the historical spatiotemporal pedestrian flow matrix for each of the multiple monitoring points based on historical pedestrian flow data, the method further includes: The negative and missing values ​​in the historical pedestrian flow dataset are set to zero, and data points exceeding the preset road capacity threshold are regarded as noise data points. The noise data points are replaced by the average data of adjacent time points to obtain the noise-reduced historical pedestrian flow dataset in order to construct the historical spatiotemporal pedestrian flow matrix.

[0054] Among them, the historical visitor flow dataset can refer to a collection of all historical visitor flow data from multiple monitoring points. It is the original data basis for constructing the historical spatiotemporal visitor flow matrix. For example, a dataset formed by summarizing the daily visitor flow data of 10 monitoring points in a scenic area over the past two years.

[0055] Negative values ​​refer to data in historical pedestrian traffic datasets that are less than 0. Since pedestrian traffic cannot be negative, such data is considered abnormal. For example, a monitoring point may record a pedestrian traffic of -5 people during a certain period.

[0056] Missing values ​​can be blank data in historical traffic data that were not recorded due to equipment failure, data transmission interruption, or other reasons. For example, traffic data for May 10, 2023, was not recorded at a certain monitoring point due to camera failure.

[0057] The preset road capacity threshold can refer to the upper limit of pedestrian flow set in advance based on factors such as the actual width and carrying capacity of the road where each monitoring point in the target area is located. For example, the preset road capacity threshold for a narrow walkway monitoring point in a scenic area is 50 people / hour.

[0058] Noise data points can refer to abnormal data points in historical pedestrian traffic data that exceed the preset road capacity threshold. Such data is usually caused by equipment misdetection, data entry errors, etc. For example, if the preset road capacity threshold of a monitoring point is 50 people / hour, and the pedestrian traffic recorded in a certain period is 150 people, this data point is a noise data point.

[0059] Adjacent time points refer to normal time points that are adjacent to the time point corresponding to the noise data point. For example, if the time corresponding to the noise data point is 10:00 on June 15, 2023, its adjacent time points could be 9:00 and 11:00 on June 15, 2023.

[0060] The average data refers to the arithmetic mean of the pedestrian flow data at adjacent time points. For example, if the pedestrian flow is 40 people at 9:00 and 44 people at 11:00, the average data is 42 people.

[0061] Setting values ​​to zero can be done by technicians using data processing software (such as Excel or Python's Pandas library) to batch replace negative and missing values ​​in historical traffic datasets and set them all to 0. For example, the fillna(0) function in the Pandas library can be used to set missing values ​​to zero, and the replace function can be used to replace negative values ​​with 0.

[0062] This solution can classify data points exceeding a preset threshold as noise data points according to predefined rules. This can be automated through programming logic, such as using an if statement to check if the data exceeds a preset road capacity threshold; if so, it is marked as a noise data point. Data processing tools calculate the average pedestrian traffic flow at adjacent time points for each noise data point and replace the original abnormal data with this average. For example, a noise data point with 150 people is replaced with an average of 42 people at adjacent time points. After processing, a high-quality, anomaly-free, denoised historical pedestrian traffic dataset is generated, which can be directly used to construct a subsequent historical spatiotemporal pedestrian flow matrix.

[0063] This technical solution effectively eliminates the impact of negative values, missing values, and noisy data points on subsequent modeling by preprocessing historical pedestrian flow data. This improves the quality and reliability of input data, avoids model training bias caused by abnormal data, and provides a guarantee for constructing an accurate historical spatiotemporal pedestrian flow matrix and improving the model's prediction accuracy.

[0064] In one feasible embodiment, the historical pedestrian traffic data includes one or more of the following: average pedestrian traffic, pedestrian traffic variance, pedestrian traffic mean difference, and statistics on the number of days of events or holidays.

[0065] The average pedestrian flow refers to the arithmetic mean of the pedestrian flow at a certain monitoring point within a specific time window. It can reflect the overall pedestrian flow situation within that time window, such as the average pedestrian flow for a window of 3 days or the average pedestrian flow for a window of 7 days.

[0066] The variance of pedestrian flow refers to the dispersion of pedestrian flow data at a monitoring point within a specific time window. It can reflect the fluctuation of pedestrian flow within that time window, such as the variance of pedestrian flow with a window size of 3 days or the variance of pedestrian flow with a window size of 14 days.

[0067] The average difference in pedestrian flow refers to the difference in the average pedestrian flow at a monitoring point within a specific time window. It can reflect the rate of change in pedestrian flow within that time window. For example, the average difference in pedestrian flow for a window of 3 days or the average difference in pedestrian flow for a window of 30 days.

[0068] The statistics on the number of days of events or festivals refer to the statistical value of the number of days that various events are held or that are in a festival state in a target area within a specific time window. It can reflect the impact of events and festivals on the flow of people. For example, the statistics on the number of days of events / festivals with a window size of 3 days, the statistics on the number of days of events / festivals with a window size of 60 days, and also the statistics on the number of days since the last event / festival.

[0069] This technical solution enriches the model's input information by clarifying the multi-dimensional feature types of historical pedestrian flow data. This enables the model to learn pedestrian flow patterns from multiple perspectives, such as overall situation, fluctuation, rate of change, and the impact of events and holidays. It solves the problem of insufficient prediction accuracy caused by the single feature of existing technologies and further improves the accuracy of pedestrian flow prediction.

[0070] In one feasible embodiment, the initial deep probabilistic autoregressive model contains a discrete sequence of hidden states, each hidden state in the sequence having its state transitions controlled by a Markov chain; the process of generating the temporal weight matrix by the deep probabilistic autoregressive model includes: For each time point in the input historical spatiotemporal human flow matrix, the conditional probability distribution of the current time-series weight is determined by the first parameterized network based on the current hidden state of the Markov chain and the time-series weight of the previous specific time point. Sample from the conditional probability distribution to generate the weight vector for the corresponding time point in the time-series weight matrix.

[0071] A discrete hidden state sequence can refer to a sequence of multiple discrete, unobservable states, each state representing a potential feature of the time pattern of people flow. For example, hidden states can be divided into low-peak, off-peak, and high-peak states, and multiple states are arranged in chronological order to form a hidden state sequence.

[0072] A latent state refers to a single discrete state in a sequence of latent states, used to characterize the local features of the time pattern of people flow. For example, if the latent state at a certain time point is the peak state, it means that the people flow at that time point is in a high-level pattern.

[0073] A Markov chain (MC) is a stochastic process with no aftereffects, meaning that the transition of the current state depends only on the previous state and is independent of earlier states. It is used to control the transition rules of each hidden state in a sequence of hidden states.

[0074] State transition refers to the process in a hidden state sequence where the previous hidden state is transformed into the current hidden state according to the transition probability of the Markov chain. For example, if the previous state is a flat state, it is transformed into the current peak state according to the transition probability of 0.3.

[0075] The preceding specific time point can refer to a specific time point before the current time point that has an impact on the current time series weight. The interval between this time point and the current time point is a preset time lag step l. For example, if the time lag step l = 2 and the current time point is t, then the preceding specific time point is t-2.

[0076] The first parameterized network refers to a neural network used to estimate the parameters of the conditional probability distribution of temporal weights. It can take the current hidden state and the temporal weights at a specific previous time point as input and output the relevant parameters of the conditional probability distribution.

[0077] Conditional probability distribution refers to the probability distribution that the current time-series weights follow given the current hidden state of the Markov chain and the time-series weights at a specific previous time point. Examples of such distributions include Gaussian distribution and binomial distribution.

[0078] This scheme can randomly select a value from the conditional probability distribution as the time series weight at the current time point. The sampling process can be implemented by a random number generation algorithm, such as sampling from a Gaussian distribution to obtain the specific value of the current time series weight.

[0079] A weight vector is a vector composed of the weight values ​​corresponding to a single time point in the time-series weight matrix. For example, the weight vector at the current time point is [0.2, 0.5, 0.3], which correspond to the weight proportions of different traffic patterns.

[0080] The initial deep probabilistic autoregressive model incorporates a discrete sequence of hidden states as a built-in component to capture latent features of pedestrian flow time patterns. A pre-defined transition probability matrix governs the transition process of each hidden state in the sequence; for example, the transition probability matrix stores the transition probabilities between each hidden state, controlling the direction and probability of state transitions. The first parameterized network extracts features and performs nonlinear transformations on the input current hidden state and the temporal weights at specific previous time points, outputting parameters of the conditional probability distribution, such as mean and variance, thus determining the specific form of the conditional probability distribution. For example, if the first parameterized network outputs a mean μ=0.4 and a variance σ²=0.01, the conditional probability distribution is determined to be N(0.4, 0.01). Finally, the weight vectors at multiple time points are arranged chronologically to form a complete temporal weight matrix. For example, arranging the weight vectors from t=1 to t=100 by rows yields a 100-row × K-column temporal weight matrix (K being the number of hidden states).

[0081] This technical solution, by introducing discrete hidden state sequences and Markov chains into a deep probabilistic autoregressive model, combined with a first parameterized network and sampling mechanism, can accurately capture the dynamic changes in pedestrian flow time patterns. It solves the problem that existing technologies are unable to mine high-order potential dependencies in the time dimension. The generated time series weight matrix can more accurately quantify the impact of different time points on the prediction results, further improving the model's time series prediction capabilities.

[0082] In one feasible embodiment, the first parameterized network is a multi-head multilayer perceptron, comprising multiple parallel fully connected sub-networks, each of which corresponds to a hidden state, for estimating the parameters of the conditional probability distribution in the current hidden state based on the temporal weights at the preceding specific time points.

[0083] The Multi-head Multi-Layer Perceptron (MH-MLP) is a neural network model consisting of multiple parallel fully connected sub-networks (MLP sub-layers) and a total fully connected layer. It can extract input features from multiple perspectives simultaneously, improving the accuracy of parameter estimation.

[0084] A fully connected subnetwork refers to a single multi-layer perceptron (MLP) set up in parallel within a multi-head multi-layer perceptron. Each subnetwork has an independent input layer, hidden layer, and output layer, and is used for feature processing for specific hidden states.

[0085] Each fully connected subnetwork takes the temporal weights at a specific preceding time point as input, and obtains the parameters of the conditional probability distribution in the current hidden state through nonlinear transformation of the hidden layer and mapping of the output layer. For example, for a fully connected subnetwork corresponding to the peak hidden state, after inputting the preceding temporal weights, the output conditional probability distribution in this state has a mean of 0.6 and a variance of 0.02.

[0086] The parameters of a conditional probability distribution are numerical values ​​used to define the specific form of the conditional probability distribution. For example, the mean μ and variance σ² of a Gaussian distribution, and the success probability p of a binomial distribution. These parameters determine the shape and location of the conditional probability distribution.

[0087] This technical solution defines the first parameterized network as a multi-head multilayer perceptron. Through the one-to-one correspondence between multiple parallel fully connected sub-networks and the hidden states, it can accurately estimate the parameters of the conditional probability distribution for different hidden states. This avoids the inadequacy of a single network in fitting complex features, improves the estimation accuracy of the temporal weight conditional probability distribution, and thus enhances the generation quality of the temporal weight matrix and the overall prediction accuracy of the model.

[0088] In one feasible embodiment, the initial spatial dependency factor model includes the generative relationship between spatial dependency factors and low-dimensional latent variables. The process of generating the spatial dependency factor matrix using the spatial dependency factor model includes: Based on the relationship between the spatial dependence factor and the generation of low-dimensional latent variables, shared low-dimensional latent variables are sampled from a preset prior distribution. Based on the shared low-dimensional latent variables, the probability distribution parameters of the spatial dependence factors are learned through the second parameterized network. The spatial dependence factor matrix is ​​generated based on the probability distribution parameters.

[0089] Among them, the spatial dependence factor refers to the factor used to characterize the spatial correlation strength between different monitoring points. It is the core component of the spatial dependence factor matrix. For example, the spatial dependence factor between monitoring point A and monitoring point B is 0.8, indicating that the spatial correlation between the two is high.

[0090] Low-dimensional latent variables refer to latent variables with lower dimensionality that cannot be directly observed. They are used to control the generation of spatially dependent factors. Their dimensionality is much lower than that of the original population flow data. For example, if the original data has a dimension of 100, the dimension of the low-dimensional latent variable can be 10.

[0091] Generative relations refer to the mapping relationship between spatially dependent factors and low-dimensional latent variables. In other words, spatially dependent factors are generated by low-dimensional latent variables through a specific function. This relationship is the core presupposition logic of the spatially dependent factor model.

[0092] The preset prior distribution refers to the probability distribution that the low-dimensional latent variables follow in advance, such as the normal distribution, the uniform distribution, etc. The specific distribution can be determined according to the actual application scenario.

[0093] Low-dimensional latent variables that can be shared by multiple monitoring points are used to capture the spatial features shared by each monitoring point. For example, all monitoring points in a scenic area share a low-dimensional latent variable with a dimension of 8.

[0094] The second parameterized network refers to a neural network used to learn the probability distribution parameters of spatially dependent factors from shared low-dimensional latent variables, such as multilayer perceptrons (MLP) and convolutional neural networks (CNN).

[0095] The probability distribution parameters of spatially dependent factors are numerical values ​​used to define the specific form of the probability distribution of spatially dependent factors, such as the mean and variance of a Gaussian distribution. These parameters are learned by the second parameterized network.

[0096] In this scheme, the initial spatial dependency factor model uses the generation relationship between spatial dependency factors and low-dimensional latent variables as the core logical component to guide the generation of spatial dependency factors. A probability distribution sampling algorithm is used to randomly sample values ​​from a pre-defined prior distribution to obtain the specific values ​​of the shared low-dimensional latent variables. For example, a shared low-dimensional latent variable with dimension 8 is sampled from a normal distribution with a mean of 0 and a variance of 1. Then, using the shared low-dimensional latent variable as input, the network parameters are continuously adjusted through backpropagation to learn the optimal parameters of the spatial dependency factor probability distribution. For example, through 1000 iterations, the mean vector and variance matrix of the spatial dependency factor probability distribution are obtained. Based on the probability distribution parameters learned by the second parameterized network, the specific generation rules of the spatial dependency factors are determined. For example, based on the mean vector μ and the variance matrix Σ, spatial dependency factors following an N(μ,Σ) distribution are generated. Based on the probability distribution parameters, spatial dependence factors between monitoring points are generated through random sampling or deterministic calculation. These factors are then arranged in rows and columns to form a spatial dependence factor matrix. For example, spatial dependence factors between three monitoring points are generated, forming a 3x3 spatial dependence factor matrix.

[0097] This technical solution, by pre-setting the generation relationship between spatial dependency factors and low-dimensional latent variables in the spatial dependency factor model, and combining the process of prior distribution sampling, second parameterized network learning, and probability distribution parameter-guided generation, can effectively explore the potential spatial correlation between different monitoring points. It solves the problem that existing technologies are unable to capture high-order potential dependencies in spatial dimensions. The generated spatial dependency factor matrix can accurately quantify the spatial correlation strength, providing support for improving the model's spatial feature capture capability and prediction accuracy.

[0098] In one feasible embodiment, the step of training the pedestrian flow prediction model based on the variational inference algorithm for pedestrian flow prediction includes: An intermediate probability function is introduced for the latent variables of the deep probabilistic autoregressive model and the spatially dependent factor model; The posterior probabilities of the latent variables in the deep probabilistic autoregressive model and the spatially dependent factor model are solved by the intermediate probability function, so as to train the deep probabilistic autoregressive model and the spatially dependent factor model.

[0099] Among them, latent variables refer to discrete latent states and time-series weights in deep probabilistic autoregressive models, as well as low-dimensional latent variables and spatially dependent factors in spatially dependent factor models, which are variables that cannot be directly observed. These variables are the core parameters that need to be estimated during model training.

[0100] An intermediate probability function is an auxiliary probability distribution function introduced to approximate the posterior probability of a latent variable. It is also called a variational distribution, such as a fully factorized variational distribution. The form of this function is usually chosen to be a probability distribution that is easy to compute.

[0101] Posterior probability refers to the probability distribution that latent variables follow after observing historical spatiotemporal pedestrian flow matrix data. It can reflect the uncertainty of latent variables under known data conditions and is the core probability distribution that needs to be solved during model training.

[0102] This approach can add intermediate probability functions to the latent variables of deep probabilistic autoregressive models and spatially dependent factor models, clarifying the correspondence between the intermediate probability functions and the latent variables. For example, a Gaussian intermediate probability function can be introduced for time-series weighted latent variables. By maximizing the lower bound of evidence, the complex problem of solving the posterior probability of latent variables is transformed into a simple problem of optimizing the parameters of the intermediate probability function, ultimately obtaining an approximate solution to the posterior probability of latent variables. For example, by maximizing the lower bound of evidence through the gradient ascent algorithm, the mean and variance of the posterior probability can be obtained.

[0103] This technical solution, by introducing an intermediate probability function and using variational inference algorithm to solve the posterior probability of latent variables, effectively solves the problem that the posterior probability of latent variables in complex models is difficult to calculate directly. It simplifies the complexity of model training, improves training efficiency, and ensures the accuracy of model parameter adjustment. This enables the model to fully learn the spatiotemporal characteristics of historical pedestrian flow data, further improving the model's prediction accuracy and robustness.

[0104] To enable those skilled in the art to more clearly understand the technical solution provided in this application, this application also provides a preferred embodiment. The specific embodiment is as follows: Step 1: Determining the training dataset; When predicting visitor flow at various locations within a scenic area, the visitor flow data recorded by different camera locations are correlated and mutually influential. Therefore, visitor flow prediction is essentially a spatiotemporal series prediction problem. During model training, the dataset selected is the visitor flow data captured by cameras at different locations at various time periods as the training set STS, as shown in Formula 1 below. After the model is trained, it predicts visitor flow for future time periods.

[0105] Formula 1, ; STS stands for Training Spatial-Temporal dataset, which is the overall dataset used for model training. It contains spatiotemporal pedestrian flow data from multiple monitoring points within the target area, and its core function is to provide basic data support for subsequent model training. A1, A2, ..., A 1pThese represent different monitoring points (such as the locations of cameras deployed at scenic spot entrances and major intersections within a scenic area). The subscripts 1, 2, ..., 1p are unique identifiers for each monitoring point, used to distinguish monitoring points in different spatial locations. For example, A1 could represent a monitoring point at the scenic area entrance, while A2 could represent a monitoring point at a core scenic spot. TS1, TS 21 , ..., TS p Each of these corresponds to the time series pedestrian data of each monitoring point. The subscript is associated with the corresponding monitoring point identifier and represents the pedestrian flow data recorded by the monitoring point at different time periods. For example, TS1 is the time series pedestrian flow data of monitoring point A1, which includes the pedestrian flow records of A1 over a period of time (such as daily or hourly).

[0106] Step 2: Data preprocessing; Data preprocessing is used to address defects in the dataset such as missing values ​​and extreme values. Missing values ​​and negative values ​​are removed using data filtering, while extreme values ​​are filtered based on road width information thresholds. The algorithm logic is as follows: Input: Training dataset STS, event / holiday information K, threshold information F; Output: Noise-reduced data in STSM format; Step 1: Iterate through the dataset and define all negative values ​​as 0; Step 2: Traverse the dataset and define all NA values ​​as 0; Step 3: Traverse the dataset. Data exceeding the threshold K is defined as noise, and the average of the pedestrian flow at the two time points before and after is used to replace it.

[0107] Step 3: Feature enhancement based on sliding window statistics; To better predict pedestrian traffic, different time windows of varying scales can be set for each time series data point. Basic statistical information such as the mean, variance, and mean difference within each time window can be calculated to uncover potential trends. The number and span of windows can be adjusted according to specific task objectives. The window construction scheme in this method is shown in Table 1 below. Table 1: Step 4: Training and prediction based on the improved DSARF model; Figure 2 This is a schematic diagram of a DSARF model structure provided in an embodiment of this application. Figure 2 As shown, the DSARF (DeepSwitching Auto-Regressive Factorization) model is a deep generative model suitable for predicting spatiotemporal sequence data, and it has been proven to be effective in trajectory prediction and traffic prediction.

[0108] The improved implementation process for transferring this model to the field of scenic area visitor flow prediction is as follows: Input a dataset consisting of pedestrian flow data from multiple camera locations processed in steps two and three, changing over time: {X1,…,Xn}. Each... Using the idea of ​​matrix factorization, we assume that each Xn can be decomposed into a state of weighted combination of T spatial factors, which is much smaller than D, as shown in Formula 2 below: Formula 2, ; in, It is the first Spatial Factor It is a point in time. When applying temporal weights, observation noise should also be set during matrix / tensor decomposition. , This represents the number of dimensions of pedestrian flow characteristics at a single monitoring point, i.e., the total number of pedestrian flow-related features collected at each monitoring point at a single point in time. For example, if the historical pedestrian flow data of a monitoring point includes three types of features: "number of people entering and exiting per hour, cumulative number of people staying, and instantaneous density," then the number of dimensions of pedestrian flow characteristics at that monitoring point is... The value is 3; if we combine event and festival statistics with weather-related features, there are a total of 8 types of features, then... The value is 8. The value can be determined in two ways: empirically, based on the conventional data collection dimensions of monitoring points in the target area, as is common in scenic areas. The value ranges from 3 to 10. For example, when only core pedestrian flow data is collected, D=3; when multi-dimensional auxiliary features are integrated, D=8-10. The value is determined by data-driven selection, which is achieved by statistically analyzing the feature dimensions of historical pedestrian flow data. If the number of features at a single time point for each monitoring point in the dataset is m, then D=m, ensuring that the value completely matches the dimensions of the actual collected data. Figure 3 This is a schematic diagram of DSARF matrix / tensor decomposition modeling provided in the embodiments of this application.

[0109] Assuming Temporal Weight It is generated by a deep probabilistic autoregressive model.

[0110] The time lag step size is of The value of and a series of discrete hidden states controlled by the Markov chain. The effect is as follows, as shown in Formula 3: Formula 3, ; It satisfies a nonlinear functional relationship with its next moment, as shown in Formula 4 below: Formula 4, ; in, ; This completes the modeling of Temporal Weight. Figure 4 This is a schematic diagram of the DSARFTemporal Weight modeling process provided in the embodiments of this application.

[0111] For the Spatial Factor, it is assumed that it is affected by shared low-dimensional hidden variables. Control, as shown in Formula 5: Formula 5, ; The mapping relationship satisfies a nonlinear function. Figure 5 This is a schematic diagram illustrating the DSARF Spatial Factor modeling provided in an embodiment of this application. The modeling process for the Spatial Factor is as follows: Figure 5 As shown.

[0112] Based on the above three-layer model, since each layer of the model has latent variables, variational inference is used to train the model: Variational inference refers to the process of introducing an intermediate probability function during the input of training data. To solve for the posterior probabilities of the parameters we introduced in our modeling. This completes the construction of the entire model, and the sign that training is complete is: The specific derivation process is as follows: Define all parameters in the model as and the posterior probability In logarithmic form, as shown in Formula 6: Formula 6, ; Introduce a probability distribution function In Equation 6, this probability distribution function is used for fitting. The posterior probability is obtained as shown in Formula 7 below: Formula 7, ; Taking the expectation of both sides of Equation 7 with respect to the variables, we get Equation 8: Formula 8, ; The first term on the right side of Formula 8, known as Evidence Low Bound (ELBO), is defined as follows: Also known as The variation is defined as the second term on the right-hand side of the formula as... The value of this term is greater than or equal to 0, which leads to formula 9. Formula 9, ; Based on the above calculations, The problem of fitting the posterior probability is transformed into solving The problem of maximum value. By adjusting the parameters Maximizing ELBO, learned a method based on Deep models of datasets, through parameter... Maximizing the ELBO, we use Bayesian inference to establish an approximate distribution of the hidden state for each data point. Define latent variables The observed values ​​and potential probability distribution of the generative model are shown in Formula 10 below: Formula 10, ; Where n represents the total number of monitoring points in the target area participating in the collection of pedestrian flow data and model training, that is, the total number of monitoring points and time series pairs contained in the training dataset. For example, if a scenic area deploys 12 monitoring points at major intersections, attraction entrances, and transfer areas, and each monitoring point collects historical pedestrian flow data, then N=12 in the formula; if only 8 monitoring points with qualified data are selected for training, then N=8.

[0113] The posterior distribution of the hidden state is approximated by a fully factorized variational distribution, as shown in Equation 11 below: Formula 11, ; When deriving ELBO, the formulas in formulas 9 and 10 are used. and Substituting into equation 7, we obtain the following formula 12: Formula 12, ; KL (as explained above) )= ,and The above equation can be simplified to obtain the parameters. The variation is given by the following formula 13: Formula 13, ; By parameterizing the variational parameters in Equation 13, we can obtain: Formula 14, ; Formula 15, ; Formula 16, ; Formula 17, ; Formula 18, ; Next, we need to parameterize the terms in Equations 7 to 11, based on the modeling of Temporal Weight and the discrete hidden states. Status at each point in time Because it is controlled by a Markov chain, we can obtain: Formula 19, ; Formula 20, ; It is in a hidden state. The state transition matrix, yes The posterior parameter matrix. Because Depend on and corresponding time points Decision, assumption The marginal probability distribution conforms to a Gaussian mixture distribution: Formula 21, ; Using a multi-head multilayer perceptron (MLP) to analyze state features and Parameterization is performed; a multi-head multilayer perceptron is a neural network model that uses fully connected layers to connect multiple MLPs. Figure 6 This is a schematic diagram of the MLP sublayer structure provided in the embodiments of this application. Figure 7 This is a schematic diagram of the overall structure of the multihead MLP provided in the embodiments of this application.

[0114] Each hidden state Controlled As input, the Gaussian parameters are estimated using a multihead MLP, as shown in Equation 22 below: Formula 22, , ; in For the defined fully connected layer function, The activation function is Leaky ReLU.

[0115] for Similarly, it is assumed to follow a Gaussian mixture distribution and parameterized using an MLP, where the common latent variables are... It follows a normal distribution, as shown in Formula 23: Formula 23, ; After completing the above steps to calculate the approximate model, and having the Spatial factors and Temporal Weight, we can then proceed with dataset repair and prediction, as shown in Formula 24 below: Formula 24, ; in It is a hyperparameter of observation noise.

[0116] Application examples: Based on a tourist dataset from a certain tourist attraction, the DSARF model used in this solution is compared with commonly used time series prediction models in the industry: XGboost, LightGBM, LSTNet, and LSTM. NRMSE is used for evaluation. The tourist flow data from March 31, 2018 to March 31, 2019 is selected as the training set to predict data from July 1 to July 31, 2019. The results are shown in Table 2. Table 2: As shown in Table 2 above, the DSARF model has a greater advantage in prediction accuracy when predicting visitor flow in scenic areas.

[0117] This proposal suggests a scenic area traffic prediction method based on the Deep Switching Auto-Regressive Factorization model. It improves the fully connected layer and activation function in the parameterization of the neural network in the original method, and solves the "dead neuron" problem in the original method.

[0118] Furthermore, when predicting pedestrian flow, the method utilizes the concept of matrix / tensor decomposition to decompose the target data into a product of temporal weights and spatial factors. It then solves for low-dimensional temporal weights and spatial factors through stochastic variational inference to fit the target data, enabling more robust short-term and long-term pedestrian flow prediction for scenic areas.

[0119] Finally, a special enhancement method more suitable for detecting visitor flow in scenic areas was adopted, which improved the accuracy of visitor flow prediction.

[0120] Compared with the prior art, the proposed application has the following technical effects: When using crowd flow data recorded by multiple cameras to predict crowd flow in scenic areas, it is equivalent to solving the prediction problem of multivariate spatiotemporal sequences. Multivariate spatiotemporal sequences often exhibit correlations between multiple dimensions, which can be considered to be dominated by some underlying hidden features. The proposed method uses a nonlinear vector autoregressive generative model parameterized by a neural network controlled by discrete Markov chains, which can capture more high-order multimodal latent dependencies and achieve higher prediction accuracy, especially with greater advantages in long-term prediction.

[0121] Figure 8 This is a schematic diagram of the structure of a pedestrian flow prediction device provided in an embodiment of this application. Figure 8 As shown, the pedestrian flow prediction device includes an acquisition module 810, a matrix construction module 820, and a training module 830.

[0122] The acquisition module 810 is used to acquire historical pedestrian traffic data from multiple monitoring points within the target area.

[0123] The matrix construction module 820 is used to construct a historical spatiotemporal pedestrian flow matrix for each monitoring point based on historical pedestrian flow data from multiple monitoring points.

[0124] The training module 830 is used to input the historical spatiotemporal pedestrian flow matrix into the initial pedestrian flow prediction model and train the pedestrian flow prediction model based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model.

[0125] Among them, the deep probabilistic autoregressive model generates a temporal weight matrix to capture the temporal pattern of pedestrian flow based on temporal and spatial constraints during the training process, and the spatial dependency factor model generates a spatial dependency factor matrix to capture the spatial pattern of pedestrian flow based on temporal and spatial constraints during the training process. The temporal and spatial constraints are that the historical spatiotemporal pedestrian flow matrix of each monitoring point can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

[0126] Figure 9 This is a schematic diagram of the hardware structure of the pedestrian flow prediction device provided in an embodiment of this application. The pedestrian flow prediction device may include a processor 901 and a memory 902 storing computer program instructions.

[0127] Specifically, the processor 901 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0128] Memory 902 may include mass storage for data or instructions. For example, and not limitingly, memory 902 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 902 may include removable or non-removable (or fixed) media, or memory 902 may be non-volatile solid-state memory. Memory 902 may be internal or external to the integrated gateway disaster recovery device.

[0129] In one instance, memory 902 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0130] The processor 901 reads and executes computer program instructions stored in the memory 902 to achieve... Figure 1 The pedestrian flow prediction method in the illustrated embodiment.

[0131] Furthermore, in conjunction with the pedestrian flow prediction methods described in the above embodiments, this invention can be implemented using a computer storage medium. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the pedestrian flow prediction methods described in the above embodiments.

[0132] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the pedestrian flow prediction methods described in the above embodiments.

[0133] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.

[0134] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0135] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0136] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0137] The above description is merely a specific embodiment of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.

Claims

1. A method for predicting pedestrian flow, characterized in that, include: Acquire historical pedestrian traffic data from multiple monitoring points within the target area; Based on the historical pedestrian flow data of the multiple monitoring points, a historical spatiotemporal pedestrian flow matrix is ​​constructed for each monitoring point; The historical spatiotemporal pedestrian flow matrix is ​​input into the initial pedestrian flow prediction model, and the pedestrian flow prediction model is trained based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model. The deep probabilistic autoregressive model generates a temporal weight matrix for capturing pedestrian flow time patterns based on temporal and spatial constraints during training. The spatial dependency factor model generates a spatial dependency factor matrix for capturing pedestrian flow spatial patterns based on the temporal and spatial constraints during training. The temporal and spatial constraints are the historical spatiotemporal pedestrian flow matrix for each monitoring point. The historical spatiotemporal pedestrian flow matrix can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

2. The method according to claim 1, characterized in that, After obtaining the trained pedestrian flow prediction model, the method further includes: By inputting historical pedestrian flow data from one or more target monitoring points during a reference historical period into the pedestrian flow prediction model, the pedestrian flow prediction model can be used to predict the pedestrian flow for the one or more target monitoring points during a preset future period.

3. The method according to claim 1, characterized in that, Before constructing the historical spatiotemporal pedestrian flow matrix for each of the multiple monitoring points based on historical pedestrian flow data, the method further includes: The negative and missing values ​​in the historical pedestrian flow dataset are set to zero, and data points exceeding the preset road capacity threshold are regarded as noise data points. The noise data points are replaced by the average data of adjacent time points to obtain the noise-reduced historical pedestrian flow dataset in order to construct the historical spatiotemporal pedestrian flow matrix.

4. The method according to claim 1, characterized in that, The historical pedestrian traffic data includes one or more of the following: average pedestrian traffic, pedestrian traffic variance, pedestrian traffic mean difference, and statistics on the number of days of events or holidays.

5. The method according to claim 1, characterized in that, The initial deep probabilistic autoregressive model contains a discrete sequence of hidden states, each of which is controlled by a Markov chain for its state transitions. The process of generating the time-series weight matrix by the deep probabilistic autoregressive model includes: For each time point in the input historical spatiotemporal human flow matrix, the conditional probability distribution of the current time-series weight is determined by the first parameterized network based on the current hidden state of the Markov chain and the time-series weight of the previous specific time point. Sample from the conditional probability distribution to generate the weight vector for the corresponding time point in the time-series weight matrix.

6. The method according to claim 5, characterized in that, The first parameterized network is a multi-head multilayer perceptron, which includes multiple parallel fully connected sub-networks. Each fully connected sub-network corresponds to a hidden state and is used to estimate the parameters of the conditional probability distribution in the current hidden state based on the temporal weights at the preceding specific time points.

7. The method according to claim 1, characterized in that, The initial spatial dependency factor model includes the generative relationship between spatial dependency factors and low-dimensional latent variables; The process of generating the spatial dependency factor matrix using the spatial dependency factor model includes: Based on the relationship between the spatial dependence factor and the generation of low-dimensional latent variables, shared low-dimensional latent variables are sampled from a preset prior distribution. Based on the shared low-dimensional latent variables, the probability distribution parameters of the spatial dependence factors are learned through the second parameterized network. The spatial dependence factor matrix is ​​generated based on the probability distribution parameters.

8. The method according to any one of claims 1-7, characterized in that, The steps for training the pedestrian flow prediction model based on the variational inference algorithm include: An intermediate probability function is introduced for the latent variables of the deep probabilistic autoregressive model and the spatially dependent factor model; The posterior probabilities of the latent variables in the deep probabilistic autoregressive model and the spatially dependent factor model are solved by the intermediate probability function, so as to train the deep probabilistic autoregressive model and the spatially dependent factor model.

9. A pedestrian flow prediction device, characterized in that, The device includes: The acquisition module is used to acquire historical pedestrian traffic data from multiple monitoring points within the target area; The matrix construction module is used to construct a historical spatiotemporal pedestrian flow matrix for each of the multiple monitoring points based on the historical pedestrian flow data of the multiple monitoring points; The training module is used to input the historical spatiotemporal pedestrian flow matrix into the initial pedestrian flow prediction model, and to train the pedestrian flow prediction model to predict pedestrian flow based on the variational inference algorithm. The pedestrian flow prediction model includes a deep probabilistic autoregressive model and a spatially dependent factor model. The deep probabilistic autoregressive model generates a temporal weight matrix for capturing pedestrian flow time patterns based on temporal and spatial constraints during training. The spatial dependency factor model generates a spatial dependency factor matrix for capturing pedestrian flow spatial patterns based on the temporal and spatial constraints during training. The temporal and spatial constraints are the historical spatiotemporal pedestrian flow matrix for each monitoring point. The historical spatiotemporal pedestrian flow matrix can be obtained by fitting the product of the temporal weight matrix and the spatial dependency factor matrix. When the pedestrian flow prediction model meets the training stopping condition, the trained pedestrian flow prediction model is obtained.

10. A pedestrian flow prediction device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the pedestrian flow prediction method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the pedestrian flow prediction method as described in any one of claims 1-8.

12. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the pedestrian flow prediction method as described in any one of claims 1-8.