Pedestrian trajectory prediction method based on hierarchical attention mechanism

By using hierarchical attention mechanism and multiple attention graph structure in pedestrian trajectory prediction, the problem of multi-level interaction and long-term prediction in social group systems is solved, more accurate pedestrian trajectory prediction and relationship reasoning are achieved, and the performance of the model is improved. and robustness.

CN118823733APending Publication Date: 2024-10-22YANAN UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410894418.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing technologies are difficult to effectively handle multi-level interactions and long-term predictions in social group systems, and suffer from degradation in interpretability and performance.

Method used

Using a pedestrian trajectory prediction method based on a hierarchical attention mechanism, through multiple attention graph structures and graph neural networks, we learn and predict the interaction dynamics in multi-pedestrian systems, and use multi-layer relationship graphs and attention mechanisms to capture interaction relationships at different levels. And gradually improve the model through hierarchical training strategies.

Benefits of technology

It significantly improves the accuracy of pedestrian trajectory prediction and relationship reasoning, can better capture interactions in complex multi-pedestrian environments, and improves the performance of prediction tasks and the robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118823733A_ABST
    Figure CN118823733A_ABST
Patent Text Reader

Abstract

The invention discloses a pedestrian trajectory prediction method based on a hierarchical attention mechanism, and belongs to the technical field of automatic driving. According to the method, multiple attention graphs are used for representing hidden variables in the prediction process, a multi-layer interaction relation is established, and the dynamic state of a social multi-pedestrian system is better captured; by introducing an attention mechanism, representing different intensities of the relationship; based on a multi-network theory, interaction relations of different layers are learned in combination with a multi-layer relation graph, each layer interacts and influences through an attention mechanism, and the model is learned and perfected in a staged and progressive mode by using a layered training strategy from simple to complex.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of autonomous driving, and relates to a pedestrian trajectory prediction method in multi-type interaction scenarios using a hierarchical attention mechanism using multiple implicit coordination graphs, and in particular to a pedestrian trajectory prediction method based on a hierarchical attention mechanism. Background Art

[0002] With the development of deep learning, multi-agent system modeling has been a hot research issue in the field of artificial intelligence in recent years, and has been applied in autonomous driving, crowd navigation, human-machine collaboration, etc. Pedestrian trajectory prediction is to infer the future location of the target pedestrian in a social gathering based on the pedestrian's historical trajectory, social intentions, and the influence of the movement of surrounding pedestrians. Accurate pedestrian trajectory prediction is crucial to the development of autonomous driving technology. This prediction can assist the car in making correct decisions during driving; at the same time, accurate pedestrian trajectory prediction is a basic component of smart transportation. If the behavior of pedestrians at various intersections can be accurately predicted, potential risks can be identified in advance, and warning information can be sent to pedestrians and vehicles through the smart transportation system to reduce the probability of traffic accidents. It can be seen that the research on pedestrian trajectory prediction has very important practical significance.

[0003] At present, domestic and foreign scholars have conducted a lot of research on multi-pedestrian trajectory prediction, mainly including the following aspects: 1. Pedestrian trajectory prediction based on deep learning: Deep learning has been widely used in multi-pedestrian trajectory prediction, such as the Social LSTM model, which can effectively capture the social interaction between pedestrians. Social GAN ​​model, this model introduces the generative adversarial network (GAN) to make the generated trajectory more natural and diverse; 2. Pedestrian trajectory prediction based on graph neural network: Graph neural network is a neural network that can process graph structure data and can effectively capture the interaction and dependency between pedestrians. For example, the Social-STGCNN model successfully captures the spatial and temporal dependencies between pedestrians by adopting a space-time graph convolutional network. 3. Pedestrian trajectory prediction based on reinforcement learning: Reinforcement learning is a machine learning method that learns and optimizes strategies through interaction with the environment, which can effectively deal with the uncertainty and dynamic problems in pedestrian trajectory prediction. For example, the RL-LSTM model can effectively handle the uncertainty and dynamic problems in pedestrian trajectory prediction by introducing deep reinforcement learning; Fourth, pedestrian trajectory prediction based on attention mechanism: The attention mechanism is a mechanism that can automatically focus on important information, which can effectively handle the uncertainty and complexity problems in pedestrian trajectory prediction. For example, the SoPhie model can effectively handle the uncertainty and complexity problems in pedestrian trajectory prediction by introducing the attention mechanism.

