Log In Sign Up

Spatio-Temporal Graph Transformer Networks for Pedestrian Trajectory Prediction

by   Cunjun Yu, et al.

Understanding crowd motion dynamics is critical to real-world applications, e.g., surveillance systems and autonomous driving. This is challenging because it requires effectively modeling the socially aware crowd spatial interaction and complex temporal dependencies. We believe attention is the most important factor for trajectory prediction. In this paper, we present STAR, a Spatio-Temporal grAph tRansformer framework, which tackles trajectory prediction by only attention mechanisms. STAR models intra-graph crowd interaction by TGConv, a novel Transformer-based graph convolution mechanism. The inter-graph temporal dependencies are modeled by separate temporal Transformers. STAR captures complex spatio-temporal interactions by interleaving between spatial and temporal Transformers. To calibrate the temporal prediction for the long-lasting effect of disappeared pedestrians, we introduce a read-writable external memory module, consistently being updated by the temporal Transformer. We show STAR outperforms the state-of-the-art models on 4 out of 5 real-world pedestrian trajectory prediction datasets, and achieves comparable performance on the rest.


Spatial-Channel Transformer Network for Trajectory Prediction on the Traffic Scenes

Predicting motion of surrounding agents is critical to real-world applic...

S2TNet: Spatio-Temporal Transformer Networks for Trajectory Prediction in Autonomous Driving

To safely and rationally participate in dense and heterogeneous traffic,...

GraphTCN: Spatio-Temporal Interaction Modeling for Human Trajectory Prediction

Trajectory prediction is a fundamental and challenging task to forecast ...

PreTR: Spatio-Temporal Non-Autoregressive Trajectory Prediction Transformer

Nowadays, our mobility systems are evolving into the era of intelligent ...

Entry-Flipped Transformer for Inference and Prediction of Participant Behavior

Some group activities, such as team sports and choreographed dances, inv...

Attentional-GCNN: Adaptive Pedestrian Trajectory Prediction towards Generic Autonomous Vehicle Use Cases

Autonomous vehicle navigation in shared pedestrian environments requires...

UST: Unifying Spatio-Temporal Context for Trajectory Prediction in Autonomous Driving

Trajectory prediction has always been a challenging problem for autonomo...

1 Introduction

Figure 1: Illustration of the predicted trajectories. STAR successfully models spatio-temporal crowd dynamics with only a strong Transformer-based attention mechanism. STAR produces more accurate prediction trajectories compared to the state-of-the-art model, SR-LSTM.

Crowd trajectory prediction is of fundamental importance to both the computer vision 

[1, 16, 53, 21, 22] and robotics [34, 33] community. This task is challenging because 1) human-human interactions are multi-modal and extremely hard to capture, e.g., strangers would avoid intimate contact with others, while fellows tend to walk in group [53]; 2) the complex temporal prediction is coupled with the spatial human-human interaction, e.g., humans condition their motions on the history and future motion of their neighbors [21].

(a) Crowd Motion Modeling (b) STAR Overview
Figure 2: (a) People decide their future motions by paying different attentions (light yellow for less attention and dark red for more attention) to the potential future motions of their neighbors up to a certain time interval (). (b) STAR models the crowd as a graph and learns spatio-temporal interaction of the crowd motion by interleaving between a graph-based spatial Transformer and a temporal Transformer. An external read-writable graph memory module is applied to improve the smoothness of the temporal predictions.

Classic models capture human-human interaction by handcrafted energy-functions [19, 18, 34], which require significant feature engineering effort and normally fail to build crowd interactions in crowded spaces [21]

. With the recent advances in deep neural networks, Recurrent Neural Networks (RNNs) have been extensively applied to trajectory prediction and demonstrated promising performance 

[1, 16, 53, 21, 22]. RNN-based methods capture pedestrian motion by their latent state and model the human-human interaction by merging latent states of spatially proximal pedestrians. Social-pooling [1, 16] treat pedestrians in a neighborhood area equally and merge their latent state by a pooling mechanism. Attention mechanisms [22, 53, 21] relax this assumption and weigh pedestrians according to a learned function, which encodes unequal importance of neighboring pedestrians for trajectory prediction. However, existing predictors have two shared limitations: 1) the attention mechanisms used are still simple, which fails to fully model the human-human interaction, 2) RNNs normally have difficulty modeling complex temporal dependencies [43].

