Abstract
Most recent successes on forecasting the people motion are based on LSTM models and all most recent progress has been achieved by modelling the social interaction among people and the people interaction with the scene. We question the use of the LSTM models and propose the novel use of Transformer Networks for trajectory forecasting. This is a fundamental switch from the sequential step-by-step processing of LSTMs to the only-attention-based memory mechanisms of Transformers. In particular, we consider both the original Transformer Network (TF) and the larger Bidirectional Transformer (BERT), state-of-the-art on all natural language processing tasks. Our proposed Transformers predict the trajectories of the individual people in the scene. These are "simple" model because each person is modelled separately without any complex human-human nor scene interaction terms. In particular, the TF model without bells and whistles yields the best score on the largest and most challenging trajectory forecasting benchmark of TrajNet. Additionally, its extension which predicts multiple plausible future trajectories performs on par with more engineered techniques on the 5 datasets of ETH + UCY. Finally, we show that Transformers may deal with missing observations, as it may be the case with real sensor data. Code is available at https://github.com/FGiuliari/Trajectory-Transformer.
Introduction
Predicting pedestrian trajectories is a critical task for autonomous systems, including self-driving cars and social robots. For years, the field has been dominated by Long Short-Term Memory (LSTM) networks. To improve performance, researchers have focused on adding complex "social pooling" layers to capture interactions between pedestrians. However, LSTMs suffer from inherent limitations: their sequential nature hinders parallelization, and their reliance on a single hidden state can struggle with long-term dependencies or missing data points. This research challenges the status quo by asking if the fundamental temporal model—the LSTM—is the bottleneck, and proposes the use of Transformer Networks as a superior alternative.
Methodology
The core proposal is to replace sequential LSTMs with Transformer Networks (TF). Unlike LSTMs that process data step-by-step, Transformers use attention mechanisms to process the entire input sequence simultaneously.
Key technical aspects include:
- Individual Modeling: Each pedestrian is modeled as an independent agent without explicit social interaction layers.
- Positional Encoding: Since Transformers lack an inherent sense of order, sine and cosine functions are used to encode the temporal position of each coordinate.
- Encoder-Decoder Architecture: The TF uses an encoder to process the observed trajectory and a decoder to generate future positions auto-regressively.
- Quantized TF ($TF_q$): A variation that treats motion as a classification problem over a grid, enabling the prediction of multiple plausible future paths.
Key Insights and Results
The shift from sequential processing to global attention provides several advantages. Transformers maintain a clear separation between the "memory" of the past (encoder output) and the current prediction (decoder state), which appears to enhance long-term forecasting stability.
Performance on Benchmarks
The "simple" individual Transformer achieved the top score on the TrajNet benchmark, outperforming 42 other models, many of which utilized complex social and scene-interaction mechanisms. On the ETH + UCY datasets, the model performed on par with state-of-the-art engineered techniques.
Robustness and Scalability
- Missing Data: Transformers are naturally robust to gaps in observations. In experiments where 75% of observation frames were removed, the TF maintained reasonable accuracy, whereas LSTMs typically fail without specific architectural modifications.
- Long-Term Horizons: When extending predictions to 32 time steps, the Transformer's error grew 25% slower than that of the LSTM, demonstrating superior long-term dependency modeling.
Conclusion
This work demonstrates that a high-capacity temporal model like the Transformer can outperform complex socially-aware LSTM models in trajectory forecasting. While social context remains important, the fundamental shift to attention-based mechanisms provides a more robust and accurate foundation. Future research may explore pre-training on massive trajectory datasets or integrating social context directly into the Transformer's attention layers.
Summary updated