[0004] However, there are still many difficulties in the study of pedestrian trajectory prediction. First, the behavior of multiple pedestrians is often affected by complex and dynamic interactions. For example, in navigation scenarios, the interaction between target location and collision avoidance affects individual behavior, making trajectory modeling and prediction challenging. Second, pedestrian trajectory prediction is subject to data incompleteness and uncertainty. In practical applications, the observable trajectory data is limited, and there is noise and uncertainty, which increases the difficulty of prediction. Third, trajectory prediction needs to consider the interaction and collaborative behavior between pedestrians. Pedestrian behavior is often affected by other pedestrians. This dynamic and complex interaction makes interactive modeling and prediction difficult. Finally, trajectory prediction needs to grasp long-term time dependencies. Pedestrian behavior is often affected by past trajectories and the environment, and it is necessary to capture and model time dependencies, which increases the complexity of prediction. Therefore, the difficulty of trajectory prediction lies in the interaction, incomplete and uncertain data, interaction between pedestrians, and time dependencies. Solving these problems requires innovative models and algorithms to handle complex multi-pedestrian systems. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a pedestrian trajectory prediction method based on a hierarchical attention mechanism to solve the technical problems that the prior art does not explicitly deal with the multi-level interactions existing in social group systems and has degraded performance in long-term prediction and interpretability.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] A pedestrian trajectory prediction method based on a hierarchical attention mechanism includes the following steps:

[0008] S1, obtain the feature vectors of N pedestrians at a certain time position;

[0009] S2, embed the position feature vectors of N pedestrians into the graph neural network GNN in the encoder as the initial node vector in the multiple attention graph of the graph neural network GNN; based on the initial node vector, obtain the initial node hidden state; based on the initial node hidden states in the multiple attention graph, obtain the initial unnormalized weights of the edges through the multi-layer perceptron MLP network; based on the initial unnormalized weights, classify the edge embeddings to obtain k layers, and obtain the initial relationship matrix of each layer; based on the initial relationship matrix of each layer, the initial hidden variables of the spliced ​​multiple attention graphs;

[0010] Each layer is learned through its own encoder network;

[0011] S3, converting the initial node vector into a hidden state representation, and then calculating the hidden state of the edge; updating the initial node hidden state based on the hidden state of the edge to obtain an updated node hidden state, and further updating the hidden state of the edge to obtain an updated hidden state of the edge; based on the updated hidden state of the edge and the updated node hidden state, obtaining an updated layer relationship matrix;

[0012] S4, decode the node hidden state through the decoder, based on the updated node hidden state, use the initial relationship matrix as the attention map, aggregate the interaction strength between pedestrians in each layer, and the influence of other pedestrians on the pedestrian corresponding to the node, and obtain the aggregated message; based on the aggregated message and the updated node hidden state, update the hidden state of the pedestrian corresponding to the node through the gated recurrent unit, and combine the readout network to obtain the next position feature of the pedestrian;

[0013] S5, repeat S3 and S4, continue to predict the next position features of the pedestrian, and obtain the pedestrian trajectory.

[0014] A further improvement of the present invention is:

[0015] Preferably, in S2, by embedding function f embed (), convert the initial node vector into the initial node hidden state.

[0016] Preferably, in S2 and S3, the hidden state formula of the edge is obtained by the hidden state of each node in the graph neural network:

[0017] e (i,j) =f e ([h i ,h j ]

[0018] Among them, h i ,h j are the hidden state vectors of node i and node j respectively, and f e is a multi-layer perceptron MLP network, e (i,j) is the unnormalized weight of the edge.

[0019] Preferably, in S3,

[0020] The formula for updating the hidden state of a node based on the hidden state of an edge is:

[0021]

[0022] Among them, f v It is a graph neural network GNN.

[0023] Preferably, in S2 and S3, an updated layer relationship matrix is ​​obtained through the attention mechanism, and the calculation formula is:

[0024]

[0025] in, Through the attention mechanism Attention(e k (i,j)) is calculated to get the output, which represents the relationship strength between pedestrian i and pedestrian j in layer k; softmax j (e k (i,j)) is the softmax function, which is used to normalize the output calculated by the attention mechanism. is for all j' in the neighborhood N j exp(e k (i,j')) is summed for normalization.