Recently, Transformer networks have made ground-breaking progress in Natural Language Processing domains (NLP) 

[43, 10, 26, 52, 50]. Transformers discard the sequential nature of language sequences and model temporal dependencies with only the powerful self-attention mechanism. The major benefit of Transformer architecture is that self-attention significantly improves temporal modeling, especially for horizon sequences, compared to RNNs [43]. Nevertheless, Transformer-based models are restricted to normal data sequences and it is hard to generalize them to more structured data, e.g., graph sequences.

In this paper, we introduce the Spatio-Temporal grAph tRansformer (STAR) framework, a novel framework for spatio-temporal trajectory prediction based purely on self-attention mechanism. We believe that learning the temporal, spatial and temporal-spatial attentions is the key to accurate crowd trajectory prediction, and Transformers provide a neat and efficient solution to this task. STAR captures the human-human interaction with a novel spatial graph Transformer. In particular, we introduce TGConv, a Transformer-based graph convolution mechanism. TGConv improves the attention-based graph convolution [44] by self-attention mechanism with Transformers and can capture more complex social interactions. We model pedestrian motions with separate temporal Transformers, which better captures temporal dependencies compared to RNNs. STAR extracts spatio-temporal interaction among pedestrians by interleaving between spatial Transformer and temporal Transformer, a simple yet effective strategy. Besides, as Transformers treat a sequence as a bag of words, they normally have problem modeling time series data where strong temporal consistency is enforced [29]. We introduce an additional read-writable graph memory module that continuously performs smoothing over the embeddings during prediction. An overview of STAR is given by Fig. 2.(b)

We experimented on 5 commonly used real-world pedestrian trajectory prediction datasets. We show that STAR outperforms the state-of-the-art (SOTA) trajectory predictors on 4 out of 5 datasets and achieves comparable results on the rest. We conduct extensive ablation studies to provide a detailed understanding of each proposed component.

We summarize our contribution as follows: 1) we provide a new insight for trajectory prediction, that spatio-temporal attention modeling is the most critical component for trajectory prediction; 2) we introduce TGConv, a novel Transformer-based graph convolution for attention based graph feature learning; 3) we extend Transformer networks to graph-structured data sequences, in particular, crowd trajectory data sequences, and we introduce STAR, a framework for spatio-temporal graph-based crowd trajectory prediction that achieves SOTA results.

2 Background

2.1 Self-Attention and Transformer Networks

Transformer networks have achieved great success in the NLP domain, such as machine translation, sentiment analysis, and text generation 

[10]. Transformer networks follow the famous encoder-decoder structure widely used in the RNN seq2seq models [3, 6].

The core idea of Transformer is to replace the recurrence completely by multi-head self-attention mechanism. For embeddings , the self-attention of Transformers first learns the query matrix , key matrix and a corresponding value matrix of all embeddings from to . It computes the attention by


where is the dimension of each query. The

implements the scaled-dot product term for numerical stability for attentions. By computing the self-attention between embeddings across different time steps, the self-attention mechanism is able to learn temporal dependencies over long time horizon, in contrast to RNNs that remember the history with a single vector with limited memory. Besides, decoupling attention into the query, key and value tuples allows the self-attention mechanism to capture more complex temporal dependencies.

Multi-head attention mechanism learns to combine multiple hypotheses when computing attentions. It allows the model to jointly attend to information from different representations at different positions. With heads, we have


where is a fully connected layer merging the output from heads and denote the self-attention of the -th head. Additional positional encoding is used to add positional information to the Transformer embeddings. Finally, Transformer outputs the updated embeddings by a fully connected layer with two skip connections.

However, one major limitation of current Transformer-based models is they only apply to non-structured data sequences, e.g., word sequences. STAR extends Transformers to more structured data sequences, as a first step, graph sequences, and apply it to trajectory prediction.

