Ship trajectory data labeling method and device
By performing deep feature clustering and confidence screening on ship trajectories, combined with manual annotation and model training, the problem of high cost and low efficiency of manual annotation in existing methods is solved, and efficient and accurate automatic annotation of ship trajectories is achieved.
Patent Information
- Application Number
- CN202611574189.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-12
- Publication Date
- 2026-11-06
AI Technical Summary
Existing ship trajectory labeling methods rely on manual labeling, which is costly and inefficient. Furthermore, unsupervised learning methods struggle to automatically discover the label space in unlabeled data, resulting in insufficient classification accuracy and efficiency.
By extracting depth features of ship trajectories for clustering, calculating the distance of samples from the cluster center and generating confidence scores, selecting high-confidence core samples for manual annotation, and using these samples to train a ship trajectory classification model for automatic annotation.
It reduces the randomness and workload of manual annotation, improves the reliability and accuracy of annotation results, ensures the representativeness of clusters, and realizes efficient automatic annotation of ship trajectory big data.
Smart Images

Figure CN123049279A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ship data processing technology, and in particular to a method and apparatus for annotating ship trajectory data. Background Technology
[0002] The widespread adoption of Automatic Identification Systems (AIS) has resulted in a massive accumulation of vessel trajectory data in the maritime sector. Efficient and accurate classification and identification of vessel trajectories is a core technological support for applications such as intelligent maritime supervision, abnormal behavior detection, route planning, maritime search and rescue, and fisheries resource management. However, the mainstream supervised trajectory classification methods rely on large amounts of high-quality labeled data. In real-world maritime scenarios, the labeling of vessel trajectories requires manual judgment by domain experts, which is costly and inefficient. Obtaining large-scale labeled trajectory datasets is extremely difficult in practice, severely limiting the practical application of supervised learning methods in vessel trajectory classification tasks.
[0003] In order to achieve efficient and accurate labeling of big data on ship trajectories, some researchers have attempted to use machines to achieve labeling with predefined rules. However, the establishment and selection of such classification rules still lead to subjective interpretations of ship behavior patterns, and the mapping rules between the original numerical features of the trajectory and the ship type are inherently difficult to describe. Unsupervised learning and semi-supervised learning machine learning algorithms have provided new ideas for solving this problem. Clustering is an important means of exploring the intrinsic structure of unlabeled data and is a typical representative of unsupervised learning algorithms. Ship trajectory clustering has been widely used in tasks such as anomaly detection and trajectory prediction. However, most existing clustering methods only output clustering results and lack a mechanism to effectively associate clusters with semantic label spaces, making it difficult to directly serve subsequent classification tasks. Furthermore, the decision boundaries are difficult to define accurately, and boundary samples located in the intersection of different clusters are easily misclassified, leading to incorrect labeling. Semi-supervised learning uses a small number of labeled samples and a large number of unlabeled samples for joint training, which is an effective paradigm to alleviate the label scarcity problem. However, in extreme small sample scenarios without any prior class information, how to determine the category system of the label space, establish a unified category semantic, and ensure that the label spaces of the source domain and the target domain data are consistent remains an unsolved problem.
[0004] In summary, the labeling of existing ship trajectory big data remains a technical problem that urgently needs to be solved. Single data-driven methods are insufficient to automatically discover and establish a label space from unlabeled data in order to cope with extreme small sample scenarios without any prior information on categories. Purely manual labeling methods also face problems such as low efficiency and high subjectivity. Summary of the Invention
[0005] Therefore, it is necessary to provide a method, device, electronic device, and medium for labeling ship trajectory data to solve the problem that existing labeling methods cannot balance efficiency and quality.
[0006] To address the aforementioned problems, in a first aspect, the present invention provides a method for annotating ship trajectory data, comprising:
[0007] Depth features of multiple ship trajectories are extracted, and the depth features are clustered to obtain multiple clusters;
[0008] Calculate the distance of each sample in the cluster from the cluster center, and determine the distance distribution statistical parameters;
[0009] Based on the distance distribution statistics of the clusters and the distance of each sample, the membership degree of each sample corresponding to different distance semantic levels is calculated. Then, the rule activation is performed according to the membership degree and the pre-constructed fuzzy inference rules between distance semantic levels and confidence evaluation. The activation results are defuzzified to obtain the confidence score of each sample.
[0010] Core samples are selected based on the confidence scores of each sample in the cluster.
[0011] The ship trajectory classification model is trained based on the core ship trajectories corresponding to the core samples of each cluster, as well as the manual annotations of the core ship trajectories. The trained ship trajectory classification model is then used to automatically annotate the ship trajectories to be annotated.
[0012] Secondly, the present invention also provides a ship trajectory data annotation device, comprising:
[0013] The clustering module is used to extract depth features from multiple ship trajectories and cluster the depth features to obtain multiple clusters;
[0014] The statistics module is used to calculate the distance of each sample in the cluster from the cluster center and to determine the distance distribution statistics parameters;
[0015] The fuzzing and defuzzing module is used to calculate the membership degree of each sample corresponding to different distance semantic levels based on the distance distribution statistical parameters of the cluster and the distance of each sample, and to activate the rules based on the membership degree and the pre-constructed fuzzy inference rules between distance semantic levels and confidence evaluation. The activation results are then defuzzified to obtain the confidence score of each sample.
[0016] The filtering module is used to filter out core samples based on the confidence scores of each sample in the cluster.
[0017] The training and automatic annotation module is used to train the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotations of the core ship trajectories, and to automatically annotate the ship trajectories to be annotated using the trained ship trajectory classification model.
[0018] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the ship trajectory data annotation method described above.
[0019] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the ship trajectory data annotation method described in any of the preceding claims.
[0020] The beneficial effects of this invention are:
[0021] This invention clusters ship trajectories based on depth features, converts the distance of samples within a cluster to the cluster center using a fuzzy model, and then selects high-confidence core samples from each cluster. The core ship trajectories corresponding to these core samples are then manually labeled by experts. High-confidence samples are located in the core, densely populated regions of the clusters, minimizing ambiguity for expert labeling and maximizing the reliability of the results. Furthermore, since only high-confidence samples require manual labeling, the workload is significantly reduced. This sample selection strategy ensures that the limited manual labeling budget is allocated to samples with the most information and highest certainty, fundamentally reducing the randomness risk and cognitive burden of expert labeling.
[0022] Furthermore, this invention evaluates confidence scores based on the distance distribution statistical parameters of the clusters, eliminating the bias caused by differences in cluster scales and ensuring that each cluster has an appropriate number of representative samples selected, thus avoiding a severe skew in the distribution of labeled samples across categories.
[0023] Finally, this invention trains a ship trajectory classification model using pre-annotated core ship trajectories, providing the model with accurate initial positioning of decision boundaries. The trained model can then automatically annotate large datasets of ship trajectories. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating an embodiment of the method for annotating ship trajectory data provided by the present invention;
[0026] Figure 2 A diagram of a semi-supervised training architecture based on pseudo-labels and consistency regularization provided by the present invention;
[0027] Figure 3 A flowchart of an efficient annotation method for ship trajectory big data provided by the present invention;
[0028] Figure 4 A schematic diagram illustrating the determination of the optimal K value using the elbow rule provided by this invention;
[0029] Figure 5 This invention provides a confusion matrix for trajectory classification and annotation results;
[0030] Figure 6 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0031] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0033] In the description of the embodiments of this invention, unless otherwise stated, "a plurality of" means two or more. The terms "first," "second," etc., used in the embodiments of this invention are used to distinguish similar objects, and are not used to describe a specific order or sequence, nor to indicate or imply their relative importance or implicitly specify the number of indicated technical features. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, and the number of objects is not limited; for example, a first object can be one or more.
[0034] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0035] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of the ship trajectory data annotation method provided by the present invention, the method comprising:
[0036] S101, extract depth features from multiple ship trajectories, and cluster the depth features to obtain multiple clusters.
[0037] Depth features of ship trajectories can be extracted using a feature encoder, and then clustered using a pre-defined clustering algorithm, such as the k-means algorithm.
[0038] S102, calculate the distance of each sample in the cluster from the cluster center, and determine the distance distribution statistical parameters.
[0039] Each sample in a cluster refers to a deep feature within that cluster.
[0040] Distance distribution statistical parameters can include maximum value, minimum value, median, etc.
[0041] S103. Based on the statistical parameters of the distance distribution of the clusters and the distance of each sample, calculate the membership degree of each sample corresponding to different distance semantic levels, and activate the rules according to the membership degree and the fuzzy inference rules between the pre-constructed distance semantic level and the confidence evaluation. Defuzzify the activation results to obtain the confidence score of each sample.
[0042] Distance semantic level refers to the distance level described by semantics. The granularity of the division can be selected according to the needs. In one example, the distance semantic level can include three semantic levels: near, medium and far.
[0043] Membership degree describes the degree of matching between each sample and different distance semantic levels. For example, the smaller the distance between a sample and the "near" semantic level, the higher the matching degree with the "near" semantic level, and the higher the membership degree of the "near" semantic level. To eliminate the bias caused by the difference in scale between different clusters, this embodiment calculates the membership degree of each sample in the cluster corresponding to different distance semantic levels based on the distribution of samples in the cluster. This process is also known as fuzzification.
[0044] Fuzzy inference rules are rules used to describe the mapping of distance semantic level inference to confidence evaluation. In one example, the fuzzy inference rules include three rules: if the distance is "near", the confidence is "high"; if the distance is "medium", the confidence is "medium"; and if the distance is "far", the confidence is "low".
[0045] By using a pre-defined fuzzy model based on membership degrees and pre-built fuzzy inference rules, rule activation and defuzzification processes can be performed to obtain the confidence score for each sample. In a specific example, the pre-defined fuzzy model can be the Mamdani fuzzy model. Based on membership degrees and pre-built fuzzy inference rules, Mamdani minimum operations can be used to activate and fuzzy imply the rules. After aggregating the outputs of each rule, the centroid method can be used to defuzzify them to obtain the accurate confidence score.
[0046] Fuzzy inference can adaptively convert distance metrics into category confidence, avoiding the problem that simple linear mappings are insufficient for characterizing complex cluster structures.
[0047] S104: Based on the confidence scores of each sample in the cluster, the core samples are selected.
[0048] Core samples can be samples with a confidence level greater than or equal to the confidence threshold.
[0049] S105. The ship trajectory classification model is trained based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotation of the core ship trajectories. The trained ship trajectory classification model is then used to automatically annotate the ship trajectories to be annotated.
[0050] The ship trajectory classification model can be any type of neural network model. In a specific example, it may include a sequentially connected feature encoder and a classifier. The classifier may include fully connected layers and softmax layers.
[0051] Once the core vessel trajectory is determined, it can be handed over to domain experts for annotation.
[0052] The ship trajectory data annotation method provided in this embodiment can be applied to a ship trajectory data annotation system, which can be a software system running on a terminal device. The terminal device can be a tablet computer, shipborne equipment, laptop computer, Ultra-Mobile Personal Computer (UMPC), netbook, Personal Digital Assistant (PDA), mobile phone, etc. This embodiment does not impose any restrictions on the specific type of terminal device.
[0053] In summary, this embodiment clusters the depth features of ship trajectories, converts the distance of samples from the cluster center into confidence scores based on a fuzzy model, and then selects high-confidence core samples from each cluster. The core ship trajectories corresponding to these core samples are then manually labeled by experts. High-confidence samples are located in the core, dense regions of the clusters, minimizing ambiguity for expert labeling and maximizing the reliability of the labeling results. Furthermore, since only high-confidence samples require manual labeling, the workload is significantly reduced. This sample selection strategy ensures that the limited manual labeling budget is allocated to samples with the most information and the highest certainty, fundamentally reducing the randomness risk and cognitive burden of expert labeling.
[0054] Furthermore, this embodiment evaluates the confidence score based on the distance distribution statistical parameters of the clusters, eliminating the bias caused by differences in cluster scale, ensuring that each cluster has an appropriate number of representative samples selected, and avoiding a serious skew in the distribution of labeled samples in the category.
[0055] Finally, this embodiment uses the labeled core ship trajectories to train the ship trajectory classification model, which can provide the model with accurate initial positioning of the decision boundary. The trained model can then achieve automatic labeling of large amounts of ship trajectory data.
[0056] In some embodiments of the present invention, the process preceding S101 includes:
[0057] Obtain the original ship trajectory and preprocess it.
[0058] Specifically, raw ship trajectory data suffers from issues such as anomalous jumps, duplicate records, and uneven time sampling intervals. Directly using it for feature extraction would severely impact the model's ability to capture the essential patterns of the trajectories. Therefore, trajectory data standardization can be achieved through preprocessing: First, the Coordinated Universal Time (UTC) time strings of each trajectory point are converted into a unified timestamp format. The trajectory points are then sorted in ascending order using the ship's static identifier, such as the Maritime Mobile Service Identity (MMSI), as the primary key and the timestamp as the secondary key, ensuring the temporal integrity of each trajectory. Invalid points with latitude / longitude, speed over ground (SOG), and course over ground (COG) exceeding reasonable ranges are removed. Duplicate records with identical timestamps and latitude / longitude are deduplicated, and excessively short trajectories are deleted. Linear interpolation is then used to reconstruct trajectory segments with large sampling intervals.
[0059] In some embodiments of the present invention, the main body of the feature encoder is composed of a cascaded multi-scale feature aggregation network based on temporal attention and a dual-branch feature attention fusion encoder. After the preprocessed trajectory is input into the feature encoder, the trajectory is first segmented through a sliding window. The position features (longitude, latitude, change in longitude, change in latitude) and motion features (speed, sine of heading, cosine of heading, acceleration) of each segmented trajectory segment are encoded into micro-temporal features by two bidirectional long short-term memory-autoencoders (BiLSTM-AE) with different parameters. Then, the features are aggregated layer by layer into a feature sequence through a two-level temporal attention mechanism of local and global. Then, the position feature sequence and motion feature sequence are projected into independent query Q, key K, and value V matrices, respectively. Multi-head attention models are used to model the spatial dependencies between position points and the temporal evolution relationships between motion states. Learnable parameters are introduced to dynamically adjust the dependence of the final feature representation on the correlation between position and motion features, achieving adaptive fusion of the two modalities. After passing through a multi-layer stacked encoder structure (including residual connections, layer normalization, and feedforward neural networks), average pooling is used to generate the track depth features. Furthermore, to further improve the completeness of the depth features, this embodiment adaptively fuses the features automatically extracted by the encoder with manually designed statistical features (latitude and longitude span, mean and standard deviation of speed and heading, total displacement, number of trajectory points, cumulative time, etc.) through a gating mechanism to obtain the final track depth features.
[0060] In some embodiments of the present invention, the step of calculating the membership degree of each sample corresponding to different distance semantic levels based on the distance distribution statistical parameters of the clusters and the distance of each sample includes:
[0061] The membership degree is calculated using the following formula:
[0062] ;
[0063] in, Represents sample vector The distance from the cluster center of its class k; , , express The membership degrees correspond to the semantic levels of near, medium, and far distances, respectively. Represents an exponential function; and The distance distribution statistical parameters of cluster k are calculated using the following formula:
[0064] ;
[0065] in, This represents a function for calculating the median.
[0066] Specifically, It can be Euclidean distance, represented as , The value represents the cluster center of the k-th cluster. A coefficient of 1.4826 ensures consistent estimation of normally distributed data. Different distance distribution statistical parameters represent different fuzzification systems. Due to the different distribution characteristics of different clusters, this embodiment establishes an independent fuzzification system for each cluster. The input to the fuzzification system is the distance between samples, and the output is the membership degree of the sample corresponding to different distance semantic levels.
[0067] In some embodiments of the present invention, S104 includes:
[0068] Based on the clustering quality of each cluster, a confidence threshold for each cluster is generated.
[0069] The confidence scores of each sample in the cluster are compared with the confidence threshold to select core samples.
[0070] Specifically, to accommodate differences in the density and separation of different clusters, this embodiment designs a dynamic threshold based on cluster quality. (For clusters...) Based on its clustering quality index Design an adaptive confidence threshold for:
[0071] ;
[0072] in, yes Calinski-Harabasz index for the class:
[0073] ;
[0074] Where K and N represent the number of clusters and the total number of samples, respectively. express The total number of samples in the class. Indicates the global cluster center.
[0075] After the above screening, each cluster outputs a small number of high-confidence core samples, and the selected core samples are given to domain experts for manual annotation.
[0076] In some embodiments of the present invention, the step of clustering deep features includes:
[0077] Calculate the sum of squared errors (SSE) for different numbers of candidate clusters; where the sum of squared errors represents the sum of squared Euclidean distances between all samples and their corresponding cluster centers;
[0078] Plot the curve of the sum of squared errors as a function of the number of candidate clusters, and select the number of candidate clusters at the inflection point of the curve as the optimal number of clusters.
[0079] Cluster deep features based on the optimal number of clusters.
[0080] Specifically, the formula for calculating SSE is as follows:
[0081] ;
[0082] in, This represents the k-th cluster.
[0083] Specifically, to address the issue of missing prior knowledge during clustering, this embodiment introduces the elbow rule to automatically determine the optimal number of clusters K.
[0084] In some embodiments of the present invention, the step of extracting depth features of multiple ship trajectories includes:
[0085] The feature encoder is pre-trained and then jointly trained sequentially, and the trained feature encoder is used to extract depth features of multiple ship trajectories.
[0086] The joint training process includes:
[0087] Generate sample pairs; the sample pairs include: unenhanced trajectory samples and enhanced trajectory samples;
[0088] Input the sample pairs into the feature encoder to obtain the deep features of the sample pairs;
[0089] The similarity prior loss is calculated based on the similarity between the depth features of the unenhanced trajectory sample and the depth features of the enhanced trajectory sample.
[0090] Cluster the deep features of each sample pair, and calculate the intra-cluster error sum of squares loss, soft assignment loss, inter-cluster distance loss, and nearest neighbor consistency loss based on the clustering results.
[0091] The similarity prior loss, intra-cluster error sum of squares loss, soft assignment loss, inter-cluster distance loss, and nearest neighbor consistency loss are weighted and fused to obtain the total loss;
[0092] Adjust the parameters of the feature encoder based on the total loss.
[0093] Specifically, the pre-training process can be a process of training a feature encoder using only a similarity prior loss. It can include:
[0094] The input trajectory is augmented to generate sample pairs. This augmentation includes adding Gaussian noise and using probabilistic random masking. An improved Information Noise-Contrastive Estimation (InfoNCE) loss is used to establish a prior similarity loss.
[0095] ;
[0096] in, Temperature parameters for controlling the sharpness of the distribution, For cosine similarity, and These are the depth feature vectors of the trajectory and the depth feature vectors of the enhanced trajectory, respectively. This is an indicator function used to exclude self-comparison.
[0097] The parameters of the feature encoder are adjusted based on similarity prior loss.
[0098] The joint training process, based on the similarity prior loss, introduces four complementary clustering losses to fine-tune the feature space, including: intra-cluster error sum of squares loss L... km Soft allocation loss L soft Cluster spacing loss L inter Consistency loss with nearest neighbors L nb .
[0099] Among them, L km Defined as:
[0100] ;
[0101] in, It is the trajectory T i eigenvector e i Assigned to the kth cluster center The Boolean variable, N, represents the number of samples, and K is the number of clusters. Soft assignment loss L soft The introduction of this method aims to enhance the guiding role of high-confidence samples in clustering for model training. The Student's t-distribution is used to measure the similarity between samples and cluster centers, and the trajectory T is defined. i Classified into cluster S k The probability is:
[0102] ;
[0103] 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 calculate 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:
[0104] ;
[0105] L soft The calculation is as follows:
[0106] ;
[0107] Introducing inter-cluster spacing loss L inter To increase the differences between different clusters, design L inter as follows:
[0108] ;
[0109] 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:
[0110] ;
[0111] 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.
[0112] Finally, according to Weight ratio calculation :
[0113] ;
[0114] The total loss during the joint training phase is calculated as follows:
[0115] ;
[0116] This optimization mechanism enables the feature space to simultaneously satisfy global similarity preservation and clustering-friendly adaptation.
[0117] In some embodiments of the present invention, the step of training a ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotations of the core ship trajectories includes:
[0118] The ship trajectory classification model is semi-supervised and trained based on the core ship trajectories corresponding to the core samples of each cluster, the manually labeled core ship trajectories, and the unlabeled ship trajectories.
[0119] The core ship trajectories, annotated by experts, possess two key characteristics: representativeness of cluster centers and complete category coverage, forming a high-quality, balanced seed set. Under these conditions, this embodiment uses these seed samples as "anchor points" and combines them with a large amount of unlabeled trajectory data to collaboratively train the model. The high-quality seed set provides accurate initial positioning for the model's decision boundary, and the introduction of unlabeled data continuously expands the model's fitting of the data distribution manifold, enabling the classification decision surface to better conform to the real data distribution. Thus, this embodiment can continuously improve classification performance during the semi-supervised training phase, achieving trajectory classification capabilities close to or even reaching the level of fully supervised training with only minimal manual annotation costs, thereby completing efficient and accurate annotation of a large number of unlabeled trajectories.
[0120] In some embodiments of the present invention, the step of semi-supervised training of the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster, the manually labeled core ship trajectories, and the unlabeled ship trajectories includes:
[0121] Weak enhancement was performed on the labeled ship trajectories corresponding to the core samples of each cluster, and weak and strong enhancement were performed on the unlabeled ship trajectories respectively.
[0122] The enhanced labeled ship trajectories and unlabeled ship trajectories are input into the ship trajectory classification model to obtain the predicted probability distribution.
[0123] The supervised loss is calculated based on the predicted probability distribution of the labeled ship trajectories after weak enhancement and the manual annotation.
[0124] Based on the predicted probability distribution of the weakly enhanced unlabeled ship trajectory, the prediction confidence level is determined and pseudo-labels are generated.
[0125] Based on the prediction confidence and the preset confidence threshold, high-confidence unlabeled ship trajectories are selected, and the unsupervised loss is calculated based on the prediction probability distribution of the strongly enhanced high-confidence unlabeled ship trajectories and the corresponding pseudo-labels.
[0126] The parameters of the ship trajectory classification model are adjusted based on supervised loss and unsupervised loss.
[0127] Specifically, after core sample screening and expert annotation, this invention obtains a small number of high-confidence labeled samples (seed set) covering all categories. However, the number of labeled samples is still far from sufficient to support adequate training of the supervised model. Therefore, this embodiment adopts a semi-supervised training paradigm of "pseudo-labels + consistency regularization" to collaboratively improve the generalization ability of the classification model by utilizing a large amount of unlabeled trajectory data.
[0128] To construct a consistent regularized training signal, weak enhancements are applied to each trajectory. With strong enhancement Two transformations are employed. Weak enhancement randomly selects one of two strategies—point distortion and downsampling—resulting in a smaller perturbation amplitude. Strong enhancement combines both point distortion and downsampling strategies, with higher noise variance and a higher downsampling ratio. This differentiated enhancement amplitude design forces the model to maintain predictive consistency even under significant input perturbations, thereby learning feature representations robust to noise and missing data.
[0129] The semi-supervised training loss is composed of the supervised loss L. s And unsupervised consistency regularization loss L u Weighted composition:
[0130] Supervised loss: For labeled samples (Its true category is) ) Calculate its weakly enhanced view The predicted probability distribution and the true label Cross-entropy between:
[0131] ;
[0132] Where B is the number of labeled trajectories in a given batch; Represents the cross-entropy function; This is the i-th unlabeled trajectory; For weakly enhanced unlabeled trajectories; The predicted probability distribution for weakly enhanced unlabeled trajectories.
[0133] Consistency regularization loss: for unlabeled trajectories After applying weak enhancement, the class with the highest predicted probability distribution is used as the pseudo-label for the trajectory. High-confidence samples are filtered by thresholding, and consistency regularization is applied to the strongly enhanced trajectory prediction results:
[0134] ;
[0135] in, This represents the ratio of unlabeled trajectories to labeled trajectories in a given batch of samples. The preset pseudo-label threshold; To enhance the label-free trajectory; To enhance the prediction probability distribution of unlabeled trajectories; This is an indicator function; it takes a value of 1 if the condition is met, and 0 otherwise. Therefore, it only takes a value higher than the maximum value of the predicted probability distribution (i.e., the prediction confidence level). It will only participate in model training at certain times.
[0136] The total loss is: , This is the balance coefficient for unsupervised loss.
[0137] Reference Figure 2 This paper illustrates a semi-supervised training process based on pseudo-labels and consistency regularization provided by the present invention. It includes: mixing labeled and unlabeled trajectories in a proportional manner to form training batches; each trajectory undergoing weak and strong enhancement respectively before being input into the aforementioned feature encoder to extract deep feature vectors; and then passing through a fully connected layer and a normalization layer (Softmax layer) to output the class probability distribution. The loss function is then used to calculate... and The encoder and classifier head parameters are jointly optimized through backpropagation. The trajectory to be labeled does not require augmentation; it is directly input into the training and converged classification model. The class probability distribution can be obtained through a single forward propagation, and the class corresponding to the highest probability is taken as the automatic labeling result for the trajectory.
[0138] Reference Figure 3 This paper presents a flowchart of an efficient annotation method for ship trajectory big data provided by the present invention. The process specifically includes: first, preprocessing the input ship trajectory by converting timestamps and removing outliers; then, encoding the trajectory features using BiLSTM-AE and strengthening the feature representation by introducing an attention mechanism; performing feature clustering based on feature similarity using the k-means algorithm, and finding the optimal number of clusters using the elbow method; using the Mamdani fuzzy model to select high-confidence trajectory samples from the clusters for expert annotation to avoid annotation noise; and finally, leveraging a large number of unlabeled trajectories under the guidance of a small number of high-quality labeled trajectories through a semi-supervised training paradigm of "pseudo-labels + consistency regularization" to improve the model's generalization ability, thereby achieving accurate and efficient annotation of ship trajectories.
[0139] The entire process generates a label space through data-driven methods, providing structured priors for expert annotation and reducing the randomness risk of manual annotation. Semantic information is then injected through expert annotations. Finally, a small amount of annotation information is used to guide knowledge generalization, thereby improving the accuracy of classification annotation. Its collaborative logic can be summarized as follows:
[0140] The first stage – structure discovery: Starting from the original unlabeled trajectory data, through deep feature extraction and cluster analysis, the inherent category structure (cluster division and number of clusters) of the data is automatically discovered. By finding the "potential cluster structure", the "unknown label space" is discovered.
[0141] The second stage—semantic injection—involves selecting the most representative core samples from each cluster through fuzzy confidence assessment and then having them semantically labeled by experts. This stage transforms the "numerical clusters" discovered by clustering into "label categories" with clear semantics, completing the establishment of the label space from scratch.
[0142] The third stage – knowledge generalization: using the labeled core samples as seeds, the limited labeled knowledge is generalized to all unlabeled data through semi-supervised learning, so as to achieve efficient automatic classification and labeling of massive trajectories.
[0143] The logical progression of the three stages is as follows: data-driven discovery of structure → structure-guided annotation → annotation-guided generalization, forming a complete end-to-end ship trajectory big data annotation solution.
[0144] The present invention will be illustrated by a specific example below:
[0145] The implementation case dataset is derived from ship AIS and radar trajectories. The process follows a technical path of "deep clustering—core sample selection—expert annotation—semi-supervised classification," and the core results of each key step are as follows:
[0146] Step 1: Data Preprocessing. Four types of trajectories (cargo ships, fishing boats, speedboats, and pilot boats) with a large number of data points were selected for timestamp conversion, trajectory cleaning, segmentation, and interpolation reconstruction. Each processed trajectory should contain at least 100 points, with an interpolation threshold set to 90 seconds. All trajectory points were arranged in chronological order, and the trajectory information included time, longitude, latitude, ground velocity, and ground heading. The dataset contains a total of 15,319 trajectories.
[0147] Step 2: Trajectory Feature Encoding and Deep Clustering. The preprocessed trajectories are input into the feature encoder (hyperparameters set to embedding dimension d=256, sliding window length 10, stride 5, BiLSTM hidden layer size 64, number of layers 2, fusion encoding attention heads 4, stacked layers 6, optimizer Adam, learning rate 0.0001, temperature coefficient τ=0.07, maximum training epochs 140, batch size 16). After convergence of the two-stage optimization comparing pre-training and joint training, all samples are mapped to a unified embedding space. The SSE curve determined by the elbow rule is shown below. Figure 4As shown, the inflection point corresponds to K=4, which is consistent with the true number of categories in the dataset. Under this condition, clustering all trajectory samples based on the k-means algorithm yielded 4 clusters, indicating that the clustering successfully discovered the inherent category structure of the data.
[0148] Step 3: Core Sample Selection and Expert Annotation. For the four clusters mentioned above, a Mamdani fuzzy system is constructed to map the distance of each sample to the cluster center as a coreity score. Using an adaptive threshold, core samples with high confidence are selected from each cluster and submitted to experts for manual annotation. Experts assign semantic categories based on domain knowledge, establishing a complete four-category label space. This step significantly reduces the workload of expert annotation, and because the selected samples are all located in the core, dense regions of each cluster, the annotation process is unambiguous and without any category omissions.
[0149] Step 4: Semi-supervised classification model training and inference. Using a small number of representative samples from each category annotated by experts as the seed set, and unlabeled trajectories as auxiliary data, a semi-supervised paradigm with pseudo-labels and consistency regularization is employed to train the classifier. Simultaneously, an unsupervised trajectory clustering baseline (running only steps 1 and 2 in this case), a supervised trajectory classification baseline, and a semi-supervised training baseline are introduced for comparison with this invention. After training convergence, the classification results of different models on the same test set for the four types of trajectories are shown in Table 1. It can be seen that, relying only on 39.8% of the labeled samples (the core samples selected account for only 39.8% of the total samples), the overall accuracy (ACC) of trajectory annotation using this invention reaches 78.06%, the precision (Prec) reaches 78.55%, and the F1 score reaches 0.7816, all of which outperform the baseline methods. The supervised trajectory classification baseline is GeoTrackNet, and the semi-supervised training baseline is the Long Short-Term Memory-Pseudo-Label-Xtreme Gradient Boosting Model (LSTM-PL-XGBoost). ACC refers to the proportion of correctly classified samples out of the total number of samples; Prec refers to the proportion of samples predicted as positive that actually belong to the positive class.
[0150] Table 1 Performance comparison of the present invention with other methods
[0151]
[0152] The confusion matrix of the test results in this embodiment is as follows: Figure 5 As shown in the confusion matrix, this invention can achieve efficient and accurate classification and labeling of ship trajectories even under extremely small sample conditions, providing effective technical support for intelligent analysis of ship behavior in maritime supervision.
[0153] The present invention also provides a ship trajectory data annotation device, the device comprising:
[0154] The clustering module is used to extract depth features from multiple ship trajectories and cluster these depth features to obtain multiple clusters.
[0155] The statistics module is used to calculate the distance of each sample in a cluster from the cluster center and to determine the statistical parameters of the distance distribution.
[0156] The fuzzing and defuzzing module is used to calculate the membership degree of each sample corresponding to different distance semantic levels based on the distance distribution statistical parameters of the cluster and the distance of each sample. It then performs rule activation based on the membership degree and the pre-constructed fuzzy inference rules between distance semantic levels and confidence evaluation, and defuzzifies the activation results to obtain the confidence score of each sample.
[0157] The filtering module is used to filter out core samples based on the confidence scores of each sample in the cluster.
[0158] The training and automatic annotation module is used to train the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotations of the core ship trajectories, and to automatically annotate the ship trajectories to be annotated using the trained ship trajectory classification model.
[0159] It should be noted that the implementation principles or processes of the above modules can be referred to the aforementioned embodiments of the ship trajectory data annotation method, and will not be elaborated here.
[0160] Reference Figure 6 The present invention illustrates an electronic device 600. The electronic device 600 includes a processor 601, a memory 602, and a display 603. Figure 6 Only some components of the electronic device 600 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0161] In some embodiments, processor 601 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 602 or process data, such as the ship trajectory data annotation method of the present invention.
[0162] In some embodiments, processor 601 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 601 may be local or remote. In some embodiments, processor 601 may be implemented on a cloud platform. In one embodiment, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-cloud, etc., or any combination thereof.
[0163] In some embodiments, memory 602 may be an internal storage unit of electronic device 600, such as a hard disk or memory of electronic device 600. In other embodiments, memory 602 may also be an external storage device of electronic device 600, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 600.
[0164] Furthermore, the memory 602 may include both internal storage units of the electronic device 600 and external storage devices. The memory 602 is used to store application software and various types of data installed on the electronic device 600.
[0165] In some embodiments, display 603 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 603 is used to display information from electronic device 600 and to display a visual user interface. Components 601-603 of electronic device 600 communicate with each other via a system bus.
[0166] In one embodiment, when the processor 601 executes the ship trajectory data annotation program in the memory 602, the following steps can be implemented:
[0167] Depth features of multiple ship trajectories are extracted and clustered to obtain multiple clusters;
[0168] Calculate the distance of each sample in the cluster from the cluster center, and determine the statistical parameters of the distance distribution;
[0169] Based on the statistical parameters of the distance distribution of the clusters and the distance of each sample, the membership degree of each sample corresponding to different distance semantic levels is calculated. Then, the rule activation is performed according to the membership degree and the fuzzy inference rule between the pre-constructed distance semantic level and the confidence evaluation. The activation results are defuzzified to obtain the confidence score of each sample.
[0170] Core samples are selected based on the confidence scores of each sample in the cluster.
[0171] The ship trajectory classification model is trained based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotations of the core ship trajectories. The trained ship trajectory classification model is then used to automatically annotate the ship trajectories to be annotated.
[0172] It should be understood that when the processor 601 executes the ship trajectory data annotation program in the memory 602, in addition to the functions mentioned above, it can also perform other functions, as can be found in the description of the corresponding method embodiments above.
[0173] Furthermore, this embodiment of the invention does not specifically limit the type of electronic device 600 mentioned. Electronic device 600 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the invention, electronic device 600 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0174] In one embodiment, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by the processor, implements the steps of any of the ship trajectory data annotation methods described above.
[0175] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0176] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for annotating ship trajectory data, characterized in that, include: Depth features of multiple ship trajectories are extracted, and the depth features are clustered to obtain multiple clusters; Calculate the distance of each sample in the cluster from the cluster center, and determine the distance distribution statistical parameters; Based on the distance distribution statistics of the clusters and the distance of each sample, the membership degree of each sample corresponding to different distance semantic levels is calculated. Then, the rule activation is performed according to the membership degree and the pre-constructed fuzzy inference rules between distance semantic levels and confidence evaluation. The activation results are defuzzified to obtain the confidence score of each sample. Core samples are selected based on the confidence scores of each sample in the cluster. The ship trajectory classification model is trained based on the core ship trajectories corresponding to the core samples of each cluster, as well as the manual annotations of the core ship trajectories. The trained ship trajectory classification model is then used to automatically annotate the ship trajectories to be annotated.
2. The ship trajectory data annotation method according to claim 1, characterized in that, The step of calculating the membership degree of each sample corresponding to different distance semantic levels based on the distance distribution statistical parameters of the cluster and the distance of each sample includes: The membership degree is calculated using the following formula: ; in, Represents sample vector The distance from the cluster center of its class k; , , Represents sample vector The membership degrees correspond to the semantic levels of near, medium, and far distances, respectively. Represents an exponential function; and The distance distribution statistical parameters of cluster k are calculated using the following formula: ; in, This represents a function for calculating the median.
3. The ship trajectory data annotation method according to claim 1, characterized in that, Based on the confidence scores of each sample in the aforementioned cluster, core samples are selected, including: Based on the clustering quality of each cluster, a confidence threshold for each cluster is generated. The confidence score of each sample in the cluster is compared with the confidence threshold to select core samples.
4. The ship trajectory data annotation method according to claim 1, characterized in that, The clustering of the deep features includes: Calculate the sum of squared errors for different numbers of candidate clusters; wherein the sum of squared errors represents the sum of squared Euclidean distances between all samples and their corresponding cluster centers; Plot the curve of the sum of squared errors as a function of the number of candidate clusters, and select the number of candidate clusters at the inflection point of the curve as the optimal number of clusters. The deep features are clustered based on the optimal number of clusters.
5. The ship trajectory data annotation method according to claim 1, characterized in that, The extraction of depth features from multiple ship trajectories includes: The feature encoder is pre-trained and then jointly trained sequentially, and the trained feature encoder is used to extract depth features of multiple ship trajectories. The joint training process includes: Generate sample pairs; the sample pairs include: unenhanced trajectory samples and enhanced trajectory samples; The sample pair is input into the feature encoder to obtain the depth features of the sample pair; Based on the similarity between the depth features of the unenhanced trajectory sample and the depth features of the enhanced trajectory sample, the similarity prior loss is calculated. Cluster the depth features of each sample pair, and calculate the intra-cluster error sum of squares loss, soft assignment loss, inter-cluster distance loss, and nearest neighbor consistency loss based on the clustering results. The similarity prior loss, intra-cluster error sum of squares loss, soft assignment loss, inter-cluster distance loss, and nearest neighbor consistency loss are weighted and fused to obtain the total loss; The parameters of the feature encoder are adjusted based on the total loss.
6. The ship trajectory data annotation method according to claim 1, characterized in that, The process of training the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster, and the manually labeled core ship trajectories, includes: The ship trajectory classification model is semi-supervised and trained based on the core ship trajectories corresponding to the core samples of each cluster, the manually labeled core ship trajectories, and the unlabeled ship trajectories.
7. The ship trajectory data annotation method according to claim 1, characterized in that, The semi-supervised training of the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster, the manually labeled core ship trajectories, and unlabeled ship trajectories includes: Weak enhancement was performed on the labeled ship trajectories corresponding to the core samples of each cluster, and weak and strong enhancement were performed on the unlabeled ship trajectories respectively. The enhanced labeled ship trajectory and the unlabeled ship trajectory are input into the ship trajectory classification model to obtain the predicted probability distribution; Based on the predicted probability distribution of the labeled ship trajectories after weak enhancement and the manual annotation, the supervised loss is calculated; Based on the predicted probability distribution of the weakly enhanced unlabeled ship trajectory, the prediction confidence level is determined and pseudo-labels are generated. Based on the predicted confidence level and the preset confidence threshold, high-confidence unlabeled ship trajectories are selected, and unsupervised loss is calculated based on the predicted probability distribution of the highly enhanced high-confidence unlabeled ship trajectories and the corresponding pseudo-labels. The parameters of the ship trajectory classification model are adjusted based on the supervised loss and the unsupervised loss.
8. A device for annotating ship trajectory data, characterized in that, include: The clustering module is used to extract depth features from multiple ship trajectories and cluster the depth features to obtain multiple clusters; The statistics module is used to calculate the distance of each sample in the cluster from the cluster center and to determine the distance distribution statistics parameters; The fuzzing and defuzzing module is used to calculate the membership degree of each sample corresponding to different distance semantic levels based on the distance distribution statistical parameters of the cluster and the distance of each sample, and to activate the rules based on the membership degree and the pre-constructed fuzzy inference rules between distance semantic levels and confidence evaluation. The activation results are then defuzzified to obtain the confidence score of each sample. The filtering module is used to filter out core samples based on the confidence scores of each sample in the cluster. The training and automatic annotation module is used to train the ship trajectory classification model based on the core ship trajectories corresponding to the core samples of each cluster and the manual annotations of the core ship trajectories, and to automatically annotate the ship trajectories to be annotated using the trained ship trajectory classification model.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the ship trajectory data annotation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the ship trajectory data annotation method as described in any one of claims 1 to 7.