[0026] Preferably, in S4, the formula for obtaining the aggregate message is:

[0027]

[0028] Among them, z k is the relationship matrix calculated by the multi-attention mechanism, representing the interaction strength between agents in different layers k; is the influence of pedestrian i on pedestrian j in layer k.

[0029] Preferably, in S4, the formula for predicting the next position feature of the pedestrian by reading out the network is:

[0030] ”'

[0031] x j =f out (h j )

[0032] Among them, f out To read out the network, h″ j is the hidden state, x′ j For prediction features.

[0033] Preferably, in S4, the formula for updating the hidden state of the node corresponding to the pedestrian through the gated recurrent unit is:

[0034] h′ j =GRU(msg j ,h j )

[0035] Among them, msg j is the aggregate message of the jth pedestrian, h j is the hidden state of pedestrian j.

[0036] Preferably, in S2, the encoder network of each layer is:

[0037]

[0038] Among them, fenc k is an independent encoder network with parameters

[0039] Preferably, the encoder of S2 and the decoder of S4 are trained by using a reconstruction loss function and a KL divergence loss function.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] The present invention discloses a new method based on a multi-relationship graph attention mechanism for learning and predicting the interaction dynamics in a multi-pedestrian social system. The method improves the accuracy of prediction tasks and relational reasoning by more accurately capturing various interactions in complex multi-pedestrian environments. Based on the theory of multiple networks, a multi-layer relationship graph is used to learn the interaction relationships at different levels. Each layer interacts and influences each other through an attention mechanism, and a hierarchical training strategy from simple to complex is used to learn and improve the model in a staged and progressive manner. Experiments were conducted on three different multi-pedestrian datasets to compare the performance of other baseline models on prediction tasks and relational reasoning tasks. The results show that the method proposed in the present invention significantly outperforms the traditional baseline model, and provides an effective method for learning interaction dynamics in multi-pedestrian systems; the system and method can simultaneously represent multiple independent types of interactions and consider different intensities in social relationships,

[0042] (1) Using multiple attention maps as latent variable representations, we explicitly model multi-layer interaction relationships and better capture the dynamics of social multi-pedestrian systems. We introduce an attention mechanism to represent the different strengths of relationships. A hierarchical training strategy stabilizes training and further improves prediction performance.

[0043] (2) The latent variable representation has good interpretability, and the interaction effect is explored through conditional generation and other methods. Hierarchical training maintains the prediction performance while better reducing the dependency between latent variables and improving the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 The overall process of the pedestrian trajectory prediction method and system based on the hierarchical attention mechanism of the present invention;

[0045] Figure 2 Design diagram for encoder;

[0046] Figure 3 Design diagram for the decoder. DETAILED DESCRIPTION

[0047] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:

[0048] The present invention discloses a pedestrian trajectory prediction method based on a hierarchical attention mechanism. The method extracts a better interactive relationship representation through a multi-attention implicit graph structure, combines relationship learning and trajectory prediction, and infers the possible trajectory for a period of time in the future. Specifically, the method includes the following steps:

[0049] S1, obtain the input data set, that is, obtain the feature vectors of N pedestrians at a certain time position

[0050] S2, use the encoder to process the trajectory data of each pedestrian to obtain the hidden state of each pedestrian. The specific process is to embed the position feature vectors of N pedestrians into the graph neural network GNN as the node vectors in the graph neural network GNN; based on the node vectors in the graph neural network GNN, obtain the hidden state of the node; based on the hidden state of each node in the graph neural network, through the multi-layer perceptron MLP network, obtain the hidden state of the edge; based on the hidden state of the edge, update the hidden state of the node;