2.2 Related Works

2.2.1 Graph Neural Networks

Graph Neural Networks (GNNs) are powerful deep learning architectures for graph-structured data. Graph convolutions 

[27, 24, 9, 15, 47]

have demonstrated significant improvement on graph machine learning tasks, e.g., modeling physical systems 

[4, 28], drug prediction [31] and social recommendation systems [11]. In particular, Graph Attention Networks (GAT) [44] implement efficient weighted message passing between nodes and achieved state-of-the-art results across multiple domains. From the sequence prediction perspective, temporal graph RNNs allow learning spatio-temporal relationship in graph sequences [8, 17]. Our STAR improves GAT with TGConv, a transformer boosted attention mechanism and tackles the graph spatio-temporal modeling with transformer architecture.

2.2.2 Sequence Prediction

RNNs and its variants, e.g., LSTM [20] and GRU [7], have achieved great success in sequence prediction tasks, e.g., speech recognition [46, 39], robot localization [14, 36], robot decision making [23, 37], and etc. RNNs have been also successfully applied to model the temporal motion pattern of pedestrians [1, 16, 21, 53, 22]. RNNs-based predictors make predictions with a Seq2Seq structure [41]. Additional structure, e.g., social pooling [1, 16], attention mechanism [48, 45, 22] and graph neural networks [21, 53], are used to improve the trajectory prediction with social interaction modeling.

Transformer networks have dominated Natural Language Processing domains in recent years [43, 10, 26, 52, 50]. Transformer models completely discard the recurrence and focus on the attention across time steps. This architecture allows long-term dependency modeling and large-batch parallel training. Transformer architecture has also been applied to other domains with success, e.g., stock prediction [30], robot decision making [12] etc. STAR is a generalization of the Transformer to the graph sequences. We demonstrate it on a challenging crowd trajectory prediction task, where we consider crowd interaction as a graph. STAR is a general framework and could be applied to other graph sequence prediction tasks, e.g., event prediction in social networks [35] and physical system modeling [28]. We leave this for future study.

2.2.3 Crowd Interaction Modeling

As the pioneering work, Social Force models [19, 32] have been proven effective in various applications, e.g., crowd analysis [18] and robotics [13]. They assume the pedestrians are driven by virtual forces for goal navigation and collision avoidance. Social Force models work well on interaction modeling while performing poorly on trajectory prediction [25]. Geometry based methods, e.g., ORCA [42] and PORCA [34], consider the geometry of the agent and convert the interaction modeling into an optimization problem. One major limitation of classic approaches is that they rely on hand-crafted features, which is non-trivial to tune and hard to generalize.

Deep learning based models achieve automatic feature engineering by directly learning the model from data. Behavior CNNs [51] capture crowd interaction by CNNs. Social-Pooling [1, 16] further encodes the proximal pedestrian states by a pooling mechanism that approximates the crowd interaction. Recent works consider crowd as a graph and merge information of the spatially proximal pedestrians with attention mechanisms [48, 45, 22]. Attention mechanism models pedestrians with importance compared to the pooling methods. Graph neural networks are also applied to address crowd modeling [21, 53]. Explicit message passing allows the network to model more complex social behaviors.

3 Method

3.1 Overview

In this section, we introduce the proposed spatio-temporal graph Transformer based trajectory prediction framework, STAR. We believe attention is the most important factor for effective and efficient trajectory prediction.

STAR decomposes the spatio-temporal attention modeling into temporal modeling and spatial modeling. For temporal modeling, STAR considers each pedestrian independently and applies a standard temporal Transformer network to extract the temporal dependencies. The temporal Transformer provides a better temporal dependency modeling protocol compared to RNNs. For spatial modeling, we introduce TGConv, a Transformer-based message passing graph convolution mechanism. TGConv improves the state-of-the-art graph convolution methods with a better attention mechanism and gives a better model for complex spatial interactions. We construct two encoder modules, each including a pair of spatial and temporal Transformers, and stack them to extract spatio-temporal interactions.

