Submitted:
19 May 2025
Posted:
19 May 2025
You are already at the latest version
Abstract
Keywords:
1. Introduction
- A fine-grained, token-level annotation scheme is proposed, defining five behavioral categories—Normal, U-Shape Turn, Cycle, Noise, and Detour, which are all based on real-world AIS trajectories. This dataset serves as a public benchmark for evaluating and comparing anomaly detection methods in maritime domains.
- This is the first work to formulate AIS trajectory anomaly detection as a token classification task, enabling sequential modeling at a fine temporal resolution and offering more precise identification of anomalous segments within vessel tracks.
- A novel hybrid architecture is proposed to integrate an exponential moving attention mechanism with a state-space-based Yearning network. Leveraging the low-latency benefits provided by SAGSIN, the proposed model demonstrates enhanced effectiveness in detecting abnormal ship characteristics.
2. Related Work
3. Methodology
3.1. Abnormal Definition
- 0 - Normal: Smooth, goal-directed trajectories that follow an expected and efficient path.
- 1 - Cycle: Repetitive a loop within a confined area.
- 2 - U-turn: Abrupt reversals in direction, over to 180 degrees.
- 3 - Detour: Significant deviations from the shortest or expected path, usually due to obstructions or errors.
- 4 - Noise: Irregular, fragmented movements lacking continuity, typically caused by sensor errors or random disturbances.

