Multi-region people flow prediction method and device in emergency scene based on graph memory network, and medium
By using a graph memory network-based method in people flow prediction, an adaptive graph structure and recursive network model is constructed, which solves the shortcomings of traditional methods in dealing with complex people flow dynamics, and achieves higher-precision multi-region people flow prediction.
Patent Information
- Application Number
- CN202411923621.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
The prior art is difficult to accurately capture complex flow dynamics, especially in burst scenarios and multi-region flow prediction. Traditional linear models and simple machine learning algorithms cannot effectively deal with the characteristics of nonlinearity, time-varying and bursting.
Using a graph memory network-based method, a flow prediction model that can handle complex space-time dependence is constructed through adaptive graph structure construction modules, graph convolution recursive units, attention-weighted and memory network modules and prediction modules.
It improves the accuracy of predicting abortion, can predict abortion changes in real time in emergencies, and dynamically adjusts the connections between regions to adapt to complex multi-regional flow dynamics.
Smart Images

Figure CN119849689A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crowd flow prediction, and in particular to a method, device and medium for predicting multi-region crowd flow in an emergency scenario based on a graph memory network. Background Art
[0002] In densely populated urban areas, accurate crowd flow prediction is crucial for crowd flow management, public safety, and resource allocation. With the acceleration of global urbanization, urban crowd flow systems and crowd flows in public places have become increasingly complex, and predicting crowd flow patterns has become a key research direction. Crowd flow prediction helps urban planners foresee congestion points or potential risk scenarios in advance through the analysis of spatiotemporal data, thereby optimizing crowd flow signals, public crowd flow scheduling, and emergency response measures. Through the massive data collected by large-scale sensors, cameras, and mobile devices, researchers can use this information to build time series models to reveal the dynamic changes of crowd flow in different time and space. However, due to the nonlinear, time-varying, and bursty characteristics of crowd flow dynamics, traditional linear models and simple machine learning algorithms often cannot accurately capture these complex patterns. Therefore, developing more flexible and adaptive prediction models has become an important research topic in the current field of crowd flow prediction. Summary of the invention
[0003] The purpose of the present invention is to provide a method, device and medium for predicting multi-region crowd flow in emergency scenarios based on a graph memory network, which can improve the accuracy of crowd flow prediction.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] A method for predicting multi-region crowd flow in emergency scenarios based on a graph memory network, comprising:
[0006] Obtain historical information of the target area;
[0007] The crowd flow prediction model is trained using the historical information, and the target to be measured is predicted according to the trained crowd flow prediction model to obtain the final time series prediction result; the crowd flow prediction model includes an adaptive graph structure building module, a graph convolution recursive unit, an attention weighted and memory network module and a prediction module connected in sequence; wherein the graph convolution recursive unit is composed of a graph convolution and a gated recursive network; the attention weighted and memory network module is composed of an attention mechanism and a multi-layer memory network.
[0008] Optionally, the predicting based on a trained crowd flow prediction model specifically includes:
[0009] In the adaptive graph structure construction module, the temporal features of the historical information are extracted, and an adaptive graph structure is constructed according to the temporal features;
[0010] Input the time series features and the adaptive graph structure into a graph convolution recursive unit, construct spatial dependency and temporal dependency in the data, and output node features and aggregation information of neighboring nodes at each time step;
[0011] The output data of the graph convolution recursive unit is used as the input data of the attention weighted and memory network module, and the enhanced spatiotemporal information is obtained after network operation; the enhanced spatiotemporal information includes a weighted feature matrix and a memory-enhanced graph embedding; the network operation includes: adaptively allocating the importance of each node feature and strengthening the feature representation of key nodes, and using a multi-layer memory network to extract multi-level feature patterns in the time series and enhance the spatiotemporal prediction ability of the model;
[0012] In the prediction module, the enhanced spatiotemporal information is used to predict the flow of people at future time steps of the target to be measured, and the final time series prediction result is obtained.
[0013] Optionally, constructing an adaptive graph structure according to the temporal features specifically includes:
[0014] Represent the historical information of multiple nodes in the input data as a time series feature matrix X t ∈R T×N×h , where T is the time step, N is the number of nodes, and h is the feature dimension of each node;
[0015] The adaptive graph structure is generated by random walk, and the part of the adjacency matrix that is less than 0 is truncated and normalized: A = softmax (ReLU (E * E T )) represents; where E is the adaptive weight matrix.
[0016] Optionally, the time series features and the adaptive graph structure are input into a graph convolution recursive unit to construct spatial dependency and temporal dependency in the data, and output node features and aggregation information of neighboring nodes at each time step, specifically including:
[0017] Graph Attention Operation in Graph Convolutional Recurrent Unit Capture the spatial relationship between each node and its neighboring nodes; GAT assigns multiple groups of attention coefficients α to all neighboring nodes of node i at each layer of message passing ij , the embedding of the node is updated by the weighted sum of the embeddings of the neighboring nodes, ELU is the activation function, W is the weight matrix composed of learnable parameters, x j is the node embedding vector of node j;
[0018] Use the gated recurrent network to recursively process the data at each time step and update the hidden state:
[0019] ut =sigmoid(W u [X t ,H t-1 ]+b u )
[0020] r t =sigmoid(W r [X t ,H t-1 ]+b r )
[0021] C t =tanh(W C [X t ,r t ⊙H t-1 ]+b C )
[0022] H t =u t ⊙H t-1 +(1-u t )⊙C t
[0023] Among them, the update gate u t and reset gate r t They are used to control the retention of historical information and the introduction of new information, C t is the candidate state, ⊙ represents element-wise multiplication, b is the weight vector, and the output is H t ∈R T×N×h contains the node features of each time step and the aggregate information of its neighboring nodes, W u , W r , W C are the weight matrices for updating, resetting gates, and candidate states, respectively, X t is the input at time step t, H t-1 is the hidden state of the previous time step, b u 、b r 、b C They are the bias vectors for the update gate, reset gate, and candidate state, respectively.
[0024] Optionally, the adaptively allocating the importance of each node feature and strengthening the feature representation of key nodes specifically includes:
[0025] Compress the spatiotemporal dimensions of the output data of the graph convolutional recurrent unit into a global descriptor This step will output H t ∈R T×N×h Transformed into the global eigenvector α c ∈R h ; Among them, H ijrepresents the hidden state vector at a specific time step i and node j;
[0026] The compressed feature vector is activated through the weight matrix to calculate the activation weight score of the feature t =sigmoid(W2ReLU(W1a t )), represents the enhanced node embedding; where, Represents the weight matrix of the first fully connected layer, which is used for dimensionality reduction. represents the weight matrix of the second fully connected layer, which is used for dimensionality increase operation, r is the ratio of dimensionality reduction, and a t represents the compressed feature vector;
[0027] Calculate the weighted feature matrix H' t =score t ⊙H t , the dimension of the output remains consistent with the input, and the feature representation H' of the enhanced key node is obtained t ∈R T×N×h .
[0028] Optionally, the method of using a multi-layer memory network to extract multi-level feature patterns in the time series and enhance the spatiotemporal prediction capability of the model specifically includes:
[0029] For the first memory network layer, the feature representation H' of the key nodes is strengthened. t Generate query vector Q t1 =W Q1 *H' t +b Q1 , the query vector is used to match the memory item Γ1 and calculate the similarity;
[0030] The similarity between the query vector and the memory item is calculated through the softmax function:
[0031] sim j1 =softmax(exp(Q t1 *Γ1[j]))
[0032] Combine similarity weights to generate enhanced information
[0033] The query of each layer of the memory network follows the same steps as the first memory network layer, processing and generating different levels of enhanced information layer by layer; when querying the number of layers l>1, the query vector calculation formula of the lth layer is modified to Q tl =W Ql *M tl +b Ql ; Among them, W Qlrepresents the query weight matrix of the l-th layer memory network, M tl represents the storage mode of the l-th layer memory network, b Ql Represents the query bias vector of the l-th layer memory network;
[0034] After passing through multiple layers of memory networks, the memory patterns at each level are integrated to generate the final graph embedding M t =M t1 +…+M tN , used for subsequent graph structure learning and prediction, and combined with H t After splicing, HM t ;
[0035] By minimizing the query vector Q t The distance difference between the most similar memory item Γ[p] and the second most similar memory item Γ[n] ensures that the memory item can effectively distinguish different patterns and calculates the first auxiliary loss
[0036] Minimize the query vector Q t The distance between the most similar memory item Γ[p] enhances the clustering effect of the memory items, ensures that the pattern can be stored effectively, and calculates the second auxiliary loss
[0037] The present invention also provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the multi-region crowd flow prediction method in an emergency scenario based on the above-mentioned graph memory network.
[0038] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the multi-region crowd flow prediction method in an emergency scenario based on a graph memory network as described above.
[0039] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0040] The present invention discloses a method, device and medium for predicting multi-region passenger flow in emergency scenarios based on a graph memory network. The method includes training a passenger flow prediction model using historical information of a target area, and predicting the target to be tested according to the trained passenger flow prediction model to obtain a final time series prediction result; the passenger flow prediction model includes an adaptive graph structure building module, a graph convolution recursive unit, an attention weighting and memory network module and a prediction module connected in sequence; wherein the graph convolution recursive unit is composed of a graph convolution and a gated recursive network; the attention weighting and memory network module is composed of an attention mechanism and a multi-layer memory network. The present invention solves the possible mutation problems in multi-region passenger flow that cannot be handled by existing algorithms and the complex spatiotemporal dependencies between regions, and at the same time achieves real-time prediction of the impact of emergencies on passenger flow, dynamic adjustment of the connection between regions, and improvement of the accuracy of passenger flow prediction in multiple regions. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 This is a flow chart of a method for predicting multi-region passenger flow in an emergency scenario based on a graph memory network according to the present invention;
[0043] Figure 2 This is a schematic diagram of passenger flow data for two days at four landmarks in a certain district of a certain city in this embodiment. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] The purpose of the present invention is to provide a method, device and medium for predicting multi-region crowd flow in emergency scenarios based on a graph memory network, which can improve the accuracy of crowd flow prediction.
[0046] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0047] like Figure 1 As shown, the present invention provides a method for predicting multi-region crowd flow in an emergency scenario based on a graph memory network, comprising:
[0048] Step 100: Obtain historical information of the target area;
[0049] Step 200: Train a crowd flow prediction model using the historical information, and predict the target to be measured based on the trained crowd flow prediction model to obtain a final time series prediction result; the crowd flow prediction model includes an adaptive graph structure building module, a graph convolution recursive unit, an attention weighted and memory network module, and a prediction module connected in sequence; wherein the graph convolution recursive unit is composed of a graph convolution and a gated recursive network; the attention weighted and memory network module is composed of an attention mechanism and a multi-layer memory network.
[0050] As a specific implementation method, the implementation process shown below is provided.
[0051] In this embodiment, the crowd flow prediction model mainly includes: 1) Adaptive graph structure construction module: automatically generate graph structure according to the time series feature matrix, input is the historical information of multiple regions, and output is the adaptively adjusted adjacency matrix. 2) Graph convolution recursive unit: composed of graph convolution and gated recursive unit, the principle is to combine graph convolution and recursive neural network to process spatial and temporal dependencies, input is adaptive graph structure and time series feature data, and output is the node features of each time step and the aggregated information of its neighboring nodes. 3) Attention weighted and memory network module: composed of attention mechanism and multi-layer memory network, the principle is to strengthen the key node features through feature compression and activation, input is the output of graph convolution recursive unit, and output is weighted feature matrix and memory enhanced graph embedding. Compared with the prior art, the present invention is suitable for complex and dynamically changing multi-region crowd flow prediction scenarios, solves the limitations of traditional models in dealing with emergencies and complex spatial dependencies, and achieves the purposes of high-precision prediction, rapid response to sudden changes, and improving model adaptability. These advantages make the present invention have extremely high practical value in the fields of smart city crowd flow management and public safety.
[0052] Based on the above content, an embodiment is provided to describe the specific operation processing process in detail.
[0053] (1) Construct an adaptive graph structure that can capture spatial relationships from the input time series data:
[0054] 101) Input the flow data, such as Figure 2 Shown is the pedestrian flow data for four landmarks in a district of a city over two days.
[0055] 102) Generate a normalized adjacency matrix A = softmax(ReLU(E*E T )), E is the adaptive weight matrix.
[0056] (2) Modeling the spatial and temporal dependencies in crowd flow data, specifically including the following steps:
[0057] 201) Graph Attention Network Update node embedding.
[0058] 202) Use a recurrent neural network and a gating mechanism to selectively retain historical information, process the data of the first time step, and generate the initial hidden state h t1 .
[0059] 203) Recursively process the data of each time step, that is, for each subsequent time step, the time data of the current step and the output of the previous time step are concatenated and put into the graph convolution and recurrent neural network to generate a new hidden state h tl .
[0060] 204) The output of the last layer is defined as H t .
[0061] (3) Extract and strengthen the feature representation of key nodes, which specifically includes the following steps:
[0062] 301) Compressing the space-time dimensions into a global descriptor
[0063] 302) Calculate the activation weight score of the feature t =sigmoid(W2ReLU(W1a t )).
[0064] 303) Calculate the weighted feature matrix H' t =score t ⊙H t .
[0065] (4) Using the memory network to extract multi-level feature patterns in the time series, specifically including the following steps:
[0066] 401) Generate query vector: If the number of layers l = 1, then Q t1 =H' t *WQ1+bQ1; otherwise Q tl =M tl *WQ l +bQ l .
[0067] 402) Calculate the similarity sim between the query vector and the memory item j1 =softmax(exp(Q t1 *Φ1[j])).
[0068] 403) Generate enhanced information by combining similarity weights
[0069] 404) The multi-layer query of the memory network follows the same steps, processing layer by layer and generating different levels of enhanced information. However, when querying with l>1 layers, the query vector calculation formula of layer l is modified to Q tl =W Ql *M Q1 +b Ql The remaining steps are the same as 402) and 403).
[0070] 405) After passing through the multi-layer memory network, the memory patterns at each level are integrated to generate the final graph embedding M t =M t1 +…+M tN For subsequent graph structure learning and prediction, and H t After splicing, HM t .
[0071] 406) Calculate auxiliary losses and
[0072] (5) To ensure that the model can give accurate time series prediction results, the process of training the model specifically includes the following steps:
[0073] 501) The enhanced hidden state HM t Input into the recursive unit with the same structure as 2), and gradually predict the flow of people in the future time step. The predicted output is: Here β represents the time step of prediction.
[0074] 502) Put the predicted value into the loss function The mean absolute deviation between the model's predictions and the actual results is measured.
[0075] 503) Calculate the gradient and pass it back to update the parameters of each layer in the optimizer.
[0076] Therefore, it can be seen from the above that compared with the prior art, the present invention has the following advantages:
[0077] 1. Can handle more complex spatiotemporal scenarios: By constructing a dynamic and adaptive graph structure, the present invention can simultaneously consider the spatiotemporal dependencies between multiple regions, which enables the model to not only handle static crowd flow patterns, but also adapt to rapidly changing urban dynamics. This method provides a new way to accurately predict crowd flow in complex crowd flow networks in multiple regions by adaptively adjusting the connection weights of the graph structure.
[0078] 2. Solve sudden changes by learning commonalities and anomalies: This paper particularly emphasizes how to quickly adapt and predict sudden changes by learning commonalities and anomalies in different regions when encountering emergencies. By combining memory networks and graph attention mechanisms, the model can effectively distinguish and memorize normal traffic patterns from abnormal patterns caused by emergencies, making it more accurate and robust in real-time predictions.
[0079] 3. Enhanced feature extraction and information fusion capabilities: By combining graph convolutional networks and recursive networks, the present invention has significant advantages in feature extraction. The graph convolution part enhances the model's ability to capture spatial features, while the recursive part enhances the processing effect of time series data. In addition, through the introduction of the attention mechanism, the model can more accurately identify and enhance the influence of key nodes, optimizing the overall information fusion process.
[0080] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0081] This article uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only used to help understand the core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A multi-region crowd flow prediction method in emergency scenarios based on graph memory network, characterized in that: include: Obtain historical information of the target area; The crowd flow prediction model is trained using the historical information, and the target to be measured is predicted according to the trained crowd flow prediction model to obtain the final time series prediction result; the crowd flow prediction model includes an adaptive graph structure building module, a graph convolution recursive unit, an attention weighted and memory network module and a prediction module connected in sequence; wherein the graph convolution recursive unit is composed of a graph convolution and a gated recursive network; the attention weighted and memory network module is composed of an attention mechanism and a multi-layer memory network.
2. The multi-region crowd flow prediction method in emergency scenarios based on graph memory network according to claim 1 is characterized in that: The prediction based on the trained passenger flow prediction model specifically includes: In the adaptive graph structure construction module, the temporal features of the historical information are extracted, and an adaptive graph structure is constructed according to the temporal features; Input the time series features and the adaptive graph structure into a graph convolution recursive unit, construct spatial dependency and temporal dependency in the data, and output node features and aggregation information of neighboring nodes at each time step; The output data of the graph convolution recursive unit is used as the input data of the attention weighted and memory network module, and the enhanced spatiotemporal information is obtained after network operation; the enhanced spatiotemporal information includes a weighted feature matrix and a memory-enhanced graph embedding; the network operation includes: adaptively allocating the importance of each node feature and strengthening the feature representation of key nodes, and using a multi-layer memory network to extract multi-level feature patterns in the time series and enhance the spatiotemporal prediction ability of the model; In the prediction module, the enhanced spatiotemporal information is used to predict the flow of people at future time steps of the target to be measured, and the final time series prediction result is obtained.
3. The multi-region crowd flow prediction method in emergency scenarios based on graph memory network according to claim 2 is characterized in that: Constructing an adaptive graph structure according to the temporal characteristics specifically includes: Represent the historical information of multiple nodes in the input data as a time series feature matrix X t ∈R T×N×h , where T is the time step, N is the number of nodes, and h is the feature dimension of each node; The adaptive graph structure is generated by random walk, with the adjacency matrix A = softmax(ReLU(E*E T )) represents; where E is the adaptive weight matrix.
4. The multi-region crowd flow prediction method in emergency scenarios based on graph memory network according to claim 2 is characterized in that: Input the time series features and the adaptive graph structure into the graph convolution recursive unit, construct the spatial dependency and time dependency in the data, and output the node features and the aggregation information of the neighboring nodes at each time step, specifically including: Graph Attention Operation in Graph Convolutional Recurrent Unit Capture the spatial relationship between each node and its neighboring nodes; GAT assigns multiple sets of attention coefficients α to all neighboring nodes of node i at each layer of message passing ij , the embedding of the node is updated by the weighted sum of the embeddings of the neighboring nodes, ELU is the activation function, W is the weight matrix composed of learnable parameters, x j is the node embedding vector of node j; Use the gated recurrent network to recursively process the data at each time step and update the hidden state: u t =sigmoid(W u [X t ,H t-1 ]+b u ) r t =sigmoid(W r [X t ,H t-1 ]+b r ) C t =tanh(WC[X t ,r t ⊙H t-1 ]+b C ) H t =u t ⊙H t-1 + ( 1-u t )⊙C t Among them, the update gate u t and reset gate r t They are used to control the retention of historical information and the introduction of new information, C t is the candidate state, ⊙ represents element-wise multiplication, b is the weight vector, and the output is H t ∈R T×N×h contains the node features of each time step and the aggregate information of its neighboring nodes, W u , W r , W C are the weight matrices for updating, resetting gates, and candidate states, respectively, X t is the input at time step t, H t-1 is the hidden state of the previous time step, b u , b r , b C They are the bias vectors for the update gate, reset gate, and candidate state, respectively.
5. The multi-region crowd flow prediction method in emergency scenarios based on graph memory network according to claim 2 is characterized in that: The adaptive distribution of the importance of each node feature and strengthening the feature representation of key nodes specifically includes: Compress the spatiotemporal dimensions of the output data of the graph convolutional recurrent unit into a global descriptor This step will output H t ∈R T×N×h Transformed into the global eigenvector α c ∈R h ; Among them, H ij represents the hidden state vector at a specific time step i and node j; The compressed feature vector is activated through the weight matrix to calculate the activation weight score of the feature t =sigmoid(W2ReLU(W1a t )), represents the enhanced node embedding; where, Represents the weight matrix of the first fully connected layer, which is used for dimensionality reduction. represents the weight matrix of the second fully connected layer, which is used for dimensionality increase operation, r is the ratio of dimensionality reduction, and a t represents the compressed feature vector; Calculate the weighted feature matrix H' t =score t ⊙H t , the dimension of the output remains consistent with the input, and the feature representation H' of the enhanced key node is obtained t ∈R T×N×h .
6. The method for predicting multi-regional crowd flow in emergency scenarios based on graph memory network according to claim 2 is characterized in that: The method of using a multi-layer memory network to extract multi-level feature patterns in a time series and enhance the spatiotemporal prediction capability of the model specifically includes: For the first memory network layer, the feature representation H' of the key nodes is strengthened. t Generate query vector Q t1 =W Q1 *H' t +b Q1 , the query vector is used to match the memory item Γ1 and calculate the similarity; The similarity between the query vector and the memory item is calculated through the softmax function: sim j1 =softmax(exp(Q t1 *Γ1[j])) Combine similarity weights to generate enhanced information The query of each layer of the memory network follows the same steps as the first memory network layer, processing and generating different levels of enhanced information layer by layer; when querying the number of layers l>1, the query vector calculation formula of the lth layer is modified to Q tl =W Ql *M tl +b Ql ; Among them, W Ql represents the query weight matrix of the l-th layer memory network, M tl represents the storage mode of the l-th layer memory network, b Ql Represents the query bias vector of the l-th layer memory network; After passing through multiple layers of memory networks, the memory patterns at each level are integrated to generate the final graph embedding M t =M t1 +…+M tN , used for subsequent graph structure learning and prediction, and combined with H t After splicing, HM t ; By minimizing the query vector Q t The distance difference between the most similar memory item Γ[p] and the second most similar memory item Γ[n] ensures that the memory item can effectively distinguish different patterns and calculates the first auxiliary loss Minimize the query vector Q t The distance between the most similar memory item Γ[p] enhances the clustering effect of the memory items, ensures that the pattern can be stored effectively, and calculates the second auxiliary loss 7. An electronic device, characterized in that: It includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the multi-area crowd flow prediction method in an emergency scenario based on a graph memory network according to any one of claims 1-6.
8. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements a multi-region crowd flow prediction method in an emergency scenario based on a graph memory network as described in any one of claims 1 to 6.
Citation Information
Cited By
Traffic flow prediction method based on deep learning
CN121281279A