[0051] Specifically, the normalized edge weights are obtained through the multi-layer perceptron MLP for edge embedding, that is, e (i,j) =f e ([h i ,h j ]), where h i ,h j are the hidden state vectors of nodes i and j, respectively, which are learned from the input feature x through the graph neural network GNN; f e It is a multi-layer perceptron MLP network that accepts the hidden states of nodes i and j as input and outputs the unnormalized weight e of edge (i, j) (i,j) ;

[0052] Based on the hidden state of the edge, the process of updating the hidden state of the node is: This scheme considers the initial hidden state of pedestrian i And the sum of the weighted hidden states of all pedestrians j connected to it. The weighted sum here is the hidden state of pedestrian j Multiply by the corresponding edge hidden state Aggregate the information of neighboring pedestrians to update the state of each pedestrian more comprehensively. Preferably, update the hidden state of the edge between pedestrians i and j again: Use the updated hidden state and The reflection is the change of the relationship between pedestrians after message passing and status update in the whole network.

[0053] In S3, the decoder learns the Agent-Centric representation of each pedestrian, and based on the updated hidden state of the node, exchanges information between different pedestrians through the message passing mechanism, aggregates the relationships and interactions between different pedestrians, and obtains the aggregated results; based on the aggregated results and the Agent-Centric representation, the GraphGRU model is used to update the state of each pedestrian.

[0054] S4, based on the updated pedestrian state and the corresponding pedestrian's hidden state, predict the pedestrian's next position feature through the readout network, which is the pedestrian's trajectory at the next moment.

[0055] The present invention discloses a method for acquiring a pedestrian trajectory prediction method model based on a hierarchical attention mechanism, which specifically comprises the following steps:

[0056] Step 1: Input the trajectory observation data of N pedestrians. Each pedestrian has a position feature vector at each time step.

[0057] Assume that there are N pedestrians in the social scene, and the pedestrian's past trajectory is defined as Time range from T 1 to T 2 The overall location feature set Given a historical trajectory observation As input, learn to predict each agent from T h +1 to T h +T f The future trajectory of the time step, the goal is to estimate the conditional probability That is, given the historical trajectory, the probability distribution of predicting the future trajectory is expressed as:

[0058]

[0059] Among them, X t represents the location feature set of N pedestrians at time t, Represents N pedestrians at time 1 to T h The historical trajectory observation sequence, Represents N pedestrians at time T h +1 to T h +T f The real trajectory sequence, Represents N pedestrians at time T h +1 to T h +T f The predicted trajectory sequence.

[0060] More specifically, t represents the time step corresponding to the position feature vector, and its value range is the time length of the observed trajectory from 1 to T h, x represents the position feature vector. For each time step t, there are N pedestrians, each of which corresponds to a position feature vector, so Represents the position feature vector of pedestrian i at time step t. The position feature vector includes the pedestrian's position coordinates (x, y, z), speed vector, direction vector, the relative position of the pedestrian with other pedestrians, the pedestrian's ID and other attributes.

[0061] Step 2: Input the trajectory observation data into the encoder. The encoder uses multiple attention maps to represent multiple interaction types. In this step, the encoder performs operations after the initial data is input into the encoder. Figure 2 It can be seen that the encoder includes a trajectory data embedding module and a GNN module, and the GNN module includes a multi-attention map.

[0062] Trajectory data embedding: time T h The trajectory data of N pedestrians in the social scene is extracted, that is, the position feature vector of each pedestrian is extracted, and each position feature vector is extracted. Embedded separately into the multi-attention graph to form the node state vector h i Specific trajectory data The embedding process is as follows, through the embedding function f embed (), compressing the observed features of pedestrian i at multiple time steps into a vector of fixed dimension as the node state vector h in the graph neural network GNN i For each pedestrian i, messages from other pedestrians j are collected, attention weights are calculated based on the multiple attention maps z, and the hidden states of other agents are aggregated to extract the influence of other pedestrians on the behavior trajectory of pedestrian i.