3.2 Problem Setup

We are interested in the problem of predicting future trajectories starting at time step to of total pedestrians involved in a scene, given the observed history during time steps to . At each time step , we have a set of pedestrians , where denotes the position of the pedestrian in a top-down view map. We assume the pedestrian pairs with distance less than would have an undirected edge . This leads to an interaction graph at each time step : , where and . For each node at time , we define its neighbor set as , where for each node , .

(a) Temporal Transformer (b) Spatial Transformer
Figure 3: STAR has two main components, Temporal Transformer and Spatial Transformer. (a) Temporal Transformer treats each pedestrians independently and extracts the temporal dependencies by Transformer model ( is the embedding of pedestrian positions, , and are the query, key, value matrix in Transformers). (b) Spatial Transformer models the crowd as a graph, and applies TGConv, a Transformer-based message passing graph convolution, to model the social interactions ( is the message from node to represented by Transformer attention)

3.3 Temporal Transformer

The temporal Transformer block in STAR uses a set of pedestrian trajectory embeddings as input, and output a set of updated embeddings with temporal dependencies as output, considering each pedestrian independently.

The structure of a temporal Transformer block is given by Fig. 3.(a). The self-attention block first learns the query matrices , key matrix and the value matrix given the inputs. For -th pedestrian, we have


where , and are the corresponding query, key and value functions shared by pedestrians . We could parallel the computation for all pedestrians, benefiting from the GPU acceleration.

We compute the attention for each single pedestrian separately, following Eq. 1. Similarly, we have the multi-head attention ( heads) for pedestrian represented as


where is a fully connected layer that merges the heads and indexes the -th head. The final embedding is generated by two skip connections and a final fully connected layers, as shown in Fig. 3.(a).

The temporal Transformer is a simple generalization of Transformer networks to a data sequence set. We demonstrate in our experiment that Transformer based architecture provides better temporal modeling.

3.4 Spatial Transformer

The spatial Transformer block extracts the spatial interaction among pedestrians. We propose a novel Transformer based graph convolution, TGConv, for message passing on a graph.

Our key observation is that the self-attention mechanism can be regarded as message passing on an undirected fully connected graph. For a feature vector of feature set , we can represent its corresponding query vector as , key vector as and value vector as . We define the message from node to in the fully connected graph as


and the attention function (Eq. 1) can be rewritten as


Built upon the above insight, we introduce Transformer-based Graph Convolution (TGConv). TGConv is essentially an attention-based graph convolution mechanism, similar to GATConv [44], but with a better attention mechanism powered by Transformers. For an arbitrary graph where is the node set and . Assume each node is associated with an embedding and a neighbor set . The graph convolution operation for node is written as


where is the output function, in our case, a fully connected layer, and is the updated embedding of node by TGConv. We summarize the TGConv function for node by . In a Transformer structure, we would normally apply layer normalization [2] after each skip connection in the above equations. We ignored them in the equations for a clean notation.

The spatial Transformer, as shown in Fig. 3.(b), can be easily implemented by the TGConv. A TGConv with shared weights is applied to each graph separately. We believe TGConv is general and can be applied to other tasks, e.g., drug prediction [31] and social recommendation systems [11]. We leave it for future study.

Figure 4: Network structure of STAR with application to trajectory prediction. In STAR, trajectory prediction is achieved completely by attention mechanisms. STAR interleaves spatial Transformer and temporal Transformer in two encoder blocks to extract spatio-temporal pedestrian dependencies. An external read-writable graph memory module helps to smooth the graph embeddings and improve the consistency of temporal predictions. The prediction at is added back to history to predict the pedestrian poses at .

3.5 Spatio-Temporal Graph Transformer

In this section, we introduce the Spatio-Temporal grAph tRansformer (STAR) framework for pedestrian trajectory prediction.

Temporal transformer can model the motion dynamics of each pedestrian separately, but fails to incorporate spatial interactions; spatial Transformer tackles crowd interaction with TGConv but can be hard to generalize to temporal sequences. One major challenge of pedestrian prediction is modeling coupled spatio-temporal interaction. The spatial and temporal dynamics of a pedestrian is tightly dependent on each other. For example, when one decides her next action, one would first predict the future motions of her neighbors, and choose an action that avoids collision with others in a time interval .