3.2. Data Processing
3.2.1. Data Cleaning
Filtering
- Area of Interest: Filter the AIS data based on the vessel’s geographic coordinates (latitude and longitude) to focus on the area of interest.
- Exclusion of moored/anchored vessels: Exclude vessels that are stationary, identified by characteristics such as a travel distance less than 5 nautical miles or a constant speed of 0 knots.
- Temporal Consistency: Select vessels with continuous and complete data points. Ensure that the time interval between consecutive data points is no more than 10 minutes to maintain temporal sequence.
- Data Point Length: Ensure that each vessel has at least 20 data points and no more than 200 data points to avoid data sparsity or excessive data.
Cubic Spline Interpolation
3.2.2. Feature Extraction
Kinematic Variables
Detour Factor
Yaw Angle Factor
3.3. Exponential Attention
3.4. State space Model
3.5. Conditional Random Fields
4. Experiment
4.1. Environment Setup
4.2. Evaluation Metrics
4.3. Comparison Studies
4.4. Ablation Studies
4.5. Discussion
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Davenport, M. Kinematic behaviour anomaly detection (KBAD)-Final report. DRDC CORA report KBAD-RP-52-6615 2008.
- Liu, J.; Li, J.; Liu, C. AIS-based kinematic anomaly classification for maritime surveillance. Ocean Engineering 2024, 305, 118026. [Google Scholar] [CrossRef]
- Ming, W.C.; Yanan, L.; Lanxi, M.; Jiuhu, C.; Zhong, L.; Sunxin, S.; Yuanchao, Z.; Qianying, C.; Yugui, C.; Xiaoxue, D.; et al. Intelligent marine area supervision based on AIS and radar fusion. Ocean Engineering 2023, 285, 115373. [Google Scholar] [CrossRef]
- Rong, H.; Teixeira, A.; Soares, C.G. A framework for ship abnormal behaviour detection and classification using AIS data. Reliability Engineering & System Safety 2024, 247, 110105. [Google Scholar]
- Gil, M. A concept of critical safety area applicable for an obstacle-avoidance process for manned and autonomous ships. Reliability Engineering & System Safety 2021, 214, 107806. [Google Scholar]
- Zhou, Y.; Shen, X.; Fu, S.; Zhang, Y.; Hao, Y. Framework for detecting abnormal behaviors of passenger ships: A case study from the Yangtze River Estuary. Ocean Engineering 2025, 325, 120796. [Google Scholar] [CrossRef]
- Zhang, J.; Teixeira, Â.P.; Guedes Soares, C.; Yan, X.; Liu, K. Maritime transportation risk assessment of Tianjin Port with Bayesian belief networks. Risk analysis 2016, 36, 1171–1187. [Google Scholar] [CrossRef]
- Gil, M.; Kozioł, P.; Wróbel, K.; Montewka, J. Know your safety indicator–A determination of merchant vessels Bow Crossing Range based on big data analytics. Reliability Engineering & System Safety 2022, 220, 108311. [Google Scholar]
- Reynolds, D.A.; et al. Gaussian mixture models. Encyclopedia of biometrics 2009, 741, 3. [Google Scholar]
- Chen, J.; Chen, H.; Chen, Q.; Song, X.; Wang, H. Vessel sailing route extraction and analysis from satellite-based AIS data using density clustering and probability algorithms. Ocean engineering 2023, 280, 114627. [Google Scholar] [CrossRef]
- Xie, Z.; Bai, X.; Xu, X.; Xiao, Y. An anomaly detection method based on ship behavior trajectory. Ocean Engineering 2024, 293, 116640. [Google Scholar] [CrossRef]
- Dai, J.; Liu, Y.; Chen, J.; Liu, X. Fast feature selection for interval-valued data through kernel density estimation entropy. International Journal of Machine Learning and Cybernetics 2020, 11, 2607–2624. [Google Scholar] [CrossRef]
- Rabiner, L.; Juang, B. An introduction to hidden Markov models. ieee assp magazine 1986, 3, 4–16. [Google Scholar] [CrossRef]
- Lafferty, J.; McCallum, A.; Pereira, F.; et al. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proceedings of the Icml. Williamstown, MA, 2001, Vol. 1, p. 3.
- Zaman, B.; Marijan, D.; Kholodna, T. Online Ornstein–Uhlenbeck based anomaly detection and behavior classification using AIS data in maritime. Ocean Engineering 2024, 312, 119057. [Google Scholar] [CrossRef]
- Ester, M.; Kriegel, H.P.; Sander, J.; Xu, X.; et al. A density-based algorithm for discovering clusters in large spatial databases with noise. In Proceedings of the kdd, 1996, Vol. 96, pp. 226–231.
- McInnes, L.; Healy, J.; Astels, S.; et al. hdbscan: Hierarchical density based clustering. J. Open Source Softw. 2017, 2, 205. [Google Scholar] [CrossRef]
- Jiao, J.B.; Li, W.F. Ship abnormal behavior detection based on KD-Tree and clustering algorithm. In Proceedings of the 2023 8th International Conference on Intelligent Computing and Signal Processing (ICSP). IEEE. 2023; 1315–1318. [Google Scholar]
- Zhang, C.; Liu, S.; Guo, M.; Liu, Y. A novel ship trajectory clustering analysis and anomaly detection method based on AIS data. Ocean Engineering 2023, 288, 116082. [Google Scholar] [CrossRef]
- Yan, Z.; Song, X.; Zhong, H.; Yang, L.; Wang, Y. Ship classification and anomaly detection based on spaceborne AIS data considering behavior characteristics. Sensors 2022, 22, 7713. [Google Scholar] [CrossRef]
- LeCun, Y.; Bottou, L.; Bengio, Y.; Haffner, P. Gradient-based learning applied to document recognition. Proceedings of the IEEE 1998, 86, 2278–2324. [Google Scholar] [CrossRef]
- Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural computation 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
- Cho, K.; Van Merriënboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv preprint, arXiv:1406.1078.
- Zhang, B.; Hirayama, K.; Ren, H.; Wang, D.; Li, H. Ship anomalous behavior detection using clustering and deep recurrent neural network. Journal of Marine Science and Engineering 2023, 11, 763. [Google Scholar] [CrossRef]
- León-López, K.; Fabre, S.; Manzoni, F.; Mirambell, L.; Tourneret, J.Y. A Multiscale Anomaly Detection Framework for AIS Trajectories via Heat Graph Laplacian Diffusion. In Proceedings of the 2024 32nd European Signal Processing Conference (EUSIPCO). IEEE, 2024, pp. 2337–2341.
- Xie, L.; Guo, T.; Chang, J.; Wan, C.; Hu, X.; Yang, Y.; Ou, C. A novel model for ship trajectory anomaly detection based on Gaussian mixture variational autoencoder. IEEE Transactions on Vehicular Technology 2023, 72, 13826–13835. [Google Scholar] [CrossRef]
- Nguyen, V.S.; Im, N.k.; Lee, S.m. The interpolation method for the missing AIS data of ship. Journal of navigation and port research 2015, 39, 377–384. [Google Scholar] [CrossRef]
- Zhang, D.; Li, J.; Wu, Q.; Liu, X.; Chu, X.; He, W. Enhance the AIS data availability by screening and interpolation. In Proceedings of the 2017 4th International Conference on Transportation Information and Safety (ICTIS). IEEE, 2017, pp. 981–986.
- Guo, S.; Mou, J.; Chen, L.; Chen, P. Improved kinematic interpolation for AIS trajectory reconstruction. Ocean Engineering 2021, 234, 109256. [Google Scholar] [CrossRef]
- Wang, C.N.; Dang, T.T.; Le, T.Q.; Kewcharoenwong, P. Transportation optimization models for intermodal networks with fuzzy node capacity, detour factor, and vehicle utilization constraints. Mathematics 2020, 8, 2109. [Google Scholar] [CrossRef]
- Ke, G.; Meng, Q.; Finley, T.; Wang, T.; Chen, W.; Ma, W.; Ye, Q.; Liu, T.Y. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems 2017, 30. [Google Scholar]
- Chen, T.; Guestrin, C. Xgboost: A scalable tree boosting system. In Proceedings of the Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, 2016, pp. 785–794.
- Liaw, A.; Wiener, M.; et al. Classification and regression by randomForest. R news 2002, 2, 18–22. [Google Scholar]
- Geurts, P.; Ernst, D.; Wehenkel, L. Extremely randomized trees. Machine learning 2006, 63, 3–42. [Google Scholar] [CrossRef]
- Peterson, L.E. K-nearest neighbor. Scholarpedia 2009, 4, 1883. [Google Scholar] [CrossRef]
- Breiman, L. Bagging predictors. Machine learning 1996, 24, 123–140. [Google Scholar] [CrossRef]
- Song, Y.Y.; Ying, L. Decision tree methods: applications for classification and prediction. Shanghai archives of psychiatry 2015, 27, 130. [Google Scholar]
- Zhang, S.; Zheng, D.; Hu, X.; Yang, M. Bidirectional long short-term memory networks for relation classification. In Proceedings of the Proceedings of the 29th Pacific Asia conference on language, information and computation, 2015, pp. 73–78.
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser. ; Polosukhin, I. Attention is all you need. Advances in neural information processing systems 2017, 30. [Google Scholar]
- Hunter, J.S. The exponentially weighted moving average. Journal of quality technology 1986, 18, 203–210. [Google Scholar] [CrossRef]
- Gu, A.; Dao, T. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint, arXiv:2312.00752.











