Probabilistic Ship Trajectory Forecasting using Transformer Models on AIS Data
Authors: Frederik E. T. Schöller
Organizations: Automation and Control Group, Department of Electrical Engineering, Technical University of Denmark, Kgs. Lyngby, Denmark · Technical University of Denmark
Anticipation of vessel trajectories is an essential task when navigating at sea. This applies to both human navigators and autonomous surface vessels. Trajectory forecasting enables sub-routines such as collision avoidance to assess the situation and react accordingly in time. This paper investigates Transformer and Performer models for trajectory prediction of surface vessels in confined waters. Using widely available position data from the Automatic Identification System (AIS), candidate models are trained and evaluated. Historical information on how other vessels have moved in the local area surrounding each agent is conveyed using positional heat maps. The heat maps are generated using Kernel Density Estimation (KDE) and encoded with a Convolutional Neural Network (CNN) before entering the Transformer models. The models are trained with quantile loss to efficiently obtain a model-aware prediction interval, as this is crucial for timely collision avoidance. The proposed model architectures are shown to greatly outperform previous work while the inclusion of local heat maps enables the prediction of vessel movement that is not otherwise indicated from the previous positions.
Figures & tables
Figure 1: Example of linear interpolation of positional AIS data.
Area
Bounding rectangle
# Trajectories
Period
The Great Belt
55∘4.2259′ N, 10∘0.1282′ E 55∘26.8333′ N, 11∘19.216′ E
574 171
September 2018
Hven
55∘47.9365′ N, 12∘23.3764′ E 56∘8.0261′ N, 13∘3.6935′ E
653 979
May 2018
Falsterborev
55∘12.6989′ N, 12∘27.1789′ E 55∘26.144′ N, 12∘50.4963′ E
408 070
September 2018
Table 1: Overview of the training data.
Figure 2: Heat maps of AIS data from the areas around The Great Belt, Oresund, and Falsterborev. The heat maps are generated using kernel density estimation.
Figure 3: Model illustration of the implemented Transformer architecture.
Operation
# Filters
Kernel
Stride
Padding
Output size
Input
–
–
–
–
64×64×1
Conv2d
8
3
1
1
64×64×8
Conv2d
8
3
1
1
64×64×8
Conv2d
8
3
2
1
32×32×8
Conv2d
16
3
1
1
32×32×16
Conv2d
16
3
1
1
32×32×16
Table 2: Structure of the spatial feature extractor. Each Conv2d block is followed by batch normalization and LeakyReLU activation.
Figure 6
Method
ADE ↓
FDE ↓
IAcc ↑
Inference time (ms)
The Great Belt
Linear
0.415
1.054
7.0%
14.5
GP
0.534
1.303
59.5%
14.5
LSTM-GAN
0.363
0.767
78.0%
157
Transformer
0.137
0.289
94.6%
6.0
Performer
0.137
0.291
94.7%
7.1
Table 4: Evaluation results on the three test areas. ADE and FDE are given in kilometres. Inference time is the average time per prediction measured over 1000 batches with a batch size of 1 on an NVIDIA RTX 3090 GPU. The best result in each group is shown in bold.
Method
ADE ↓
FDE ↓
IAcc ↑
Transformer
0.222
0.483
71.1%
Performer
0.206
0.461
75.0%
TransformerNo Heat
0.247
0.585
86.6%
PerformerNo Heat
0.257
0.608
85.3%
Table 5: Evaluation results on the Oresund area using models trained on data from the same area gathered during a different month. ADE and FDE are given in kilometres.
Figure 5: Trajectory forecasting of a vessel using the different methods. Here, the background shows the local heat map, the pink coordinates indicate the input data, the blue coordinates the true trajectory, the yellow coordinates show the predicted trajectory, and the orange ellipsoids indicate the 95% prediction interval for each time step. It is clearly seen that including the heat map yields a far better prediction. The scale of the sub-figures is shown by the scale bar at the top of Figure 5(a) .
Accurate long-term trajectory prediction for maritime vessels is essential for safety and logistical efficiency. While deep learning models, particularly Transformers, have shown promise in processing Automatic Identification System (AIS) data, they often struggle with the quadratic computational complexity of self-attention and the loss of accuracy over extended forecasting horizons. This study proposes TempTPI, a novel prediction framework that integrates an Informer-based encoder with a multi-channel temporal encoding mechanism. The Informer architecture leverages a ProbSparse self-attention mechanism to reduce computational overhead and focus on the most significant dependencies, while the temporal encoder utilizes Fourier-like frequency expansions to capture cyclic patterns (hourly, daily, and seasonal) in vessel behavior. We evaluate our model against the state-of-the-art TPTrans architecture using AIS data from Danish waters. Experimental results demonstrate that TempTPI consistently outperforms existing methods across prediction windows of 1 to 5 hours. Notably, at a 5-hour horizon, the proposed model achieves a 55% improvement in Mean Squared Error (MSE), offering a robust solution for long-range maritime situational awareness.
Kevin Ferneding, Veronika Lietavcova, Aleksandra M. Blachowiak +1
Technical University of Denmark Anker Engelunds Vej 101 2800 Kongens Lyngby, Denmark
Accurate vessel trajectory prediction is essential for safe and efficient maritime operations, enabling collision avoidance and supporting route optimization. Although memory-augmented neural networks have recently shown strong performance in pedestrian and road-vehicle trajectory prediction by selectively retrieving relevant information from an external memory, their potential for vessel trajectory prediction remains underexplored. This paper presents an empirical investigation of memory-based trajectory prediction using Automatic Identification System (AIS) data. Experiments on data from the Gulf of Mexico and the New York Bight demonstrate consistent and substantial performance gains over a range of deep learning baselines that do not incorporate an external memory.
Wonmo Koo, Sanha Chang, Heeyoung Kim
Department of Industrial and Systems Engineering, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, Republic of Korea.
Accurate vessel trajectory prediction is critical for maritime safety and anomaly detection, yet existing models often struggle with geographic bias and navigational realism. We propose the Continuous Regression Hybrid Transformer (CRHT), a deep learning framework designed to forecast vessel motion using Automatic Identification System (AIS) data. To mitigate spatial data imbalance, we introduce an online K-means cluster sampling strategy that ensures diverse exposure to rare maneuvers during training. Our hybrid architecture integrates 1D convolutional layers for local kinematic feature extraction with a multi-head attention mechanism for global temporal context. CRHT demonstrates superior performance in short-term forecasting, achieving the lowest errors at the 1-hour horizon. The results demonstrate that while discrete models provide high navigational stability over long horizons, CRHT offers an optimal balance of precision and maneuver tracking for real-time maritime surveillance.
Alexander Schiøtz, Bertram Hage, Christian Rand +2
Technical University of Denmark Anker Engelunds Vej 101 2800 Kongens Lyngby, Denmark