STAR addresses the coupled spatio-temporal modeling by interleaving the spatial and temporal Transformers in a single framework. Fig. 4 shows the network structure of STAR. STAR has two encoder modules and a simple decoder module. The input to the network is the pedestrian position sequences from to , where the pedestrian positions at time step is denoted by with . In the first encoder, we embed the positions by two separate fully connected layers and pass the embeddings to spatial Transformer and Temporal Transformer, to extract independent spatial and temporal information from the pedestrian history. The spatial and temporal features are then merged by a fully connected layer, which gives a set of new features with spatio-temporal encodings. To further model spatio-temporal interaction in the feature space, we perform post-processing of the features with the second encoder module. In encoder 2, spatial Transformer models spatial interaction with temporal information; the temporal Transformer enhances the output spatial embeddings with temporal attentions. STAR predicts the pedestrians positions at using a simple fully connected layer with the embeddings from the second temporal Transformer as input. We construct by connecting the nodes with distance smaller than according to the predicted positions. The prediction is added to the history for the next step prediction.

The STAR architecture significantly improves the spatio-temporal modeling ability compared to naively combining spatial and temporal Transformers.

3.6 External Graph Memory

Although Transformer networks improve long-horizon sequence modeling by self-attention mechanism, it would potentially have difficulties handling continuous time-series data which requires a strong temporal consistency [29]. Temporal consistency, however, is a strict requirement for trajectory prediction, because pedestrian positions normally would not change sharply during a short period.

We introduce a simple external graph memory to tackle this dilemma. A graph memory is read-writable and learnable, where has the same size with and memorizes the embeddings of pedestrian . At time step , in encoder 1, the temporal Transformer first reads from memory the past graph embeddings with function and concatenate it with the current graph embedding . This allows the Temporal Transformers to condition current embeddings on the previous embedding for a consistent prediction. In encoder 2, we write the output of Temporal Transformer to the graph memory by function , which performs a smoothing over the time series data. For any , the embeddings will be updated by the information from , which gives temporally smoother embeddings for a more consistent trajectory.

For implementing and , many potential function forms could be adopted. In this paper, we only consider a very simple strategy


that is, we directly replace the memory with the embeddings and copy the memory to generate the output. This simple strategy works well in practice. More complicated functional form of and could be considered, e.g., fully connected layers or RNNs. We leave this for future study.

4 Experiments

In this section, we first report our results on five pedestrian trajectory datasets which serve as the major benchmark for the task of trajectory prediction: ETH (ETH and HOTEL) and UCY (ZARA1, ZARA2, and UNIV) datasets. We compare STAR to 9 trajectory predictors, including the SOTA model, SR-LSTM [53]. We follow the leave-one-out cross-validation evaluation strategy which is commonly adopted by previous works. We also perform extensive ablation studies to understand the effect of each proposed component and try to provide deeper insights for model design in the trajectory prediction task.

As a brief conclusion, we show that: 1) STAR outperforms the SOTA model on 4 out of 5 datasets and have a comparable performance to the SOTA model on the other dataset; 2) the spatial Transformer improves crowd interaction modeling compared to existing graph convolution methods; 3) the temporal Transformer generally improves the LSTM; 4) the graph memory gives a smoother temporal prediction and a better performance.

4.1 Experiment Setup

We follow the same data prepossessing strategy as SR-LSTM[53] for our method. The origin of all the input is shifted to the last observation frame. Random rotation is adopted for data augmentation.

  • Average Displacement Error (ADE): the mean square error (MSE) overall estimated positions in the predicted trajectory and ground-truth trajectory.

  • Final Displacement Error (FDE): the distance between the predicted final destination and the ground-truth final destination.

We take 8 frames (3.2s) as an observation sequence and 12 frames(4.8s) as the target sequence for prediction to have a fair comparison with all the existing works. In addition, we mainly compare our results with 7 deterministic methods in which only one unique position of a target at a certain time point would be predicted instead of distribution.

