Ship trajectory clustering method based on feature embedding representation learning
Patent Information
- Application Number
- CN202511621964.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-10-20
AI Technical Summary
[0006]本发明旨在提供一种基于特征嵌入表示学习的船舶轨迹聚类方法,以解决现有的轨迹聚类方法存在的问题
[0097]本发明提供的基于特征嵌入表示学习的船舶轨迹聚类方法,以基于时间注意力的特征聚合网络为主体,建模轨迹特征的跨尺度依赖关系,通过可学习查询向量动态调整关注焦点并以逐层聚合的形式保留不同尺度下的关键信息,生成低维稠密特征向量,克服现有方法难以兼顾捕捉轨迹局部特征与长期时序模式的问题,能够自动适配不同时空跨度的船舶轨迹;针对不同维度轨迹特征相互干扰、难以有效交互协同问题,提出将轨迹中的运动、位置特征解耦并利用双特征自注意力融合编码器实现交叉融合,形成更全面的轨迹特征嵌入表示;并且,引入对比学习的思想并采用“预训练-联合训练”两阶段模型训练策略,设计了包含对比损失和聚类损失的联合损失函数优化模型参数和聚类中心从而同时约束轨迹特征相似性学习和k-means聚类过程,使学习到的轨迹嵌入表示与原始轨迹特征对齐并引导同类样本聚集,以聚类损失锐化类间边界,从而得到更有利于聚类任务的嵌入表示,以改善聚类效果。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship trajectory clustering, and more specifically to a ship trajectory clustering method based on feature embedding representation learning. Background Technology
[0002] Ship trajectory clustering, through unsupervised learning, discovers ship behavior patterns and spatiotemporal clustering characteristics, thereby revealing the regularity of ship activities and decoding the connection between ship activities and high-value information such as identity. This has significant value for maritime regulation, risk assessment, and route planning optimization. Existing trajectory clustering methods can be divided into two main categories: point-matching-based trajectory clustering methods and deep trajectory clustering methods.
[0003] Traditional trajectory clustering methods rely on local point matching similarity metrics, such as Longest Common Subsequence (LCSS), Edit Distance (EDR), and Dynamic Time Warping (DTW). These methods use dynamic programming to find the optimal alignment and calculate the similarity between trajectories point-by-point, using algorithms like k-means and DBSCAN to complete clustering. However, these algorithms are sensitive to small perturbations in local trajectory points, which can lead to distortion of the global similarity measurement due to accumulated errors. Furthermore, the similarity calculation process for point matching requires at least quadratic time with respect to the number of trajectory points N. This high computational cost typically makes it difficult to directly scale to large-scale samples.
[0004] To address this, researchers have proposed a deep trajectory clustering method. This method aims to embed the original trajectories into a low-dimensional space using dimensionality reduction mapping, representing them as fixed-length vectors while preserving their original similarity relationships. Then, a clustering algorithm is used to divide the feature vector representation, thereby achieving trajectory clustering. The key lies in designing and training a neural network model to extract potential discriminative trajectory features. However, different types of ship trajectories overlap in spatiotemporal location, and there is a complex coupling relationship between position and motion features. Existing methods struggle to simultaneously establish comprehensive and accurate trajectory feature embedding representations across multiple scales and dimensions. This is the main reason why many models that perform well on urban traffic trajectory datasets are unsuitable for ship trajectory clustering tasks.
[0005] Therefore, there is an urgent need to design a new, efficient, and accurate method for clustering ship trajectories. Summary of the Invention
[0006] The present invention aims to provide a ship trajectory clustering method based on feature embedding representation learning, so as to solve the problems existing in the existing trajectory clustering methods.
[0007] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0008] A ship trajectory clustering method based on feature embedding representation learning is proposed. A training model for ship trajectory feature embedding representation learning is established, and this model is processed through the following steps to obtain the embedded representation of the trajectory features:
[0009] S1. For any trajectory data in the trajectory set, preprocess the trajectory data;
[0010] S2. For the trajectory data processed in step S1, the trajectory is segmented using a time sliding window. For each trajectory segment obtained after segmentation, the time position of the trajectory points is encoded.
[0011] S3. For each trajectory segment, a bidirectional long short-term memory network encoder is used to extract micro-temporal features and a multi-layer temporal attention aggregation mechanism is used to achieve multi-scale feature aggregation from micro to macro.
[0012] S4. The dual-feature self-attention fusion encoder is used to complete the adaptive fusion of the position features and motion features of the trajectory segment. Its output, together with the statistical features of the entire trajectory, is processed by the gated fusion module to generate an embedded representation of the trajectory features.
[0013] After model training is completed, the embedding representations corresponding to all trajectory data in the trajectory set are obtained based on the model, and then clustering is performed to obtain the ship trajectory clustering results.
[0014] Furthermore, in the established model, the trajectory of a ship with length L is represented as:
[0015] ;
[0016] Where any t-th trajectory point p t The original information is represented by a quintuple:
[0017] ;
[0018] Each trajectory point includes a timestamp (Time), longitude (Lon), latitude (Lat), ground speed (SOG), and ground heading (COG). The trajectory set is denoted as... N is the number of trajectories;
[0019] The goal of ship trajectory clustering is to group ships according to their similarity. The data is divided into K distinct clusters, each representing a set of trajectories of a certain category. The clustering process is described as follows:
[0020] ;
[0021] Where D k Let k represent a set containing several trajectories of the same type, k=1,2,…,K.
[0022] Furthermore, in step S1, the preprocessing of the trajectory data includes at least timestamp conversion, outlier cleaning, and interpolation.
[0023] Furthermore, in step S2, when performing time-position encoding of the trajectory points, specifically:
[0024] Absolute position encoding is performed using sine and cosine functions, assigning a unique temporal position identifier to each trajectory point. For the i-th trajectory point, its absolute position in the d-dimensional feature space is... The encoding calculation formula is:
[0025] ;
[0026] Where j = 0, 1, ..., d;
[0027] Furthermore, to characterize the time interval relationship between trajectory points, relative position encoding is introduced, assuming trajectory point p i The time interval between the starting point and the starting point is Using a linear transformation layer (Linear) to transform the relative time interval Mapped to relative position vectors That is, trajectory point p i The relative time position code relative to the starting point is:
[0028] ;
[0029] Then the trajectory point p i The final time location code is:
[0030] .
[0031] Furthermore, in step S3, when extracting micro-temporal features using a bidirectional long short-term memory network encoder, specifically:
[0032] The bidirectional long short-term memory network is designed as two independent long short-term memory network structures that map the input sequence to the forward hidden sequence in positive and negative order, respectively. and backward hidden sequence , is represented as:
[0033] ;
[0034] ;
[0035] in, and These are the weight matrices for the forward and backward layers, respectively, x t The feature sequence of the trajectory segment includes location features such as longitude and latitude, as well as motion features such as ground speed and ground heading;
[0036] The forward and backward implicit sequences output by the encoder are fed back to the same output layer and concatenated into a compact bidirectional representation. By using an encoder to sequentially encode the sequence of trajectory segments after the entire trajectory is segmented, a micro-level trajectory temporal feature embedding representation sequence is obtained. m is the number of sliding windows.
[0037] Furthermore, in step S3, when using a multi-layer temporal attention aggregation mechanism to achieve multi-scale feature aggregation from micro to macro, specifically:
[0038] First, the time position encoding information (PE) is added to the h output of the bidirectional long short-term memory network encoder. t From :
[0039] ;
[0040] The corresponding sequence is represented as ;
[0041] Then, a local attention mechanism is introduced to calculate the trajectory feature weights at different time locations. The corresponding micro-level embedding representations are weighted and summed to form a summary vector representing the trajectory features of this stage.
[0042] In sequence In the process, the sequences are divided into groups of three without overlap. For sequences shorter than the allotted length, zero-padding is used. The intra-group attention weights are then calculated for each group. :
[0043] ;
[0044] Where t is the time step, m = 0, 1, ..., n, and n is the number of groups. Here, d represents the local query vector, and d represents the feature dimension.
[0045] Generate local summary vectors :
[0046] ;
[0047] This yields the mesoscopic feature sequence of the trajectory features. ;
[0048] Similarly, in the local summary vector Based on this, we further aggregate the vectors into groups of three to form a macroscopic feature embedding representation, which is then used for global query vectors. and linear transformation matrix W g Long-term temporal dependencies are established, represented by global attention weights as follows:
[0049] ;
[0050] Where h = 0, 1, ..., s, and s is the number of groups;
[0051] Generate global vector :
[0052] ;
[0053] This leads to the macroscopic feature sequence of the trajectory. .
[0054] Further, in step S4, specifically:
[0055] For the feature sequence obtained in step S3 Encoding is performed separately for positional features and motion features to avoid mutual interference. Positional feature sequences and motion feature sequences are encoded using... and express;
[0056] Using a dual-feature self-attention fusion encoder, the position feature sequence and motion feature sequence are input and linearly projected to generate their respective query matrix Q, key matrix K, and value matrix V, as follows:
[0057] ;
[0058] ;
[0059] In this context, the subscript p corresponds to positional features, and the subscript m corresponds to motion features. , , Both are parameter matrices;
[0060] Subsequently, the attention weights for positional and motion features are calculated using scaled dot products:
[0061] ;
[0062] ;
[0063] Where Num_h represents the number of heads in the multi-head attention mechanism. Let be the feature attention coefficient matrix of the i-th head, representing the feature correlation between different points;
[0064] Furthermore, to effectively fuse dual-modal features, a parameter γ is introduced to dynamically adjust the correlation between positional and motion features. The final fusion weight is calculated as follows:
[0065] ;
[0066] This leads to the fusion characteristics of the single-head output:
[0067] ;
[0068] The outputs of each head are then concatenated to form the complete output of the dual-feature self-attention fusion encoder. :
[0069] ;
[0070] Where || denotes series connection. It is a weight matrix;
[0071] Then, through residual connections and layer normalization... The process is performed, and the result is used... express:
[0072] ;
[0073] Next, we further extract higher-order features using FFN and then normalize them:
[0074] ;
[0075] Again Trajectory feature integration embedding representation generated by average pooling ;
[0076] Furthermore, a gating fusion module was added, which standardizes the statistical features of the entire trajectory and then maps them to a map using a fully connected layer. In the same dimensional space, we get Then and splicing:
[0077] ;
[0078] Adaptive feature fusion is achieved using a gating mechanism:
[0079] ;
[0080] ;
[0081] Where f is the fusion weight, W f Let b be the weight matrix. f For bias terms, Using the sigmoid activation function, the fusion weights are constrained to the interval [0,1]. The Hadamard product, where I is an all-one vector, and the eigenvectors are... This is the embedded representation of the complete output trajectory; the final output is the feature vector set corresponding to all trajectories in the trajectory set.
[0082] Furthermore, during model training, the trajectory set is the collected trajectory sample set, and a two-stage training strategy is adopted: pre-training is performed first, followed by joint training.
[0083] Furthermore, during the pre-training phase, for any trajectory data in the training set, after the preprocessing in step S1, trajectory enhancement processing is performed on the ship trajectory using two strategies: point distortion and downsampling, in order to enrich the training set of trajectory data.
[0084] Among them, point distortion affects the original ship trajectory T. i Random offsets are applied to each trajectory point to obtain similar trajectories with slight differences in numerical characteristics;
[0085] Downsampling generates an incomplete trajectory sequence through a dot masking mechanism, for a given original ship trajectory T. i For each trajectory point, a random deletion operation is performed with probability P, and the probability P of each point satisfies an independent and identical uniform distribution.
[0086] For trajectory sample set After trajectory enhancement processing, the corresponding enhanced sample set is generated as follows: ;
[0087] For the two sample sets, the feature vector sets output by the model are represented as follows: and The contrastive loss function is then defined as:
[0088] ;
[0089] in, The temperature parameter used to control the sharpness of the distribution is dist, which represents the cosine similarity. This is an indicator function used to exclude self-comparison;
[0090] During the pre-training phase, continuous optimization continues until L... cont Convergence is achieved by extracting features from the pre-trained model and executing the k-means algorithm to initialize cluster centers.
[0091] Furthermore, during the joint training phase, specifically:
[0092] Constructing a multi-objective loss function:
[0093] ;
[0094] in, L is the balance coefficient. clusterIt includes four clustering losses, namely the k-means loss L km Soft allocation loss L soft Cluster spacing loss L inter Consistency loss with nearest neighbors L nb L cluster It is calculated by weighted summation of four clustering losses;
[0095] During the joint training phase, the neural network parameters and cluster assignments are updated alternately, allowing the cluster centers to converge rapidly while gradually adjusting the feature space; this process is repeated until the preset maximum number of iterations or L is reached. joint After convergence, training is complete. The trained model and optimized cluster centers are used to perform the final clustering assignment on all ship trajectory data to obtain the ship trajectory clustering results.
[0096] Compared with the prior art, the advantages of the present invention are as follows:
[0097] This invention provides a ship trajectory clustering method based on feature embedding representation learning. It uses a time-attention-based feature aggregation network as the main body to model the cross-scale dependencies of trajectory features. By dynamically adjusting the focus of attention through learnable query vectors and retaining key information at different scales through layer-by-layer aggregation, it generates low-dimensional dense feature vectors. This overcomes the problem of existing methods struggling to capture both local trajectory features and long-term temporal patterns, and can automatically adapt to ship trajectories with different spatiotemporal spans. Addressing the problem of mutual interference and difficulty in effective interaction and collaboration among trajectory features of different dimensions, the method proposes decoupling motion and position features in the trajectory and using a dual-feature self-attention fusion encoder to achieve cross-fusion, forming a more comprehensive trajectory feature embedding representation. Furthermore, it introduces the idea of contrastive learning and adopts a two-stage model training strategy of "pre-training-joint training." A joint loss function, including contrastive loss and clustering loss, is designed to optimize model parameters and cluster centers, thereby simultaneously constraining trajectory feature similarity learning and the k-means clustering process. This aligns the learned trajectory embedding representation with the original trajectory features and guides the clustering of similar samples. The clustering loss sharpens the inter-class boundaries, resulting in an embedding representation more conducive to the clustering task and improving the clustering effect. Attached Figure Description
[0098] Figure 1 A partial flowchart illustrating a ship trajectory clustering method based on feature embedding representation learning provided by this invention;
[0099] Figure 2 This is a schematic diagram of the principle corresponding to step S3 of the present invention;
[0100] Figure 3 This is a schematic diagram of the dual-feature self-attention fusion encoder in step S4 of the present invention;
[0101] Figures 4a-4g The t-SNE embedding visualizations are for the clustering results of seven different methods. Detailed Implementation
[0102] To make the technical means, creative features, objectives and effects of this invention easier to understand, the following description, in conjunction with the accompanying drawings and specific embodiments, further explains how this invention is implemented.
[0103] In one specific embodiment, the present invention provides a ship trajectory clustering method based on feature embedding representation learning, establishing a training model for ship trajectory feature embedding representation learning. The purpose of ship trajectory feature embedding representation learning is to map the original trajectory features to a low-dimensional space through the model, representing them as fixed-length vectors while maintaining the similarity relationship between the original trajectory patterns.
[0104] In the established model, the ship trajectory of length L is represented as:
[0105] ;
[0106] Where any t-th trajectory point p t The original information is represented by a quintuple:
[0107] ;
[0108] Each trajectory point includes a timestamp (Time), longitude (Lon), latitude (Lat), speed (SOG), and heading (COG). The set of trajectories is denoted as […]. N is the number of trajectories.
[0109] The goal of ship trajectory clustering is to group ships according to their similarity. The data is divided into K distinct clusters, each representing a set of trajectories of a certain category. The clustering process is described as follows:
[0110] ;
[0111] Taking the k-means algorithm as an example, its clustering objective function is:
[0112] ;
[0113] Among them, D k Let T represent a set containing several trajectories of the same type, k = 1, 2, ..., K. k This represents the central trajectory of this cluster.
[0114] Reference Figure 1 As shown, the model processes the data through the following steps to obtain the embedded representation of the trajectory features:
[0115] In step S1, for any trajectory data in the trajectory set, the trajectory data is preprocessed, including at least timestamp conversion, outlier cleaning, and interpolation.
[0116] In step S2, the trajectory data processed in step S1 is segmented using a time sliding window, and the time position of the trajectory points is encoded for each segmented trajectory data.
[0117] The temporal position and time interval of ship trajectory points are crucial for understanding dynamic changes in the trajectory. Traditional single-position encoding often ignores time interval information, which results in a significant loss of useful information for trajectory points with non-uniform sampling. In this embodiment, an encoding strategy combining absolute and relative time positions is adopted to capture temporal information while addressing the issue of non-uniform time intervals between trajectory points. Specifically:
[0118] Absolute position encoding is performed using sine and cosine functions, assigning a unique temporal position identifier to each trajectory point. For the i-th trajectory point, its absolute position in the d-dimensional feature space is... The encoding calculation formula is:
[0119] ;
[0120] Where j=0,1,…,d; by combining sine and cosine functions of different frequencies, the model can learn the absolute position information of the trajectory points in the time series.
[0121] Furthermore, to characterize the time interval relationship between trajectory points, relative position encoding is introduced, assuming trajectory point p i The time interval between the starting point and the starting point is Using a linear transformation layer (Linear) to transform the relative time interval Mapped to relative position vectors That is, trajectory point p i The relative time position code relative to the starting point is:
[0122] ;
[0123] Then the trajectory point p i The final time location code is:
[0124] .
[0125] This method simultaneously encodes the sequential order of trajectory points and their relative time intervals.
[0126] In step S3, for each trajectory segment, micro-temporal features are first extracted using a bidirectional long short-term memory (BiLSTM) encoder, and then a multi-scale feature aggregation mechanism from micro to macro is achieved. The essence of multi-scale feature aggregation is a weighted sum of sequences at different levels, where the weights represent the degree of attention paid to information at different time points. This invention, through a two-level design of local and global temporal attention, utilizes dynamic weight allocation to achieve hierarchical feature extraction and layered aggregation from micro to macro to improve the model's ability to represent trajectory features across different time spans. The principle is as follows: Figure 2 shown. Specifically:
[0127] When extracting micro-temporal features using BiLSTM, BiLSTM consists of a bidirectional LSTM structure. The input sequence is input in both forward and reverse order, and the output is simultaneously influenced by the input values at previous and subsequent time steps, as well as the hidden layer state. This design aims to model the temporal dependencies of trajectory features bidirectionally. Specifically:
[0128] BiLSTM is designed as two independent LSTM structures that map the input sequence to forward hidden sequences in positive and negative order, respectively. and backward hidden sequence , represented as:
[0129] ;
[0130] ;
[0131] in, and These are the weight matrices for the forward and backward layers, respectively, x t It is a feature sequence of the trajectory segment, including location features such as longitude and latitude, as well as motion features such as ground speed and ground heading.
[0132] The forward and backward implicit sequences output by the encoder are fed back to the same output layer and concatenated into a compact bidirectional representation. By using an encoder to sequentially encode the sequence of trajectory segments after the entire trajectory is segmented, a micro-level trajectory temporal feature embedding representation sequence is obtained. m is the number of sliding windows.
[0133] Furthermore, local temporal attention is used to aggregate the feature embeddings of trajectories at the micro level. First, the temporal location encoding information (PE) is added to the h output of the bidirectional long short-term memory network encoder. t From :
[0134] ;
[0135] The corresponding sequence is represented as .
[0136] A local attention mechanism is then introduced to calculate the trajectory feature weights at different time points. The corresponding micro-level embeddings are then weighted and summed to form a summary vector representing the trajectory features of that stage. In the sequence... In the process, the sequences are divided into groups of three without overlap. For sequences shorter than the allotted length, zero-padding is used. The intra-group attention weights are then calculated for each group. :
[0137] ;
[0138] Where t is the time step, m = 0, 1, ..., n, and n is the number of groups. Let d be a learnable local query vector, and d be the feature dimension; then a local summary vector is generated. :
[0139] ;
[0140] This yields the mesoscopic feature sequence of the trajectory features. .
[0141] Similarly, in the local summary vector Based on this, we further aggregate the vectors into groups of three to form a macroscopic feature embedding representation, which is then used for global query vectors. and linear transformation matrix W g Long-term temporal dependencies are established, represented by global attention weights as follows:
[0142] ;
[0143] Where h = 0, 1, ..., s, and s is the number of groups.
[0144] Generate global vector :
[0145] ;
[0146] This leads to the macroscopic feature sequence of the trajectory. .
[0147] This invention addresses the complexity of ship trajectory feature distribution at different time scales and the difficulty in effectively capturing long-term and short-term feature dependencies. It designs a multi-scale feature aggregation network based on temporal attention, in which a BiLSTM encoder extracts micro-scale features, and then temporal attention is used to achieve multi-scale feature aggregation layer by layer.
[0148] Global temporal attention mechanisms can filter out information on certain key segments of a voyage at a macroscopic scale. From a nautical kinematics perspective, the microscopic feature sequence obtained by BiLSTM can be seen as the characteristics exhibited by a ship when performing certain basic maneuvering units, while the feature sequence obtained by hierarchical attention aggregation reflects certain long-period behavioral patterns of the ship.
[0149] In step S4, the Dual-Feature Self-Attention Fusion Encoder (DFSAE) is used to adaptively fuse the position and motion features of the trajectory segment. Its output, together with the statistical features of the entire trajectory, is processed by the gated fusion module to generate an embedded representation of the trajectory features.
[0150] Trajectory classification is the result of multiple factors, including spatiotemporal location and motion characteristics. Previous studies often input multidimensional trajectory features into the model simultaneously, leading to increased input dimensionality and processing difficulty. Furthermore, differences in dimensions and noise can cause feature conflicts, affecting the transmission of useful information. To address this problem, this invention designs DFSAE, such as... Figure 3 As shown.
[0151] Specifically, for the feature sequence obtained in step S3 Encoding is performed separately for positional features and motion features to avoid mutual interference. Positional feature sequences and motion feature sequences are encoded using... and express;
[0152] from Figure 3 As can be seen, DFSAE employs a dual-branch structure, enabling separate encoding of positional and motion features to maintain the independence of different modal features and avoid mutual interference between features. Furthermore, DFSAE utilizes a multi-layer stacked design, with each layer containing a Dual-Feature Self-Attention module (DFSAM), residual connections (Dropout), layer normalization (LayerNorm), and a feedforward neural network (FFN). Its core lies in the design of DFSAM.
[0153] In DFSAM, after inputting the position feature sequence and motion feature sequence, linear projection is performed to generate their respective query matrix Q, key matrix K, and value matrix V, as follows:
[0154] ;
[0155] ;
[0156] In this context, the subscript p corresponds to positional features, and the subscript m corresponds to motion features. , , All parameters are learnable matrices. The multi-head attention mechanism employed in this invention maps trajectory features to different subspaces, with each head focusing only on a specific aspect of the features. Furthermore, the linear transformation enhances the representational power of the input features while preventing the attention coefficient matrix from degenerating into an identity matrix.
[0157] Subsequently, the attention weights for positional and motion features are calculated using scaled dot products:
[0158] ;
[0159] ;
[0160] Where Num_h represents the number of heads in the multi-head attention mechanism. Let be the attention coefficient matrix of the features (positional features or motion features) of the i-th head, representing the feature correlation between different points.
[0161] Furthermore, to effectively fuse dual-modal features, a parameter γ is introduced to dynamically adjust the correlation between positional and motion features. The final fusion weight is calculated as follows:
[0162] ;
[0163] This leads to the fusion characteristics of the single-head output:
[0164] ;
[0165] The outputs of each head are then concatenated to form the complete output of the dual-feature self-attention fusion encoder. :
[0166] ;
[0167] Where || denotes series connection. It is a learnable weight matrix.
[0168] After the input feature sequence undergoes dual-modal feature fusion via DFSAM, it is then processed through residual connections and layer normalization. Processing is performed to stabilize the training process, and the results are used... express:
[0169] ;
[0170] Next, we further extract higher-order features using FFN and then normalize them:
[0171] ;
[0172] FFN consists of two MLP layers and uses the ReLU activation function.
[0173] Again Trajectory feature integration embedding representation generated by average pooling .
[0174] To further enhance the completeness of the embedded representation, a gating fusion module was added. This module uses a gating mechanism to fuse features automatically extracted by the encoder with manually designed statistical features, including latitude and longitude span, mean and standard deviation of speed and heading, total displacement, number of trajectory points, and total cumulative time. Specifically, the statistical features of the entire trajectory are standardized and then mapped to a mapping layer using a fully connected layer. In the same dimensional space, we get Then and splicing:
[0175] ;
[0176] Adaptive feature fusion is achieved using a gating mechanism:
[0177] ;
[0178] ;
[0179] Where f is the fusion weight, W f Let b be the weight matrix. f For bias terms, Using the sigmoid activation function, the fusion weights are constrained to the interval [0,1]. The Hadamard product, where I is an all-one vector, and the eigenvectors are... This is the embedded representation of the complete output trajectory; the final output is the feature vector set corresponding to all trajectories in the trajectory set.
[0180] In addition, during model training, the trajectory set is the collected trajectory sample set, and a two-stage training strategy is adopted: pre-training is performed first, followed by joint training.
[0181] Previous studies have often used reconstruction loss to construct the initial feature space. However, the goal of clustering is not to reconstruct data faithfully, but to obtain more unique category features. To this end, this invention uses a contrastive loss function in the pre-training stage. By constructing positive and negative sample pairs, it directly optimizes the similarity structure of the feature space. The improved InfoNCE loss function is used as the optimization objective to maximize the similarity of features between two similar samples and the dissimilarity between features between two dissimilar samples. Its essence lies in maximizing the lower bound of mutual information. The core is to perform the instance discrimination task, driving the model to ignore irrelevant low-level detail variations and instead capture invariant features related to high-level semantics. This is synergistic with the optimization objective of clustering, thus guiding the model to learn more discriminative and structurally superior feature representations.
[0182] During the pre-training phase, a trajectory feature embedding space is constructed based on contrastive loss. By maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs, the model learns discriminative initial representations.
[0183] Specifically, for any trajectory data in the training set, after preprocessing in step S1, trajectory enhancement processing is performed on the ship trajectory using two strategies: point distortion and downsampling, to enrich the training set of trajectory data. To simulate noise interference and data gaps in real-world scenarios, point distortion and downsampling are used to generate the corresponding ship trajectory. On the one hand, this enriches the trajectory dataset, thereby significantly improving the model's generalization ability in different complex scenarios. On the other hand, based on the concept of contrastive learning, trajectory enhancement creates diverse trajectory variants for the encoder, prompting it to capture common and distinguishing features among different variants in subsequent training, thus enhancing the robustness and discriminative power of trajectory feature representation.
[0184] Point distortion is related to the original ship trajectory T i Random offsets are applied to each trajectory point to obtain similar trajectories with slight differences in numerical characteristics. The points are then distorted. and trajectory points This can be represented as follows:
[0185] ;
[0186] ;
[0187] ; ;
[0188] ; ;
[0189] , , , These are random noises following a specific Gaussian distribution, based on four original feature dimensions: longitude (lon), latitude (lat), ground speed (SOG), and ground heading (COG). Since the noise cannot be arbitrarily large, a bounded Gaussian distribution is used, with parameters... It is the maximum offset of longitude. This is its normalization coefficient; the same applies to other dimensions, ensuring that the trajectory points are not disturbed within a reasonable range. Standard deviation Determined based on the fluctuation range of the characteristics and the measurement accuracy.
[0190] Downsampling generates an incomplete trajectory sequence through a dot masking mechanism, for a given original ship trajectory T. i For each trajectory point, a random deletion operation is performed with probability P, where each point's probability P follows an independent and identical uniform distribution. Furthermore, considering the importance of the temporal continuity of trajectory points for feature representation, a sliding window constraint mechanism is employed when deleting trajectory points: if the number of consecutively deleted points within the window exceeds a threshold, the deletion operation is re-executed to ensure that the trajectory does not exhibit excessively long fragments. This mechanism enhances data diversity while avoiding damage to the core dynamic features of the trajectory, providing the model with more challenging training samples and enabling the encoder to learn the correlation between the global structure and local features of the sparse trajectory.
[0191] For trajectory sample set After trajectory enhancement processing, the corresponding enhanced sample set is generated as follows: .
[0192] For the two sample sets, the feature vector sets output by the model are represented as follows: and The contrastive loss function is then defined as:
[0193] ;
[0194] in, The temperature parameter used to control the sharpness of the distribution is dist, which represents the cosine similarity. This is an indicator function used to exclude self-comparison.
[0195] During the pre-training phase, continuous optimization continues until L... cont Convergence is achieved by extracting features from the pre-trained model and initializing cluster centers using the k-means algorithm. Since the loss function exhibits a typical "push-pull" effect on the gradient of the feature vector, as L... cont The reduction in size allows positive sample pairs to be closer to each other and negative sample pairs to be farther apart in the feature space, making the embeddings of different categories of trajectory features distinguishable.
[0196] Furthermore, during the joint training phase, specifically:
[0197] The core objective of joint training is to map the general trajectory representation obtained from pre-training to a clustering-friendly space. To achieve this objective, a multi-objective loss function is constructed:
[0198] ;
[0199] in, L is the balance coefficient. cluster It includes four clustering losses, namely the k-means loss L km Soft allocation loss L soft Cluster spacing loss L inter Consistency loss with nearest neighbors L nb L cluster It is calculated by weighted summation of the four clustering losses.
[0200] For the four clustering losses, firstly, the k-means loss is used to force samples to be close to the center of their respective clusters, as defined below:
[0201] ;
[0202] in, It is the trajectory T i The embedded representation of e i Assigned to the kth cluster center The boolean variable is N, where N represents the number of samples and K is the number of clusters. k-means loss improves clustering quality by minimizing the distance between a sample point and its cluster center.
[0203] The soft assignment loss uses Student's t-distribution to measure the similarity between a sample and the cluster center, defining the trajectory T. i Classified into cluster S k The probability is:
[0204] ;
[0205] Where v is a constant, These are dummy variables in the iterative summation process (hereinafter referred to as...) (Same), used to distinguish different cluster centers in the denominator and avoid conflict with k in the numerator. For q ik Nonlinear transformations can be performed to compute the target distribution P, thereby enhancing the weight of high-confidence samples and balancing cluster size, where the probability p in P is... ik The calculation is as follows:
[0206] ;
[0207] Then, the difference between the target distribution and the predicted distribution is optimized using KL divergence to bring high-confidence samples closer to the cluster center:
[0208] ;
[0209] Introducing inter-cluster spacing loss L inter To increase the differences between different clusters, this invention primarily considers maximizing the distance between cluster centers, and designs L... inter as follows:
[0210] ;
[0211] Nearest Neighbor Consistency Loss L nb The main purpose is to ensure that the model maintains its local manifold structure during feature mapping, meaning that sample points have the same labels as their n nearest neighbors in the same cluster. The design of L... nb as follows:
[0212] ;
[0213] in, These are the n nearest neighbors of the i-th sample. It is a Boolean variable that indicates whether two samples belong to the same cluster.
[0214] Finally, L is calculated according to a certain weight ratio. cluster :
[0215] ;
[0216] in, , can be set .
[0217] During the joint training phase, neural network parameters and cluster assignments are updated alternately, allowing cluster centers to converge rapidly while gradually adjusting the feature space. This ensures that similar samples are tightly clustered in the embedding space and dissimilar samples are significantly separated, reaching the preset maximum number of iterations or L. joint After convergence, training is complete. After model training is complete, the trained model and optimized cluster centers are used to perform final k-means clustering on all ship trajectory data to obtain the ship trajectory clustering results.
[0218] To verify the effectiveness of the ship trajectory clustering method based on feature embedding representation learning (hereinafter referred to as ERL-DTC) provided by this invention, six current mainstream and advanced baseline methods were selected and compared with this invention. The six existing methods are LCSS+KM, DTW+SC, Traj2vec+KM, ITraj2vec+KM, DTC and DSTC, which are briefly introduced below.
[0219] LCSS+KM: Calculate trajectory similarity based on the longest common subsequence between different trajectories, and then use k-means to complete clustering.
[0220] DTW+SC: Calculates the optimal alignment path between trajectories by constructing a spatiotemporal alignment distance matrix, and uses spectral clustering based on this similarity to achieve effective trajectory partitioning.
[0221] Traj2vec+KM: Extracts trajectory movement behavior features through a sliding window, encodes them into fixed-length vector representations using an LSTM encoder, and then uses the k-means algorithm to cluster the vectors to achieve the classification of motion patterns.
[0222] Improved Traj2vec+KM (ITraj2vec+KM): Introduces a masking strategy into Traj2Vec+KM to ignore invalid loss calculations of padding parts, thereby solving padding interference in variable-length sequences and making loss calculation more accurate; at the same time, the LSTM network is changed to a BiLSTM network to enhance bidirectional feature modeling capabilities.
[0223] DTC: It utilizes a Seq2Seq autoencoder network for pre-training to obtain preliminary trajectory vector representations. During joint training, clustering loss is added to jointly optimize the learning of trajectory embedding representations and cluster centers. It is the first deep trajectory clustering study oriented towards a cluster-friendly space.
[0224] DSTC: By combining density-partitioned spatiotemporal token representation and periodic temporal coding methods with Seq2Seq pre-training and joint clustering loss optimization, it achieves spatiotemporal trajectory representation learning and end-to-end clustering for cluster-friendly spaces.
[0225] To compare the above six methods with the ERL-DTC method provided in this invention, the performance of the methods was tested using three evaluation metrics: accuracy (ACC), normalized mutual information (NMI), and adjusted Land coefficient (ARI), and the computational efficiency of each method was analyzed. All experiments were implemented using Python and PyTorch, and were conducted on a platform configured with an 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz CPU, 16GB RAM, and a GeForce GTX 3060 GPU.
[0226] For the ERL-DTC method proposed in this invention, the embedding dimension is set to 256, the sliding window length is set to 10, the stride is 5, the BiLSTM-AE hidden layer size and number of layers are set to 64 and 2 respectively, the DFSAE attention head number is 4, the stacked layer number is 6, Adam is used as the optimizer, the learning rate is set to 0.0001, and the temperature hyperparameter is... The parameter settings are set to 0.07, the maximum epoch is 30, and the batch size is 16. The other four deep clustering methods (including Traj2vec+KM, ITraj2vec+KM, DTC, and DSTC) all use the same parameter configuration as ERL-DTC. The point matching-based clustering methods (LCSS+KM and DTW+SC) use the default parameter settings.
[0227] First, the performance of the proposed method in terms of clustering accuracy was quantitatively evaluated using ACC, NMI, and ARI. Table 1 shows the comparison of clustering results between the proposed method and the baseline method on datasets with different numbers of clusters (e.g., K=4, i.e., the dataset contains 4 types of trajectory samples). The values in the table are the average of 10 repeated runs of the algorithm under the same conditions, and the best results are highlighted in bold.
[0228] Table 1 Comparison of results from different trajectory clustering methods
[0229]
[0230] The results in the table show that the accuracy of deep trajectory clustering is generally better than that of point matching clustering. The main reason is that the latter is very sensitive to noise and trajectory length. For trajectories with many noisy points and large differences in trajectory length, mismatch is likely to occur, which will seriously affect the clustering effect. However, as the number of clusters decreases, the performance gap between deep clustering and point matching clustering increases while the three evaluation indicators increase. This is because, on the one hand, deep feature embedding representation has an over-parameterization problem in simple tasks, while traditional clustering methods may be easier to optimize; on the other hand, existing deep clustering methods have blindness in the feature embedding process, and the features may not be discriminative. The ERL-DTC method provided by this invention achieved the highest NMI and ARI results on datasets with different numbers of clusters. The ACC improved by approximately 14.14% to 39.2% compared to other deep clustering methods (K=4), indicating that the trajectory feature embedding representation formed by the method can accurately reflect the similarity of the original trajectory features and is more suitable for clustering tasks. Compared with existing deep clustering methods, its advantage lies in its ability to effectively extract the most discriminative trajectory features at different spatiotemporal scales and construct multidimensional feature coupling relationships. Therefore, it is more suitable for mining patterns from trajectories with wide spatiotemporal distribution, large location span, and complex feature relationships.
[0231] To visually demonstrate the clustering effects of different methods, t-distributed random nearest neighbor embedding (t-SNE) is used to perform two-dimensional visualization of the output trajectory embedding representation, such as... Figures 4a-4g As shown. Figures 4a-4gThe following are t-SNE embedding visualizations of the clustering results of the LCSS+KM, DTW+SC, Traj2vec+KM, ITraj2vec+KM, DTC, DSTC and ERL-DTC methods on the dataset (K=4).
[0232] Combined Table 1 and Figures 4a-4g The calculation results show that, compared with the baseline method, the trajectory feature embedding representation obtained by ERL-DTC has larger and more obvious cluster spacing in the cluster space, smaller and more compact intra-cluster spacing, and only a few boundary samples with ambiguity in class determination. This indicates that the embedding representation generated by the model trained by the ERL-DTC method has good discriminativeness and fits the clustering task, and can obtain more accurate clustering results, thereby realizing the pattern division of ship trajectories.
[0233] The computational efficiency of different methods is analyzed next. Since deep trajectory clustering methods are all trainable offline, in practical applications, we are more concerned with the time cost of encoding trajectory features into embedding representations and using them for clustering tasks. For the sake of simplicity, we only study the complexity of online model computation. The online computation time of different methods is shown in Table 2. For point matching clustering methods (corresponding to LCSS+KM and DTW+SC), point matching, feature calculation, and clustering processes are considered. For deep clustering methods (corresponding to Traj2vec+KM, ITraj2vec+KM, DTC, DSTC, and ERL-DTC), the embedding representation and clustering process are mainly considered. The values in the table are the average of 10 repeated calculations on a dataset with a specified number of clusters under the same conditions.
[0234] Table 2. Time (seconds) used for trajectory feature encoding
[0235]
[0236] As can be seen from the table, compared to traditional point-matching-based clustering algorithms, depth trajectory clustering offers an order-of-magnitude improvement in computational efficiency. This is partly due to the former's complexity being O(L... 2The complexity of the ERL-DTC method is significantly higher than that of the deep learning model O(L) (where L is the trajectory length). Furthermore, the dynamic programming process for calculating a single distance in the former is inherently sequential, meaning that cells in the matrix must be calculated sequentially. Coupled with its skip-memory access pattern, this greatly limits the parallel processing capability of the GPU within a single task. In contrast, the computational pattern of the deep learning method is "GPU-friendly," easily processing dozens or even hundreds of trajectories simultaneously in a batch. Moreover, compared to deep embedding representations guided by RNN models, the ERL-DTC method provided in this invention has higher processing efficiency. This is because RNN models require O(L) sequential operations to process trajectories, while self-attention models only require O(1), and it becomes faster as the batch size increases during inference. This is the main reason why the ERL-DTC method, despite its more complex computational process, does not experience a significant increase in computation time.
[0237] In summary, the ship trajectory clustering method based on feature embedding representation learning provided by this invention uses a time-attention-based feature aggregation network as the main body to model the cross-scale dependencies of trajectory features. It dynamically adjusts the focus of attention through learnable query vectors and retains key information at different scales through layer-by-layer aggregation, generating low-dimensional dense feature vectors. This overcomes the problem of existing methods struggling to capture both local trajectory features and long-term temporal patterns, and can automatically adapt to ship trajectories with different spatiotemporal spans. Addressing the problem of mutual interference and difficulty in effective interaction and collaboration among trajectory features of different dimensions, the method proposes decoupling motion and position features in the trajectory and using a dual-feature self-attention fusion encoder to achieve cross-fusion, forming a more comprehensive trajectory feature embedding representation. Furthermore, it introduces the idea of contrastive learning and adopts a two-stage model training strategy of "pre-training-joint training." A joint loss function, including contrastive loss and clustering loss, is designed to optimize model parameters and cluster centers, thereby simultaneously constraining trajectory feature similarity learning and the k-means clustering process. This aligns the learned trajectory embedding representation with the original trajectory features and guides the clustering of similar samples. The clustering loss sharpens the inter-class boundaries, resulting in an embedding representation more conducive to the clustering task, thus improving the clustering effect.
[0238] Compared with existing deep clustering methods, this invention improves the accuracy of trajectory clustering by about 10%-20% without significantly increasing computation time, and can be widely used to decode cross-regional ship activity patterns.
[0239] This invention addresses the complexity of ship trajectory feature distribution at different time scales and the difficulty in effectively capturing long-term and short-term feature dependencies. It designs a multi-scale feature aggregation network based on time attention, extracting micro-scale features using a BiLSTM encoder. Then, through a two-level design of local and global time attention, dynamic weight allocation is used to achieve hierarchical feature extraction and aggregation from micro to macro to improve the model's ability to represent trajectory features across different time spans.
[0240] This invention designs a dual-feature self-attention fusion encoder. On the one hand, the trajectory position and motion features are decoupled at the feature input layer and encoded separately through a multi-scale feature aggregation network to avoid mutual interference and generate independent embedding representation sequences. On the other hand, the dynamic correlation between position and motion features is modeled through a dual-branch self-attention mechanism to generate a more comprehensive trajectory embedding representation, thereby avoiding information confusion caused by hard splicing.
[0241] Finally, it should be noted that the above description is only an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A ship trajectory clustering method based on feature embedding representation learning, characterized in that, A training model for learning the embedding representation of ship trajectory features is established. This model is processed through the following steps to obtain the embedding representation of trajectory features: S1. For any trajectory in the trajectory set, preprocess the trajectory data; S2. For the trajectory data processed in step S1, the trajectory is segmented using a time sliding window. For each trajectory segment obtained after segmentation, the time position of the trajectory points is encoded. S3. For each trajectory segment, a bidirectional long short-term memory network encoder is used to extract micro-temporal features, and a multi-layer temporal attention aggregation mechanism is used to achieve multi-scale feature aggregation from micro to macro. S4. The dual-feature self-attention fusion encoder is used to complete the adaptive fusion of the position features and motion features of the trajectory segment. Its output, together with the statistical features of the entire trajectory, is processed by the gated fusion module to generate an embedded representation of the trajectory features. After model training is completed, the embedding representations corresponding to all trajectory data in the trajectory set are obtained based on the model, and then clustering is performed to obtain the ship trajectory clustering results.
2. The ship trajectory clustering method based on feature embedding representation learning according to claim 1, characterized in that, In the established model, the ship trajectory of length L is represented as: ; Where any t-th trajectory point p t The original information is represented by a quintuple: ; Each trajectory point includes a timestamp (Time), longitude (Lon), latitude (Lat), ground speed (SOG), and ground heading (COG). The trajectory set is denoted as... N is the number of trajectories; The goal of ship trajectory clustering is to group ships according to their similarity. The data is divided into K distinct clusters, each representing a set of trajectories of a certain category. The clustering process is described as follows: ; Where D k Let k represent a set containing several trajectories of the same type, k=1,2,…,K.
3. The ship trajectory clustering method based on feature embedding representation learning according to claim 2, characterized in that, In step S1, the preprocessing of trajectory data includes at least timestamp conversion, outlier cleaning, and interpolation.
4. The ship trajectory clustering method based on feature embedding representation learning according to claim 2, characterized in that, In step S2, when performing time-position encoding of trajectory points, specifically: Absolute position encoding is performed using sine and cosine functions, assigning a unique temporal position identifier to each trajectory point. For the i-th trajectory point, its absolute position in the d-dimensional feature space is... The encoding calculation formula is: ; Where j = 0, 1, ..., d; Furthermore, to characterize the time interval relationship between trajectory points, relative position encoding is introduced, assuming trajectory point p i The time interval between the starting point and the starting point is Using a linear transformation layer (Linear) to transform the relative time interval Mapped to relative position vectors That is, trajectory point p i The relative time position code relative to the starting point is: ; Then the trajectory point p i The final time location code is: 。 5. The ship trajectory clustering method based on feature embedding representation learning according to claim 4, characterized in that, In step S3, when extracting micro-temporal features using a bidirectional long short-term memory network encoder, specifically: The bidirectional long short-term memory network is designed as two independent long short-term memory network structures that map the input sequence to the forward hidden sequence in positive and negative order, respectively. and backward hidden sequence , is represented as: ; ; in, and These are the weight matrices for the forward and backward layers, respectively, x t The feature sequence of the trajectory segment includes location features such as longitude and latitude, as well as motion features such as ground speed and ground heading; The forward and backward implicit sequences output by the encoder are fed back to the same output layer and concatenated into a compact bidirectional representation. By using an encoder to sequentially encode the sequence of trajectory segments after the entire trajectory is segmented, a micro-level trajectory temporal feature embedding representation sequence is obtained. m is the number of sliding windows.
6. The ship trajectory clustering method based on feature embedding representation learning according to claim 5, characterized in that, In step S3, when using a multi-layer temporal attention aggregation mechanism to achieve multi-scale feature aggregation from micro to macro, specifically: First, the time position encoding information (PE) is added to the h output of the bidirectional long short-term memory network encoder. t From : ; The corresponding sequence is represented as ; Then, a local attention mechanism is introduced to calculate the trajectory feature weights at different time locations. The corresponding micro-level embedding representations are weighted and summed to form a summary vector representing the trajectory features of this stage. In sequence In the process, the sequences are divided into groups of three without overlap. For sequences shorter than the allotted length, zero-padding is used. The intra-group attention weights are then calculated for each group. : ; Where t is the time step, m = 0, 1, ..., n, and n is the number of groups. Here, d represents the local query vector, and d represents the feature dimension. Generate local summary vectors : ; This yields the mesoscopic feature sequence of the trajectory features. ; Similarly, in the local summary vector Based on this, we further aggregate the vectors into groups of three to form a macroscopic feature embedding representation, which is then used for global query vectors. and linear transformation matrix W g Long-term temporal dependencies are established, represented by global attention weights as follows: ; Where h = 0, 1, ..., s, and s is the number of groups; Generate global vector : ; This leads to the macroscopic feature sequence of the trajectory. .
7. The ship trajectory clustering method based on feature embedding representation learning according to claim 6, characterized in that, In step S4, specifically: For the feature sequence obtained in step S3 Encoding is performed separately for positional features and motion features to avoid mutual interference. Positional feature sequences and motion feature sequences are encoded using... and express; Using a dual-feature self-attention fusion encoder, the position feature sequence and motion feature sequence are input and linearly projected to generate their respective query matrix Q, key matrix K, and value matrix V, as follows: ; ; In this context, the subscript p corresponds to positional features, and the subscript m corresponds to motion features. , , Both are parameter matrices; Subsequently, the attention weights for positional and motion features are calculated using scaled dot products: ; ; Where Num_h represents the number of heads in the multi-head attention mechanism. Let be the feature attention coefficient matrix of the i-th head, representing the feature correlation between different points; Furthermore, to effectively fuse dual-modal features, a parameter γ is introduced to dynamically adjust the correlation between positional and motion features. The final fusion weight is calculated as follows: ; This leads to the fusion characteristics of the single-head output: ; The outputs of each head are then concatenated to form the complete output of the dual-feature self-attention fusion encoder. : ; Where || denotes series connection. It is a weight matrix; Then, through residual connections and layer normalization... The process is performed, and the result is used... express: ; Next, we further extract higher-order features using FFN and then normalize them: ; Again Trajectory feature integration embedding representation generated by average pooling ; Furthermore, a gating fusion module was added, which standardizes the statistical features of the entire trajectory and then maps them to a map using a fully connected layer. In the same dimensional space, we get Then and splicing: ; Adaptive feature fusion is achieved using a gating mechanism: ; ; Where f is the fusion weight, W f Let b be the weight matrix. f For bias terms, Using the sigmoid activation function, the fusion weights are constrained to the interval [0,1]. The Hadamard product, where I is an all-one vector, and the eigenvectors are... This is the embedded representation of the complete output trajectory; the final output is the feature vector set corresponding to all trajectories in the trajectory set.
8. The ship trajectory clustering method based on feature embedding representation learning according to claim 7, characterized in that, During model training, the trajectory set is the collected trajectory sample set, and a two-stage training strategy is adopted: pre-training is performed first, followed by joint training.
9. The ship trajectory clustering method based on feature embedding representation learning according to claim 8, characterized in that, During the pre-training phase, for any trajectory data in the training set, after the preprocessing in step S1, trajectory enhancement processing is performed on the ship trajectory using two strategies: point distortion and downsampling, in order to enrich the training set of trajectory data. Among them, point distortion affects the original ship trajectory T. i Random offsets are applied to each trajectory point to obtain similar trajectories with slight differences in numerical characteristics; Downsampling generates an incomplete trajectory sequence through a dot masking mechanism, for a given original ship trajectory T. i For each trajectory point, a random deletion operation is performed with probability P, and the probability P of each point satisfies an independent and identical uniform distribution. For trajectory sample set After trajectory enhancement processing, the corresponding enhanced sample set is generated as follows: ; For the two sample sets, the feature vector sets output by the model are represented as follows: and The contrastive loss function is then defined as: ; in, The temperature parameter used to control the sharpness of the distribution is dist, which represents the cosine similarity. This is an indicator function used to exclude self-comparison; During the pre-training phase, continuous optimization continues until L... cont Convergence is achieved by extracting features from the pre-trained model and executing the k-means algorithm to initialize cluster centers.
10. The ship trajectory clustering method based on feature embedding representation learning according to claim 9, characterized in that, During the joint training phase, specifically: Constructing a multi-objective loss function: ; in, L is the balance coefficient. cluster It includes four clustering losses, namely the k-means loss L km Soft allocation loss L soft Cluster spacing loss L inter Consistency loss with nearest neighbors L nb L cluster It is calculated by weighted summation of four clustering losses; During the joint training phase, the neural network parameters and cluster assignments are updated alternately, allowing the cluster centers to converge rapidly while gradually adjusting the feature space; this process is repeated until the preset maximum number of iterations or L is reached. joint After convergence, training is complete. The trained model and optimized cluster centers are used to perform the final clustering assignment on all ship trajectory data to obtain the ship trajectory clustering results.
