A ResNet1D-AttLSTM-Based Approach for Ship Trajectory Classification
Abstract
:1. Introduction
- Non-adjacent co-feature extraction based on self-attention: To overcome the limitations in extracting features from non-adjacent regions, this study leverages the self-attention mechanism [36], which can directly attend to any position in the sequence and dynamically focus on the most useful information for the current task, to construct the AttLSTM module. By innovatively integrating the self-attention mechanism with the LSTM architecture, the model can more effectively extract feature patterns that require joint representation across multiple regions, even if these patterns are discontinuously distributed within a region.
- Depth-scalable architecture with residual learning: To enhance model scalability in sequence tasks while minimizing gradient-related concerns, this study proposes the Resnet1D module. This module combines one-dimensional convolution with skip connections, constructing a multi-scale feature pyramid to ensure stable gradient propagation while expanding model depth.
2. Methods
2.1. Data Preprocessing
- Missing value data refers to records where critical attributes such as longitude, latitude, speed over ground, course over ground, and time are absent.
- Outlier data includes records where the values for important attributes like longitude, latitude, speed over ground, course over ground, and time fall outside reasonable ranges.
- Duplicate data consists of identical records that appear multiple times within the dataset.
- Fixed time window-based segmentation: For the navigation records of each ship in the AIS dataset, an initial trajectory segmentation is performed using a sliding window approach. Specifically, a fixed time window of 60 min is employed to traverse the entire navigation record in chronological order. Each window’s trajectory points are aggregated into an independent trajectory sequence.
- Removal of anchoring points: A speed threshold, , is set; if the speed of a trajectory point is less than , it is considered an anchoring point and removed from the trajectory sequence. Anchoring points are removed because they contain static data that contribute little to the analysis of vessel navigation behavior and may even introduce noise.
- Outlier removal: An heuristic outlier detection method [34] is employed. Using the current trajectory point as the center and as the radius (where is the upper limit of the reasonable speed range and is the time interval between the current and next trajectory points), a circular region is defined. If the next trajectory point falls outside this circular region, it is identified as an outlier. Outliers are typically caused by sensor malfunctions, signal interference, or other external factors leading to data anomalies, which can interfere with the analysis of true vessel navigation behavior.
- Trajectory segmentation: A time interval threshold, , is set. In the trajectory sequence, the time interval between each trajectory point and the previous one is calculated. If the time interval exceeds , it is marked as a segmentation point, dividing the trajectory sequence into multiple subsequences. The primary purpose of trajectory segmentation is to ensure that the trajectory points within each segment are more closely related in space and time, avoiding data dispersion caused by long time intervals. This helps the model learn more accurate behavioral patterns.
- Sequence length filtering: A trajectory point count threshold, , is established. The number of trajectory points in each sequence is calculated, and sequences with fewer points than are discarded. Removing overly short sequences reduces the impact of noise and allows the model to focus on high-quality data.
2.2. Construction of the ResNet1D-AttLSTM Model
2.2.1. ResNet1D Module
2.2.2. AttLSTM Module
- denotes element-wise multiplication (Hadamard product).
- denotes assignment.
- and represent the weight matrices and bias parameters of the gate controllers, respectively.
- and denote the Sigmoid activation function and the hyperbolic tangent activation function, respectively.
- represents the new information to be added to the cell state.
2.2.3. Trajectory Classification Based on Multilayer Perceptron
- Number of layers: 2 hidden layers.
- Number of neurons per layer:
- The first hidden layer has twice the number of neurons as the dimensionality of the comprehensive feature vector.
- The second hidden layer has half the number of neurons as the first hidden layer.
- Activation Function: ReLU activation function is used for all hidden layers.
3. Experiment
3.1. Data Analysis and Preprocessing
3.2. Experimental Setup
3.2.1. Experimental Environment
3.2.2. Model Implementation and Training
- For the ResNet1D module, the convolutional layers were configured with 32 convolutional kernels of size 3;
- Within the residual blocks, the convolutional layers were configured with 64 convolutional kernels of the same size;
- In the AttLSTM module, the dimension of the memory cells was set to 128.
3.3. Model Evaluation and Analysis
3.3.1. Evaluation Metrics
- : The number of correctly classified ship trajectory sequences.
- : The total number of ship trajectory sequences.
- : The number of true positives, i.e., the number of ship trajectory sequences correctly classified as belonging to a particular class.
- : The number of false negatives, i.e., the number of ship trajectory sequences that belong to a particular class but were incorrectly classified as belonging to another class.
- : The number of false positives, i.e., the number of ship trajectory sequences that do not belong to a particular class but were incorrectly classified as belonging to that class.
3.3.2. Hyperparameter Tuning of ResNet1D-AttLSTM
3.3.3. Classification Performance on Different Ship Types
- F1-score analysis:
- The model demonstrates good recognition ability across all categories of ship trajectories, with F1 scores exceeding 87% for each category. The highest F1 score is achieved for towing vessels at 91.6%, while the lowest is for sailing vessels at 87.3%.
- The superior classification performance for towing vessels may be attributed to their distinctive movement patterns: relatively fixed navigation paths, low and stable speeds, and regular turning behaviors.
- The lower F1 score for sailing vessels could be due to their variable heading and speed characteristics, as well as their broad and unfixed activity areas.
- Precision analysis:
- The model achieves the lowest precision for fishing vessels at 86.3% and the highest for passenger ships at 93%. This indicates that many non-fishing vessel trajectories were misclassified as fishing vessels, whereas most predicted passenger ship trajectories were correctly identified.
- Further analysis of the confusion matrix reveals that the low precision for fishing vessels primarily stems from confusion between sailing and fishing vessel trajectories. Under specific sailing conditions, these two types of vessels exhibit similar trajectory features. For example, when wind conditions allow small fishing boats and sailboats to have comparable speed and heading changes, or when they operate in similar waters, it becomes challenging for the model to distinguish between them. This confusion also contributes to the lower recall rate for sailing vessels.
- Recall analysis:
- The recall for passenger ship trajectories is relatively low at 86.8%, while it is highest for oil tankers at 93.2%. This suggests that some passenger ship trajectories were misclassified as other types, whereas most actual oil tanker trajectories were correctly identified.
- The analysis shows that many passenger ship trajectories were misidentified as oil tankers. Oil tankers typically have more fixed routes and higher data quality, which helps the model better distinguish them from other types of ships.
3.3.4. Comparative Analysis
4. Conclusions and Future Work
- Expanding the training dataset: Increase the diversity and volume of training data, especially for less represented vessel types like fishing and sailing boats, to improve classification accuracy and robustness.
- Integrating contextual features: Incorporate additional discriminative features such as operational type and weather conditions into the model to better capture the context of vessel movements, thereby improving classification performance.
- Refining data preprocessing techniques: Optimize preprocessing methods, considering the periodic nature of certain navigational data (e.g., longitude and COG), to ensure that these steps more accurately reflect actual navigation scenarios.
- Optimizing model architecture: Explore various optimization strategies for the ResNet1D-AttLSTM architecture, including the testing of different activation functions or the introduction of partitioned activation mechanisms, to potentially achieve even better model performance.
- Enhancing classification system diversity: Expand the scope of the classification system to include a wider range of vessel types, making it adaptable to diverse maritime environments and specific application scenarios.
- Generalizing to other domains: Investigate the applicability of the developed methods to other domains, such as urban traffic management, to validate the generalizability and adaptability of the proposed techniques.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Ma, Q.; Tang, H.; Liu, C.; Zhang, M.; Zhang, D.; Liu, Z.; Zhang, L. A Big Data Analytics Method for the Evaluation of Maritime Traffic Safety Using Automatic Identification System Data. Ocean Coast. Manag. 2024, 251, 107077. [Google Scholar] [CrossRef]
- El Mekkaoui, S.; Benabbou, L.; Caron, S.; Berrado, A. Deep Learning-Based Ship Speed Prediction for Intelligent Maritime Traffic Management. J. Mar. Sci. Eng. 2023, 11, 191. [Google Scholar] [CrossRef]
- Feng, C.; Fu, B.; Luo, Y.; Li, H. The Design and Development of a Ship Trajectory Data Management and Analysis System Based on AIS. Sensors 2022, 22, 310. [Google Scholar] [CrossRef] [PubMed]
- Shahir, A.Y.; Tayebi, M.A.; Glasser, U.; Charalampous, T.; Zohrevand, Z.; Wehn, H. Mining Vessel Trajectories for Illegal Fishing Detection. In Proceedings of the 2019 IEEE International Conference on Big Data (Big Data), Los Angeles, CA, USA, 9–12 December 2019; pp. 1917–1927. [Google Scholar]
- Li, H.; Jiao, H.; Yang, Z. Ship Trajectory Prediction Based on Machine Learning and Deep Learning: A Systematic Review and Methods Analysis. Eng. Appl. Artif. Intell. 2023, 126, 107062. [Google Scholar] [CrossRef]
- Park, J.; Jeong, J.; Park, Y. Ship Trajectory Prediction Based on Bi-LSTM Using Spectral-Clustered AIS Data. J. Mar. Sci. Eng. 2021, 9, 1037. [Google Scholar] [CrossRef]
- Murray, B.; Perera, L.P. Ship Behavior Prediction via Trajectory Extraction-Based Clustering for Maritime Situation Awareness. J. Ocean Eng. Sci. 2022, 7, 1–13. [Google Scholar] [CrossRef]
- Suo, Y.; Chen, W.; Claramunt, C.; Yang, S. A Ship Trajectory Prediction Framework Based on a Recurrent Neural Network. Sensors 2020, 20, 5133. [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]
- Rong, H.; Teixeira, A.P.; Guedes Soares, C. Data Mining Approach to Shipping Route Characterization and Anomaly Detection Based on AIS Data. Ocean Eng. 2020, 198, 106936. [Google Scholar] [CrossRef]
- Jin, J.; Zhou, W.; Jiang, B. An Overview: Maritime Spatial-Temporal Trajectory Mining. J. Phys. Conf. Ser. 2021, 1757, 012125. [Google Scholar] [CrossRef]
- Han, P.; Yang, X. Big Data-Driven Automatic Generation of Ship Route Planning in Complex Maritime Environments. Acta Oceanol. Sin. 2020, 39, 113–120. [Google Scholar] [CrossRef]
- Rong, Y.; Zhuang, Z.; He, Z.; Wang, X. A Maritime Traffic Network Mining Method Based on Massive Trajectory Data. Electronics 2022, 11, 987. [Google Scholar] [CrossRef]
- Kaklis, D.; Kontopoulos, I.; Varlamis, I.; Emiris, I.Z.; Varelas, T. Trajectory Mining and Routing: A Cross-Sectoral Approach. J. Mar. Sci. Eng. 2024, 12, 157. [Google Scholar] [CrossRef]
- Li, G.; Liu, M.; Zhang, X.; Wang, C.; Lai, K.; Qian, W. Semantic Recognition of Ship Motion Patterns Entering and Leaving Port Based on Topic Model. J. Mar. Sci. Eng. 2022, 10, 2012. [Google Scholar] [CrossRef]
- Zhou, C.; Liu, G.; Huang, L.; Wen, Y. Spatiotemporal Companion Pattern (STCP) Mining of Ships Based on Trajectory Features. J. Mar. Sci. Eng. 2023, 11, 528. [Google Scholar] [CrossRef]
- Feng, C.; Xu, J.; Zhang, J.; Li, H. A Spatiotemporal Co-Occurrence Pattern Mining Algorithm Based on Ship Trajectory Data. Adv. Mech. Eng. 2024, 16, 16878132241274449. [Google Scholar] [CrossRef]
- Gao, M.; Shi, G.-Y. Ship-Handling Behavior Pattern Recognition Using AIS Sub-Trajectory Clustering Analysis Based on the T-SNE and Spectral Clustering Algorithms. Ocean Eng. 2020, 205, 106919. [Google Scholar] [CrossRef]
- Liu, J.; Chen, Z.; Zhou, J.; Xue, A.; Peng, D.; Gu, Y.; Chen, H. Research on A Ship Trajectory Classification Method Based on Deep Learning. Chin. J. Inf. Fusion 2024, 1, 3–15. [Google Scholar] [CrossRef]
- Liu, Z.; Gao, H.; Zhang, M.; Yan, R.; Liu, J. A Data Mining Method to Extract Traffic Network for Maritime Transport Management. Ocean Coast. Manag. 2023, 239, 106622. [Google Scholar] [CrossRef]
- Sheng, K.; Liu, Z.; Zhou, D.; He, A.; Feng, C. Research on Ship Classification Based on Trajectory Features. J. Navig. 2018, 71, 100–116. [Google Scholar] [CrossRef]
- Hu, B.; Jiang, X.; Souza, E.; Pelot, R.; Matwin, S. Identifying Fishing Activities from AIS Data with Conditional Random Fields. In Proceedings of the 2016 Federated Conference on Computer Science and Information Systems (FedCSIS), Gdansk, Poland, 11–14 September 2016; pp. 47–52. [Google Scholar]
- Sánchez Pedroche, D.; Amigo, D.; García, J.; Molina, J.M. Architecture for Trajectory-Based Fishing Ship Classification with AIS Data. Sensors 2020, 20, 3782. [Google Scholar] [CrossRef] [PubMed]
- Luo, D.; Chen, P.; Yang, J.; Li, X.; Zhao, Y. A New Classification Method for Ship Trajectories Based on AIS Data. J. Mar. Sci. Eng. 2023, 11, 1646. [Google Scholar] [CrossRef]
- Baeg, S.; Hammond, T. Ship Type Classification Based on the Ship Navigating Trajectory and Machine Learning. Available online: https://hdl.handle.net/1969.1/199814 (accessed on 5 June 2024).
- Damastuti, N.; Siti Aisjah, A.; Masroeri, A.A. Classification of Ship-Based Automatic Identification Systems Using K-Nearest Neighbors. In Proceedings of the 2019 International Seminar on Application for Technology of Information and Communication (iSemantic), Semarang, Indonesia, 21–22 September 2019; pp. 331–335. [Google Scholar]
- Wang, H.; Zuo, Y.; Li, T.; Wang, Z. Classification Algorithm of Ship Trajectory Based on Machine Learning Techniques. In Proceedings of the 2020 IEEE Asia-Pacific Conference on Computer Science and Data Engineering (CSDE), Gold Coast, Australia, 16 December 2020; pp. 1–7. [Google Scholar]
- Kontopoulos, I.; Makris, A.; Tserpes, K. A Deep Learning Streaming Methodology for Trajectory Classification. ISPRS Int. J. Geo-Inf. 2021, 10, 250. [Google Scholar] [CrossRef]
- Simonyan, K.; Zisserman, A. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv 2015, arXiv:1409.1556. [Google Scholar]
- Yang, T.; Wang, X.; Liu, Z. Ship Type Recognition Based on Ship Navigating Trajectory and Convolutional Neural Network. J. Mar. Sci. Eng. 2022, 10, 84. [Google Scholar] [CrossRef]
- Guo, T.; Xie, L. Research on Ship Trajectory Classification Based on a Deep Convolutional Neural Network. J. Mar. Sci. Eng. 2022, 10, 568. [Google Scholar] [CrossRef]
- Jiang, X.; Liu, X.; De Souza, E.N.; Hu, B.; Silver, D.L.; Matwin, S. Improving Point-Based AIS Trajectory Classification with Partition-Wise Gated Recurrent Units. In Proceedings of the 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA, 14–19 May 2017; pp. 4044–4051. [Google Scholar]
- de Freitas, N.A.; Coelho Da Silva, T.; Fernandes De Macêdo, J.; Melo Junior, L.; Cordeiro, M. Using Deep Learning for Trajectory Classification. In Proceedings of the 13th International Conference on Agents and Artificial Intelligence; SCITEPRESS—Science and Technology Publications, Online Streaming, 4–6 February 2021; pp. 664–671. [Google Scholar]
- Zhang, P.X.; Li, L.Y.; Yang, M.; An, X.Y.; Xu, X.L. Ship Trajectory Classification Model Considering Changes in Movement Behavior Characteristics. Sci. Surv. Mapp. 2023, 48, 25–34. [Google Scholar] [CrossRef]
- Cui, T.T.; Wang, G.L.; Gao, J. Ship Trajectory Classification Method Based on 1DCNN-LSTM. Comput. Sci. 2020, 47, 175–184. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention Is All You Need. arXiv 2017, arXiv:1706.03762. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep Residual Learning for Image Recognition. arXiv 2015, arXiv:1512.03385. [Google Scholar]
Type of Ship | Fishing | Towing | Sailing | Passenger | Tanker |
---|---|---|---|---|---|
Number of track points | 4,423,130 | 28,025,380 | 3,609,600 | 5,796,500 | 2,518,370 |
Number of ships | 10,460 | 33,880 | 13,150 | 9960 | 5020 |
Hardware/Software Environment | Detailed Information |
---|---|
Central processing unit (CPU) | Intel(R) Core(TM) i9-13900HX, 2.20 GHz |
Graphics processor unit (GPU) | GeForce RTX 4060 |
Computer memory | 32 GB, DDR5 |
Computer system | Windows 11, 64-bit |
Development framework | PyTorch 2.0.1+cu118 |
Development language | Python 3.11.5 |
Scheme 1 | Scheme 2 | Scheme 3 | Scheme 4 | Scheme 5 | Scheme 6 | Scheme 7 | |
---|---|---|---|---|---|---|---|
Number of residual blocks | 1 | — | 1 | 1 | 2 | 2 | 3 |
Number of LSTM layers | — | 2 | 2 | 2 | 2 | 2 | 2 |
Memory cell dimension | — | 128 | 128 | 128 | 128 | 128 | 128 |
Number of attention heads | — | — | — | 4 | 4 | 8 | 12 |
Attention layer embedding dimension | — | — | — | 128 | 128 | 256 | 256 |
Accuracy (%) | 79 | 81.1 | 84.3 | 87.4 | 87.9 | 90.1 | 88.5 |
Actual Class | Predicted Class | |||||||
---|---|---|---|---|---|---|---|---|
Towing | Fishing | Sailing | Passenger | Tanker | Precision(%) | Recall(%) | F1(%) | |
Towing | 45,849 | 1144 | 888 | 741 | 928 | 90.8 | 92.5 | 91.6 |
Fishing | 1075 | 44,863 | 2060 | 635 | 917 | 86.3 | 90.5 | 88.4 |
Sailing | 1632 | 3737 | 42,304 | 840 | 1037 | 89.2 | 85.4 | 87.3 |
Passenger | 1091 | 1390 | 1492 | 43,007 | 2570 | 93.0 | 86.8 | 89.8 |
Tanker | 845 | 837 | 690 | 1008 | 46,170 | 89.4 | 93.2 | 91.3 |
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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Ke, J.; Lu, F.; Liu, Y.; Fu, B. A ResNet1D-AttLSTM-Based Approach for Ship Trajectory Classification. Appl. Sci. 2025, 15, 3489. https://doi.org/10.3390/app15073489
Ke J, Lu F, Liu Y, Fu B. A ResNet1D-AttLSTM-Based Approach for Ship Trajectory Classification. Applied Sciences. 2025; 15(7):3489. https://doi.org/10.3390/app15073489
Chicago/Turabian StyleKe, Jiankang, Faxing Lu, Yifei Liu, and Bing Fu. 2025. "A ResNet1D-AttLSTM-Based Approach for Ship Trajectory Classification" Applied Sciences 15, no. 7: 3489. https://doi.org/10.3390/app15073489
APA StyleKe, J., Lu, F., Liu, Y., & Fu, B. (2025). A ResNet1D-AttLSTM-Based Approach for Ship Trajectory Classification. Applied Sciences, 15(7), 3489. https://doi.org/10.3390/app15073489