[0063] Encoder Encoder Figure 2 As shown in the figure, for each attention map, the graph neural network GNN is used to pass messages on the fully connected directed graph, where each node represents a pedestrian. GNN transforms the trajectory feature vector x of each pedestrian into j Embedded into the edge embedding, for the i-th pedestrian, embed x i , for the jth pedestrian, embed x j ; The edge embedding is obtained by the multi-layer perceptron MLP as the normalized edge weight, i.e., e (i,j) =f e ([h i ,h j ]), where h i ,h j are the hidden state vectors of nodes i and j, respectively, which are learned from the input feature x through the graph neural network GNN; f eIt is a multi-layer perceptron MLP network, which takes the hidden states of nodes i and j as input and outputs the normalized weight e of edge (i, j) (i,j) ;e (i,j) is a vector of dimension K, which determines the number of layers of the implicit interaction graph.

[0064] This method does not classify edges to infer a single-layer interaction graph. Instead, it is based on the normalized weights e (i,j) Directly perform multi-classification on edge embedding to obtain multiple separate layers. Each layer k obtains the relationship matrix z through the attention mechanism k , and normalized by softmax, the relationship matrix consists of the relationship strengths between multiple nodes Composition, each The calculation process is:

[0065]

[0066] in, Through the attention mechanism Attention(e k (i,j)) calculates the output, softmax j (e k (i,j)) is the softmax function applied to e k The result of (i, j) is used to normalize the output after the attention mechanism is calculated, the denominator is for all j' in the neighborhood N j exp(e k (i,j')) is summed for normalization. It represents the relationship strength between pedestrian i and pedestrian j in layer k.

[0067] Multiple layers are concatenated and combined with multiple attention mechanisms to form a latent variable representation z. Specifically, we first define the posterior distribution It is parameterized by an encoder network where z k Represents the relationship matrix of the kth layer. Then, an independent encoder network is assigned to each layer Among them, fenc k is an independent encoder network with parameters Only used for learning the kth layer, fenc k (X) Output the category distribution of each edge through the Categorical distribution model z k In this way, each layer z k Each has its own encoder k To learn, the parameters of these encoders are independent and not shared. Therefore, the relationship matrix z of each layer kk It can represent an interaction type.

[0068] It should be emphasized that the independent encoder network in the above paragraph and the encoder proposed in step 2 have two functions. This part of the independent encoder network is used for learning a single layer.

[0069] In step 3, based on the multiple initial states and variables obtained in step 2, the multiple attention maps pass messages to the feature vectors of each agent through the GNN module in the encoder to update the hidden state of each pedestrian at each time step.

[0070] Representation of interaction types: A graph neural network (GNN) structure is used to pass messages on a fully connected undirected graph, where each node represents a pedestrian. The GNN network outputs multiple hidden layer representations of interaction types and learns k layers of hidden variables for each edge (i, j) in the graph.

[0071] First, the feature vector sequence has been input in step 1, and the primary hidden state of the node is calculated Function f v It is a graph neural network GNN, processing the initial feature vector x of pedestrian i i , converting the original features into a latent representation that is more suitable for graph processing This hidden state provides the basis for subsequent graph structure analysis and message passing; then, the hidden state of the edge is calculated: is the hidden state of the edge between pedestrians i and j. Function f e It is also a graph neural network that uses the hidden states of two pedestrians as input to generate new hidden states that represent the relationship between them, helping to capture the interactions or connections between pedestrians.

[0072] Based on the hidden state of the edge, update the hidden state of the node: This scheme considers the initial hidden state of pedestrian i And the sum of the weighted hidden states of all pedestrians j connected to it. The weighted sum here is the hidden state of pedestrian j Multiply by the corresponding edge hidden state Aggregate the information of neighboring pedestrians to more comprehensively update the status of each pedestrian.

[0073] Based on the update and Through the attention mechanism, formula (5), update the hidden variable of layer k Learning attention between layers of different interaction types The multiple attention maps are represented as linear combinations of different interaction type layers. In this way, through GNN and attention mechanism, the multiple attention map latent variables z representing multiple interaction types are learned from the observed data. ij The hidden state of a pedestrian is the relationship between nodes and edges.

[0074] The updated Input to step 4 to update the hidden state of the pedestrian; at the same time, update the hidden state of the edge between pedestrians i and j again: Use the updated hidden state and The reflection is the change of the relationship between pedestrians after message passing and status update in the whole network.

