Abstract
To enable fast and effective similarity computation between vessel trajectories, this paper proposes a novel Multi-modal Convolutional Auto-Encoder (MCAE) framework for large-scale trajectory representation learning and similarity measurement. The approach converts multi-modal Automatic Identification System (AIS) data—including position(POS), speed over ground (SOG), and course over ground (COG)—into structured image representations. A deep convolutional auto-encoder is employed to automatically learn discriminative features of trajectories. The MCAE model adopts a phased training strategy with a dynamic loss adjustment mechanism to balance learning across different modalities, effectively addressing challenges such as non-uniform sampling, noise interference, and modal heterogeneity in trajectory data. The framework is evaluated using the Adaptive Clustering criterion (AC), silhouette coefficient(SI) and coefficient variation(CV) for comprehensive assessment. Experiments on real-world AIS datasets demonstrate that the proposed method significantly outperforms baseline algorithms—such as Dynamic Time Warping (DTW), Fréchet distance, Convolutional Auto-Encoder (CAE), and t2vec—in trajectory similarity computation and clustering tasks. The method achieves the minimum AC value of 0.0465, the maximum SI of 0.93003 and the minimum CV of 0.1198, indicating stronger robustness and applicability. Furthermore, the research outcomes provide reliable technical support for maritime applications such as vessel monitoring, route planning, and anomaly detection.
Keywords: Convolutional neural network, Auto-encoder, Trajectory similarity, Trajectory cluster, AIS
Subject terms: Engineering, Mathematics and computing
Introduction
With the deepening of global economic integration, the vessel industry has assumed an increasingly critical role within the global economic system. Consequently, vessel traffic density in waters such as coastal ports and estuarine terminals has been steadily rising, making the perception and understanding of maritime traffic situations crucial1,2. Simultaneously, the International Maritime Organization’s mandate for vessels above a specific tonnage to be equipped with the AIS equipment has led to the generation of vast amounts of vessel AIS data, which continues to grow and is rich in spatiotemporal information. AIS trajectory data holds significant value for various domains, including vessel pattern recognition3,4, maritime safety monitoring5,6, route planning7,8, and environmental protection9,10.
Trajectory similarity calculation constitutes a fundamental and core task within trajectory data mining. Its purpose is to quantify the degree of similarity between two or more trajectories, thereby providing support for subsequent applications such as pattern recognition, clustering, anomaly detection, and route planning11–13. However, when analyzing vessel trajectory AIS data, challenges arise due to the data’s inherent characteristics: spatiotemporal nature, unequal lengths, non-uniform sampling rates, and the presence of noise. Consequently, how to compute the similarity between trajectories efficiently and accurately has emerged as a key challenge in the field of maritime data mining
Based on the employed metric paradigms, existing trajectory similarity calculation methods can be broadly categorized into three groups: shape-based methods, warping-based methods, and learning-based methods14,15.
Shape-based methods
Shape-based methods primarily focus on the overall geometric morphology and spatial positional relationships of trajectories, measuring similarity by computing spatial distances between trajectory points. This category of methods is generally less sensitive to the sampling rate and point sequence of trajectories; however, their performance is prone to degradation when handling non-uniformly sampled or noisy data.
Hausdorff Distance: This metric assesses similarity by calculating the maximum-minimum distance between sets of trajectory points, effectively capturing the overall shape correspondence between trajectories. A notable limitation is its sensitivity to noise. Reference16,17 utilized trajectory direction and density as similarity measures, combined with a trajectory segment clustering algorithm. The Hausdorff distance was employed to identify bidirectional shipping routes. Reference18 proposed an improved OD-Hausdorff distance. By segmenting trajectories and performing a weighted fusion of dynamic attributes such as speed and course, this method significantly enhances the characterization capability for vessel inbound and outbound behaviors.
Fréchet Distance(FD): This metric computes the infimum of the maximum distance between two curves, making it particularly suitable for similarity measurement between trajectories of different lengths while effectively capturing continuous characteristics. It demonstrates strong robustness against local noise and outliers19. Reference20 proposed the Discrete Fréchet Distance. It computes the minimum value of the maximum distance over all possible coupled point pairs between polygonal curves, thereby precisely capturing morphological differences between routes. Reference21 introduced a hierarchical clustering method that integrates FD with Principal Component Analysis (PCA). This approach has also been employed for the efficient analysis of spatial morphological similarities among complex vessel trajectories.
Other shape-based methods include the One-Way Distance (OWD)22,23, Signed Barycenter Distance (SBD)24, and Cosine and Hausdorff distances25. These distances also effectively achieve similarity measurement between trajectories.
Warping-based methods
Warping-based methods focus on identifying the optimal alignment between trajectory points by employing dynamic programming techniques that permit “warping” along the temporal axis, thereby mitigating the impact of disparities in sampling rates. This category of approaches is capable of effectively handling trajectories of varying lengths; however, it is associated with relatively high computational complexity.
Dynamic Time Warping (DTW): This method identifies the optimal alignment path between two sequences by minimizing the cumulative point-to-point distance, and is widely used in trajectory pattern recognition and prediction26. Reference27 employed DTW to construct a distance matrix between trajectories. This matrix was subsequently integrated with Principal Component Analysis (PCA) and centroid-based clustering algorithms to facilitate the discovery of routine routes and the detection of anomalies. References28,29 proposed the Fast-DTW algorithm. By implementing coarsening, projection, and refinement operations, the method significantly reduces computational complexity while maintaining accuracy. The optimized similarity results are then combined with an improved DBSCAN algorithm to accomplish trajectory clustering and abnormal behavior identification.
Longest Common Subsequence (LCSS): Measures similarity by matching common subsequences between trajectories, exhibiting certain robustness to noise and outliers30. Reference31 introduced a collaborative map matching method (CMM) for low-sampling-rate GPS trajectories. The core of this method is to measure the similarity between trajectories and candidate paths based on the LCSS distance, selecting the path with the largest LCSS value as the matching result. Experiments demonstrate that CMM outperforms baseline methods on both real and simulated GPS trajectory datasets, achieving higher precision and recall rates.
Other warping-based methods include Edit distance on Real Sequences (EDR)32 and Edit distance with Real Penalty (ERP)33, which measure trajectory dissimilarity through insertion, deletion, and substitution operations.
Learning-based methods
Learning-based methods employ neural networks to automatically learn feature representations of trajectories for similarity computation. These approaches can overcome the sensitivity to noise and sampling rates inherent in traditional methods, while significantly improving computational efficiency.
Auto-encoder (AE) model: an encoder maps trajectories into low-dimensional vectors, while a decoder reconstructs them. Similarity is calculated based on the distance (e.g., Euclidean distance) between these vectors34. Reference35 proposed the use of a Variational Auto-Encoder (VAE) for trajectory anomaly detection. The method learns the distribution of normal trajectories. Anomalous patterns, such as position drift or sharp turns, are identified by comparing the original and reconstructed trajectories based on discrepancies in multi-dimensional distances, including Euclidean distance and angular distance.
Graph neural network (GNN) models: this category of algorithms leverages GNNs to process the graph-structured characteristics of trajectory data, enabling the capture of spatial relationships and topological structures between trajectory points. By learning global spatial features of trajectories, they facilitate trajectory clustering, classification, or anomaly detection36. Reference37 introduced a Gated Spatio-Temporal Graph Aggregation Network (G-STGAN) that integrates GNN and RNN approaches for predicting sea vessel trajectories in dynamic traffic scenarios. This method effectively captures static and dynamic spatial interactions among vessels, demonstrating exceptional robustness and practicality, thereby providing reliable technical support for maritime traffic management and safety.
Convolutional neural network (CNN) models: this category of algorithms utilizes CNNs to extract local spatial features from trajectories, for instance, by converting trajectories into images for processing, thereby integrating multi-modal information such as velocity and heading38–40.Reference41 proposed a clustering and Convolutional Neural Network (CNN)-based mobility pattern perception method. By processing three-dimensional structured inputs containing geographical, geometric, and kinematic information, the method automatically extracts features and outputs pattern probabilities, effectively enhancing the automation level and recognition accuracy of trajectory mining. Reference42 introduced the t2vec model, which utilizes a sequence-to-sequence architecture to embed trajectories into high-dimensional vectors. Through an encoder-decoder process, the distances in the vector space reflect trajectory similarity. This method outperforms traditional approaches like LCSS and DTW in terms of computational efficiency and scalability. However, its model training requires substantial computational resources, and it exhibits limitations in domain adaptability, showing weaker transfer capability across datasets from different geographical regions or with varying sampling characteristics.
Other learning-based algorithmic models include Recurrent Neural Network (RNN) models43, Graph Attention Network (GAT) models44, and Seq2seq models45.
Although learning-based methods have achieved significant progress in vessel trajectory analysis, most existing studies focus solely on positional information. Research on deep representation learning that incorporates multi-modal information such as POS, SOG, and COG remains in the exploratory stage.
This research proposes an innovative multi-modal vessel trajectory representation learning framework. By deeply integrating three heterogeneous data modalities—POS, SOG, and heading—the framework employs a convolutional autoencoder architecture to learn complementary feature representations of vessel behaviors. It adopts a phased training strategy: initially optimizing the spatial structure learning of POS modal, then progressively incorporating SOG-based kinetic features and heading-based directional information. Through a dynamic weight adjustment strategy that balances learning progress across modalities, the framework significantly enhances the accuracy and robustness of trajectory similarity computation.
The main contributions of this paper are summarized as follows:
(1) An innovative multi-modal trajectory image generation method is proposed, which converts raw AIS data (including longitude/latitude POS, SOG, and COG) into structured channel representations. This method employs a precise grid projection algorithm and adaptive resampling technique to generate three-channel images comprising a binary POS channel, a normalized SOG channel, and a trigonometric COG channel. This lays the foundation for fully leveraging the powerful feature extraction capabilities of convolutional neural networks. The approach not only preserves the spatiotemporal characteristics of trajectories but also mitigates issues related to non-uniform sampling and noise in raw data.
(2) A novel multi-modal convolutional autoencoder model architecture is designed, employing a phased training strategy for unsupervised feature learning. The model incorporates three dedicated encoding branches to process POS, SOG, and COG modalities respectively, performs feature fusion at the bottleneck layer, and utilizes symmetric decoders for high-precision reconstruction of modal information. The phased training strategy initially focuses on learning positional geometric features, then progressively incorporates kinematic features (SOG) and directional features (COG). A dynamic weight adjustment strategy balances learning progress across modalities, ensuring training stability and feature quality.
(3) Comprehensive experiments on large-scale real AIS datasets demonstrate that the proposed method significantly outperforms comparative approaches (such as DTW, FD, CAE models, and t2vec) in trajectory similarity computation and clustering tasks, while exhibiting stronger robustness and generalization capability.
The remainder of this paper is organized as follows: “Methods” details the proposed MCAE method; “Experiments and analyses” presents experimental results and analysis; “Conclusions and future work” concludes the paper and outlines future research directions.
Methods
The multi-modal representation learning framework proposed in this paper is illustrated in Fig. 1, which mainly consists of three core steps: (1) generation of multi-modal trajectory images; (2) unsupervised feature learning based on the MCAE model; and (3) calculation of trajectory similarity and clustering application.
Fig. 1.
The flowchart of the method framework proposed in this research.
Relevant definitions
Vessel Trajectory: A vessel trajectory can be represented as a sequence of time-stamped positions, denoted as
, where each point
corresponds to the position at the ith timestamp, and N indicates the length of the trajectory T. Here,
, where
represent the timestamp, longitude, latitude, SOG, and COG of point
, respectively.Trajectory Similarity: The similarity between two trajectories
and
is measured by the distance
between their feature representations
and
. A smaller distance value indicates a higher similarity between the trajectories.
Trajectory multi-modal information imagery
The generation of multi-modal trajectory imagery serves as a core preprocessing step in this research, aimed at converting raw spatiotemporal trajectory sequences into structured two-dimensional image representations (as shown in Step 2 of Figure 1). This transformation provides a compatible input format for subsequent deep learning models.
Trajectory interpolation and resampling
Raw AIS data often exhibit non-uniform sampling issues (with intervals ranging from 2 seconds to several minutes)46, which may lead to grid projection distortions if processed directly. To address this, cubic spline interpolation is applied followed by trajectory point resampling47, as illustrated in Fig. 2.
Fig. 2.
Trajectory interpolation and resampling process.
(1) Time series alignment: Extract trajectory timestamps
and compute the relative time offsets
, where
denotes the start time of the current trajectory.
(2) POS and SOG modal interpolation: Cubic spline fitting is applied separately to the longitude, latitude, and SOG sequences
to generate continuous functions
,
,
.
(3) COG modal interpolation: Given the periodicity of
, direct linear interpolation may lead to erroneous results. Therefore, a trigonometric function-based periodic interpolation strategy is adopted: First, the original angular sequence is converted into sine and cosine components
and
. Then, cubic spline interpolation is applied separately to the
and
components. Finally, the arctangent function is computed using the interpolated sine and cosine results to reconstruct the COG values, normalized to the range
.The COG interpolation formula is as follows:
![]() |
1 |
where
and
represent the interpolated results of the sine and cosine components at time t, respectively, and mod denotes the modulo operation.
(4) Fixed-interval resampling: a new trajectory sequence denoted
is generated at fixed intervals of
to ensure temporal uniformity. Referring to the reporting interval of AIS Class A devices, the sampling interval in this research is set to 10 seconds.
While cubic spline interpolation is effective in handling non-uniformly sampled AIS data and provides smooth trajectories, it exhibits certain limitations in practical applications. In data-sparse regions, such as during prolonged signal loss, the method may cause trajectories to deviate from the actual motion, introducing geometric and speed errors that consequently affect the accuracy of downstream analyses. Furthermore, its inherent smoothness assumption may not hold in areas of frequent vessel maneuvers, such as sharp turns, potentially leading to the loss of local motion characteristics.
To mitigate these issues, this study introduces a grid-threshold-based noise suppression method following the interpolation process. By filtering out grid cells with low confidence, the interference from sparse data is reduced.
Grid projection and spatial discretization
To map the generated trajectory sequences onto a discrete grid, the following steps are adopted:
(1) Determine grid dimensions: The core objective of grid partitioning is to discretize the continuous geographic coordinate space into a regular two-dimensional grid structure, thereby providing a foundation for structured image representation of trajectory data. A uniform grid partitioning strategy is employed, where the grid dimensions–width W and height H–are determined based on expert knowledge or trial-and-error methods tailored to the specific waterway and trajectory characteristics under research(detailed calculations are provided in “Image size”).
(2) Compute grid coordinates: the computation of grid coordinates involves transforming the trajectory sequence from the Mercator coordinate system to the Cartesian coordinate system. For each trajectory point
, its grid coordinates are calculated using the following formula:
![]() |
2 |
where
and
denote the column and row indices of the grid, respectively;
,
,
and
represent the minimum and maximum longitude and latitude values of the research area or trajectory points; and
denotes the floor operation, ensuring
and
.
Construction of trajectory multi-modal information images
To enhance the accuracy of trajectory similarity measurement and improve trajectory clustering performance, this research designs a multi-modal image representation that transforms multidimensional trajectory information—including POS, SOG, and COG (decomposed into sine and cosine components)–into imagery, as illustrated in Fig. 3.
Fig. 3.
Multi-modal information construction.
(1) POS modal: for each grid cell (r, c), the value
indicates the presence of trajectory points within that cell, as illustrated in Fig. 3a and the formula is as follows:
![]() |
3 |
where
is the indicator function, and
is a predefined threshold. To mitigate false detections caused by noise,
is typically set to 3 or 5. Through this process, a binary image of the POS modal is generated, preserving the geometric shape of the trajectory (with white as the background and black as trajectory points). The threshold setting effectively suppresses random noise and outliers in the data, preventing them from being mapped into the image.
(2) SOG modal : based on the POS modal, the average SOG within each grid cell is calculated and globally normalized, as shown in Fig. 3b SOG modal : based on the POS modal, the average SOG within each grid cell is calculated and globally normalized, as shown in Fig. 3b and the formula is as follows:
![]() |
4 |
where
denotes the maximum SOG value across all trajectory data, and
represents the average relative SOG of the vessel at that location.
(3) COG modal : similar to the processing method for the SOG modal, the COG values are decomposed into sine and cosine components. Based on the POS modal, the grid averages for each component are computed separately, as shown in Fig. 3c, d and the formula is as follows:
![]() |
5 |
where rad(.) denotes the conversion factor from degrees to radians.
Based on the construction method of the aforementioned multi-modal information, the completeness of trajectory information is enhanced by incorporating dynamic navigation features (SOG modal) and motion direction features (COG modal) while preserving the spatial geometric characteristics of the trajectory (POS modal). Simultaneously, techniques such as threshold, averaging, and normalization effectively suppress random noise and outliers in AIS data, ensuring comparability across trajectories of varying lengths and SOG ranges.
MCAE model
The Multi-modal convolutional autoencoder (MCAE) model is a convolutional autoencoder specifically designed for vessel trajectory data, aimed at multi-modal feature learning and representation. This model integrates the local feature extraction capability of CNN with the advantages of unsupervised representation learning from AE. Through its encoder-decoder architecture, it maps multi-modal trajectory data into a low-dimensional latent space, enabling efficient feature reconstruction and similarity measurement.To handle heterogeneous motion information, MCAE encodes data from each modal into a unified tensor format, using multi-channel images as input: the position channel employs binarized trajectory images, the speed channel contains normalized speed information, and the COG channel represents course variation through sine and cosine components. This multi-branch structure effectively captures the spatiotemporal features of trajectories, thereby enhancing the accuracy and robustness of similarity measurement. The framework of the model is illustrated in Fig. 4.
Fig. 4.
The framework diagram of MCAE model.
CNN component design
The CNN component serves as the feature extraction core of the MCAE model, responsible for capturing hierarchical spatial features from the input multi-modal trajectory images. In vessel trajectory processing, the CNN progressively learns local and global patterns of trajectories through convolutional layers, pooling layers, and activation functions48, as illustrated in Fig. 5.
Fig. 5.
The CNN structure diagram.
(1) Input layer: this layer receives the structured channel representations of multi-modal data (as shown in Fig. 3), where each channel corresponds to a distinct trajectory attribute: POS (binary image), SOG (normalized continuous values), and COG (trigonometric function values). The image dimensions are fixed at
(detailed in “Image size”) to ensure spatial consistency.
(2) Convolutional layer: this layer employs kernels of multiple sizes to perform multi-scale feature extraction. The convolution operation utilizes padding to preserve spatial dimensions and prevent information loss. The computation is formulated as follows:
![]() |
6 |
where
denotes the input feature map for the
kernel at layer l,
represents the convolution operation,
is the
convolutional kernel in layer l,
is the learnable bias term, and f denotes the activation function, for which the ReLU function is adopted in this research.
In the design of deep networks for trajectory feature extraction, the adoption of multi-scale convolutional kernels is essential for constructing multi-level feature representations. Larger-sized convolutional kernels (e.g.,
), with their expansive receptive fields, are effective at capturing macro spatial structures, long-range dependencies, and global contextual information. Medium-sized kernels (e.g.,
) achieve a balance between the receptive field and feature detail, focusing on extracting mid-scale local motion patterns and key trajectory segments. Smaller-sized kernels (e.g.,
) are employed to learn fine-grained local features and details, proving particularly suitable for dense feature extraction in deeper network layers.
(3) Pooling layers: the MCAE model employs a composite pooling strategy that integrates both max pooling and adaptive average pooling. The encoder progressively reduces the spatial dimensions of the feature maps through multi-stage max pooling(
window). This process retains key local features, enhances spatial invariance, and effectively suppresses noise. At the final stage, adaptive average pooling(
window) converts the feature maps into a fixed-size global descriptor vector. This strategy significantly enhances the model’s robustness in representing multi-modal trajectory features.
(4) fully connected layers: the MCAE model employs a combination of global average pooling and fully connected layers to construct an efficient bottleneck structure (the selection of feature dimensionality is detailed in “Experimental setup”). Global average pooling aggregates features across the entire feature map, yielding spatial invariance. The fully connected layers subsequently perform non-linear combinations of these aggregated features, generating dense and information-rich representations suitable for similarity computation.
(5) AnglePeriodicLayer: this layer is specifically designed to handle COG data, addressing the periodic nature of angular values. It maps scalar angle values to a periodic vector in a high-dimensional space using the following formulation:
![]() |
7 |
where
is the input angle value (i.e., the angular feature from the fully connected layer),
denotes the output vector,
represents the mapping dimension (length of the output vector), and
is the period normalization factor.
AE component design
AE component is responsible for learning low-dimensional feature representations and reconstructing the original input through the decoder. Its design is based on an encoder-decoder architecture (as shown in Fig. 4), but optimized for trajectory data to handle variable-length trajectories and noise. The AE components for each modal share a similar structure, illustrated in Fig. 6. Taking the POS modal as an example, its architecture comprises:
Fig. 6.
The CNN structure diagram.
(1) Encoder architecture: the encoder consists of convolutional and pooling layers that compress the input image into a low-dimensional latent vector. The computation is formulated as follows:
![]() |
8 |
where Y denotes the low-dimensional feature representation obtained after encoder compression of the sample. The POS, SOG, and COG modalities are encoded from the original
spatial data into 32-dimensional and 16-dimensional vectors, respectively. Here,
represents the input sample set with M samples;
and b denote the weight matrix and bias vector, which are shared across all samples.
(2) Decoder architecture: the decoder performs upsampling operations symmetric to the encoder, progressively restoring the spatial resolution (from
to
) through transposed convolutions and skip connections to reconstruct the image (as shown in Fig. 10). Skip connections fuse intermediate features from the encoder with corresponding layers in the decoder, ensuring the preservation of detailed information. The reconstruction is formulated as follows:
![]() |
9 |
where
represents the set of reconstructed samples;
and
denote the weight matrix and bias vector in the reconstruction process, respectively.
Fig. 10.
The POS modal information reconstruction for trajectories
under different model dimensions.
(3) Multi-branch fusion and bottleneck layer: the outputs from the multi-branch encoders are concatenated into a unified latent vector, forming a comprehensive trajectory representation. The bottleneck layer further compresses features through fully-connected layers for similarity computation. The decoders reconstruct their respective modal data separately, while sharing latent spatial information to ensure multi-modal consistency.
Training strategy
The staged training strategy is designed based on the gradient of modal learning difficulty and feature dependencies. The POS modal serves as the spatial foundation, exhibiting the lowest feature learning difficulty and providing spatial mask constraints for other modals. The SOG modal reflects dynamic characteristics and requires position information as a prerequisite. The COG modal presents periodic ambiguity and possesses the highest learning difficulty. Therefore, the training process follows the cognitive principle of “progressing from easy to difficult and unlocking layers gradually.”
Stage transitions are not based on simple temporal divisions but are determined by loss convergence. Specifically, the transition to phases II is triggered when the position loss decreases by less than 1% over 10–20 consecutive epochs. After the speed loss stabilizes, the process enters phases III. This adaptive transition mechanism ensures each modal converges sufficiently before introducing a new task, thereby avoiding gradient conflict. The specific stage divisions and parameter values are detailed in “Modal parameters at different stages” and Table 2.
Table 2.
Weight coefficient setting.
| Training stage | ![]() |
![]() |
![]() |
|---|---|---|---|
(POS modal dominance phases) |
1.0 | 0.0 | 0.0 |
(SOG modal dominance phases) |
0.1 | 0.7 | 0.2 |
(COG modal dominance phases) |
0.1 | 0.2 | 0.7 |
(the full modal fusion phase) |
0.4 | 0.3 | 0.3 |
(the full modal balance phase) |
0.2 | 0.4 | 0.4 |
Loss function
In vessel trajectory representation learning, the design of the loss function directly influences the model’s feature learning capability. This paper proposes a dynamic adjustment strategy for the loss function, which balances the learning process across the three modalities—POS, SOG, and COG—through a weighted mechanism.
(1) POS modal loss function: this loss function employs a hybrid loss function, in which the structural similarity loss
captures local structural similarities and is sensitive to local distortions in trajectory shape, while the absolute error loss
ensures pixel-level sparsity and suppresses background noise. The calculation formula is as follows:
![]() |
10 |
where
and
represent the POS channel data
of the original and reconstructed samples, respectively; M denote the total number of pixels in the POS channel;
,
and
,
are the local window means and standard deviations of
and
, respectively, with a window size of
;
represents the covariance;
denotes the weighting coefficient, set to 0.15 in this research; and
,
are stability constants.
(2) SOG modal loss function: the velocity loss employs a relative mean squared error loss to eliminate the influence of units. By applying a POS mask, the loss is computed only within trajectory-containing regions to prevent interference from background areas during SOG learning. The calculation formula is as follows:
![]() |
11 |
where
and
represent the SOG channel data
of the original and reconstructed samples, respectively;
denotes the region of the POS channel; and
is a stability constant.
(3) COG Modal Loss Function: The COG modal exhibits periodicity. After being decomposed into sine and cosine components, it requires adherence to the unit vector constraint. Therefore, an angle difference loss is adopted, which must simultaneously satisfy the conditions of trajectory POS validity and SOG validity. The calculation formula is as follows:
![]() |
12 |
where
and
represent the COG channel data of the original and reconstructed samples, respectively;
and
is used to exclude unstable points where the original COG values approach 90° or 270°, thereby filtering out unreliable COG data points; and
denotes the dot product operation.
(4) Weight adjustment: the loss function incorporates a dynamic adjustment strategy to modulate the weights of the POS, SOG, and COG modalities respectively, ensuring the model focuses on learning specific features at different training stages. The calculation formula is as follows:
![]() |
13 |
where
represents the ratio of the model’s current training epoch to the total number of training epochs. The values provided are suggested upper and lower bounds for this ratio in each training stage, which can be adjusted in practice according to the specific training strategy.
,
and
are modal-specific parameters for different phases (detailed in “Modal parameters at different stages”). The values range within [0, 1]and satisfy
. This design dynamically adjusts each modal’s contribution to the total loss, preventing any single modal from dominating the training process.
During the training of the MCAE model, the weight matrices and bias vectors are iteratively adjusted based on the loss function to minimize the discrepancy between the input samples and their reconstructions. Once the MCAE model is fully trained, the encoder component alone can be utilized to extract low-dimensional feature vectors representing trajectory characteristics, which are then employed for computing trajectory similarity.
Trajectory clustering application
The aforementioned method can effectively extract multi-modal features from vessel trajectories. Based on these features, trajectory clustering can be performed. Since clustering results are highly dependent on the similarity metric, this process can indirectly and quantitatively evaluate the accuracy of the similarity measure. This paper designs a hierarchical clustering strategy based on the hierarchical clustering algorithm with Ward linkage49. First, coarse clustering is conducted using the POS modal, which reflects the overall spatial distribution of trajectories, to partition macro-level navigation areas. Then, within each spatial cluster, fine partitioning is performed using the SOG and COG modalities, which capture vessel motion attributes, to identify micro-level behavioral patterns.
Hierarchical clustering strategy and evaluation indicators
To effectively evaluate the performance of unsupervised hierarchical clustering, this research adopts a combined assessment approach utilizing the Silhouette Score (SI) ,Coefficient Variation (CV) and the Adaptive Clustering criterion (AC).
(1) Coarse clustering: this stage employs a hierarchical clustering algorithm to perform initial clustering based on trajectory POS modal information, grouping trajectories with similar spatial distributions into the same macro category. Drawing on the theory from Reference14 and tailored to the unsupervised learning approach proposed in this research, a phased AC is specifically designed as the core evaluation metric. This criterion integrates the Within-Like criterion (WC) and the Between-Like criterion (BC). Here, WC represents within-cluster compactness, defined as the sum of the average distances from trajectories within a cluster to the representative trajectory of other clusters. BC represents between-cluster separation, defined as the sum of the distances from the global representative trajectory to the representative trajectories of each cluster. The calculation formulas are as follows:
![]() |
14 |
where d(.) represents the Euclidean distance between the feature values of trajectories;
denotes the set of trajectories contained in the
cluster; K is the number of coarse clustering clusters;
represents the global representative trajectory, defined as the trajectory with the minimum sum of distances to all other trajectories in the dataset, reflecting the average characteristics of vessel behavior across the entire waterway;
represents the representative trajectory of the
cluster, defined as the trajectory with the minimum sum of distances to all other trajectories within the current cluster; arg(.) denotes the argument that minimizes the expression; and S represents the entire trajectory dataset.
Equation (14) indicates that a smaller AC value corresponds to better clustering performance. When
, it signifies highly compact clusters with clear separation between them; when
, it suggests either dispersed clusters or significant overlap between clusters; when
, it indicates a balance between within-cluster compactness and between-cluster separation. However, further analysis of Eq. (14) and Reference14 reveals that while WC decreases as the number of clusters increases, its rate of decline slows (e.g., entering a plateau phase when the cluster count exceeds 15). If the number of clusters becomes excessively large, the growth of BC may not be significant, potentially resulting in a low AC value that does not necessarily reflect ideal clustering performance.
(2) Fine clustering: the fine clustering phase represents a deeper analysis following the coarse clustering stage. Within each coarse cluster, further refined clustering is performed based on SOG and COG modal features. This phase similarly employs a hierarchical clustering algorithm and utilizes the Local AC (LAC) as the evaluation metric. The calculation formula is as follows:
![]() |
15 |
where
denotes the total number of fine clusters;
represents the centroid of the
fine cluster, and
denotes the centroid of the coarse cluster, both defined as the mean values of multidimensional vectors.
(3) Silhouette score: the contour coefficient is a widely used quality assessment index for clustering, which evaluates the clustering effect by quantifying the compactness of samples within clusters and the separation degree between clusters. The calculation formula is as follows:
![]() |
16 |
where
represents the average distance between trajectory
and all other trajectories within the same cluster;
denotes the average distance between trajectory
and all trajectories in the nearest neighboring cluster;
is the SI of trajectory
; and
represents the global silhouette coefficient.
Equation 16 indicates that a larger
value corresponds to better clustering performance. For multi-dimensional feature clustering: when
, it signifies excellent clustering results with precise trajectory separation; when
, it indicates good clustering performance capable of effectively identifying navigation patterns; when
, the clustering effect is poor, and the extracted features require re-evaluation.
(4) Coefficient variation (CV): the coefficient of variation, also referred to as the relative standard deviation, is a standardized statistical measure used to quantify the dispersion of data. It is defined as the ratio of the standard deviation to the absolute mean of a probability distribution or sample dataset. In statistics, the sample coefficient of variation is calculated as follows:
![]() |
17 |
where
represents the coefficient of variation,
denotes the sample standard deviation, and
represents the sample mean.
Unlike absolute dispersion metrics such as standard deviation, the CV serves as a relative measure of dispersion. It provides a dimensionless indicator regarding the scale of data variability, making it particularly suitable for comparing the degree of dispersion between datasets with different units or significantly different means, such as the fluctuation of SOG and COG.
Through this multidimensional evaluation framework, a comprehensive assessment from macro structures to micro individuals can be achieved, ensuring clustering results maintain physical interpretability while demonstrating statistical significance.
Determination of the number of clusters
The traditional elbow method determines the optimal number of clusters by analyzing the variation trend of the Within-Cluster Sum of Squares (WCSS) as the number of clusters increases. For multi-stage clustering in this research, the elbow method50 is optimized based on the variation pattern of the aforementioned AC metric.
Let the sequence of AC values be
, with its first-order and second-order differences denoted as
and
, respectively. The formula for calculating the optimal number
of clusters is as follows:
![]() |
18 |
The AC metric reflects the balance between cluster compactness and separation in clustering results. When the number of clusters approaches the true distribution: if
, it indicates under-clustering, where increasing the number of clusters can significantly improve clustering quality, and the AC value changes rapidly; if
, it suggests over-clustering, where further increasing the number of clusters yields limited improvement in quality, and the AC value changes gradually.
The aforementioned method effectively overcomes the limitations of the traditional elbow method in high-dimensional trajectory feature spaces, providing reliable technical support for the automatic discovery of vessel behavior patterns. Through inflection point analysis of the AC curve, it avoids artificial bias caused by subjective cluster number selection while ensuring clustering quality. A schematic diagram of calculating the coarse cluster number based on the elbow method is shown in Fig. 7. The figure demonstrates that as the number of clusters increases, the AC value generally exhibits a decreasing trend. When the number of clusters is below the optimal value, the AC value decreases rapidly with a pronounced decline; when the number of clusters exceeds the optimal value, the rate of decrease slows and the value stabilizes.
Fig. 7.
Schematic diagram of the elbow rule (determination of the number of coarse clusters).
Experiments and analyses
Data sources
To validate the effectiveness and scientific rigor of the proposed method, a water area characterized by relatively complex environmental conditions and heavy traffic was selected as the experimental region. The specific latitude and longitude ranges are provided in Table 1.The observation period for the experimental waters spanned from 2020-05-31 00:00:00 to 2020-12-30 23:59:59 (UTC). During this period, a total of 5,531,897 raw AIS messages were received (data source: NOAA’s Office Website51, involving 3217 unique MMSI identifiers (as shown in Fig. 8a). After preprocessing steps including spatiotemporal denoising, trajectory reconstruction, and quality filtering34, 2,228,150 valid trajectory points were obtained, generating 5742 complete vessel trajectories (when the same vessel entered and exited the experimental waters at different time intervals, these were treated as distinct trajectories), and the maximum SOG recorded within the waters was
, as illustrated in Fig. 8b.
Table 1.
The experimental water scope.
| Boundary points | Longitude | Latitude |
|---|---|---|
| Upper left | 125 58’46.66”W |
47 54’43.54”N |
| Lower right | 123 32’48.90”W |
48 47’14.77”N |
Fig. 8.
The AIS trajectories in the experimental water area.
The Fig. 8b reveals that the experimental waters comprise a narrow coastal area constrained by the coastline orientation, forming a geographical bottleneck that serves as a high-density convergence zone for multiple shipping routes. This region also exhibits significant heterogeneity in vessel behavior, resulting in vessel trajectories that are highly overlapping and characterized by an extremely uneven spatial distribution. These conditions pose significant challenges for trajectory similarity computation and cluster analysis.
Experimental setup
To comprehensively evaluate the method proposed in this paper, this subsection elaborates in detail on the Settings of key parameters and the selection of comparison algorithms, etc. All experiments were implemented using Python3.11 on a computer (Windows 64, Intel(R), Xeon(R) Gold 5218R CPU @ 2.10GHz, 2.10GHz and 32.0GB RAM).
Image size
The dimensions (
) of the converted vessel trajectory images directly affect the granularity of feature extraction and computational efficiency. Excessively small dimensions may lead to loss of spatial information, while excessively large dimensions increase computational burden and potentially introduce noise. To determine the optimal image dimensions, this research maintains the spatial coverage ratio of trajectories and adopts the method from Reference34. Three trajectories were randomly selected from the dataset and visualized at different dimensions, with the results presented in Fig. 9.
Fig. 9.
The construction of POS modal information for trajectories
under different image sizes.
Analysis of Fig. 9 reveals that small-sized images (
) suffer from severe trajectory detail compression with noticeable information loss (Trajectory
). While large-sized images (
) preserve rich details, they exhibit blurred trajectory edges, potential grid noise, and higher computational costs. Medium-sized images (
) effectively retain trajectory morphology and strike an optimal balance between detail preservation and computational efficiency. Therefore, medium image dimensions (
) are selected for this research.
Model feature dimensions
The feature dimensionality of the bottleneck layer in the aforementioned MCAE model determines the density of the trajectory latent representation, i.e., the feature dimension size influences the model’s representational capacity and generalization ability. Excessively low dimensionality may lead to information loss due to compression, while excessively high dimensionality may introduce overfitting risks. Therefore, this research compares the reconstruction effects (using the POS and SOG modalities as examples, with the model trained for 1000 epochs) of trajectory images (selected in “Trajectory interpolation and resampling”) under different feature dimensionality conditions. The results are shown in the Fig. 10:
Analysis of Figs. 10 and 11 reveals that when
, the reconstructed POS modal images exhibit relatively blurred edges with noticeable noise, demonstrating p oor characterization of trajectory details. Furthermore, the SOG modal reconstructions for Trajectories
and
show severe information loss, resulting in incomplete trajectory reconstruction (though increasing represents the ratio of the current epoch to the total epochs may alleviate this issue), indicating the weakest reconstruction capability of the model. When
, the edge clarity of the reconstructed POS modal images improves with reduced noise, leading to enhanced detail representation. The SOG modal reconstructions also display more complete information, reflecting stronger model performance. At
, the reconstructed POS modal images demonstrate sharp edges with minimal noise, achieving optimal detail representation. The SOG modal reconstructions maintain high information integrity, yielding the highest similarity to the original images and thus representing the model’s strongest reconstruction capability. When
, while the POS modal reconstructions show strong detail characterization comparable to the 64-dimensional case, the SOG modal reconstructions deviate significantly from the original images with higher noise levels than other dimensions, exhibiting clear signs of overfitting and consequently the poorest reconstruction performance. Therefore, a feature dimension of 64 is selected for the model in this research.
Fig. 11.
The SOG modal information reconstruction for trajectories
under different model dimensions.
Learning rate and maximum epochs
In deep model training, the learning rate is a critical hyperparameter that influences both convergence and final performance. An excessively high learning rate tends to cause overly large parameter update steps, leading to oscillations or divergence; whereas an overly low learning rate, while conducive to stable convergence, significantly reduces training efficiency and increases the risk of becoming trapped in local optima. To determine a suitable learning rate for the MCAE architecture, this study partitioned the experimental waters data into training and test sets in a 4:1 ratio. Multiple learning rates (0.002, 0.001, 0.0005, 0.0001) were set for comparative experiments. By analyzing the variation trends of training loss and validation loss, the optimal learning rate strategy was quantitatively evaluated and selected. The comparative results for different learning rates are shown in Figure 12.
Fig. 12.
Loss functions at different learning rates.
Analysis of Fig. 12a indicates that the higher learning rate (lr=0.002) exhibits the fastest initial convergence speed within the first 200 epochs, with the loss value decreasing rapidly. The medium learning rate (lr=0.001) demonstrates the next fastest convergence speed, reaching a stable state more quickly than the lower rates. The lower learning rates (lr=0.0001 and lr=0.0005) converge relatively slowly, requiring more training epochs to achieve comparable loss levels. These results demonstrate that while the MCAE model effectively learns on the training set across all learning rates, its convergence behavior varies significantly depending on the specific learning rate applied.
Analysis of Fig. 12b reveals that the higher learning rate (lr=0.002) exhibits pronounced overfitting characteristics, with the loss value increasing after the mid-training phase, indicating excessive adaptation to the training data. The medium learning rate (lr=0.001) maintains relative stability after convergence but achieves a higher final loss value than the optimal setting. The lowest learning rate (lr=0.0001) demonstrates stable training and good generalization performance, albeit with slower convergence. The lower learning rate (lr=0.0005) shows the best convergence behavior, achieving the lowest final loss value and superior generalization capability. In summary, the lower learning rate (lr=0.0005) ensures stable convergence on the training set and achieves optimal performance on the validation set; therefore, this research selects this learning rate.
Simultaneously, the number of training epochs serves as a critical aspect of the model training process, directly influencing both model convergence and generalization performance: an insufficient number of epochs leads to underfitting due to inadequate training, while excessive epochs result in overfitting and an increase in validation loss. Based on the selected parameters, a comparison of training and validation losses across different epoch counts is conducted, with the results presented in Fig. 13.
Fig. 13.
Loss functions at different epochs clusters.
Analysis of Fig. 13 reveals three distinct phases during training: During the rapid decline phase (0–200 epochs), where training primarily relies on static POS modal information, both training and validation losses exhibit a sharp decline with minimal divergence, indicating scientifically configured model parameters and preliminary convergence. In the fluctuating adjustment phase (200–900 epochs), the loss curves demonstrate a stepwise decreasing trend with plateau characteristics, accompanied by noticeable fluctuations in both training and validation losses, suggesting the model is learning more refined feature representations from multi-modal information. Throughout the stable convergence phase (>900 epochs), training loss gradually decreases while validation loss shows an upward trend after 1000 epochs, with the gap between training and validation losses gradually widening, indicating potential onset of overfitting.
Furthermore, the curves in Fig. 13 indicate that when increasing epochs from 1000 to 1500, the training loss rises gradually from 0.1599 to 0.1652, while the validation loss increases markedly from 0.1714 to 0.2118. This demonstrates that the model overfits the training data, thereby compromising its generalization capability. Moreover, additional training epochs prolong the training duration. Therefore, by comprehensively considering overfitting risks, computational efficiency, and generalization capability while balancing training accuracy and validation performance, this research sets the maximum number of training epochs to 1000.
Modal parameters at different stages
Parameter settings for different stages are detailed in Table 2. Weight adjustment follows a phased training framework, dividing the model training cycle into multiple stages according to Eq. (13) :
(1) Initial stage focuses on reconstructing the spatial structure of trajectories, which also forms the foundation for reconstructing other modalities. Therefore, during the POS modal dominance phase, high weights are assigned to ensure the model rapidly learns collective trajectory features while avoiding convergence interference from other modalities.
(2) After preliminary learning of POS modal features, the SOG/COG modal dominance phases are sequentially introduced. Different modal weight coefficients take the lead for targeted training to accelerate convergence, while the POS modal information is retained for regularization to prevent overfitting.
(3) During the full modal fusion phase, weights are relatively balanced to achieve multi-modal feature fusion and enhance the robustness of representation learning. The POS modal weight remains slightly higher to emphasize the fundamental role of spatial structure.
(4) The full modal balance phase optimizes overall training. SOG/COG modal weights are set slightly higher to improve the learning capacity for dynamic trajectory features, thereby enhancing performance in subsequent similarity computation and clustering tasks.
Multi-modal trajectory information reconstruction
After determining the parameters and hyperparameters of the MCAE model through the aforementioned comparative experiments, the trained model is applied to reconstruct trajectories. The reconstruction results for the POS and SOG modals are shown in Figs. 10 and 11, while the reconstruction results for the COG modal are presented in Fig. 14.
Fig. 14.
The reconstruction results of COG modal information for different trajectories.
Comprehensive comparison of trajectory construction and reconstruction results in Figs. 3, 10, 11 and 14 demonstrates that the proposed method exhibits strong robustness against trajectory noise and non-uniform sampling. It achieves effective multi-modal feature learning and faithful reconstruction of vessel trajectories, thereby validating its scientific soundness and applicability for trajectory similarity computation.
Clustering results and discussion
Selection of comparison algorithms
To impartially evaluate the effectiveness and scientific validity of the proposed method, representative approaches were selected from each of the three aforementioned similarity measurement categories (“Introduction”) for comparison. Optimal parameter configurations were determined either using the original authors’ recommendations or through grid search. The comparative methods include DTW29 and Fréchet distance19 (both employing hierarchical clustering), the CAE model34 (using hierarchical clustering with image dimensions of
), and the t2vec model42(utilizing Spectral Clustering with a grid size of
).The performance comparison of all methods is shown in Table 3.
Table 3.
The performance comparison of different algorithm.
| Algorithm name | Computational efficiency & complexity | Robustness | Feature abstraction & representation learning |
|---|---|---|---|
| DTW | Low &
|
Poor | Geometric only |
| FD | Low &
|
Poor | Geometric only |
| t2vec | Medium & O(n) | Moderate | Sequential, single-modal |
| CAE | High & O(1) | Moderate | Local spatial, single-modal |
| MCAE | High & O(1) | Strong | Multi-modal fusion |
Analysis of clustering results from different algorithms
(1) Overall clustering effect analysis
This research employed various algorithms to cluster trajectories in the experimental waters, with the maximum number of clusters set to 50. The corresponding AC values for different cluster counts and the optimal cluster numbers are shown in Fig. 15, where the MCAE model presents the coarse clustering results. When clustering was performed using the optimal number of clusters, the proportion of trajectories in each cluster relative to the total trajectory count is illustrated in Fig. 16 (only values exceeding 5% are displayed), and trajectories of certain specific cluster categories are shown in Fig. 17.
Fig. 15.
The optimal number of clusters and AC values of different algorithms.
Fig. 16.
The proportion of each cluster trajectory in the optimal number of clusters of different algorithms.
Fig. 17.
The clustering trajectories and specific cluster trajectories with different algorithms.
A comprehensive analysis of Figs. 15, 16 and 17 reveals the following findings. Although DTW achieved a relatively low AC value (0.11, 23 clusters), it exhibited a significant “oversized cluster” phenomenon–two clusters accounted for 98.2% of the trajectories, nearly ten clusters contained only a single trajectory, and obvious trajectory forks were present within typical clusters (shown in Fig. 17a, b). This indicates that its global shape-matching strategy overlooks local details, resulting in overly coarse clustering outcomes.
The Fréchet distance obtained the lowest AC value (0.08, 19 clusters), showing better clustering performance than DTW. However, it similarly suffered from an imbalance in “core cluster” distribution (two clusters comprised 55.7% of trajectories, while six clusters contained fewer than 10 trajectories) and demonstrated a limited ability to capture route branch structures (shown in Fig. 17c, d), leading to poor overall balance.
The t2vec model produced the most balanced trajectory distribution (10 clusters, AC=0.26) with no oversized clusters. However, trajectories within its typical clusters were spatially dispersed and lacked clear physical boundaries (shown in Fig. 17e, f), suggesting it is suitable for sequential pattern analysis but less effective for spatial tasks such as waterway extraction.
The CAE model outperformed t2vec in clustering effectiveness (9 clusters, AC=0.21), showing balanced distribution and clearly depicting main shipping routes (shown in Fig. 17g, h). It demonstrated a strong capability to capture local spatial information but was limited by the local receptive field of its convolutional kernels, making it difficult to subdivide route branches.
The MCAE model yielded the fewest clusters in coarse clustering (8 clusters, AC=0.24). The relatively high AC value confirms the overfitting tendency associated with training solely on the POS modal, consistent with the findings in “Learning rate and maximum epochs”. Nevertheless, it achieved the most balanced trajectory distribution (shown in Fig. 16) and effectively grouped spatially similar trajectories (shown in Fig. 17i, j), laying a foundation for subsequent fine-grained clustering. The apparent forking trend within typical clusters indicates that coarse clustering based only on the POS modal has limited refinement capability, necessitating the introduction of multi-modal information for fine-grained partitioning.
(2) CV effect analysis
The average CV for each cluster across different algorithms are summarized in Table 4. Analysis of the SOG CV shows that the MCAE model achieves the optimal value, significantly outperforming comparative algorithms. This demonstrates that the multi-modal architecture of MCAE effectively captures essential characteristics of the SOG modal, generating trajectory representations that better preserve SOG consistency. Notably, despite being a coarse clustering result, MCAE attains such a low speed CV, highlighting its unique advantage in high-level trajectory pattern recognition.
Table 4.
The CV statistics of different algorithm.
| Algorithm name | SOG CV | COG CV(%) |
|---|---|---|
| DTW | 0.5411 | 0.2835 |
| FD | 0.48886 | 0.3023 |
| t2vec | 0.3800 | 0.2576 |
| CAE | 0.34884 | 0.3067 |
| MCAE | 0.3123 | 0.3421 |
Analysis of the COG CV reveals that the MCAE model achieves a value of 0.3421, slightly higher than other comparative algorithms yet remains relatively low. This indicates the balanced multi-modal feature learning capability of the MCAE model–maintaining excellent SOG feature consistency while preserving reasonable COG feature coherence.
Experimental results demonstrate that the MCAE model exhibits significant advantages in preserving both SOG and COG trajectory characteristics, with particularly outstanding performance in SOG consistency maintenance. In conclusion, compared to other algorithms, the MCAE model enables effective trajectory clustering analysis and delivers satisfactory coarse clustering performance.
Analysis of fine clustering results with MCAE
(1) Overall clustering effect analysis
The aforementioned experiments demonstrate that the MCAE model can effectively cluster trajectories in the experimental waters, though further refinement of clustering granularity is required. Building upon the optimal coarse cluster count, fine clustering analysis is performed using SOG/COG modal data. Following Eq. (14) and Referencing14, the maximum number of fine clusters for each coarse cluster is constrained to 10. The corresponding AC metric values are shown in Fig. 18, and the trajectory proportions of each fine cluster under their respective optimal cluster counts are presented in Fig. 19.
Fig. 18.
The fine clustering AC values of different coarse clusters.
Fig. 19.
The proportion of trajectories of each fine cluster in different coarse clusters.
Analysis of Fig. 18 reveals that during fine clustering of different coarse clusters, the LAC values follow a consistent overall trend with the aforementioned AC values (shown in Fig. 15), characterized by an initial rapid decline followed by gradual stabilization. This indicates the rationality of the metric design in accurately reflecting clustering performance. The generally lower LAC values in fine clustering compared to the AC values in coarse clustering demonstrate the scientific validity of the fine clustering methodology. Examination of Fig. 19 shows relatively uniform distribution of trajectory proportions across fine clusters, validating the rationality of the fine clustering design with enhanced equilibrium.
However, for the 6th coarse cluster, the number of fine clusters is 2 and the LAC value is nan–both being user-defined default values. Furthermore, Fig. 19 reveals a “super-cluster” phenomenon within this cluster, where a single fine cluster accounts for 99.8% of trajectories. This indicates a failure to obtain the optimal cluster count, likely due to the high intra-cluster compactness of these trajectories, making them unsuitable for further subdivision and should be considered a natural cluster (as shown in Fig. 20).
Fig. 20.
The 6th coarse cluster.
To further enhance the granularity of clustering, this study conducted fine-grained clustering analysis based on SOG/COG modals for the 1st coarse cluster obtained from the coarse clustering stage (Fig. 17j). As shown in Fig. 18, this coarse cluster can be subdivided into 5 subclusters with relatively balanced trajectory proportions (shown in Fig. 21), which achieved the minimum LAC value, which indicates that the introduction of multi-modal information effectively improves both intra-cluster consistency and inter-cluster separation.
Fig. 21.
Specific cluster subdivision results.
The fine clustering results clearly reveal the most standardized and highest-traffic main navigation route within these waters shown in Fig. 21), suggesting the potential existence of a “Traffic Separation Scheme.” Specifically, most trajectories (shown in Fig. 21a–c) enter or depart from the lower-right waters (near Port Angeles and Seattle), while trajectories (shown in Fig. 21d, e) correspond to the upper-right waters (near Port Victoria and Vancouver). This demonstrates the algorithm’s capability to effectively distinguish trajectories with similar navigation patterns but different origins in areas of high spatial overlap.
Notably, the trajectories (shown in Fig. 21c) form an independent subcluster due to their significant differences in SOG/COG features compared to those trajectories (shown in Fig. 21a, b). A small number of “globally shifted” trajectories (shown in Fig. 21d) are grouped into the 5th subcluster because of their high similarity in multi-modal features, verifying the algorithm’s ability to identify stable, parallel navigation modes. Whether the two special trajectories (shown in Fig. 21e) constitute anomalous behavior requires further investigation incorporating additional navigational information.
(2)SOG&COG effect analysis
When each coarse cluster is finely clustered with the optimal number of clusters, its contour coefficients are shown in Table 5.
Table 5.
The SI values of each coarse cluster.
| Coarse cluster ID | SIV | Coarse cluster ID | SI |
|---|---|---|---|
| 0th | 0.84285 | 4th | 0.55027 |
| 1th | 0.54796 | 5th | 0.52767 |
| 2th | 0.64431 | 6th | 0.93003 |
| 3th | 0.64294 | 7th | 0.803771 |
All SI for the coarse clusters in Table 5 exceed the 0.5 benchmark, with values ranging from 0.53 to 0.93. Over half of the clusters achieved values above 0.64, with three clusters surpassing 0.80. These results demonstrate significant fine clustering performance, with enhanced inter-cluster separation and intra-cluster compactness, validating the effectiveness of the hierarchical clustering strategy and indicating the MCAE model’s strong capability in trajectory feature extraction.
Simultaneously, the total number of trajectory points in the 7th fine cluster is 41,190. The corresponding CV for SOG and COG in this cluster are 0.2518 and 0.1199 respectively, with their distribution histograms shown in Fig. 22.
Fig. 22.
Histogram distribution.
Analysis of Fig. 22a reveals that the CV for SOG is 0.2518, indicating moderate variability in the speed of trajectories within this cluster. This suggests significant fluctuations in SOG across different time points, reflecting pronounced acceleration and deceleration processes during vessel navigation. Such patterns align with typical vessel behavior in the experimental waters, where vessels transition between open and constricted areas. Furthermore, SOG values are primarily concentrated within the 0–15 knots range, with the frequency peak occurring near the mean, following an approximately normal distribution.
Analysis of Fig. 22b indicates that the CV for COG is 0.1199, suggesting relatively stable COG with low variability and minimal directional changes. The standard deviation of COG fluctuates near the mean, indicating that observed variations primarily stem from normal navigational fluctuations rather than fundamental differences, thereby reinforcing the similarity of trajectories within the cluster. Consequently, the coefficients of variation for both SOG and COG collectively support the validity of this cluster’s formation.
In summary, the proposed MCAE model, through multi-modal feature learning and hierarchical clustering strategy, effectively enhances both the computational efficiency of vessel trajectory similarity measurement and clustering performance in complex waterways.
Conclusions and future work
This research achieves significant progress in vessel trajectory representation learning and similarity computation by developing MCAE model. The core innovation lies in effectively integrating multi-modal information from vessel AIS data–POS, SOG, and COG–into structured image representations, and leveraging deep convolutional networks for feature extraction. This approach overcomes limitations of traditional methods in handling non-uniform sampling, noise, and modal heterogeneity. Experimental validation demonstrates that the MCAE framework achieves outstanding performance in trajectory clustering tasks, with the AC metric reaching as low as 0.0465 the minimum CV as 0.1198 and the SI as high as 0.93003, significantly outperforming comparative algorithms (DTW, FD, CAE model, and t2vec model). These results confirm its superiority in feature learning and similarity measurement. The framework not only enhances the accuracy and robustness of trajectory analysis but also provides a reliable technical foundation for applications such as maritime surveillance and anomalous trajectory detection, demonstrating substantial theoretical and practical value.
Several limitations of this study warrant further investigation. Regarding data preprocessing, the generalization capability of cubic spline interpolation for extremely irregular AIS data (e.g., prolonged missing intervals, high noise levels) remains insufficiently validated. Additionally, the model assumes a fixed study region, and the scale adaptability for cross-regional transferability requires enhancement. With respect to methodological comparison, due to the authors’ current research capacity and research scope constraints, deep clustering models based on graph regularization,
-divergence non-negative matrix factorization, and semi-supervised learning were not incorporated. Future work will focus on three directions: (1) introducing uncertainty modeling or physical constraints to improve interpolation robustness, and exploring self-supervised or meta-learning approaches to enhance the model’s adaptability to varying sampling rates and noise levels; (2) integrating attention mechanisms with graph neural networks to strengthen the capture of local maneuvering behaviors and improve applicability in complex scenarios; (3) systematically incorporating advanced clustering methods such as graph regularization, non-negative matrix factorization, and semi-supervised learning for comparative analysis with the MCAE model, and exploring the fusion of semi-supervised learning frameworks with multimodal AE to leverage limited labeled data for guiding the model toward more generalizable feature representations, thereby achieving superior performance on unlabeled or partially labeled datasets.
Author contributions
Ting Zhang : Writing - original draft, Conceptualization, Methodology. Zhiming Wang: Writing - original draft, Reviewing and Editing, Writing - review & editing. Peiliang Wang: Writing - review & editing, Reviewing and Editing, Software, Visualization.
Funding
The work described in this paper was supported by grants from Science and Technology Commission of Shanghai Municipality (Grant No.22010502000 and No.23010501900).
Data availability
The data that support the findings of this study are available from Shanghai Maritime Safety Administration but restrictions apply to the availability of these data, which were used under license for the current study, and so are not publicly available. The datasets generated and analysed during the current study are not publicly available due data sensitivity but are available from the corresponding author on reasonable request
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Ting Zhang, Zhiming Wang and Peiliang Wang are now designated as having contributed equally to this work.
References
- 1.Du, L., Goerlandt, F. & Kujala, P. Review and analysis of methods for assessing maritime waterway risk based on non-accident critical events detected from AIS data. Reliab. Eng. Syst. Saf.200, 106933. 10.1016/j.ress.2020.106933 (2020). [Google Scholar]
- 2.Sui, Z. et al. Node importance evaluation in marine traffic situation complex network for intelligent maritime supervision. Ocean Eng.247, 110742. 10.1016/j.oceaneng.2022.110742 (2022). [Google Scholar]
- 3.Liu, H., Liu, Y. & Zong, Z. Research on ship abnormal behavior detection method based on graph neural network. In 2022 IEEE International Conference on Mechatronics and Automation (ICMA). 834–838. 10.1109/ICMA54519.2022.9856198 (IEEE, 2022).
- 4.Murray, B. & Perera, L. P. Ship behavior prediction via trajectory extraction-based clustering for maritime situation awareness. J. Ocean Eng. Sci.7, 1–13. 10.1016/j.joes.2021.03.001 (2022). [Google Scholar]
- 5.Blindheim, S., Johansen, T. A. & Utne, I. B. Risk-based supervisory control for autonomous ship navigation. J. Mar. Sci. Technol.28, 624–648. 10.1007/s00773-023-00945-6 (2023). [Google Scholar]
- 6.Guo, Y. & Ding, Z. Application of big data in analyzing the impact of explosive cyclone on ship navigation safety. In 2021 2nd International Conference on Smart Electronics and Communication (ICOSEC). 910–913. 10.1109/ICOSEC51865.2021.9591958 (IEEE, 2021).
- 7.Han, P. & Yang, X. Big data-driven automatic generation of ship route planning in complex maritime environments. Acta Oceanol. Sin.39, 113–120. 10.1007/s13131-020-1638-5 (2020). [Google Scholar]
- 8.Zhang, T., Wang, Z. & Wang, P. A method for compressing AIS trajectory based on the adaptive core threshold difference Douglas-Peucker algorithm. Sci. Rep.14, 21408. 10.1038/s41598-024-71779-4 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Cheng, Z., Li, Y., Wang, J., Niu, M. & Zuo, T. Collapse of cetacean biodiversity in the North Yellow Sea: Social media and AIS data uncover anthropogenic threats and conservation hotspots. Ocean Coast. Manag.270, 107897. 10.1016/j.ocecoaman.2025.107897 (2025). [Google Scholar]
- 10.Sun, Z., Xu, S. & Jiang, J. Spatial-temporal characteristics of ship carbon emission based on AIS data. Ocean Coast. Manag.265, 107629. 10.1016/j.ocecoaman.2025.107629 (2025). [Google Scholar]
- 11.Zhou, Y., Daamen, W., Vellinga, T. & Hoogendoorn, S. P. Ship classification based on ship behavior clustering from AIS data. Ocean Eng.175, 176–187. 10.1016/j.oceaneng.2019.02.005 (2019). [Google Scholar]
- 12.Rong, H., Teixeira, A. P. & Guedes Soares, C. A framework for ship abnormal behaviour detection and classification using AIS data. Reliab. Eng. Syst. Saf.247, 110105. 10.1016/j.ress.2024.110105 (2024). [Google Scholar]
- 13.Zhao, L. & Shi, G. A trajectory clustering method based on Douglas-Peucker compression and density for marine traffic pattern recognition. Ocean Eng.172, 456–467. 10.1016/j.oceaneng.2018.12.019 (2019). [Google Scholar]
- 14.Besse, P. C., Guillouet, B., Loubes, J.-M. & Royer, F. Review and perspective for distance-based clustering of vehicle trajectories. IEEE Trans. Intell. Transport. Syst.17, 3306–3317. 10.1109/TITS.2016.2547641 (2016). [Google Scholar]
- 15.Su, H., Liu, S., Zheng, B., Zhou, X. & Zheng, K. A survey of trajectory distance measures and performance evaluation. VLDB J.29, 3–32. 10.1007/s00778-019-00574-9 (2020). [Google Scholar]
- 16.Zhang, H., Li, W., Shi, G., Desrosiers, R. & Wang, X. A ship trajectory clustering algorithm based on segmentation direction. Ocean Eng.313, 119383. 10.1016/j.oceaneng.2024.119383 (2024). [Google Scholar]
- 17.Liu, L. et al. A hybrid-clustering model of ship trajectories for maritime traffic patterns analysis in port area. J. Mar. Sci. Eng.10, 342. 10.3390/jmse10030342 (2022). [Google Scholar]
- 18.Liu, Z. et al. Research on the optimization of ship trajectory clustering based on the OD-Hausdorff distance. J. Mar. Sci. Eng.12, 1398. 10.3390/jmse12081398 (2024). [Google Scholar]
- 19.He, S. & Wu, C. A Fréchet distance -hierarchical density-based spatial clustering of applications with noise for ship trajectory clustering and route recognition. In 2024 International Conference on Distributed Systems, Computer Networks and Cybersecurity (ICDSCNC). 1–5. 10.1109/ICDSCNC62492.2024.10939571 (IEEE, 2024).
- 20.Šakan, D., Žuškin, S., Rudan, I. & Brčić, D. Container ship fleet route evaluation and similarity measurement between two shipping line ports. J. Mar. Sci. Eng.11, 400. 10.3390/jmse11020400 (2023). [Google Scholar]
- 21.Cao, J. et al. PCA-based hierarchical clustering of AIS trajectories with automatic extraction of clusters. In 2018 IEEE 3rd International Conference on Big Data Analysis (ICBDA). 448–452. 10.1109/ICBDA.2018.8367725 (2018).
- 22.Lin, B. & Su, J. One way distance: For shape based similarity search of moving object trajectories. Geoinformatica12, 117–142. 10.1007/s10707-007-0027-y (2008). [Google Scholar]
- 23.Ma, W., Wu, Z., Yang, J. & Li, W. Vessel motion pattern recognition based on one-way distance and spectral clustering algorithm. In Algorithms and Architectures for Parallel Processing (Sun, X.-H. et al. Eds.). 461–469. 10.1007/978-3-319-11194-0_38 (Springer, 2014).
- 24.Ouyang, Z., Xue, L., Ding, F. & Li, D. An algorithm for extracting similar segments of moving target trajectories based on shape matching. Eng. Appl. Artif. Intell.127, 107243. 10.1016/j.engappai.2023.107243 (2024). [Google Scholar]
- 25.Shen, H., Tang, H. & Yin, Y. A novel method for ship trajectory clustering. Int. J. Naval Architect. Ocean Eng.14, 100474. 10.1016/j.ijnaoe.2022.100474 (2022). [Google Scholar]
- 26.Zhang, X., Zhou, S., Jiang, Z., Chu, X. & Yu, C. A novel ship trajectory clustering model integrated with spatiotemporal attributes. Ocean Eng.336, 121774. 10.1016/j.oceaneng.2025.121774 (2025). [Google Scholar]
- 27.Li, H. et al. A dimensionality reduction-based multi-step clustering method for robust vessel trajectory analysis. Sensors17, 1792. 10.3390/s17081792 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Bai, X., Xie, Z., Xu, X. & Xiao, Y. An adaptive threshold fast DBSCAN algorithm with preserved trajectory feature points for vessel trajectory clustering. Ocean Eng.280, 114930. 10.1016/j.oceaneng.2023.114930 (2023). [Google Scholar]
- 29.Xie, Z., Bai, X., Xu, X. & Xiao, Y. An anomaly detection method based on ship behavior trajectory. Ocean Eng.293, 116640. 10.1016/j.oceaneng.2023.116640 (2024). [Google Scholar]
- 30.Choong, M. Y., Angeline, L., Yin Chin, R. K., Beng Yeo, K. & Kin Teo, K. T. Modeling of vehicle trajectory clustering based on LCSS for traffic pattern extraction. In 2017 IEEE 2nd International Conference on Automatic Control and Intelligent Systems (I2CACIS). 74–79. 10.1109/I2CACIS.2017.8239036 (IEEE, 2017).
- 31.Bian, W., Cui, G. & Wang, X. A trajectory collaboration based map matching approach for low-sampling-rate GPS trajectories. Sensors20, 2057. 10.3390/s20072057 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32.Xu, D., Yang, J., Qin, K. S., Qi, Y. & Zhou, Z. Anomaly detection method for ship trajectory based on stay region mining. Ocean Eng.331, 121364. 10.1016/j.oceaneng.2025.121364 (2025). [Google Scholar]
- 33.Chen, L., Özsu, M. T. & Oria, V. Robust and fast similarity search for moving object trajectories. In Proceedings of the 2005 ACM SIGMOD International Conference on Management of Data, SIGMOD ’05. 491–502. 10.1145/1066157.1066213 (Association for Computing Machinery, 2005).
- 34.Liang, M. et al. An unsupervised learning method with convolutional auto-encoder for vessel trajectory similarity computation. Ocean Eng.225, 108803. 10.1016/j.oceaneng.2021.108803 (2021). [Google Scholar]
- 35.Zhang, L., Lu, W., Xue, F. & Chang, Y. A trajectory outlier detection method based on variational auto-encoder. Math. Biosci. Eng.20, 15075–15093. 10.3934/mbe.2023675 (2023). [DOI] [PubMed] [Google Scholar]
- 36.Ma, L., Cao, H. & Shi, G.-Y. Ship behavior pattern recognition method based on hybrid graph neural networks. Front. Mar. Sci.12, 1605216. 10.3389/fmars.2025.1605216 (2025). [Google Scholar]
- 37.Zhang, X. et al. Trajectory prediction of seagoing ships in dynamic traffic scenes via a gated spatio-temporal graph aggregation network. Ocean Eng.287, 115886. 10.1016/j.oceaneng.2023.115886 (2023). [Google Scholar]
- 38.Lee, H.-J. & Park, D.-J. Collision evasive action timing for MASS using CNN-LSTM-based ship trajectory prediction in restricted area. Ocean Eng.294, 116766. 10.1016/j.oceaneng.2024.116766 (2024). [Google Scholar]
- 39.Chen, P., Liu, S. & Niko, L. CNN-based vessel meeting knowledge discovery from AIS vessel trajectories. J. Database Manag.34. 10.4018/JDM.321636 (2023).
- 40.Chen, X., Liu, Y., Achuthan, K. & Zhang, X. A ship movement classification based on automatic identification system (AIS) data using convolutional neural network. Ocean Eng.218, 108182. 10.1016/j.oceaneng.2020.108182 (2020). [Google Scholar]
- 41.Chen, R., Chen, M., Li, W., Wang, J. & Yao, X. Mobility modes awareness from trajectories based on clustering and a convolutional neural network. ISPRS Int. J. Geo-Inf.8, 208. 10.3390/ijgi8050208 (2019). [Google Scholar]
- 42.Taghizadeh, S., Elekes, A., Schäler, M. & Böhm, K. How meaningful are similarities in deep trajectory representations?. Inf. Syst.98, 101452. 10.1016/j.is.2019.101452 (2021). [Google Scholar]
- 43.Ferreira, M. D. & Campbell, J. N. A. A novel RNN architecture to improve the precision of ship trajectory predictions. Appl. Artif. Intell.39, 2459465. 10.1080/08839514.2025.2459465 (2025). [Google Scholar]
- 44.Dongjiang, L., Leixiao, L. & Jie, L. A trajectory similarity computation method based on GAT-based transformer and CNN model. Sci. Rep.14, 16173. 10.1038/s41598-024-67256-7 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45.Li, H., Jiao, H. & Yang, Z. AIS data-driven ship trajectory prediction modelling and analysis based on machine learning and deep learning methods. Transport. Res. Part E Logist. Transport. Rev.175, 103152. 10.1016/j.tre.2023.103152 (2023). [Google Scholar]
- 46.Bole, A., Wall, A. & Norris, A. Chapter 5 - Automatic Identification System (AIS). In Radar and ARPA Manual (Third Edition) (Bole, A., Wall, A. & Norris, A. eds.) . 255–275. 10.1016/B978-0-08-097752-2.00005-2 (Butterworth-Heinemann, 2014).
- 47.Guo, S., Mou, J., Chen, L. & Chen, P. Improved kinematic interpolation for AIS trajectory reconstruction. Ocean Eng.234, 109256. 10.1016/j.oceaneng.2021.109256 (2021). [Google Scholar]
- 48.Liu, R. W., Yuan, W., Chen, X. & Lu, Y. An enhanced CNN-enabled learning method for promoting ship detection in maritime surveillance system. Ocean Eng.235, 109435. 10.1016/j.oceaneng.2021.109435 (2021). [Google Scholar]
- 49.Hafeezallah, A., Al-Dhamari, A. & Abu-Bakar, S. A. R. Motion segmentation using Ward’s hierarchical agglomerative clustering for crowd disaster risk mitigation. Int. J. Disaster Risk Reduct.102, 104262. 10.1016/j.ijdrr.2024.104262 (2024). [Google Scholar]
- 50.Liu, Z., Zhou, D., Zheng, Z., Wu, Z. & Guedes Soares, C. A multi-dimensional formulation for assessing regional collision risk based on AIS data. Appl. Ocean Res.161, 104612. 10.1016/j.apor.2025.104612 (2025). [Google Scholar]
- 51.Cadastre, M. Vessel Traffic - Marine Cadastre. https://hub.marinecadastre.gov/pages/vesseltraffic.
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The data that support the findings of this study are available from Shanghai Maritime Safety Administration but restrictions apply to the availability of these data, which were used under license for the current study, and so are not publicly available. The datasets generated and analysed during the current study are not publicly available due data sensitivity but are available from the corresponding author on reasonable request






















































