Pedestrian flow space distribution prediction method and regional public safety early warning method
By constructing a multi-layer perceptron, attention mechanism and deep neural network, the problem of insufficient understanding of prior knowledge and spatial heterogeneity in the existing technology is solved, and higher prediction reliability and accuracy are achieved.
Patent Information
- Application Number
- CN202510417809.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-04-03
AI Technical Summary
The existing spatial distribution prediction scheme for people flows has the problem of relying on prior knowledge, and the subjective deviation is large; the data-driven method lacks understanding of spatial heterogeneity, insufficient utilization of spatial context information, and low accuracy.
A multi-layer perceptron, attention mechanism and deep neural network are used to build a spatial distribution prediction model for people flow including feature pattern extraction module, spatial feature distance weight extraction module and feature fusion regression module. By learning the flow of people, extracting the pattern matrix, and combining the data of geographical environment factors for weight mining.
The reliability and accuracy of the prediction of the spatial distribution of people's flow are achieved, and the similarity of people's flow patterns and local spatial differences between regions can be captured more accurately, enhancing the model's understanding of the characteristics of people's flow in the region.
Smart Images

Figure CN119940658A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of urban intelligent computing, and in particular relates to a method for predicting the spatial distribution of human flow and a method for early warning of regional public safety. Background Art
[0002] The prediction of the spatial distribution of pedestrian flow can provide data support for the formulation of urban planning, the control of traffic flow, and the early warning of regional public safety. Therefore, the prediction of the spatial distribution of pedestrian flow is of great significance.
[0003] At present, the commonly used prediction schemes for the spatial distribution of human flow are mainly divided into mechanism-driven methods and data-driven methods. The mechanism-driven method is based on the physical laws of human movement and establishes a prediction framework through parameters such as regional attraction and distance attenuation effect. Typical schemes include the improved gravity model, which improves prediction accuracy by quantifying the dynamic relationship between activity space and urban functions; however, such schemes are extremely dependent on the construction and input of prior knowledge and have large subjective deviations. The data-driven method uses machine learning models to mine the objective nonlinear relationship of spatiotemporal data, such as the multi-scale spatiotemporal network scheme and the deep geographical weighted regression model scheme; however, such schemes have problems such as insufficient understanding of spatial heterogeneity and insufficient use of spatial context information, so the accuracy of such schemes is not high. Summary of the invention
[0004] One of the purposes of the present invention is to provide a method for predicting the spatial distribution of human traffic with high reliability and good accuracy.
[0005] A second object of the present invention is to provide a regional public safety early warning method.
[0006] The method for predicting the spatial distribution of human traffic provided by the present invention comprises the following steps: S1. Obtain existing human flow observation sample data and geographical environment factor data; S2. Preprocessing the data information obtained in step S1 to construct a training data set; S3. Based on multi-layer perceptron, attention mechanism and deep neural network, an initial model for predicting the spatial distribution of pedestrian flow is constructed, which includes a feature pattern extraction module, a spatial feature distance weight extraction module and a feature fusion regression module; Among them, the feature pattern extraction module is used to learn the time series characteristics of the pedestrian flow data and obtain the corresponding pattern matrix; the spatial feature distance weight extraction module is used to mine the weight of the geographical environment factor information and obtain the corresponding spatial feature distance weight; the feature fusion regression module is used to fuse the pattern matrix and the spatial feature distance weight, and calculate the final pedestrian flow spatial distribution prediction data; S4. Using the training data set constructed in step S2, the initial model for predicting the spatial distribution of human traffic constructed in step S3 is trained to obtain a prediction model for the spatial distribution of human traffic; S5. Using the spatial distribution prediction model of passenger flow obtained in step S4, predict the spatial distribution of passenger flow in the target area.
[0007] The step S1 specifically includes the following steps: Obtain existing pedestrian flow observation data; Obtain existing geographical environment factor data; the geographical environment factor data includes POI data, road network data and urban environment data.
[0008] The preprocessing described in step S2 specifically includes the following steps: The preprocessing includes averaging and standardization. The averaging process comprises the following steps: According to the set resolution grid, align the spatial resolution of the data information obtained in step S1; The aligned data are averaged and projected into each grid element; The standardization process specifically includes the following steps: The following formula is used for standardization: In the formula is the attribute value of the r1th data information corresponding to the i1th grid after standardization; is the attribute value of the r1th data information corresponding to the i1th grid before standardization; is the maximum value of the r1th data information; is the minimum value of the r1th data information.
[0009] The step S3 comprises the following steps: Based on the multi-layer perceptron neural network, a feature pattern extraction module is constructed; Based on the attention mechanism and deep neural network, a spatial feature distance weight extraction module is constructed; Based on the dimension transformation scheme, a feature fusion regression module is constructed.
[0010] The processing process of the feature pattern extraction module specifically includes the following steps: The mode matrix is calculated using the following formula: In the formula is the kth column in the pattern matrix P; MLP() is the processing function of the multilayer perceptron neural network; X is the input grid data; is the longitude of the input grid i; is the latitude of the input grid i.
[0011] The processing process of the spatial feature distance weight extraction module specifically includes the following steps: The following formula is used to calculate the spatial distance between sample point i and sample point j in the sample point data: In the formula is the spatial distance between grid i and grid j; is the longitude of the input grid j; is the latitude of the input grid j; The following formula is used to calculate the characteristic dimension distance vector between grid i and grid j in the grid data: In the formula is the characteristic dimension distance vector between grid i and grid j; is the eigenvector of grid i; is the eigenvector of grid j; Based on the attention mechanism, the following formula is used to fuse the obtained spatial distance and feature dimension distance vector to obtain a unified spatial feature distance matrix: In the formula is the uniform spatial feature distance of grid i to the rest of the space points; a is the coefficient of the self-attention mechanism; b is the bias term; Q is the query vector in the self-attention mechanism, and , is the linear weight of the query vector transformation; K is the key vector in the self-attention mechanism, and , is the linear weight of the key vector transformation; V is the value vector in the self-attention mechanism, and , is the linear weight of the value vector transformation; F is the concatenation matrix, and , is the i2th element in F; is the feature dimension; Based on the deep neural network, the spatial feature distance weight matrix is calculated using the following formula: In the formula The coordinates in the spatial feature distance weight matrix are The spatial feature distance weight of grid i; is the unified spatial feature distance between grid i and grid n; SFWNN() is the processing function of the spatial feature distance weight extraction network built based on the deep neural network.
[0012] The processing process of the spatial feature distance weight extraction network specifically includes the following steps: The spatial feature distance weight extraction network includes a plurality of hidden layers and an output layer; the plurality of hidden layers and the output layer are connected in series in sequence; For the i-th hidden layer, the processing process is expressed as: In the formula is the output of the i-th hidden layer; is the hyperbolic tangent activation function; It is the layer normalization operation; is the weight matrix of the i-th linear layer; is the bias vector of the i-th linear layer; is the set annihilation probability; It is an annihilation operation. The specific operations are: The value of The probability of annihilation corresponding to the value of is 0, and according to The probability corresponding to the value of remains unchanged; For the output layer, the processing is expressed as: In the formula is the output of the output layer; is the weight matrix of the output linear layer; x is the input of the output layer; is the bias vector of the output linear layer; is the set annihilation probability.
[0013] The processing process of the feature fusion regression module includes the following steps: Based on the dimension conversion solution, the predicted value of the flow of people in the i-th grid is calculated using the following formula: In the formula is the predicted value of the flow of people in the i-th grid; is the hth column in the spatial feature distance weight matrix; is the hth column in the pattern matrix P; is the set coefficient vector; is the feature vector of the i-th grid of the input; is the bias term of the i-th grid of the input.
[0014] The present invention also provides a regional public safety early warning method, comprising the following steps: A. Obtain data information of the target area; B. According to the data information obtained in step A, the spatial distribution of human flow is predicted in the target area using the method for predicting the spatial distribution of human flow; C. Based on the prediction results of the spatial distribution of passenger flow in the target area obtained in step B, the following rules are used to conduct regional public safety warning: If the pedestrian flow prediction result of a certain grid in the target area is greater than the set pedestrian flow threshold, a public safety warning will be issued for the grid area.
[0015] The method for predicting the spatial distribution of pedestrian flow and the method for regional public safety early warning provided by the present invention extracts a pattern matrix by learning the characteristics of regional pedestrian flow and performs weight mining in combination with geographical environmental factor data. This not only realizes the prediction of the spatial distribution of pedestrian flow and the corresponding regional public safety early warning, but also has higher reliability and better accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Schematic diagram of the method flow of the prediction method of the present invention.
[0017] Figure 2 Schematic diagram of the study area of the prediction method embodiment of the present invention.
[0018] Figure 3 The figure is a schematic diagram of the method flow of the early warning method of the present invention. DETAILED DESCRIPTION
[0019] like Figure 1 The figure shows a flow chart of the prediction method of the present invention: the method for predicting the spatial distribution of passenger flow disclosed in the present invention comprises the following steps: S1. Obtain existing human flow observation sample data and geographical environment factor data; specifically including the following steps: Obtain existing pedestrian flow observation data; Obtain existing geographical environment factor data; the geographical environment factor data includes POI data, road network data and urban environment data.
[0020] S2. Preprocessing the data information obtained in step S1 to construct a training data set; The preprocessing process specifically includes the following steps: The preprocessing includes averaging and standardization. The averaging process comprises the following steps: According to the set resolution grid, align the spatial resolution of the data information obtained in step S1; The aligned data are averaged and projected into each grid element; The standardization process specifically includes the following steps: The following formula is used for standardization: In the formula is the attribute value of the r1th data information corresponding to the i1th grid after standardization; is the attribute value of the r1th data information corresponding to the i1th grid before standardization; is the maximum value of the r1th data information; is the minimum value of the r1th data information.
[0021] S3. Based on multi-layer perceptron, attention mechanism and deep neural network, an initial model for predicting the spatial distribution of pedestrian flow is constructed, which includes a feature pattern extraction module, a spatial feature distance weight extraction module and a feature fusion regression module; Among them, the feature pattern extraction module is used to learn the time series characteristics of the pedestrian flow data and obtain the corresponding pattern matrix; the spatial feature distance weight extraction module is used to mine the weight of the geographical environment factor information and obtain the corresponding spatial feature distance weight; the feature fusion regression module is used to fuse the pattern matrix and the spatial feature distance weight, and calculate the final pedestrian flow spatial distribution prediction data; Among them, the adaptive spatial weight mining is carried out through the feature pattern extraction module, and then the local heterogeneous driving mechanism of regional pedestrian flow is mined and perceived through the spatial feature distance weight extraction module; During the specific implementation: based on the multi-layer perceptron neural network, a feature pattern extraction module is constructed; based on the attention mechanism and deep neural network, a spatial feature distance weight extraction module is constructed; based on the dimension conversion scheme, a feature fusion regression module is constructed.
[0022] The processing process of the feature pattern extraction module specifically includes the following steps: The mode matrix is calculated using the following formula: In the formula is the kth column in the pattern matrix P; MLP() is the processing function of the multilayer perceptron neural network; X is the input grid data; is the longitude of the input grid i; is the latitude of the input grid i.
[0023] The processing process of the spatial feature distance weight extraction module specifically includes the following steps: The following formula is used to calculate the spatial distance between sample point i and sample point j in the sample point data: In the formula is the spatial distance between grid i and grid j; is the longitude of the input grid j; is the latitude of the input grid j; The following formula is used to calculate the characteristic dimension distance vector between grid i and grid j in the grid data: In the formula is the characteristic dimension distance vector between grid i and grid j; is the eigenvector of grid i; is the eigenvector of grid j; Based on the attention mechanism, the following formula is used to fuse the obtained spatial distance and feature dimension distance vector to obtain a unified spatial feature distance matrix: In the formula is the uniform spatial feature distance of grid i to the rest of the space points; a is the coefficient of the self-attention mechanism; b is the bias term; Q is the query vector in the self-attention mechanism, and , is the linear weight of the query vector transformation; K is the key vector in the self-attention mechanism, and , is the linear weight of the key vector transformation; V is the value vector in the self-attention mechanism, and , is the linear weight of the value vector transformation; F is the concatenation matrix, and , is the i2th element in F; is the feature dimension; Based on the deep neural network, the spatial feature distance weight matrix is calculated using the following formula: In the formula The coordinates in the spatial feature distance weight matrix are The spatial feature distance weight of grid i; is the unified spatial feature distance between grid i and grid n; SFWNN() is the processing function of the spatial feature distance weight extraction network built based on the deep neural network.
[0024] Among them, the processing process of the spatial feature distance weight extraction network specifically includes the following steps: The spatial feature distance weight extraction network includes a plurality of hidden layers and an output layer; the plurality of hidden layers and the output layer are connected in series in sequence; For the i-th hidden layer, the processing process is expressed as: In the formula is the output of the i-th hidden layer; is the hyperbolic tangent activation function; It is the layer normalization operation; is the weight matrix of the i-th linear layer; is the bias vector of the i-th linear layer; is the set annihilation probability; It is an annihilation operation. The specific operations are: The value of The probability of annihilation corresponding to the value of is 0, and according to The probability corresponding to the value of remains unchanged; For the output layer, the processing is expressed as: In the formula is the output of the output layer; is the weight matrix of the output linear layer; x is the input of the output layer; is the bias vector of the output linear layer; is the set annihilation probability.
[0025] The processing process of the feature fusion regression module includes the following steps: Based on the dimension conversion solution, the predicted value of the flow of people in the i-th grid is calculated using the following formula: In the formula is the predicted value of the flow of people in the i-th grid; is the hth column in the spatial feature distance weight matrix; is the hth column in the pattern matrix P; is the set coefficient vector; is the feature vector of the i-th grid of the input; is the bias term of the i-th grid of the input.
[0026] S4. Using the training data set constructed in step S2, the initial model for predicting the spatial distribution of human traffic constructed in step S3 is trained to obtain a prediction model for the spatial distribution of human traffic; During the training process, the regularization error of the pattern matrix is added, which is expressed as: In the formula is the regularized error value; is the weight parameter; P is the pattern matrix; I is the identity matrix; is the Frobenius norm.
[0027] S5. Using the spatial distribution prediction model of passenger flow obtained in step S4, predict the spatial distribution of passenger flow in the target area.
[0028] The prediction method of the present invention innovatively introduces a crowd flow spatial characteristic pattern matrix mining scheme, which effectively captures the similarity of crowd flow patterns between regions by identifying the potential pattern distribution of crowd flow in different regions and constructing a pattern matrix, which can enhance the model's understanding of regional crowd flow characteristics and make the operation process of the crowd flow spatial prediction model more systematic. The prediction method of the present invention constructs a spatial weight matrix in the model extraction data, mines the spatial local differences of regional crowd flow, and meticulously reflects the local details of the regional crowd flow driving mechanism.
[0029] The prediction method of the present invention is further described below in conjunction with an embodiment: Taking the main urban area of XM City in 2022 (such as Figure 2 Based on the geographical and population information data (as shown), the specific implementation process of the present invention is explained.
[0030] This embodiment uses taxi trajectory data to simulate the inflow and outflow of people in the observation area; collects taxi trajectory data, map POI data, OSM road network data, CLCD land use data, building height data and NDVI data, performs preprocessing, and constructs a regional pedestrian flow driving factor indicator system as a model input feature sample set; constructs a grid with a resolution of 500m, aligns the spatial resolution of the data, and crops the data according to the study area.
[0031] The taxi trajectory data is used as the material to calculate the population inflow and outflow of the regional grid. As the regional passenger flow observation data, the departure and arrival times of the taxi trajectories in the grid are counted. A total of 7007 grids are collected and the data is standardized. According to the three dimensions of infrastructure, built environment and traffic accessibility, the regional passenger flow geographical environment factor index system is constructed and calculated and standardized to construct the model training data set.
[0032] The constructed index system of geographical environment influencing factors includes: infrastructure, built environment and traffic accessibility; among them, infrastructure includes 6 indicators, including hotel accommodation facility density, business company density, science and education culture index, medical facility density, business residential density and tourist attraction density. The built environment includes 3 indicators, including built environment greening intensity, water area ratio and building height; traffic accessibility includes 5 indicators, including travel cost, airport accessibility, railway station accessibility, bus station density and subway station density.
[0033] The prediction method of the present invention is used to construct a model, and the regional passenger flow prediction model is trained for the main urban area of SM City according to the division of training, verification and test sets. The training set is used to fit the model parameters, the verification set is used to test the fitting effect of the model parameters and determine whether to stop training, and the test set is used to test the accuracy of the model's passenger flow prediction effect.
[0034] Finally, the simulation results of the present invention are compared with the goodness of fit using the OLS least squares method and the GNNWR method; the comparison index used is the goodness of fit , root mean square error RMSE and mean absolute error MAE; Among them, the OLS least squares method is the method proposed by Adrien-Marie Legendre in his paper "Nouvelles méthodes pour la détermination des orbites des comètes" in 1805; the GNNWR method is the method proposed by Du Zhenhong in his paper "Geographically neural network weighted regression for the accurate estimation of spatial non-stationarity" in 2020; The final evaluation index comparison is shown in Table 1 and Table 2: Table 1 Comparison of evaluation indicators of regional crowd outflow
[0035] Table 2 Comparison of regional population inflow evaluation indicators
[0036] It can be seen from Table 1 and Table 2 that the method of the present invention performs best in all indicators, thereby proving the reliability and effectiveness of the method of the present invention.
[0037] like Figure 3 The figure shows a schematic diagram of the method flow of the early warning method of the present invention: the regional public safety early warning method disclosed by the present invention comprises the following steps: A. Obtain data information of the target area; B. According to the data information obtained in step A, the spatial distribution of human flow is predicted in the target area using the method for predicting the spatial distribution of human flow; C. Based on the prediction results of the spatial distribution of passenger flow in the target area obtained in step B, the following rules are used to conduct regional public safety warning: If the pedestrian flow prediction result of a certain grid in the target area is greater than the set pedestrian flow threshold, a public safety warning will be issued for the grid area.
Claims
1. A method for predicting the spatial distribution of passenger flow, characterized in that The steps include: S1. Obtain existing human flow observation sample data and geographical environment factor data; S2. Preprocessing the data information obtained in step S1 to construct a training data set; S3. Based on multi-layer perceptron, attention mechanism and deep neural network, an initial model for predicting the spatial distribution of pedestrian flow is constructed, which includes a feature pattern extraction module, a spatial feature distance weight extraction module and a feature fusion regression module; Among them, the feature pattern extraction module is used to learn the time series characteristics of the pedestrian flow data and obtain the corresponding pattern matrix; the spatial feature distance weight extraction module is used to mine the weight of the geographical environment factor information and obtain the corresponding spatial feature distance weight; the feature fusion regression module is used to fuse the pattern matrix and the spatial feature distance weight, and calculate the final pedestrian flow spatial distribution prediction data; S4. Using the training data set constructed in step S2, the initial model for predicting the spatial distribution of human traffic constructed in step S3 is trained to obtain a prediction model for the spatial distribution of human traffic; S5. Using the spatial distribution prediction model of passenger flow obtained in step S4, predict the spatial distribution of passenger flow in the target area.
2. The method for predicting the spatial distribution of human traffic according to claim 1, characterized in that The step S1 specifically includes the following steps: Obtain existing pedestrian flow observation data; Obtain existing geographical environment factor data; the geographical environment factor data includes POI data, road network data and urban environment data.
3. The method for predicting the spatial distribution of human traffic according to claim 1, characterized in that The preprocessing described in step S2 specifically includes the following steps: The preprocessing includes averaging and standardization. The averaging process comprises the following steps: According to the set resolution grid, align the spatial resolution of the data information obtained in step S1; The aligned data are averaged and projected into each grid element; The standardization process specifically includes the following steps: The following formula is used for standardization: In the formula is the attribute value of the r1th data information corresponding to the i1th grid after standardization; is the attribute value of the r1th data information corresponding to the i1th grid before standardization; is the maximum value of the r1th data information; is the minimum value of the r1th data information.
4. The method for predicting the spatial distribution of human traffic according to claim 3 is characterized in that The step S3 comprises the following steps: Based on the multi-layer perceptron neural network, a feature pattern extraction module is constructed; Based on the attention mechanism and deep neural network, a spatial feature distance weight extraction module is constructed; Based on the dimension transformation scheme, a feature fusion regression module is constructed.
5. The method for predicting the spatial distribution of human traffic according to claim 4 is characterized by: The processing of the pattern extraction module specifically includes the following steps: The mode matrix is calculated using the following formula: In the formula is the kth column in the pattern matrix P; MLP() is the processing function of the multilayer perceptron neural network; X is the input grid data; is the longitude of the input grid i; is the latitude of the input grid i.
6. The method for predicting spatial distribution of passenger flow according to claim 5, characterized in that The processing process of the spatial feature distance weight extraction module specifically includes the following steps: The following formula is used to calculate the spatial distance between sample point i and sample point j in the sample point data: In the formula is the spatial distance between grid i and grid j; is the longitude of the input grid j; is the latitude of the input grid j; The following formula is used to calculate the characteristic dimension distance vector between grid i and grid j in the grid data: In the formula is the characteristic dimension distance vector between grid i and grid j; is the eigenvector of grid i; is the eigenvector of grid j; Based on the attention mechanism, the following formula is used to fuse the obtained spatial distance and feature dimension distance vector to obtain a unified spatial feature distance matrix: In the formula is the uniform spatial feature distance of grid i to the rest of the space points; a is the coefficient of the self-attention mechanism; b is the bias term; Q is the query vector in the self-attention mechanism, and , is the linear weight of the query vector transformation; K is the key vector in the self-attention mechanism, and , is the linear weight of the key vector transformation; V is the value vector in the self-attention mechanism, and , Transform linear weights for value vector; F is the concatenation matrix, and , is the i2th element in F; is the feature dimension; Based on the deep neural network, the spatial feature distance weight matrix is calculated using the following formula: In the formula The coordinates in the spatial feature distance weight matrix are The spatial feature distance weight of grid i; is the unified spatial feature distance between grid i and grid n; SFWNN() is the processing function of the spatial feature distance weight extraction network built based on the deep neural network.
7. The method for predicting the spatial distribution of human traffic according to claim 6, characterized in that The processing process of the spatial feature distance weight extraction network specifically includes the following steps: The spatial feature distance weight extraction network includes a plurality of hidden layers and an output layer; the plurality of hidden layers and the output layer are connected in series in sequence; For the i-th hidden layer, the processing process is expressed as: In the formula is the output of the i-th hidden layer; is the hyperbolic tangent activation function; It is the layer normalization operation; is the weight matrix of the i-th linear layer; is the bias vector of the i-th linear layer; is the set annihilation probability; It is an annihilation operation. The specific operations are: The value of The probability of annihilation corresponding to the value of is 0, and according to The probability corresponding to the value of remains unchanged; For the output layer, the processing is expressed as: In the formula is the output of the output layer; is the weight matrix of the output linear layer; x is the input of the output layer; is the bias vector of the output linear layer; is the set annihilation probability.
8. The method for predicting the spatial distribution of human traffic according to claim 7 is characterized by feature fusion The processing of the regression module includes the following steps: Based on the dimension conversion solution, the predicted value of the flow of people in the i-th grid is calculated using the following formula: In the formula is the predicted value of the flow of people in the i-th grid; is the hth column in the spatial feature distance weight matrix; is the hth column in the pattern matrix P; is the set coefficient vector; is the feature vector of the i-th grid of the input; is the bias term of the i-th grid of the input.
9. A regional public safety early warning method, characterized in that The steps include: A. Obtain data information of the target area; B. According to the data information obtained in step A, the spatial distribution of human flow is predicted in the target area using the method for predicting the spatial distribution of human flow as described in any one of claims 1 to 8; C. Based on the prediction results of the spatial distribution of passenger flow in the target area obtained in step B, the following rules are used to conduct regional public safety warning: If the pedestrian flow prediction result of a certain grid in the target area is greater than the set pedestrian flow threshold, a public safety warning will be issued for the grid area.
Citation Information
Patent Citations
Pedestrian volume prediction method in city range based on deep bottleneck residual network
CN111260121A
Urban area flow prediction system and method for vehicle track big data
CN113724504A
Building safety alert level dynamic adjustment method and system based on artificial intelligence driving
CN119204699A
Structured data modeling analysis method based on Transform
CN119577402A
Smart shop data processing method and device based on multi-dimensional data analysis
CN119579220A
Cited By
Prediction model training method, pedestrian flow prediction method, device, equipment, medium and program product
CN120744515A