4.2 Implementation Details

Coordinates as input would be first encoded into a vector in size of 32 by a fully connected layer followed with ReLU activation. The dropout ratio at 0.1 is applied when processing the input data. All the transformer layers accept input with feature size at 32. Both spatial transformer and temporal transformer consists of two basic encoding layers with 8 heads. We performed a hyper-parameter search over the learning rate, from 0.0001 to 0.004 with interval 0.0001 on a smaller network and choose the best-performed learning rate (0.0015) to train all the other models. As a result, we train the network using Adam optimizer with a learning rate of 0.0015 and batch size 4 for 300 epochs. Each batch contains around 128 pedestrians in different time windows indicated by an attention mask to accelerate the training and inference process.

4.3 Baselines

We compare STAR with a wide range of baselines, including: 1) LR: A simple temporal linear regressor; 2) LSTM: a vanilla temporal LSTM; 3) S-LSTM [1]: each pedestrian is modeled with an LSTM, and the hidden state is pooled with neighbors at each time-step; 4) Social Attention [45]: it models the crowd as a spatio-temporal graph and uses two LSTMs to capture spatial and temporal dynamics; 5) CIDNN [49]: a modularized approach for spatio-temporal crowd trajectory prediction with LSTMs; 6) SGAN [16]: a stochastic trajectory predictor with GANs; 7) SoPhie [40]: one of the SOTA stochastic trajectory predictors with LSTMs. 8) TrafficPredict [38]: LSTM-based motion predictor for heterogeneous traffic agents. Note that TrafficPredict in [38] reports isometrically normalized results. We scale them back for a consistent comparison; 9) SR-LSTM: the SOTA trajectory predictor with motion gate and pair-wise attention to refine the hidden state encoded by LSTM to obtain social interactions.

4.4 Quantitative Results and Analyses

We compare ST-GAT with state-of-the-art approaches as mentioned in Section 4.3. Note that the stochastic methods [16, 40] are also presented for reference, but not directly comparable to our approach. All the stochastic method samples 20 times and reports the best-performed sample, which is infeasible for many online applications, e.g., autonomous driving, because measuring the prediction error requires the hindsight knowledge of the ground truth.

The main results are presented in Table 1. We observe that STAR outperforms SOTA models on 4 out of 5 datasets, and achieved comparable performance on the other one. STAR also achieves the best average performance over the 5 datasets. Besides, STAR significantly outperforms the stochastic methods, even though they use 20 samples and select the best one compared to the ground truth. This suggests STAR, as a deterministic model, successfully captures the underlying stochastic nature of the complex crowd dynamics.

One interesting finding is that the simple model LR significantly outperforms many deep learning approaches including the SOTA model, SR-LSTM, in the HOTEL scene, which mostly contains straight-line trajectories and is relatively less crowded. This indicates that these complex models might overfit to those complex scenes like UNIV. Another example is that STAR significantly outperforms SR-LSTM on ETH and HOTEL, but is only comparable to SR-LSTM on UNIV, where the crowd density is high. This can potentially be explained by that SR-LSTM has a well-designed gated-structure for message passing on the graph, but has a relatively weak temporal model, a single LSTM. The design of SR-LSTM potentially improves spatial modeling but might also lead to overfitting. In contrast, our approach performs well in both simple and complex scenes. We then will further demonstrate this in Sect. 4.5 with visualized results.