[0075] Repeatedly update the hidden state of the node and the hidden state of the edge until the set number of times is reached or the update accuracy meets the requirements.

[0076] Through multiple iterations, the hidden states of nodes and edges are continuously optimized, and finally more complex and accurate interaction relationships are captured. In general, this step updates the state of each pedestrian in order to effectively transmit information in the graph structure, so as to capture and utilize multiple relationships and interaction patterns in the network. Under this scheme, the hidden state of each pedestrian not only reflects its own characteristics, but also integrates the information of other pedestrians connected to it.

[0077] Step 4: The decoder uses GraphGRU, takes the hidden state as input, and updates the hidden state of each pedestrian through message passing; GraphGRU is used to update the hidden state of pedestrian i Repeat this step based on the message passed in step 3 to update the hidden state of each pedestrian at each time step through multiple rounds of message passing.

[0078] The relationship matrix z k As a multi-attention map, the input decoder GraphGRU is as follows Figure 3 , and further message passing is performed. First, the message aggregation of pedestrian j is calculated: where z k is the relationship matrix calculated by the multi-attention mechanism, representing the interaction strength between nodes in different layers k. For each layer k, the influence of pedestrian i on pedestrian j is calculated This is the hidden state h of pedestrian i i and relationship strength Afterwards, these effects are summed for all pedestrians and layers to get the final aggregate message msg j This process can capture the mutual influences between different pedestrians and aggregate this information to a single pedestrian j.

[0079] Use the Gated Recurrent Unit (GRU) to update the hidden state of pedestrian j. h' j =GRU(msg j ,h j ), where GRU is a commonly used recurrent neural network structure that can effectively process sequence data. Here, GRU takes into account the current aggregate message msg j and pedestrian j’s current hidden state h j , to generate a new updated hidden state h' j This updating process allows the model to maintain the continuity of time series data while taking into account new information from other pedestrians.

[0080] In summary, through the multiple attention mechanism, the model can consider the dynamic relationship between different pedestrians and update the state of each pedestrian through GRU, thereby effectively capturing the complex spatiotemporal relationship and interaction pattern between pedestrians. The hidden state of each pedestrian not only contains its own information, but also incorporates the information of other pedestrians in the network, improving the model's understanding and prediction capabilities of the entire network structure.

[0081] Step 5: Decode the predicted features of each pedestrian at each time step and continuously predict the future trajectory for multiple steps.

