Objective Existing ship trajectory anomaly detection methods often rely on a single reconstruction or temporal modeling mechanism and therefore have difficulty simultaneously capturing long-term temporal dependencies, critical local variations, and correlations among kinematic features. This limitation reduces their ability to uniformly model and collaboratively discriminate multiple anomaly types in complex navigation scenarios. To address this problem, a ship trajectory anomaly detection method based on a dual-attention residual predictive-discriminative autoencoder is proposed to improve anomaly recognition accuracy, robustness, and stability.
Method Historical automatic identification system (AIS) data released by the Danish Maritime Authority were cleaned, reordered, interpolated, and segmented to obtain continuous normal trajectories. Because accurately labeled real abnormal trajectories were insufficient, four controllable anomaly types—turning, acceleration, stopping, and lateral translation—were generated from normal trajectories. Eighteen time-series features were then constructed from position, speed, and course information to describe spatial displacement, motion intensity, and maneuvering variation. A dual-attention residual autoencoder with predictive and discriminative latent space (DAR-AE-PD) was developed. In the encoder, a bidirectional gated recurrent unit extracts local temporal information, multi-head self-attention models global dependencies among sequence features, and temporal attention emphasizes critical time steps. A residual bottleneck compresses and reconstructs the latent representation while preserving trajectory continuity and reducing information attenuation. On this shared representation, reconstruction, one-step prediction, and discrimination branches are jointly optimized. During inference, feature-group-weighted reconstruction and prediction errors are fused with the discriminative probability to produce a point-wise anomaly score, and the final threshold is selected from candidate quantiles according to the highest validation-set F1 score.
Results Experiments were conducted for four types of abnormal ship trajectories, including turning, acceleration, stopping, and lateral translation. The detection performance was evaluated in terms of accuracy, recall, F1 score, and AUC. For turning anomalies, the proposed method achieved an F1 score of 0.854 7 and an AUC of 0.988 6. For acceleration anomalies, the accuracy, recall, F1 score, and AUC reached 0.950 9, 0.965 1, 0.877 4, and 0.998 2, respectively. For stopping anomalies, the corresponding values were 0.951 5, 0.997 8, 0.881 2, and 0.994 4. For lateral translation anomalies, the method achieved an accuracy of 0.910 9, a recall of 0.996 6, an F1 score of 0.846 3, and an AUC of 0.937 2. The proposed method showed stable detection performance across different anomaly types and generally outperformed the comparison methods. Further experiments also confirmed that the introduced attention mechanisms, prediction branch, and residual structure contributed to improving the overall detection performance.
Conclusion The proposed method effectively captures both the dynamic evolution and local deviations of ship trajectories and enables unified detection of multiple abnormal navigation behaviors. It can provide technical support for intelligent maritime traffic monitoring, navigation safety assessment, and maritime supervision.