Performance (ADE/FDE)
LR 1.33/2.94 0.39/0.72 0.62/1.21 0.77/1.48 0.82/1.59 0.79/1.59
LSTM 1.13/2.39 0.69/1.47 0.64/1.43 0.54/1.21 0.73/1.60 0.75/1.62
S-LSTM[1] 0.77/1.60 0.38/0.80 0.51/1.19 0.39/0.89 0.58/1.28 0.53/1.15
CIDNN[49] 1.25/2.32 1.31/1.86 0.90/1.28 0.50/1.04 0.51/1.07 0.89/1.73
SocialAttention [45] 1.39/2.39 2.51/2.91 1.25/2.54 1.01/2.17 0.88/1.75 1.41/2.35
TrafficPredict [38] 5.46/9.73 2.55/3.57 4.32/8.00 3.76/7.20 3.31/6.37 3.88/6.97
SR-LSTM [53] 0.63/1.25 0.37/0.74 0.41/0.90 0.32/0.70 0.51/1.10 0.45/0.94
STAR 0.56/1.11 0.26/0.50 0.40/0.89 0.31/0.71 0.52/1.13 0.41/0.87
SGAN [16] 0.81/1.52 0.72/1.61 0.34/0.69 0.42/0.84 0.60/1.26 0.58/1.18
SoPhie* [40] 0.70/1.43 0.76/1.67 0.30/0.63 0.38/0.78 0.54/1.24 0.54/1.15
Table 1: Comparison with baselines models. The stochastic methods are not directly comparable to STAR though we outperform them in general. We cite the results here just for reference. : The results marked with are calculated on 20 samples since they are stochastic models. : SoPhie method takes extra image input.

4.5 Qualitative Results and Analyses

We present our qualitative results in Fig. 5 and Fig. 7. We focus on the visualization of STAR and compare it with the SOTA model, SR-LSTM.

Figure 5: Trajectory visualization. STAR successfully models the spatio-temporal interaction of the crowd and makes better predictions than the SOTA model, SR-LSTM. (a) STAR accurately extracts the temporal dynamics of the agent; (b, c, d) STAR is able to model crowd interaction and spatio-temporal interactions.
(a) (b) (c) (d)
Figure 6: Attention visualization of the spatial Transformer in encoder 2. We visualize the attention of all pedestrians with respect to the red dotted pedestrian. The size of circles represents the attention value and bigger circles indicate higher attention. STAR learns reasonable spatial attention, the pedestrians have higher attentions over themselves and their neighbors.
  • STAR is able to predict temporally consistent trajectories. In Fig. 5.(a), STAR successfully captures the intention and velocity of the single pedestrian, where no social interaction exists.

  • STAR successfully extracts the social interaction of the crowd. We visualize the attention values of the second spatial Transformer in Fig. 7. We notice that pedestrians are paying high attention to themselves and the neighbors who might potentially collide with them, e.g., Fig. 7.(c) and (d); less attention is paid to spatially far away pedestrians and pedestrians without conflict of intentions, e.g., Fig. 7.(a) and (b).

  • STAR is able to capture spatio-temporal interaction of the crowd. In Fig. 5.(b), we can see that the prediction of pedestrian considers the future motions of their neighbors. In addition, STAR better balances the spatial modeling and temporal modeling, compared to SR-LSTM. SR-LSTM potentially overfits on the spatial modeling and often tends to predict curves even when pedestrians are walking straight. This also corresponds to our findings in the quantitative analyses section, that deep predictors overfits onto complex datasets. STAR better alleviates this issue with the spatial-temporal Transformer structure.

  • Auxiliary information is required for more accurate trajectory prediction. Although STAR achieves the SOTA results, prediction can be still inaccurate occasionally, e.g., Fig. 5.(d). The pedestrian takes a sharp turn, which makes it impossible to predict future trajectory purely based on the history of locations. For future work, additional information, e.g., environment setup or map, should be used to provide extra information for prediction.

4.6 Ablation Studies

We conduct extensive ablation studies on all 5 datasets to understand the influence of each STAR component. The results are presented in Table 2.