[0082] Through the message passing and hidden state update of the previous step, h″ can be obtained in the next time step j =GRU(msg j ,h' j ), h' j is the hidden state of the previous step, and h″ j is the updated hidden state. Next, the updated hidden state is passed to the readout network to predict the characteristics of the pedestrian. The readout network formula is: j =f out (h″ j ), where f out is to read out the network and convert the hidden state h″ j Convert to prediction feature x′ j To achieve multi-step prediction, repeat the above steps and use the predicted features of each time step as the input of the next time step.

[0083] The repeated prediction formula is: h″′ j =GraphGRU(h″ j ,z k ), x″ j =f out (h″′ j ), where h″′ j is the updated hidden state for the next time step, and x' j ' is the predicted feature at that time step.

[0084] Among them, the relationship matrix z k remains unchanged at each time step, but the hidden state h j The model is updated over time. This process is achieved through the GraphGRU module to update the hidden state, combined with the readout network to predict the features, and achieve the prediction of each agent at each time step. This approach allows the model to capture and predict the dynamic behavior of the agent at different time steps, thereby continuously predicting future trajectories for multiple steps.

[0085] Therefore, the method of decoding the predicted features of each pedestrian at each time step and predicting the future trajectory in multiple steps is as follows:

[0086] Use the output network f{out} to the hidden state Decode and predict the position characteristics of pedestrian i at time t+1 The predicted position features As the input of the next time step t+1, repeat the above steps, update the hidden state and predicted position, and get and By analogy, the above steps are repeated continuously to predict the next position feature of each pedestrian at each time step, realizing multi-step future trajectory prediction. The predicted position feature sequence constitutes the predicted trajectory of each pedestrian within a certain time step in the future.

[0087] The encoder and decoder introduce two loss functions during the training process:

[0088] (1) Reconstruction loss function, which is used to drive the encoder to learn the distribution of latent variables and enable the decoder to reconstruct the input sequence based on the latent variables. The loss function can be written as: Where X represents the input trajectory sequence, z represents the latent variable, and p θ Denote the encoder and decoder respectively. This loss function is calculated and optimized together during the training process of the encoder and decoder;

[0089] (2) KL divergence loss function is used to constrain the distance between the latent variable distribution and the prior distribution to avoid overfitting. The loss function can be written as: Where p(z) represents the prior distribution, which is usually a standard normal distribution. This loss function is calculated and optimized together during the training process of the encoder and decoder;

[0090] So the overall training objective function is: L = L {recom} +λL {KL}, where λ controls the weight of the KL divergence loss. This method uses reconstruction loss to drive learning during the training of both the encoder and decoder, and adds KL divergence loss to constrain the distribution of latent variables during the encoder training process.

[0091] The present invention provides a pedestrian trajectory prediction based on a hierarchical attention mechanism, which mainly includes two parts: an encoder and a decoder. The encoder mainly completes the following tasks: independently embed the trajectory of each agent to obtain the state representation of each agent; use a graph neural network to pass messages to all agent states and learn interaction relationships; output a multiple attention map as a latent variable representation of the interaction relationship, and each attention layer represents the intensity of a type of interaction relationship; the hierarchical training strategy can gradually learn the representation capabilities of different levels of interaction relationships. The decoder mainly completes the following tasks: independently encode each agent to obtain the state representation of each agent at the current moment; use a graph neural network structure to pass messages based on the multiple attention maps output by the encoder to update the state of each agent; use the same multiple attention map for message passing at each time step, but the state representation is dynamically updated; the output reads the network to predict the position state of each agent at each future time step. Based on this function implementation, such as Figure 1 As shown, the specific steps include:

[0092] The implementation of the present invention is based on the Ubuntu 22.04 operating system, the GPU uses NVIDIA GTX4090TI, and all models and environmental simulations are implemented using PyTorch. In order to better test the performance of the IMMA pedestrian trajectory prediction method based on the hierarchical attention mechanism proposed in this paper, three simulation environments commonly used in baseline algorithms are selected: Social Navigation Environment, PHASE dataset, NBA dataset. The invention is mainly analyzed in the social navigation environment, including experiments such as comparison of baseline methods, relational reasoning performance evaluation, and conditional generation. In addition, the prediction performance is compared on the PHASE dataset and the NBA dataset to verify the generalization ability of the method in different environments.

[0093] This paper mainly uses the following indicators to evaluate the effects of different methods on trajectory prediction tasks: 1. Average Displacement Error (ADE), which is defined as the average deviation distance of all entities in the prediction time window: 2. Final Displacement Error (FDE), defined as the deviation distance of all entities at the last prediction time step: 3. GraphAccuracy: It measures the accuracy of the model in predicting the relationships between pedestrians. It is calculated by comparing the consistency between the relationship graph predicted by the model and the actual relationship graph, expressed as: in is an indicator function, when the predicted relationship graph Relationship diagram with actual G i If they are the same, the value is 1, otherwise it is 0; 4. Normalized Mutual Information (NMI), a measure of the amount of shared information between two data sets (such as predicted and actual relationship graphs), is used to evaluate clustering quality and is expressed as: These four indicators jointly evaluate the performance of trajectory prediction and relational reasoning models in various aspects, including prediction accuracy (ADE and FDE), relational reasoning accuracy (GraphAccuracy), and the degree of information overlap between prediction and actual data (NMI).

[0094] Table 1 summarizes the trajectory prediction results of running the model more than 3 times for all three datasets: ADE, FDE and their average values.

[0095]

[0096] Table 2 summarizes the relationship reasoning accuracy of the social navigation environment and the PHASE dataset

[0097]

[0098] It can be seen from Tables 1 and 2 that the proposed method is better than other baseline models overall and improves the performance of pedestrian trajectory prediction. The PHASE dataset is relatively difficult and all models perform relatively poorly in this dataset, indicating that the dataset attributes affect the results.

[0099] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A pedestrian trajectory prediction method based on a hierarchical attention mechanism, characterized in that: The following steps are involved: S1, obtain the feature vectors of N pedestrians at a certain time position; S2, embed the position feature vectors of N pedestrians into the graph neural network GNN in the encoder as the initial node vector in the multi-attention graph of the graph neural network GNN; based on the initial node vector, obtain the initial node hidden state; based on the initial node hidden state of each node in the multi-attention graph, obtain the initial unnormalized weight of the edge through the multi-layer perceptron MLP network; Based on the initial unnormalized weights, classify the edge embeddings to obtain k layers, and obtain the initial relationship matrix for each layer; Based on the initial relationship matrix of each layer, the initial latent variables of the concatenated multiple attention maps; Each layer is learned through its own encoder network; S3, converting the initial node vector into a hidden state representation, and then calculating the hidden state of the edge; updating the initial node hidden state based on the hidden state of the edge to obtain an updated node hidden state, and further updating the hidden state of the edge to obtain an updated hidden state of the edge; based on the updated hidden state of the edge and the updated node hidden state, obtaining an updated layer relationship matrix; S4, decode the node hidden state through the decoder, based on the updated node hidden state, use the initial relationship matrix as the attention map, aggregate the interaction strength between pedestrians in each layer, and the influence of other pedestrians on the pedestrian corresponding to the node, and obtain the aggregated message; based on the aggregated message and the updated node hidden state, update the hidden state of the pedestrian corresponding to the node through the gated recurrent unit, and combine the readout network to obtain the next position feature of the pedestrian; S5, repeat S3 and S4, continue to predict the next position features of the pedestrian, and obtain the pedestrian trajectory.

2. The pedestrian trajectory prediction method based on the hierarchical attention mechanism according to claim 1, characterized in that: In S2, by embedding function f embed (), convert the initial node vector into the initial node hidden state.

3. The pedestrian trajectory prediction method based on the hierarchical attention mechanism according to claim 1 is characterized in that: In S2 and S3, the hidden state formula of each node in the graph neural network is used to obtain the hidden state of the edge: e (i,j) =f e ([h i ,h j ] Among them, h i ,h j are the hidden state vectors of node i and node j respectively, and f e is a multi-layer perceptron MLP network, e (i,j) is the unnormalized weight of the edge.

4. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S3, The formula for updating the hidden state of a node based on the hidden state of an edge is: Among them, f v It is a graph neural network GNN.

5. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S2 and S3, the updated layer relationship matrix is ​​obtained through the attention mechanism, and the calculation formula is: in, Through the attention mechanism Attention(e k (i,j)) is calculated to get the output, which represents the relationship strength between pedestrian i and pedestrian j in layer k; softmax j (e k (i,j)) is the softmax function, which is used to normalize the output calculated by the attention mechanism. is for all j' in the neighborhood N j exp(e k (i,j')) is summed for normalization.

6. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S4, the formula for obtaining the aggregated message is: Among them, z k is the relationship matrix calculated by the multi-attention mechanism, representing the interaction strength between agents in different layers k; is the influence of pedestrian i on pedestrian j in layer k.

7. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S4, the formula for predicting the next position feature of a pedestrian through the readout network is: x′ j =f out (h″ j ) Among them, f out For the readout network, h″ j is the hidden state, x′ j For prediction features.

8. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S4, the formula for updating the hidden state of the node corresponding to the pedestrian through the gated recurrent unit is: h′ j =GRU(msg j ,h j ) Among them, msg j is the aggregate message of the jth pedestrian, h j is the hidden state of pedestrian j.

9. The pedestrian trajectory prediction method based on a hierarchical attention mechanism according to claim 1, characterized in that: In S2, the encoder network of each layer is: Among them, fenc k is an independent encoder network with parameters 10. The pedestrian trajectory prediction method based on hierarchical attention mechanism according to claim 1, characterized in that: The encoder of S2 and the decoder of S4 are trained using the reconstruction loss function and the KL divergence loss function.

Citation Information

Cited By

  • Dynamic system relation reasoning method based on bidirectional attention

    CN122334522A