Urban people flow prediction method based on urban interest point spatio-temporal data set
Through hierarchical perceptual attention fusion, spherical convolutional coding and business hours mask generator, the problem of distortion of text modal semantic structure and spatial relationship in traditional pedestrian flow prediction is solved, and more accurate urban pedestrian flow prediction is achieved.
Patent Information
- Application Number
- CN202511104856.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2045-08-07
AI Technical Summary
Traditional pedestrian flow prediction methods have difficulty in fully utilizing the diverse information of a city, ignore the hierarchical semantic structure of text modalities, use Euclidean distance to distort spatial relationships, fail to consider business hour constraints, have poor training stability, and are unable to adapt to cross-regional and non-business hour predictions.
A hierarchical perceptual attention fusion mechanism is adopted to process the text information of urban points of interest, spherical convolutional coding is used to model spatial relationships, and a business hours mask generator is combined for time constraints. The model parameters are optimized through kernel density estimation and asynchronous learning rate to perform region-aware temporal modeling and multi-task shared prediction.
It strengthens the semantic association of text modalities, accurately models cross-regional spatial relationships, suppresses predictions during non-business hours, improves the training stability and prediction accuracy of the model, adapts to data imbalance, and improves the accuracy and generalization ability of pedestrian flow predictions.
Smart Images