Components Performance (MAD/FAD)
(1) GCN STAR 3.06/5.57 0.99/1.80 2.49/4.58 1.37/2.52 1.38/2.47 1.86 /3.34
(2) GAT STAR 0.64/1.25 0.34/0.72 0.47/1.09 0.37/0.86 0.55/1.19 0.48/1.02
(3) MHA STAR 0.58/1.15 0.25/0.48 0.50/0.98 0.35/0.76 0.60/1.24 0.56/0.92
(4) STAR LSTM - 0.66/1.29 0.34/0.68 0.45/0.96 0.34/0.74 0.60/1.29 0.48/0.99
(5) STAR STAR 0.60/1.18 0.28/0.60 0.53/1.13 0.36/0.76 0.57/1.20 0.47/0.97
(6) VSTAR VSTAR 0.61/1.18 0.29/0.56 0.48/1.00 0.36/0.76 0.58/1.24 0.46/0.95
(7) STAR STAR 0.56/1.11 0.26/0.50 0.40/0.89 0.31/0.71 0.52/1.13 0.41/0.87
Table 2: Ablation Study on SR-LSTM. We replace components in STAR with existing works. SP denotes spaital encoder. TP denotes temporal encoder. GM denotes Graph Memory. GAT denotes Graph Attention Network[44], MHA denotes Multi-Head Additive attention[5].STAR denotes components in original STAR. VSTAR denoets simplified STAR without encoder2.
  • The temporal Transformer improves the temporal modeling of pedestrian dynamics compared to RNNs. In (4) and (5), we remove the graph memory and fix the STAR for spatial encoding. The temporal prediction ability of these two models is only dependent on their temporal encoders, LSTM for (4) and STAR for (5). We observe that the model with temporal Transformer encoding outperforms LSTM in its overall performance, which suggests that Transformers provide a better temporal modeling ability compared to RNNs.

  • TGConv outperforms the other graph convolution methods on crowd motion modeling. In (1), (2), (3) and (7), we change the spatial encoders and compare the spatial Transformer by TGConv (7) with the GCN [24], GATConv [44] and the multi-head additive graph convolution [5]. We observe that TGConv, under the scenario of crowd modeling, achieves higher performance gain compared to the other two alternative attention-based graph convolutions.

  • Interleaving spatial and temporal Transformer is able to better extract spatio-temporal correlations. In (6) and (7), we observe that the two encoder structures proposed in the STAR framework (7), generally outperforms the single encoder structure (6). This empirical performance gain potentially suggests that interleaving the spatial and temporal Transformers is able to extract more complex spatio-temporal interactions of pedestrians.

  • Graph memory gives a smoother temporal embedding and improves performance. In (5) and (7), we verify the embedding smoothing ability of the graph memory module, where (5) is the STAR variant without GM. We first noticed that graph memory improves the performance of STAR on all datasets. In addition, we noticed that on ZARA1, where the spatial interaction is simple and temporal consistency prediction is more important, graph memory improves (6) to (7) by the largest margin. According to the empirical evidence, we can conclude that the embedding smoothing of graph memory is able to improve the overall temporal modeling for STAR.

5 Conclusion

We have introduced STAR, a framework for spatio-temporal crowd trajectory prediction with only attention mechanisms. STAR consists of two encoder modules, composed of spatial Transformers and temporal Transformers. We also have introduced TGConv, a novel powerful Transformer based graph convolution mechanism. STAR achieves state-of-the-art performance on 4 out of 5 commonly used pedestrian trajectory prediction datasets.

STAR makes prediction only with the past trajectories, which might fail to detect the unpredictable sharp turns. Additional information, e.g., environment configuration, could be incorporated into the framework to solve this issue.

STAR framework and TGConv are not limited to trajectory prediction. They can be applied to any graph learning task. We leave it for future study.


Additional Attention Visualization

Figure 7: Additional attention visualizations of the spatial Transformer, i.e., connected in the interaction graph, in encoder 2. We visualize the attention of neighbor pedestrians with respect to the red dotted pedestrian. The size of circles represents the attention value and bigger circles indicate higher attention. STAR learns reasonable spatial attention, the pedestrians have higher attentions over themselves and their neighbors.

Ablation Trajectory Prediction Visualizations

(a) GAT + STAR
(b) MHA + STAR
(d) STAR without Graph Memory
(e) Simplified STAR without Encoder 2
(f) STAR
Figure 8: Trajectory visualization of all ablations. Yellow lines denote the history, red lines denote the ground-truth, and blue lines denote the prediction. Qualitatively, STAR produces best predictions both spatially and temporally.