| Model | Class F1-Score | Macro Avg | Weighted Avg | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | Prec | Rec | F1 | Prec | Rec | F1 | |
| Machine Learning | |||||||||||
| LGBM [31] | 0.54 | 0.52 | 0.49 | 0.47 | 0.64 | 0.66 | 0.51 | 0.53 | 0.64 | 0.53 | 0.53 |
| XGB [32] | 0.54 | 0.53 | 0.49 | 0.47 | 0.62 | 0.65 | 0.51 | 0.53 | 0.63 | 0.53 | 0.53 |
| RandomForest [33] | 0.54 | 0.50 | 0.48 | 0.45 | 0.58 | 0.55 | 0.50 | 0.51 | 0.54 | 0.52 | 0.51 |
| ExtraTrees [34] | 0.55 | 0.50 | 0.48 | 0.45 | 0.57 | 0.55 | 0.50 | 0.51 | 0.54 | 0.52 | 0.51 |
| KNeighbors [35] | 0.53 | 0.49 | 0.50 | 0.46 | 0.50 | 0.53 | 0.49 | 0.50 | 0.52 | 0.50 | 0.50 |
| Bagging [36] | 0.54 | 0.50 | 0.46 | 0.45 | 0.57 | 0.53 | 0.50 | 0.50 | 0.53 | 0.51 | 0.50 |
| ExtraTree [34] | 0.53 | 0.49 | 0.49 | 0.45 | 0.55 | 0.53 | 0.50 | 0.50 | 0.53 | 0.51 | 0.50 |
| DecisionTree [37] | 0.53 | 0.49 | 0.45 | 0.44 | 0.55 | 0.52 | 0.49 | 0.49 | 0.51 | 0.50 | 0.50 |
| Deep Learning | |||||||||||
| LSTM [22] | 0.78 | 0.61 | 0.50 | 0.56 | 0.75 | 0.65 | 0.65 | 0.64 | 0.65 | 0.66 | 0.65 |
| BiLSTM [38] | 0.94 | 0.49 | 0.45 | 0.48 | 0.86 | 0.68 | 0.64 | 0.64 | 0.70 | 0.66 | 0.66 |
| Transformer [39] | 0.61 | 0.38 | 0.16 | 0.36 | 0.65 | 0.52 | 0.47 | 0.43 | 0.52 | 0.49 | 0.44 |
| EMA [40] | 0.94 | 0.51 | 0.46 | 0.50 | 0.88 | 0.67 | 0.65 | 0.66 | 0.69 | 0.67 | 0.68 |
| SSM [41] | 0.75 | 0.64 | 0.53 | 0.57 | 0.77 | 0.47 | 0.47 | 0.47 | 0.66 | 0.67 | 0.66 |
| Ours | 0.94 | 0.71 | 0.55 | 0.65 | 0.90 | 0.79 | 0.76 | 0.75 | 0.80 | 0.77 | 0.76 |
| Class labels 0 to 4 represent the patterns: Normal, Cycle, U-turn, Detour, and Noise Cluster. | |||||||||||
| No. | BS | Attention | SSM | Metric | |||||
|---|---|---|---|---|---|---|---|---|---|
| macro avg | weighted avg | ||||||||
| P | R | F1 | P | R | F1 | ||||
| 1 | LSTM | 0.6462 | 0.6469 | 0.6387 | 0.6543 | 0.6563 | 0.6478 | ||
| 2 | Mulit-Head | 0.5545 | 0.548 | 0.5454 | 0.5548 | 0.5449 | 0.5441 | ||
| 3 | EMA | 0.6677 | 0.6534 | 0.6586 | 0.6908 | 0.6716 | 0.6794 | ||
| 4 | Base | 0.4740 | 0.4690 | 0.4658 | 0.6643 | 0.6669 | 0.6576 | ||
| 5 | Gated | 0.6406 | 0.6261 | 0.6242 | 0.6653 | 0.6522 | 0.6497 | ||
| 6 | EMA | Base | 0.7274 | 0.7098 | 0.7043 | 0.7510 | 0.7176 | 0.7219 | |
| Ours | EMA | Gated | 0.7877 | 0.7557 | 0.7492 | 0.7996 | 0.7657 | 0.7610 | |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).