Figure CN120821893A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pedestrian flow prediction, and in particular to a method for predicting urban pedestrian flow based on a spatiotemporal data set of urban points of interest. Background Art
[0002] With the acceleration of urbanization and the advancement of smart city construction, the demand for high-precision pedestrian flow prediction in urban management and operations is increasing. As a key indicator of urban operations, pedestrian flow is widely used in public safety warnings, commercial site optimization, traffic diversion and scheduling, and public resource allocation. Traditional pedestrian flow prediction methods often rely on a single data source, such as historical pedestrian flow records, traffic sensor data, or mobile signaling data. Modeling methods are often based on time series analysis, which makes it difficult to fully utilize the rich and diverse structured and unstructured information in cities, resulting in limited prediction accuracy and generalization capabilities.
[0003] The Chinese invention patent with publication number CN119848365A proposes a point of interest recommendation method and system based on the fusion of subjective and objective factors. It uses Gaussian distribution and two-hop information to capture movement patterns and simulate user travel decisions, while considering personal subjective preferences and objective factors. When considering personal subjective preferences, points of interest are embedded as low-dimensional vectors, and Mahalanobis distance is used as the distance measurement standard to make the embedding space non-flat and stable, thereby expressing the asymmetric relationship between points of interest; when considering objective factors, two-hop information is mined through the global trajectory graph to reflect the association between points of interest and user movement. By combining personal subjective preferences and objective factors, user behavior patterns can be more accurately mined.
[0004] A Chinese invention patent with publication number CN114969007B proposes a method for identifying urban functional areas based on functional mixing and ensemble learning, belonging to the field of digital information technology. The method performs the following steps: 1) data collection and preprocessing; 2) constructing 10 indicator features of the identification system of the urban functional area; 3) structuring indicators; using spatial statistical tools to count the 10 indicator feature data corresponding to each plot; 4) constructing an independent variable data set; 5) labeling the response variable; 6) dividing the training data set into several sub-training sets based on functional mixing; 7) ensemble learning training based on the stacking strategy; 8) connecting the attribute tables to complete the functional area identification of the plot. The present invention separates the training set by grading the functional mixing degree and predicts the prediction set data according to the corresponding functional mixing degree, providing a method for more accurately mining the correlation between urban functional area types and urban characteristics, and realizing the identification of urban functional area types by urban feature mapping.
[0005] The above technical solution has the following problems that still need to be further solved:
[0006] 1. Traditional methods mostly use static splicing or simple embedding, which makes it difficult to mine the hierarchical semantic structure in text modalities and cannot cope with the uneven expression caused by text features of different lengths.
[0007] 2. Existing methods usually use Euclidean distance to model geographic relationships without considering the curvature of the earth, which leads to significant errors when applied at city boundaries or across regions and distorts spatial dependencies.
[0008] 3. Traditional models only use timestamps as numerical inputs, ignoring the rigid constraints of business hours on passenger flow, and are prone to producing erroneous positive predictions during non-business hours such as late at night.
[0009] 4. Conventional loss functions do not consider the spatial distribution differences of points of interest, resulting in poor performance in sparse areas. At the same time, the unified learning rate cannot adapt to the gradient characteristics of each parameter, resulting in poor training stability and slow convergence. Summary of the Invention
[0010] In view of the above-mentioned deficiencies in the prior art, the present invention provides a method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest.
[0011] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:
[0012] A method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest comprises the following steps:
[0013] Obtain a spatiotemporal dataset of city points of interest; the spatiotemporal dataset includes name text, address text, classification code, latitude and longitude coordinates, current timestamp, and business hours information;
[0014] A hierarchical perception and attention fusion mechanism is used to dynamically fuse the name text, address text, and classification coding information of urban points of interest to obtain the point of interest feature vector;
[0015] The regional adaptive spherical convolution coding method is used to perform spherical spatial dependency modeling on the longitude and latitude coordinates of urban points of interest to obtain a spatial coding vector.
[0016] A periodic mask generator is used to encode the current timestamp and business hours information of the city's points of interest into business hours constraints to obtain a time feature vector.
[0017] The spatiotemporal coupling features are extracted based on the feature vectors of the points of interest, the spatial coding vectors and the temporal feature vectors, and the spatiotemporal coupling features are subjected to regional perception time series modeling. The predicted value of pedestrian flow and the probability distribution of congestion level are generated through multi-task shared prediction.
[0018] The present invention has the following beneficial effects:
[0019] (1) The present invention dynamically identifies the semantic association between the name, address and classification code of the point of interest, strengthens the spatial hierarchical semantic expression, and solves the modeling difficulties caused by inconsistent text length.
[0020] (2) The present invention uses the haversine formula to accurately calculate the spherical distance between the point of interest and the administrative center, and combines the transformation matrix of multi-level administrative regions to solve the problem of distortion in cross-regional spatial relationship modeling caused by the curvature of the earth.
[0021] (3) The present invention adopts the joint modeling of business hour mask and sine-cosine time period coding to automatically suppress the prediction output of non-business hours and explicitly model the business hour constraints and the periodicity of passenger flow.
[0022] (4) The present invention obtains higher training weights for sparse region samples through kernel density estimation, and adopts sensitivity-driven asynchronous learning rate allocation for model parameters to achieve joint optimization of data imbalance and training instability problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a flowchart of a method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest;
[0024] Figure 2 Schematic diagram of the attention weight distribution of multimodal features;
[0025] Figure 3 Schematic diagram of the effect of address text length on prediction accuracy;
[0026] Figure 4 This is a schematic diagram for comparing spatial encoding methods;
[0027] Figure 5 Schematic diagram of the effect of coding business hours constraints;
[0028] Figure 6 Schematic diagram of the space-time coupling characteristic tensor;
[0029] Figure 7 Schematic diagram of the impact of residual connections on deep network training;
[0030] Figure 8 Schematic diagram of the predicted effect of the regional perception gating mechanism;
[0031] Figure 9 Schematic diagram of the dynamic behavior of the gating mechanism;
[0032] Figure 10 Schematic diagram of the multi-task shared feature space distribution;
[0033] Figure 11 This is a schematic diagram for comparing the spatial density weighting effects;
[0034] Figure 12 Schematic diagram of the training effect of the gradient sensitive optimizer. DETAILED DESCRIPTION
[0035] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.
[0036] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest, comprising the following steps S1 to S5:
[0037] S1. Obtain a spatiotemporal dataset of city points of interest; the spatiotemporal dataset of city points of interest includes name text, address text, classification code, latitude and longitude coordinates, current timestamp, and business hours information;
[0038] In an optional embodiment of the present invention, step S1 first receives new input data of the target point of interest, including name text, address text, classification code, latitude and longitude coordinates, current timestamp and business hours information, such as the name text is "Starbucks Coffee", the address text is a complete street description, the classification code is a predefined category index, and the timestamp is in hours, such as t=14 represents 2 pm, and the model then gradually performs feature processing and inference.
[0039] In an optional embodiment of the present invention, the training data set is integrated from multiple authoritative sources, and mainly includes basic attribute data of urban points of interest, spatial location data, time-related data, and pedestrian flow annotation data.
[0040] The data sources cover public map service platforms, urban public data open platforms, and IoT sensors deployed around points of interest. These data are obtained in batches through API interfaces or regularly captured and updated through crawler technology to ensure the timeliness and coverage of the data.
[0041] The core attributes of the dataset include the name text, address text, classification code, latitude and longitude coordinates, business hours information, and pedestrian flow annotation of the point of interest.
[0042] The name text and address text are both string types. For example, the name may be "Starbucks Coffee" and the address may be "No. 666, Middle Section of Tianfu Avenue, Wuhou District, Chengdu";
[0043] The classification code uses a predefined category system, such as catering, shopping, tourism, transportation, office, etc. Each category is assigned a unique integer index, such as catering corresponds to index 0;
[0044] Latitude and longitude coordinates are stored as floating-point numbers with an accuracy of six decimal places, and are used to represent the geographic location of a point of interest. Business hours include start and end times, and are stored in hourly format, such as 09:00 and 17:00.
[0045] The pedestrian flow data contains continuous values (such as the number of passengers per hour) and discrete crowding levels (loose, normal, crowded, full), which are generated through historical sensor data or manual verification.
[0046] During the data collection process, name text, address text and classification code are directly obtained through the map API, and longitude and latitude coordinates are converted through GPS devices or geocoding services; business hours information comes from the point of interest details page or self-reporting by merchants.
[0047] The labeling method adopts a semi-automatic process. Specifically, the pedestrian flow values are collected in real time by sensors and aggregated into hourly data. They are then converted into congestion levels using a threshold method. For example, a pedestrian flow of <100 is loose, 100-500 is normal, 500-1000 is crowded, and >1000 is full.
[0048] All data were cleaned and standardized, such as removing duplicate points of interest, filling missing values, and converting text to UTF-8 encoding.
[0049] The organizational structure of the dataset is centered around the spatiotemporal dimension. Each point of interest stores multi-day data in a time series. Specifically, the data is divided by day, and each point of interest contains 24 time point records per day, each of which covers all the above attributes.
[0050] Alternatively, you can use an open-source POI dataset to construct training data, such as the Foursquare dataset, which contains over 1 million POIs worldwide and 22 million check-in records with latitude, longitude, category, and timestamps.
[0051] The Gowalla dataset contains 640,000 check-in records (user ID, time, latitude and longitude, and point of interest ID) and 950,000 social relationships;
[0052] The LibCity dataset integrates more than 30 urban spatiotemporal datasets (traffic, pedestrian flow, points of interest, etc.) into a unified and easy-to-use format.
[0053] It should be noted that the design of the present invention is decoupling. If the open source dataset does not contain the attribute data specifically selected in the present invention, the attribute can be uniformly encoded. For example, if an open source dataset does not contain longitude and latitude, the longitude and latitude attributes can be uniformly encoded as "0" to adapt to the data processing flow and model framework of the present invention.
[0054] S2. Use the hierarchical perception attention fusion mechanism to dynamically fuse the name text, address text, and classification coding information of the city's points of interest to obtain the point of interest feature vector;
[0055] In an optional embodiment of the present invention, step S2 performs dynamic fusion of multimodal features. Specifically, the name text and address text are respectively converted into fixed-dimensional vectors through a pre-trained text embedding layer, and the classification code is processed by a one-hot encoding and projection layer; then, the hierarchical perception attention mechanism dynamically calculates the weight of each modality to generate a unified point of interest feature vector.
[0056] Urban point of interest data contains multimodal features such as text information and classification codes. Conventional methods usually use static splicing or simple embedding techniques to process these features, but it is difficult to effectively capture the dynamic correlation between different modal features and cannot identify the spatial hierarchical semantic structure contained in the address text. At the same time, it is difficult to perform robust feature representation when the length of address description text varies greatly.
[0057] The present invention adopts a hierarchical perceptual attention fusion mechanism to dynamically assign weights to different modal features and fuse them. Specifically, first, the name text, address text, and classification code of the point of interest are represented separately to generate fixed-dimensional vectors. Then, the attention mechanism is used to dynamically calculate the importance weight of each modality based on the semantic association between the name and address text. Finally, these weights are used to perform weighted fusion on the feature vectors of each modality to generate a unified point of interest feature vector, thereby strengthening the relevance of spatial semantics and alleviating the problem of ineffective feature representation caused by differences in address text length. The specific steps are as follows:
[0058] S201. Multimodal feature embedding and concatenation
[0059] The name text, address text, and classification code of the point of interest are represented by features. Specifically, the name text and address text are converted into fixed-dimensional vectors through independent text embedding layers, and the classification code is projected to the same dimension after one-hot encoding. Then, the name embedding vector, address embedding vector, and classification projection vector are concatenated column by column to form the initial feature matrix, which is expressed as:
[0060]
[0061] Where, is the initial feature matrix of the p-th interest point, with a dimension of D×M; D is the embedding dimension; M represents the number of modalities, such as M=3, name / address / category; Embed1(·) is the first text embedding layer; Embed2(·) is the second text embedding layer; name p is the name text of the pth point of interest; addr p is the address text of the p-th point of interest; cat p is the classification code of the p-th interest point; p is the interest point index; OneHot(·) represents the one-hot encoding of the classification feature; [·; ·; ·] represents the vector splicing operation.
[0062] It should be noted that Embed1(·) and Embed2(·) serve as text embedding layers to convert text into a fixed-dimensional vector with an embedding dimension of D. In addition, OneHot(·) is used as the one-hot encoding of the categorical features to generate a vector of the category dimension. The final matrix dimension is D×M.
[0063] It should also be noted that OneHot(cat p ) is a vector of category dimensions. Assuming the number of categories is C, it is possible that C≠D, but a D×M matrix must be formed. Therefore, in actual implementation, the one-hot encoding needs to be projected into D dimensions, for example, through a learnable fully connected layer.
[0064] In one embodiment, assuming a POI is a coffee shop, the specific parameters are set as: embedding dimension D = 64, number of modalities M = 3, and assuming there are 5 categories, for example, index 0: "catering", 1: "shopping", 2: "travel", 3: "transportation", 4: "office"), so C = 5;
[0065] The text embedding layer uses pre-trained word embedding, such as Word2Vec word embedding, and outputs a D-dimensional vector;
[0066] Point of interest data is, name name p :"Starbucks Coffee", address addr p :"No. 666, Middle Section of Tianfu Avenue, Wuhou District, Chengdu", Category cat p : "catering", corresponding to category index 0;
[0067] When constructing the initial multimodal feature matrix, for the input text "Starbucks Coffee", we might first segment it into ["Starbucks", "Coffee"], then use the embedding layer to obtain the vector for each word, outputting a D = 64-dimensional vector, for example, Embed1("Starbucks Coffee") = [0.15, -0.22, 0.31, ..., 0.08] (64 elements) (Note: The actual values are learned by the model, and this is for illustrative purposes only; the vector elements typically range from [-1, 1]).
[0068] Furthermore, for the input text "No. 666, Middle Section of Tianfu Avenue, Wuhou District, Chengdu", since the address text is long, the embedding layer can use average pooling to process the long sequence and output a D = 64-dimensional vector, such as Embed2("No. 666, Middle Section of Tianfu Avenue, Wuhou District, Chengdu") = [-0.18, 0.25, 0.12, ..., -0.05] (64 elements) (Note: The actual value is learned by the model, and this is only for illustration; the vector element range is usually around [-1, 1]);
[0069] Furthermore, input the category: "catering", the category index is 0, and one-hot encoding is used to generate a C = 5-dimensional vector, specifically, OneHot("catering") = [1,0,0,0,0], and then projected to D dimensions. Since the one-hot encoding is 5-dimensional, and the matrix requires D×M, that is, each column must be D-dimensional, it is necessary to project to 64 dimensions through a learnable fully connected layer, represented as v cat =W proj OneHot(cat p )+b proj , where W proj is a 64×5 weight matrix, a learnable parameter, and b proj is a 64-dimensional bias vector, which is a learnable parameter. The example output is v cat = [0.10, -0.30, 0.05, ..., 0.20] (64 elements) (Note: The actual value is learned by the model, this is just for illustration; the vector element range is usually around [-1, 1]);
[0070] Furthermore, construct the initial feature matrix The vectors of the three modes are concatenated as columns, expressed as Among them, the first column is the name modal feature, the second column is the address modal feature, and the third column is the classification modal feature.
[0071] S202, Attention Weighted Feature Fusion
[0072] Based on the semantic association of the name and address modalities, a query vector is generated. The attention weight of each modality is calculated. Then, the feature column vectors of each modality in the initial feature matrix are weighted and summed using this weight. The sum is multiplied by the projection matrix of the corresponding modality and fused to generate the point of interest feature vector. The contribution of different modalities is then dynamically adjusted to strengthen the spatial semantic association and solve the problem of address text length differences. It is expressed as:
[0073]
[0074] Where V p is the pth fused interest point feature vector; is the attention weight of the mth modality of the pth interest point, and the calculation method is expressed as W m is the projection matrix of the mth mode, which is a learnable parameter; m is the mode index; for The characteristic column vector corresponding to the mth mode; exp(·) is the natural exponential function; q p is the query vector of the p-th point of interest, generated by a multi-layer perceptron, and expressed as for The feature column vector corresponding to the name mode in , that is, the name embedding vector extracted from the initial feature matrix; for The feature column vector corresponding to the address modality in , that is, the address embedding vector extracted from the initial feature matrix; MLP(·) represents a multi-layer perceptron, that is, a multi-layer fully connected neural network; q p The transpose of k m is the key vector of the mth mode, which is a learnable parameter; k j is the key vector of the jth mode, which is a learnable parameter; d k is the key vector dimension, and the specific value can be adjusted according to the embedding dimension D, such as d k =D, or take the empirical value, such as d k =64.
[0075] It should be noted that through the attention weight Dynamically adjusting the contribution of name, address, and classification modes can solve the feature imbalance problem caused by the difference in address text length. At the same time, using the query vector q p Explicitly capture the semantic association between names and addresses and strengthen spatial hierarchical semantics.
[0076] It should also be noted that the query vector It can capture the semantic association between name and address rather than static splicing, and the attention weight Dynamically compute modal importance by scaling dot products, Prevent gradient disappearance and make the feature column vector of long address text It can adjust weights based on semantic associations to alleviate the problem of feature representation imbalance caused by differences in text length.
[0077] S3, using a regional adaptive spherical convolution coding method to perform spherical spatial dependency modeling on the longitude and latitude coordinate information of the city's points of interest to obtain a spatial coding vector;
[0078] In an optional embodiment of the present invention, step S3 performs spherical spatial dependency modeling. Specifically, based on the latitude and longitude coordinates of the point of interest, the semi-vector formula is used to accurately calculate its spherical distance to the center of the multi-level administrative region to eliminate the distortion caused by the curvature of the earth; then, a spatial coding vector is generated through distance-aware weighted fusion to accurately capture cross-regional spatial dependencies.
[0079] The latitude and longitude coordinates of points of interest imply spatial dependence. Conventional methods usually use Euclidean distance to calculate spatial relationships. However, in geographic space, especially in cross-regional scenarios, Euclidean distance will produce significant distortion due to ignoring the curvature of the earth, resulting in increased errors in encoding spatial relationships near regional boundaries and failure to accurately reflect the true geographic distance.
[0080] The present invention adopts a regional adaptive spherical convolution coding method. First, the semi-vector formula is used to accurately calculate the spherical distance from the point of interest to the center of each level of administrative region to eliminate the distance calculation distortion caused by the curvature of the earth. Then, based on these calculated spherical distances, the transformation matrix unique to each administrative region is weightedly fused to achieve distance perception. Finally, the final spatial coding vector is generated through activation function processing, thereby accurately modeling the spatial dependencies under multi-level regional coverage and solving the problem of cross-regional spatial modeling distortion. The specific steps are as follows:
[0081] S301, spherical distance calculation
[0082] The haversine formula is used to calculate the spherical distance from the point of interest to the center of each administrative region. Specifically, the input parameters are the latitude and longitude coordinates of the point of interest and the latitude and longitude coordinates of the center of the target region. The haversine distance is used to output a scalar distance value. By considering the influence of the earth's curvature, the distance distortion when crossing regions is eliminated, which is expressed as:
[0083]
[0084] Where ΔDist p,r is the spherical distance from the pth point of interest to the center of the rth region, measured in kilometers, but as a scalar, no unit is substituted in the calculation; lon p is the longitude coordinate of the pth point of interest; lat p is the latitude coordinate of the pth point of interest; is the longitude coordinate of the center of the rth administrative region; is the latitude coordinate of the center of the rth administrative region; r is the administrative region index; Ha(·) represents the haversine distance, and its inputs are defined as x1, x2, x3, and x4, respectively, where x1 is the first parameter of the haversine distance, corresponding to lon in the present invention. p , x2 is the second parameter of the haversine distance, corresponding to lat p , x3 is the third parameter of the haversine distance, corresponding to the present invention x4 is the fourth parameter of the haversine distance, corresponding to Then the calculation method of the haversine distance is expressed as R is the radius of the Earth, which is approximately 6371. The unit is measured in kilometers, but as a scalar quantity, no unit is included in the calculation.
[0085] It should be noted that the spherical distance ΔDist p,r The haversine formula containing arcsin and trigonometric function terms is used to accurately calculate the distance on the curved surface of the earth, replacing the Euclidean distance and solving the problem of cross-regional distance distortion.
[0086] S302, multi-level spatial coding generation
[0087] Based on the spherical distance from the point of interest to the multi-level administrative regions, the distance normalization weight is calculated. Then, the weighted sum of the transformation matrix unique to each region is used. After being processed by the activation function, a spatial coding vector is generated to achieve spatial dependency modeling of multi-level regional coverage. The distance attenuation effect is controlled by the distance sensitivity factor, which is expressed as:
[0088]
[0089] Where S p is the spatial encoding vector of the p-th interest point; is the set of K administrative regions to which the p-th point of interest belongs, including provinces, cities, districts and counties; β s is the distance sensitivity factor, which controls the steepness of distance attenuation, such as β s =0.5; Soft(-β s ΔDist p,r ) represents the normalized weight based on negative distance, the closer the distance, the greater the weight; W r is the transformation matrix unique to the rth administrative region and is a learnable parameter; Ge(·) is the GeLU activation function.
[0090] It is necessary to explain that when calculating the spatial coding vector, multi-level regional coverage is achieved through Softmax weighting. For example, tourist attractions are affected by both the district and the upper-level city, and Soft(-β s ΔDist p,r ) item realizes normalized weight through negative distance exponential decay. The closer the distance, the greater the weight. The distance sensitivity factor β s Accurately control the distance attenuation effect, adaptively adjust the impact intensity of multi-level regions of provinces / cities / districts, and solve the problem of cross-regional spatial modeling distortion.
[0091] S4, using a periodic mask generator to perform business hour constraint encoding on the current timestamp and business hour information of the city point of interest to obtain a time feature vector;
[0092] In an optional embodiment of the present invention, step S4 performs business hour constraint encoding. Specifically, the business start and end times are linearly transformed to generate a mask vector, and the time feature vector is constructed in combination with the sine-cosine periodic signal of the current timestamp to ensure that the output during non-business hours is close to zero.
[0093] The business hours of a point of interest often result in its foot traffic being constantly zero during non-business hours. Conventional models directly use timestamps as input features and are unable to explicitly model this hard constraint brought about by business hours. As a result, the model may predict non-zero values during non-business hours, and it is difficult to effectively capture the cyclical changes in foot traffic over time.
[0094] This paper uses a periodic mask generator. First, the business start and end times are encoded into learnable vectors. An activation function is then used to generate a business status mask vector. This vector can automatically learn the characteristic of the output approaching zero during non-business hours during training. Then, a time feature of sine and cosine periodic signals containing hourly timestamps is constructed to encode the 24-hour periodicity. Finally, the business status mask vector is spliced with the periodic time signal to form a final time feature vector, which then constrains the prediction output of non-business hours and integrates time periodicity information. The specific steps are as follows:
[0095] S401: Business status mask generation
[0096] After multiplying the one-hot encoding of the business start time and end time by the corresponding weight matrix, the bias vector is used as the input of the linear rectifier activation function to generate the business status mask vector. The business time constraint characteristics are automatically learned, so that the output of non-business hours approaches zero value, which is expressed as:
[0097]
[0098] Where M p,t represents the business status mask vector of the p-th point of interest at the t-th time point; is the one-hot encoding of the opening time of the p-th point of interest, for example, 09:00 corresponds to the 9th element being 1; is the one-hot encoding of the business closing time of the p-th point of interest, for example, 17:00 corresponds to the 17th element being 1; W open ∈ is the weight matrix of business start time, which is a learnable parameter; W close is the weight matrix of business closing time, which is a learnable parameter; b mis the business state bias vector, which is a learnable parameter; ReLU(·) is the linear rectification activation function.
[0099] It should be noted that The term is designed through linear subtraction to make the output of negative values during non-business hours, and is returned to zero through the ReLU activation function, forcing the learning of the "zero traffic when the store is closed" feature.
[0100] S402. Construction of periodic time features
[0101] The sine periodic signal and cosine periodic signal of the hourly timestamp are concatenated with the business status mask vector to form a time feature vector. The sine and cosine signals encode the 24-hour periodicity. Combined with the business mask, the problem of prediction deviation during non-business hours is solved. It is expressed as:
[0102] T p,t =[sin(2πt / 24); cos(2πt / 24); M p,t ]
[0103] Where, T p,t is the time feature vector of the p-th interest point at the t-th time point; t is the time point index, representing the hour timestamp of the day, and t∈{0,1,…,23}; [·;·;·] represents the vector splicing operation.
[0104] It should be noted that the (2πt / 24) term maps hourly time to the angle domain, 2π radians corresponds to a 24-hour period, sin(2πt / 24) is the sine periodic signal at the t-th time point, and cos(2πt / 24) is the cosine periodic signal at the t-th time point.
[0105] It should also be noted that the business status mask vector M p,t Business hour constraints are automatically learned during training, such as the output approaches zero after 17:01. Time patterns are modeled together with sine / cosine periodic signals to solve the problems of "non-business hour prediction bias" and "time periodicity".
[0106] S5. Extract spatiotemporal coupling features based on the feature vectors of the points of interest, the spatial coding vectors, and the temporal feature vectors, perform regional perception time series modeling on the spatiotemporal coupling features, and generate crowd flow prediction values and congestion level probability distributions through multi-task shared prediction.
[0107] In an optional embodiment of the present invention, step S5 first performs spatiotemporal coupling feature extraction. Specifically, the dynamic fusion features, spatial encoding vectors and temporal feature vectors are spliced into an initial feature tensor, and features are jointly extracted on the spatiotemporal neighborhood (such as the previous 3 hours and 3×3 spatial grid) through a three-dimensional convolution kernel, and residual connections are used to enhance stability.
[0108] The feature sequence is then processed through region-aware temporal modeling. Specifically, the regional memory vector adjusts the gating mechanism, the update gate enhances the sensitivity of regional characteristics (such as the weekend peak of scenic spots), and the reset gate suppresses excessive resetting of historical information, ultimately outputting the hidden state vector.
[0109] Finally, the results are generated through multi-task shared prediction. Specifically, after the hidden state vector is mapped by the shared projection layer, the separate linear layers output the predicted value of the pedestrian flow (continuous regression) and the probability distribution of the congestion level (discrete classification). The entire inference process is efficient and automated, requiring no human intervention.
[0110] The prediction results are output in a structured form, including the passenger flow value of each point of interest at a specified time point (such as the predicted passenger flow is 350 people) and the probability distribution of congestion (such as loose: 0.1, normal: 0.7, crowded: 0.2, full: 0.0).
[0111] The specific steps for building and training a city pedestrian flow prediction model are as follows:
[0112] S501, spatiotemporal coupling feature extraction
[0113] Passenger flow is affected by both local spatial aggregation effects and short-term time series fluctuations, and there is a coupling relationship between the two. Conventional convolutional neural networks usually process spatial or temporal dimensions separately, ignoring the cross-interaction between spatiotemporal features, resulting in the inability to capture spatiotemporal coupling effects such as the passenger flow overflow caused by the morning rush hour at subway stations to surrounding business districts.
[0114] The present invention constructs a spatiotemporal interleaved convolution block. First, the dynamically fused multimodal features, spatial encoding vectors, and temporal feature vectors are spliced to form an initial spatiotemporal feature representation. Then, a three-dimensional convolution kernel is used to perform a convolution operation on the spatiotemporal cube composed of spatial neighborhood points and adjacent time points, thereby simultaneously extracting joint features within the spatial neighborhood and on the temporal window. The convolution result is then processed by an activation function and layer normalization, and then superimposed with the input feature through a residual connection, directly capturing the coupling effect of the spatial neighborhood and the temporal window. The residual connection is used to ensure the training stability of the deep network, which is expressed as:
[0115] 1) Initialization of spatiotemporal feature tensor
[0116] The multimodal feature vector, spatial encoding vector and temporal feature vector generated by dynamic attention fusion are concatenated to form the initial feature vector, which is expressed as:
[0117]
[0118] Where, is the initial feature vector of the p-th interest point at the t-th time point; [·;·;·] represents the vector splicing operation.
[0119] 2) 3D convolution joint feature extraction
[0120] In the three-dimensional spatiotemporal neighborhood, a three-dimensional convolution operation is performed on the feature tensors of all points in the neighborhood. The convolution result is processed by activation function and layer normalization, and then the input features are superimposed through residual connection, thereby directly capturing the coupling effect of spatial neighborhood and temporal window. At the same time, residual connection is used to ensure the stability of deep network, which is expressed as:
[0121]
[0122] Where, is the feature vector output by the p-th point of interest at the l-th convolutional block layer; l is the convolutional block layer index, and the total number of convolutional blocks is set to L, for example, L is set to 5 layers; is the spatiotemporal neighborhood of the p-th point of interest, including spatial neighborhood and temporal neighborhood. The spatial neighborhood is a 3×3 grid neighborhood point selected by the k nearest neighbors of longitude and latitude, and the temporal neighborhood is the time window of the previous 3 hours, that is, the time point interval (t-2, t-1, t); Represents the feature tensor of all points in the spatiotemporal neighborhood of the p-th point of interest at the l-1 layer; U (l) It is a three-dimensional convolution kernel with a spatial size of 3×3 and a temporal depth of 3; 3D represents a three-dimensional convolution operation; Sw(·) is the Swish activation function; Lay(·) is the layer normalization operation; It is the feature vector output by the p-th interest point in the l-1 convolutional block layer.
[0123] It should be noted that by sliding the three-dimensional convolution kernel across the 3×3 spatial grid and the previous 3-hour time window at the same time, the "space-time coupling effect" can be directly captured, such as the impact of passenger flow overflow from subway stations to surrounding business districts during the morning rush hour, and the residual connection ensures the stability of the deep network.
[0124] It should also be noted that the spatial size of 3×3 corresponds to a 3×3 spatial grid neighborhood, and the time series window of the first 3 hours corresponds to a time series depth of 3, which effectively captures the local spatiotemporal coupling effect, such as the overflow of customer flow in the business district during peak hours, while maintaining computational efficiency.
[0125] It should also be noted that the spatiotemporal interleaved convolution block directly models the local spatiotemporal coupling effect, and the three-dimensional convolution kernel U (l) At the same time, the 3×3 spatial grid and the time series window from t-2 to t are slid to directly extract joint features such as "passenger flow overflow from subway stations to business districts during the morning peak hours". At the same time, the feature vector Perform residual connections to ensure the stability of deep networks and avoid gradient disappearance.
[0126] S502. Region-aware temporal modeling
[0127] There are significant differences in pedestrian flow patterns in different regions. Conventional gated recurrent units use a fixed gating mechanism and lack the ability to adapt to regional characteristics, making it difficult for the model to accurately capture the unique temporal patterns of different regions, such as the weekend peak in tourist attractions or the weekday commuting peak in office areas.
[0128] To address the problem of regional heterogeneity, the present invention improves the gating mechanism to a region-aware gated recurrent unit, combining a learnable regional memory vector to adjust the sensitivity of the gating. When calculating the update gate and reset gate, the regional memory vector participates in the calculation in different ways. Specifically, it is directly added to the update gate to enhance sensitivity to region-specific patterns, and it participates in the reset gate through a negative inhibition term to reduce the impact of regional prior knowledge on excessive resetting of historical information. Then, after the gate calculation is completed, the hidden state is updated according to the standard gating mechanism, enabling the model to adaptively integrate regional characteristics and more accurately capture regional-specific temporal dynamics. The specific steps are as follows:
[0129] 1) Region-sensitive update gate calculation
[0130] The feature vector output by the spatiotemporal interleaved convolution and the hidden state at the previous time point are linearly transformed respectively. After superimposing the regional memory vector and the bias term, the update gate vector is generated through the Sigmoid activation function to dynamically control the update strength of the historical information, which is expressed as:
[0131]
[0132] Where z p,t is the updated gate vector of the p-th interest point at the t-th time point; Sig(·) is the Sigmoid activation function; W z To update the gate feature weight matrix, it is a trainable parameter; is the output feature vector of the p-th interest point after L layers of spatiotemporal interleaving convolution at the t-th time point; U z To update the gate hidden state weight matrix, it is a trainable parameter; h p,t-1 is the hidden state of the pth interest point at the t-1th time point; b z To update the gate bias vector, it is a trainable parameter; C r is the memory vector of the rth region and is a learnable parameter.
[0133] It should be noted that the gate vector z is updated p,t Dynamically control the update intensity of historical information. When its value approaches 1, the influence of new features is strengthened. When its value approaches 0, more historical states are retained. The memory vector C rCustomize the gating sensitivity for different regions to enhance the model's ability to capture regional heterogeneous temporal patterns.
[0134] 2) History reset gate calculation
[0135] After linearly combining the spatiotemporal feature vector with the hidden state at the previous time point, the inhibition term of the regional memory vector is subtracted, and the reset gate vector is generated through the activation function. The inhibition term is then used to reduce the excessive resetting of historical information by the regional prior, which can be expressed as:
[0136]
[0137] Where r p,t is the reset gate vector of the p-th interest point at the t-th time point; W r is the reset gate feature weight matrix, which is a trainable parameter; U r is the reset gate hidden state weight matrix, which is a trainable parameter; b r is the reset gate bias vector, which is a trainable parameter; γ is the reset gate area suppression coefficient, γ>0, such as γ=0.3.
[0138] It should be noted that the memory vector C r Encoding area priors, such as weekend peak patterns in scenic spots, may over-reset historical information if used directly. Add -γC r The term acts as an inhibitory term to reduce the influence of regional priors, lower the reset intensity of regional priors on historical information, and prevent the model from ignoring long-term temporal dependencies.
[0139] 3) Candidate state fusion
[0140] The reset gate vector is multiplied element-by-element by the hidden state at the previous time point to control the strength of the historical information flow, and then linearly combined with the current spatiotemporal feature vector to generate a candidate hidden state vector through the activation function, which is expressed as:
[0141]
[0142] Where, is the candidate hidden state vector of the p-th interest point at the t-th time point; tanh(·) is the hyperbolic tangent activation function; W h is the candidate feature weight matrix, which is a trainable parameter; U h is the candidate hidden state weight matrix, which is a trainable parameter; ⊙ represents element-by-element multiplication, also known as the Hadamard product operation.
[0143] It should be noted that the reset gate vector r (p,t) Determines the degree of retention of historical information, r p,t ⊙h p,t-1 The reset gate vector r is multiplied by element-by-element(p,t) When it is close to 0, the historical information is reset, and when it is close to 1, the historical information is retained, thereby controlling the information flow and the retention ratio of historical information.
[0144] 4) Gating status update
[0145] By updating the gate vector, the weighted sum of the hidden state at the previous time point and the candidate hidden state is performed, and the hidden state vector of the fusion region feature is output, which is expressed as:
[0146]
[0147] Where h p,t is the hidden state vector of the fused regional features of the p-th interest point at the t-th time point.
[0148] It should be noted that the gate vector z is updated (p,t) Control the proportion of new information, (1-z (p,t) ) represents the proportion of old information, (1-z p,t )⊙h p,t-1 The item directly retains part of the historical state, The term represents the proportion of newly added candidate information, and the candidate hidden state vector Update the gate vector z (p,t) The proportion of is added, generating new information to update the state.
[0149] It should also be noted that through the regional memory vector C r Encode regional priors, such as the weekend peak mode of scenic spots, and add a memory vector C to the update gate r Enhance regional sensitivity by adding -γC to the reset gate r This item prevents excessive resetting of historical information and solves the problem of "regional heterogeneity".
[0150] It should also be noted that the update gate and the reset gate jointly realize the adaptive fusion regional timing mode, and the update gate adds the regional memory vector C r Enhance the sensitivity to regional characteristics such as weekend peaks in scenic spots, and use -γC for the reset gate r The term acts as an inhibitory term to prevent regional priors from over-resetting historical information and balance long-term dependence with regional heterogeneity.
[0151] S503, multi-task shared prediction
[0152] The prediction goal needs to output continuous pedestrian flow values and discrete congestion levels at the same time. Conventional single-task design trains independent models or output layers for the two tasks, ignoring the inherent relationship between tasks. This easily leads to low model parameter utilization and may cause conflicts due to differences in task objectives, reducing the overall prediction accuracy.
[0153] The present invention adopts a shared representation multi-task head. First, the hidden state vector output by the region-aware gating network is mapped to a common feature space through a shared projection layer, extracting the feature representation shared by the two tasks. Then, based on this shared feature, independent linear layers are used for subsequent processing. Specifically, one linear layer is responsible for the regression task and directly outputs the predicted value of the pedestrian flow, while the other linear layer is responsible for the classification task and outputs the probability distribution of the congestion level. The shared layer then exploits the correlation between tasks to improve generalization ability, while the separate output layer adapts to the different characteristics of the regression and classification tasks. The specific steps are as follows:
[0154] 1) Shared feature projection
[0155] The hidden state vector output by the region-aware gating network is mapped to the shared feature space through a shared projection matrix and activation function, and the common feature representation of the pedestrian flow and congestion tasks is extracted to obtain a shared feature vector, which is expressed as:
[0156]
[0157] Where, is the shared feature vector at the tth time point; W share is the shared projection matrix, which is a trainable parameter.
[0158] 2) Regression output of traffic flow
[0159] Perform linear transformation on the shared feature vector and output the predicted value of pedestrian flow to complete the continuous regression task, which can be expressed as:
[0160]
[0161] Where, is the predicted value of the flow of people at the p-th point of interest at the t-th time point; w flow is the regression weight vector, which is a trainable parameter; It is w flow The transpose of b flow is the regression bias term, which is a trainable parameter.
[0162] 3) Crowding classification output
[0163] After linear transformation and normalization of the shared feature vector, the probability distribution of the congestion level is output to complete the discrete classification task, which is expressed as:
[0164]
[0165] Where, is the probability distribution vector of the congestion of the p-th point of interest at the t-th time, corresponding to 4 levels: loose / normal / crowded / full; W crowdis the classification weight matrix.
[0166] It should be noted that by sharing the projection matrix W share The common feature representation of pedestrian flow and congestion is extracted, which not only improves generalization by utilizing the correlation between tasks, but also adapts to different task characteristics by separating the output layer.
[0167] It should also be noted that the shared layer and the separated output layer collaboratively learn related tasks. The shared layer extracts the common features of pedestrian flow and congestion to improve parameter utilization. The regression calculation and classification calculation of the separated output layer adapt to different task characteristics to avoid target conflicts.
[0168] S504, spatial density weighted training
[0169] The spatial distribution of urban points of interest is highly uneven. The conventional mean square error loss function treats the prediction errors of all points of interest equally, which easily ignores the differences in spatial density. As a result, the model training process is overly biased towards areas with dense points of interest, such as the city center, while the prediction ability for points of interest in sparse areas such as suburbs is insufficient.
[0170] To address the problem of uneven spatial distribution, this paper adopts kernel density estimation weighted loss. First, the spatial density weight of each point of interest is calculated based on the Gaussian kernel function. This weight reflects the distribution density of points of interest in the local area where the point is located. The weight is high in dense areas and low in sparse areas. Then, a power decay transformation is performed on this spatial density weight so that samples in sparse areas obtain higher relative weights in the loss function. Finally, the transformed weight is used to simultaneously weight the loss of the crowd flow regression task and the loss of the congestion classification task, thereby balancing the impact of uneven spatial distribution and improving the prediction ability of points of interest in low-density areas. It is expressed as:
[0171] 1) Kernel density weight calculation
[0172] The spatial density weight of each point of interest is calculated based on the Gaussian kernel function. Specifically, the number of neighborhood points of interest in an area with a fixed bandwidth as the radius and the target point as the center is counted, and the spatial distribution density is quantified by the kernel function, which is expressed as:
[0173]
[0174] Where KDE(p) is the spatial density weight of the p-th point of interest; n p is the number of points of interest in the neighborhood of the pth point of interest, which is calculated by spatial query, that is, loc p The number of other points of interest is counted in the area with the kernel bandwidth h as the radius, where h is the kernel bandwidth, for example, 0.05 times the spatial range of the dataset; N is the total number of points of interest in the dataset; q is the index of the point of interest different from p; loc pis the latitude and longitude coordinate vector of the pth point of interest; loc q is the longitude and latitude coordinate vector of the qth point of interest; ‖·‖ represents the L2 norm, which is calculated in the same way as the Euclidean distance; Ks(·) is the Gaussian kernel function.
[0175] 2) Multi-task loss weighting
[0176] After the spatial density weight is exponentially decayed, the weighted pedestrian flow regression loss and congestion classification loss balance the spatial distribution imbalance problem by giving higher weights to sparse areas, which can be expressed as:
[0177]
[0178] Where Loss is the total loss; c a is the weight decay exponent, The term c is the spatial density weight of the p-th interest point a Power, characterizes the spatial weight term, such as, is the actual flow of people at the p-th point of interest at the t-th time point; is the one-hot encoding of the true congestion label of the p-th point of interest at the t-th time point; δ1 is the first task weight, which is used to adjust the importance of the crowd flow regression task, such as δ1 = 0.6; δ2 is the second task weight, which is used to adjust the importance of the congestion classification task, such as δ2 = 0.4; Hc(·,·) is the cross entropy loss; Σ p,t represents the sum of all points of interest and time points.
[0179] It should be noted that through The term assigns higher loss weights to sparse areas, balances the problem of uneven spatial distribution, and improves the prediction ability of the model in low-density areas.
[0180] It should also be noted that the weight decay exponent c a It needs to be set to a value less than 1 to ensure that sparse areas with low spatial density weights obtain higher loss weights, but decay smoothly to avoid over-weighting. Preferably, the weight decay exponent c a The adjustable range is 0.5-0.8 to balance the uneven spatial distribution.
[0181] S505, gradient sensitive parameter optimization
[0182] Conventional pedestrian flow prediction models have a large number of parameters, and the gradient magnitudes generated by different tasks vary significantly. Conventional optimizers use a uniform learning rate for all model parameters, which can easily lead to unstable training of parameters that are sensitive to gradient fluctuations, slow convergence, and easy trapping in local optimal solutions.
[0183] To improve training stability and efficiency, the present invention adopts a parameter sensitivity-driven asynchronous optimizer. First, during the training process, the gradient vectors of all model parameters in the most recent iterations are calculated. Then, the degree of fluctuation of these gradient vectors is analyzed and used as an indicator to measure parameter sensitivity. Then, the learning rate is dynamically allocated according to the sensitivity ratio of the parameters. A smaller learning rate is allocated to parameters with high fluctuation to stabilize the update, and a larger learning rate is allocated to parameters with low fluctuation to accelerate convergence. Finally, based on the basic optimizer update rule, the calculated adaptive learning rate is used to update the parameters. Then, differentiated optimization is performed based on the gradient characteristics of the parameters themselves, effectively improving the stability and convergence speed of the training process. The specific steps are as follows:
[0184] 1) Parameter gradient statistics
[0185] Through the back-propagation algorithm, the gradient vector of all trainable parameters of the model in the current training iteration is calculated, which is expressed as:
[0186]
[0187] Where, is the gradient vector of the parameter θ at the kth iteration; θ is the trainable parameter of the model, in set form; k is the index of the current training iteration number; represents the gradient operator with respect to the parameter θ, Represents the gradient of the loss function with respect to the parameter θ, which is calculated by the error back propagation algorithm.
[0188] 2) Sensitivity adaptive learning rate allocation
[0189] The sensitivity is calculated based on the gradient fluctuation of the parameter in the most recent iteration. The learning rate is allocated according to the sensitivity ratio. The high-fluctuation parameters are allocated a smaller learning rate, and the low-fluctuation parameters are allocated a larger learning rate. It is expressed as:
[0190]
[0191] Where η θ is the adaptive learning rate; η0 is the basic learning rate, such as η0 = 0.001; std(·) represents the standard deviation calculation; Ta is the preset number of recent iterations, such as Ta = 10; Θ is the set of all trainable parameters of the model; log(·) is the logarithmic function, and the default base is a natural constant.
[0192] It should be noted that The term measures the degree of gradient fluctuation by calculating the standard deviation.
[0193] It should also be noted that the adaptive learning rate η θ In the calculation method, the logarithmic function is used to compress the magnitude difference and avoid the influence of extreme values.
[0194] 3) Asynchronous parameter update
[0195] Adaptive learning rate is used instead of basic learning rate, parameters are updated according to the internal rules of the optimizer, and the training process is stabilized by gradient correction term, so that small step size updates of high-volatility parameters and large step size updates of low-volatility parameters can be achieved, which can be expressed as:
[0196]
[0197] Where θ (k) is the value of the model's trainable parameters at the kth iteration; θ (k+1) is the value of the model's trainable parameters at the k+1th iteration; Ada(·) represents the update rule of the Adam optimizer, which is implemented as is the first-order moment correction term of the kth iteration, which is the intermediate statistic in the Adam optimization process; is the second-order moment correction term of the kth iteration, which is the intermediate statistic in the Adam optimization process; ∈ is a numerical stability constant used to prevent the denominator from being 0, such as ∈ = 0.00001.
[0198] It should be noted that std(‖g θ The term ‖) characterizes the degree of gradient fluctuation, and thus quantifies the parameter sensitivity. A smaller learning rate is assigned to the high-fluctuation parameter to stabilize the training, and a larger learning rate is assigned to the low-fluctuation parameter to accelerate convergence.
[0199] It should also be noted that the internal mechanism of the Adam optimizer involves the first-order moment correction term and the second-order moment correction term Both are based on the exponential moving average of gradients and perform bias correction to stabilize training. and Provides adaptive gradient scaling, small update step size when large variance, combined with adaptive learning rate η θ , the learning rate of high-volatility parameters is small, and together they achieve adaptive adjustment of parameter update step size, providing double protection for improving training stability.
[0200] In one embodiment, the dynamic fusion effect of multimodal features is analyzed to verify the effectiveness of the hierarchical perception attention mechanism in fusing multimodal features, evaluate the robustness of the present invention to differences in address text length, and compare the spatial modeling accuracy of spherical distance coding and traditional Euclidean distance.
[0201] In terms of attention weight allocation, the conventional static splicing method is compared with the dynamic weight allocation mechanism of the present invention, such as Figure 2As shown in the attention weight distribution diagram, the present invention significantly improves the weight share of the address modality (about 45%), indicating that the attention mechanism can effectively identify the spatial hierarchical semantic structure contained in the address text, and solve the defect of conventional methods that treat each modality feature equally.
[0202] In terms of the impact of address text length, the impact of address texts of different lengths on prediction errors is analyzed, such as Figure 3 As shown in the address text length influence diagram, the slope of the prediction error curve of the present invention is flatter, and the error increase rate is reduced by 60% in the high text length area (>60 characters), which proves that the hierarchical perception mechanism effectively alleviates the imbalance problem of long text feature representation.
[0203] In terms of spatial coding methods, the coding errors of Euclidean distance and spherical distance in cross-region scenarios are compared, such as Figure 4 As shown in the figure, the spatial coding comparison diagram clearly shows that as the distance increases, the error growth rate of spherical distance coding is significantly lower than that of Euclidean distance. In the 100-kilometer cross-region scenario, the error is reduced by more than 40%, verifying the effectiveness of the half-vector formula in eliminating the distortion of the earth's curvature.
[0204] In terms of business hour constraints, verify the improvement effect of time constraint coding on non-business hour prediction, such as Figure 5 As shown in the business hours constraint diagram, the proposed method achieves zero predictions during non-business hours (00:00-9:00 and 22:00-24:00), while conventional methods produce incorrect predictions, demonstrating that the masking mechanism successfully learns the "zero traffic during closed store" characteristic. The sine / cosine periodic signals in the temporal features accurately capture the fluctuations in customer flow during peak hours in the afternoon and evening.
[0205] In another embodiment, the effect of spatiotemporal coupling feature extraction is analyzed to verify the ability of three-dimensional spatiotemporal convolution to capture local spatiotemporal coupling effects, and to analyze the effect of residual connections on improving the stability of deep networks.
[0206] In terms of spatiotemporal feature structure, we visualize the feature activation patterns in the spatiotemporal cube, e.g. Figure 6 As shown in the spatiotemporal feature tensor heat map, the features show regular activation patterns in the spatial dimension (9 grid points) and the temporal dimension (6 time steps), such as the strong activation (red) in the central area during the morning rush hour (t-1), proving that the three-dimensional convolution successfully extracts spatiotemporal coupling effects such as "subway station passenger flow overflow to the business district".
[0207] In terms of residual connections, the training stability of deep networks with and without residual connections is compared, such as Figure 7 As shown in the residual connection effect diagram, the training loss of the present invention (with residual) continues to decrease with the increase of network depth, while the loss of the baseline method rebounds after layer 2, proving that the residual connection effectively solves the gradient vanishing problem, enables stable training of the 5-layer deep network, and reduces the error by 40%.
[0208] In another embodiment, the effect of region-aware temporal modeling is analyzed to verify the enhancement effect of regional memory vectors on temporal modeling and to analyze the adaptability of the gating mechanism to regional heterogeneity patterns.
[0209] In terms of regional time series patterns, the crowd flow prediction effects of scenic spots and office areas are compared, such as Figure 8 As shown in the regional prediction effect diagram, the prediction curves of the present invention during the morning peak hour (8-10 a.m.) in the scenic area and the evening peak hour (17-19 p.m.) in the office area are almost consistent with the true values, while the conventional method has an obvious lag in prediction during the weekend peak hour in the scenic area, proving that the regional memory vector successfully enhances the model's sensitivity to heterogeneous patterns.
[0210] In terms of gating mechanisms, the dynamic behavior of update gates and reset gates is demonstrated, e.g. Figure 9 As shown in the figure, the analysis of gating behavior shows that the update gate increases significantly (>0.7) during periods of drastic passenger flow changes (such as 7 a.m.), enhancing the impact of new features, and the reset gate maintains a high level (>0.8) during stable periods (such as early morning), protecting historical information and dynamically balancing to resolve the contradiction between "regional heterogeneity" and "long-term dependence".
[0211] In another embodiment, the effectiveness of multi-task prediction and optimization strategies is analyzed to verify the effectiveness of the shared representation multi-task head and to evaluate the performance improvement of spatial density weighting and gradient-sensitive optimization.
[0212] In terms of feature space distribution, visualize the relationship between shared features and task-specific features, such as Figure 10 As shown in the multi-task feature space diagram, the flow characteristics (blue) and the congestion characteristics (red) are closely distributed around the shared features (green), with an overlap of 70%, proving that the shared projection layer effectively extracts the common representations of the tasks and improves parameter utilization.
[0213] In terms of spatial density weighting, the improvement effect of density weighting on sparse area prediction is analyzed, such as Figure 11 As shown in the spatial density weighted map, the accuracy of the present invention in low-density areas (weight < 0.4) is improved by 25% compared with the unweighted method, and the overall curve is flatter, indicating that the kernel density weighted strategy successfully balances the problem of uneven spatial distribution and improves the prediction ability in sparse areas such as suburbs.
[0214] In terms of optimizer effect analysis, the training convergence speed and stability are compared, such as Figure 12 As shown in the optimizer effect diagram, the loss curve of the gradient-sensitive optimizer converges twice as fast, and maintains a steady decline in the later stages of the iteration without oscillation. The adaptive learning rate mechanism assigns a small learning rate to high-volatility parameters (to prevent divergence) and a large learning rate to low-volatility parameters (to accelerate convergence), achieving efficient and stable training process.
[0215] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts 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, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0216] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0217] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0218] Specific embodiments are used in the present invention to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
[0219] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
Claims
1. A method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest, characterized by: The following steps are involved: Obtain a spatiotemporal dataset of city points of interest; the spatiotemporal dataset includes name text, address text, classification code, latitude and longitude coordinates, current timestamp, and business hours information; A hierarchical perception and attention fusion mechanism is used to dynamically fuse the name text, address text, and classification coding information of urban points of interest to obtain the point of interest feature vector; The regional adaptive spherical convolution coding method is used to perform spherical spatial dependency modeling on the longitude and latitude coordinates of urban points of interest to obtain a spatial coding vector. A periodic mask generator is used to encode the current timestamp and business hours information of the city's points of interest into business hours constraints to obtain a time feature vector. The spatiotemporal coupling features are extracted based on the feature vectors of the points of interest, the spatial coding vectors and the temporal feature vectors, and the spatiotemporal coupling features are subjected to regional perception time series modeling. The predicted value of pedestrian flow and the probability distribution of congestion level are generated through multi-task shared prediction.
2. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: The hierarchical perception attention fusion mechanism is used to dynamically fuse the name text, address text, and classification coding information of urban points of interest to obtain the point of interest feature vector, including: Perform feature representation on the name text, address text and classification code of the point of interest to form an initial feature matrix; The attention mechanism is used to dynamically calculate the importance weight of each modality according to the semantic association of the name text and the address text, and the feature vectors of each modality are weightedly fused according to the importance weight to generate the point of interest feature vector.
3. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 2, characterized in that: The attention mechanism is used to dynamically calculate the importance weight of each modality based on the semantic association of the name text and the address text. The feature vectors of each modality are weighted and fused according to the importance weight to generate the feature vector of the point of interest, including: Generate a query vector based on the semantic association between the name text and the address text, and calculate the attention weight of each modality; The feature column vectors of each modality in the initial feature matrix are weighted and summed using the attention weights of each modality, and then multiplied by the projection matrix of the corresponding modality to generate the interest point feature vector.
4. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: The regional adaptive spherical convolution coding method is used to perform spherical spatial dependency modeling on the longitude and latitude coordinate information of urban points of interest, and a spatial coding vector is obtained, including: The spherical distance from the point of interest to the center of each area is calculated using the haversine formula; According to the spherical distance from the point of interest to the center of each region, the transformation matrix of each region is weightedly fused with distance awareness, and a spatial encoding vector is generated through an activation function.
5. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 4, characterized in that: According to the spherical distance from the point of interest to the center of each region, the transformation matrix of each region is weightedly fused with distance awareness, and a spatial encoding vector is generated through an activation function, including: Calculate the distance normalization weight based on the spherical distance from the point of interest to the center of each area; The distance normalization weight and distance sensitivity factor are used to perform weighted summation on the transformation matrix corresponding to each region, and then processed by the activation function to generate a spatial encoding vector.
6. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: The current timestamp and business hours information of the city's points of interest are encoded using a periodic mask generator to obtain a time feature vector, including: Encode the business start time and end time into a learnable vector and generate a business status mask vector through the activation function; Construct the time features of the sine and cosine periodic signals containing the hourly timestamp, concatenate the business status mask vector with the time features of the periodic signal, and generate a time feature vector.
7. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: Extract spatiotemporal coupling features based on interest point feature vectors, spatial encoding vectors, and time feature vectors, including: Concatenate the interest point feature vector, spatial encoding vector, and time feature vector to form the initial spatiotemporal feature representation; A three-dimensional convolution kernel is used to perform convolution operation on the space-time cube composed of spatial neighborhood points and adjacent time points. The convolution result is processed by activation function and layer normalization, and then superimposed with the input feature through residual connection to obtain the space-time coupling feature.
8. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: Perform region-aware temporal modeling of spatiotemporal coupling features, including: The spatiotemporal coupling features and the hidden state at the previous time point are linearly transformed, the regional memory vector and the bias term are superimposed, and the update gate vector is generated through the activation function; After linearly combining the spatiotemporal coupling features with the hidden state at the previous time point, the inhibition term of the regional memory vector is subtracted, and the reset gate vector is generated through the activation function; Multiply the reset gate vector by the hidden state at the previous time point element by element, then linearly combine it with the spatiotemporal coupling feature, and generate a candidate hidden state vector through the activation function; The hidden state at the previous time point and the candidate hidden state are weightedly summed by updating the gate vector, and the hidden state vector of the fused regional features is output.
9. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: Generate crowd flow prediction values and congestion level probability distribution through multi-task shared prediction, including: The hidden state vector obtained by region-aware temporal modeling is mapped to the common feature space through a shared projection layer to extract the shared feature representation; Independent linear layers are used to perform regression and classification tasks on the shared feature representation, outputting the predicted value of pedestrian flow and the probability distribution of congestion level.
10. The method for predicting urban pedestrian flow based on a spatiotemporal dataset of urban points of interest according to claim 1, characterized in that: During the training process, the spatial density weight of each point of interest is calculated based on the Gaussian kernel function, and then the spatial density weight of each point of interest is subjected to a power decay transformation. Finally, the transformed spatial density weight is used to simultaneously weight the loss of the crowd flow regression task and the loss of the congestion classification task. And / or during the training process, the gradient vectors of all model parameters in the most recent iterations are calculated, and then the fluctuation degree of the gradient vector is used as an indicator to measure the sensitivity of the parameters. The learning rate is dynamically allocated according to the sensitivity ratio of the parameters, and finally the calculated adaptive learning rate is used to update the parameters based on the basic optimizer update rule.
Citation Information
Patent Citations
A method for identifying urban functional areas based on functional mixing degree and ensemble learning
CN114969007B
Interest point recommendation method and system based on subjective and objective factor fusion
CN119848365A
City impedance calculation method based on points of interest
CN105117816A
Bicycle flow prediction method and device, storage medium and computer equipment
CN118734030A
Commercial vitality prediction and business district evaluation method based on multi-modal feature fusion
CN119918981A
Cited By
Artificial intelligence-based embankment slope stability assessment method
CN120995226A
Method and system for predicting urban park visitor flow based on optimized CNN-LSTM model
CN121168766A
Method and system for predicting urban park flow based on an optimized cnn-lstm model
CN121168766B
People flow simulation analysis method and system based on space-time behavior dynamics
CN121235558A
Method and system for crowd flow simulation analysis based on space-time behavior dynamics
CN121235558B
