Small sample ship trajectory prediction method based on self-supervision and domain adaptation

By adopting self-supervising and domain adaptive methods in small sample ship trajectory prediction, combining time-frequency domain feature extraction and multi-scale attention fusion modules, the problem of difficult training of deep learning networks in small sample data sets and low model migration accuracy is solved, and more efficient trajectory prediction and noise processing capabilities are achieved.

CN120067965APending Publication Date: 2025-05-30NANJING UNIV OF SCI & TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411984642.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The deep learning network of existing small sample ship trajectory datasets is difficult to train and easily overfit, and the prediction accuracy after model migration is low due to differences in domain distribution.

Method used

A small sample ship trajectory prediction method based on self-supervised and domain adaptation is adopted, and deep learning model training is carried out by combining large-scale source domain data sets and small sample target domain data sets. Time-frequency domain dual-branch feature extraction and multi-scale spatial attention channel attention fusion module are used, and the domain unchanging features are learned by combining self-supervised learning and domain adaptation models.

Benefits of technology

It effectively solves the problem of difficulty in training and overfitting small sample data, enhances the noise processing and long-distance feature extraction capabilities of trajectory data, and reduces the decline in model migration performance caused by domain distribution differences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067965A_ABST
    Figure CN120067965A_ABST
Patent Text Reader

Abstract

The invention discloses a small sample ship trajectory prediction method based on self-supervised learning and domain adaptation. The method comprises the following steps: acquiring an anchor sample, a positive sample and a negative sample with global semantic features from a source domain data set and a target domain data set; a double-branch time-frequency domain feature extraction and fusion encoder based on depth separable convolution and spectrum convolution after discrete cosine transform is adopted to encode the data enhancement sample, and multi-scale spatial features and cross-channel attribute features of the trajectory are learned; the triple comparison loss of positive and negative sample pairs is calculated, anchor point sample coding features of a source domain and a target domain are selected, domain distribution difference judgment is carried out through a discriminator, cross-domain invariant feature representation is learned, and downstream trajectory prediction fine adjustment is completed through feature extraction, fusion and a prediction head. In addition, a plurality of loss functions are fused through a self-adaptive weighted summation method, so that the training process is optimized. According to the method, the accuracy of ship trajectory prediction in a small sample scene can be improved, and the generalization ability of the model is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of trajectory prediction, and particularly relates to a small-sample ship trajectory prediction method based on self-supervised and domain adaptation. Background Art

[0002] Ship trajectory prediction can predict the movement trajectory of ships in advance, helping shipping companies and relevant management agencies optimize resource allocation, improve shipping efficiency, and reduce the risk of maritime accidents. However, ship trajectory prediction faces some technical challenges, especially difficulties in small-sample learning and cross-domain transfer learning.

[0003] Ship trajectory data has significant temporal and spatial dependencies. Due to the high cost of obtaining high-quality labeled data, especially for specific regions or specific types of ship behaviors, the amount of data annotation in the target domain is often limited, thus forming a typical small-sample learning problem. Secondly, ship trajectory data usually has obvious domain differences. The trajectory characteristics may vary for different regions and types of ships. When a model trained on some ship trajectory datasets is transferred to other datasets, it often faces the problem of poor transfer effect. At this time, how to effectively improve the transfer effect of the model in the target domain has become a key problem to be solved urgently.

[0004] Deep learning-based ship trajectory prediction methods learn the complex non-linear latent patterns of the target by constructing deep neural networks. However, they often rely on a large amount of training data and are difficult to train with small-sample ship data. Existing methods usually train on other large-scale datasets and then apply the model to the prediction of real small-sample ship trajectories. Due to the domain distribution differences between datasets, their generalization effects often fail to meet expectations.

[0005] Therefore, in view of the above deficiencies, there is an urgent need for a new improved method that can not only give full play to the advantages of deep learning in capturing complex non-linear patterns but also effectively address the decline in prediction performance caused by domain distribution differences during model transfer. Summary of the Invention

[0006] The purpose of the present invention is to provide a small-sample ship trajectory prediction method based on self-supervised and domain adaptation, aiming to overcome the challenges that it is difficult to train and prone to overfitting for deep learning networks with small-sample ship trajectory datasets, and the low prediction accuracy after model transfer due to domain distribution differences.

[0007] The solution to achieve the purpose of the present invention is: a small-sample ship trajectory prediction method based on self-supervised and domain adaptation, and the steps are as follows:

[0008] Step 1: Obtain the source domain dataset and the target domain small sample dataset. Each ship trajectory contains four parameters: longitude, latitude, speed, and heading. Divide the target domain dataset into a pre-training dataset and a fine-tuning dataset. Intercept a fixed-length trajectory segment x from the source domain and target domain pre-training datasets. i , and randomly select one of the parameters, perform data enhancement operations through two random drops, and obtain anchor point samples x anc and positive sample x pos ; In trajectory segment x i Select another parameter and randomly discard it to perform data enhancement operation to obtain negative samples x neg ;

[0009] Step 2: Establish a backbone model for ship trajectory contrast learning, including feature extraction module, feature fusion module, domain discriminator and triple contrast module. The samples after data enhancement are sequentially passed through the feature extraction module and feature fusion module to output the encoding features; the encoding features are passed through the parallel domain discriminator and triple contrast loss module, where the domain discriminator module outputs the probability of the domain to which the sample belongs and calculates the cross entropy loss value L disc , the output of the triplet contrast loss module is the contrast loss value of the source domain sample Compare the loss value with the target domain

[0010] Step 3: Based on the cross entropy loss value L disc , source domain sample contrast loss value Compare the loss value with the target domain Construct a composite loss function, with the goal of minimizing the composite loss function, complete the pre-training of the ship trajectory contrast learning backbone model, and solidify the network parameters of the feature extraction module and feature fusion module;

[0011] Step 4: Load the pre-trained feature extraction module and feature fusion module, connect the prediction heads in series to build the ship trajectory prediction model, and output the coded features of the feature extraction module and feature fusion module through the prediction head to output the predicted trajectory, with the goal of minimizing the mean absolute error between the predicted trajectory and the actual trajectory, to complete the fine-tuning of the ship trajectory prediction model;

[0012] Step 5: Input the trajectory of the ship to be tested into the fine-tuned ship trajectory prediction model, and output the longitude, latitude, speed and heading of the target ship trajectory.

[0013] Furthermore, in step 1, the source domain dataset and the target domain small sample dataset are obtained, and each ship trajectory contains four parameters: longitude, latitude, speed, and heading; the target domain dataset is divided into a pre-training dataset and a fine-tuning dataset; a fixed-length trajectory segment x is intercepted from the source domain and target domain pre-training datasets. i, and randomly select one of the parameters, and perform data augmentation operations through two random discards to obtain the anchor sample x anc and the positive sample x pos ; In the trajectory segment x i Select another parameter to randomly discard for data augmentation operation to obtain the negative sample x neg , where:

[0014] Each ship trajectory in the target domain and source domain datasets needs to undergo data cleaning and preprocessing operations, including: filtering outliers, overly short trajectories, shoreline trajectories, and trajectories with long docking times, and removing high-frequency noise;

[0015] The target domain dataset is split into a pre-training dataset and a fine-tuning dataset in a ratio of 6:4.

[0016] Furthermore, Step 2: Establish a backbone model for ship trajectory contrast learning, including a feature extraction module, a feature fusion module, a domain discriminator, and a triplet contrast module. The samples after data augmentation are sequentially passed through the feature extraction module and the feature fusion module to output encoded features; the encoded features pass through the parallel domain discriminator and triplet contrast loss module, where the domain discriminator module outputs the probability of the sample belonging to the domain and calculates the cross-entropy loss value L disc , and the output of the triplet contrast loss module is the contrast loss value of the source domain samples and the contrast loss value of the target domain where:

[0017] a) Feature extraction module

[0018] The input data of the feature extraction module is the anchor, positive, and negative samples obtained by data augmentation of the source domain dataset and the target domain pre-training dataset Then, instance normalization is performed on the input, and it passes through the parallel time domain branch and frequency domain branch;

[0019] The time domain branch consists of depthwise convolution (DWConv), GeLU activation function, batch normalization (BatchNorm, BN), pointwise convolution (PWConv), GeLU, BN, PWConv, and residual connection, and the output is the time domain feature

[0020] The frequency domain branch consists of discrete cosine transform DCT, PWConv, GeLU, BN, PWConv, and residual connection, and the output is the frequency domain feature

[0021] b) Feature fusion module

[0022] The feature fusion module includes spatial attention fusion and channel attention fusion;

[0023] Spatial attention fusion is composed of the time domain feature ft and the frequency-domain feature f s After concatenation (Concat), we get Then, through average pooling, PWConv, and Sigmoid, and then combined with f con Perform element-wise matrix multiplication and PWConv output

[0024] Channel attention fusion is performed on the time-domain feature f t and the frequency-domain feature f s respectively perform PWConv, matrix addition operation, Sigmoid, and then perform element-wise multiplication with the fusion result f of spatial attention att1 to output the final encoded feature

[0025] c) Domain discriminator

[0026] The input of the domain discriminator is the encoded feature f after the anchor samples of the source domain and target domain pre-training datasets pass through the feature extraction and fusion module att ;

[0027] The domain discriminator consists of gradient reversal, fully connected layers, and Sigmoid activation function;

[0028] The output value of Sigmoid is between the interval [0, 1], representing the probability of predicting the domain to which the current input sample belongs. If the result is close to 1, it means the sample comes from the source domain; if the result is close to 0, it means the sample comes from the target domain;

[0029] Use the cross-entropy loss L disc to calculate the output value of the domain discriminator:

[0030]

[0031] where N s , N t represent the number of samples in the source domain and target domain, i represents the current sample number, are the feature encodings and domain labels of the i-th sample in the source domain respectively, are the feature encodings and domain labels of the i-th sample in the target domain respectively; D(·) represents the discriminator module, and L(·) represents the cross-entropy loss;

[0032] d) Triplet contrast module

[0033] The input of the triplet contrast module each time is the encoded features of the anchor sample, positive sample, and negative sample of the same trajectory, and the contrast loss L con is as follows:

[0034]

[0035] Among them represents the anchor point, positive sample, and negative sample, and f(·) corresponds to the feature extraction and fusion network represents the square of the Euclidean distance, and α is a hyperparameter

[0036] Furthermore, step 3: Based on the cross-entropy loss value L disc and the source domain sample contrast loss value and the target domain contrast loss value construct a composite loss function, aiming to minimize the composite loss function, complete the pre-training of the backbone model for ship trajectory contrast learning, and solidify the network parameters of the feature extraction module and the feature fusion module, where

[0037] Through the domain discriminator loss value L disc and the source domain contrast loss value and the target domain contrast loss value add the adaptive weights and sum them to obtain the composite loss value L sum :

[0038]

[0039] where α i is the generated weight

[0040] Furthermore, step 3: Based on the cross-entropy loss value L disc and the source domain sample contrast loss value and the target domain contrast loss value construct a composite loss function, aiming to minimize the composite loss function, complete the pre-training of the backbone model for ship trajectory contrast learning, and solidify the network parameters of the feature extraction module and the feature fusion module, where

[0041] The pre-training uses the AdamW optimizer, with the initial learning rate and weight decay parameter being 0.0001, the size of each batch being 512, and the number of epochs for pre-training being 50

[0042] Furthermore, step 4: Load the pre-trained feature extraction module and feature fusion module, concatenate the prediction head to construct a ship trajectory prediction model, and the encoded features output by the feature extraction module and the feature fusion module are used to output the predicted trajectory through the prediction head, aiming to minimize the mean absolute error between the predicted trajectory and the actual trajectory, complete the fine-tuning of the ship trajectory prediction model, where

[0043] The prediction head module consists of a fully connected layer, a Sigmoid activation function, a fully connected layer, and an inverse normalization layer

[0044] Segment the trajectories of the target domain fine-tuning dataset into the observation interval x jand the prediction interval y j , with x j as the input, load the pre-trained feature extraction and feature fusion modules, and after passing through the prediction head, output the predicted trajectory to minimize and y j The mean absolute error of is the goal to complete the fine-tuning of the ship trajectory prediction model. Specifically, the mean absolute error loss function L pred is defined as follows:

[0045]

[0046] In the formula, N is the length of the prediction interval.

[0047] Furthermore, Step 4: Load the pre-trained feature extraction module and feature fusion module, and concatenate the prediction head to construct the ship trajectory prediction model. The encoded features output by the feature extraction module and feature fusion module are output as the predicted trajectory through the prediction head. The goal is to minimize the mean absolute error between the predicted trajectory and the actual trajectory to complete the fine-tuning of the ship trajectory prediction model, where:

[0048] The number of epochs for fine-tuning the prediction head is 10. The fine-tuning only targets the weights of the prediction head, and the weights of the feature extraction and feature fusion modules will be frozen.

[0049] A small-sample ship trajectory prediction method based on self-supervision and domain adaptation. Implement the described small-sample ship trajectory prediction method based on self-supervision and domain adaptation to achieve small-sample ship trajectory prediction based on self-supervision and domain adaptation. It is divided into four modules to execute Steps 1 to 4 respectively.

[0050] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the small-sample ship trajectory prediction method based on self-supervision and domain adaptation to achieve small-sample ship trajectory prediction based on self-supervision and domain adaptation.

[0051] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the small-sample ship trajectory prediction method based on self-supervision and domain adaptation to achieve small-sample ship trajectory prediction based on self-supervision and domain adaptation.

[0052] Compared with the prior art, the present invention has significant advantages: 1) By jointly training a deep learning model with a large-scale source domain dataset and a small-sample target domain dataset, it not only retains the powerful ability of deep learning in complex non-linear feature extraction but also effectively solves the problems that small-sample data is difficult to train and prone to overfitting. 2) Based on the time-frequency domain double-branch depthwise separable convolution feature extraction operation and the multi-scale spatial attention and channel attention fusion module, it can enhance the noise processing and long-distance feature extraction capabilities of trajectory data. 3) By combining self-supervised learning and domain adaptation models, it can learn domain-invariant features and reduce the degradation of model transfer performance caused by domain distribution differences. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is the overall flowchart of the prediction model in the embodiment of the present invention.

[0054] Figure 2 It is the structural diagram of the pre-training and fine-tuning of the ship trajectory contrast learning backbone model in the embodiment of the present invention.

[0055] Figure 3 It is the structural diagram of the feature extraction module in the embodiment of the present invention.

[0056] Figure 4 It is the structural diagram of the feature fusion module in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0058] As Figure 1 shown, for the small-sample ship trajectory prediction method based on self-supervised and domain adaptation, the whole process mainly includes the following steps: 1. Construct a dataset sample pair; 2. Establish a ship trajectory contrast learning backbone model; 3. Pre-train the ship trajectory contrast learning backbone model; 4. Fine-tune the ship trajectory prediction model; 5. Predict the trajectory to be measured. The specific steps are as follows:

[0059] Step 1, construct a dataset sample pair:

[0060] The source domain dataset and the target domain dataset can be trajectories with domain distribution difference characteristics from different ships, different sea areas, etc. Each ship trajectory contains four parameters: longitude, latitude, speed, and heading.

[0061] Each ship trajectory needs to go through data cleaning and preprocessing operations, including: filtering outliers, overly short trajectories, shore trajectories, and trajectories with long docking times, and removing high-frequency noise.

[0062] Intercept a trajectory segment \(x\) of a fixed length from the source domain and target domain pre-training datasets i , and randomly select one of the parameters, and perform data augmentation operations through two random dropouts to obtain an anchor sample \(x\) anc and a positive sample \(x\) pos ; In the trajectory segment \(x\) i select another parameter to randomly drop for data augmentation operation to obtain a negative sample \(x\) neg ;

[0063] Divide the target domain dataset into a pre-training dataset and a fine-tuning dataset according to a ratio of 6:4.

[0064] Step 2, establish a backbone model for ship trajectory contrast learning:

[0065] As Figure 2 shown, the backbone model for ship trajectory contrast learning includes feature extraction, feature fusion, domain discriminator, and triplet contrast module;

[0066] Given a data-augmented ship trajectory sample output the time-domain feature and frequency-domain feature through the feature extraction module, and then output the encoded feature

[0067] The input of the domain discriminator is the encoded feature \(X_f\) of the anchor sample, and the output is the probability that the sample belongs to the target domain, and calculate the cross-entropy loss \(L\) according to the probability disc ;

[0068] The input of the triplet contrast module is the encoded features of the source domain and target domain triplet samples, and the output is the source domain and target domain triplet contrast loss values and

[0069] a) Feature extraction module

[0070] All anchor, positive and negative samples in the source domain and target domain pre-training datasets have to go through the feature extraction module, and then perform instance normalization on the input samples, and pass through parallel time-domain and frequency-domain branches;

[0071] As Figure 3 shown, the time-domain branch consists of depthwise convolution (DWConv), GeLU activation function, batch normalization (BatchNorm, BN), pointwise convolution (PWConv), GeLU, BN, PWConv, and residual connection, and the output is the time-domain feature

[0072] The frequency domain branch consists of a Discrete Cosine Transform (DCT), PWConv, GeLU, BN, PWConv, and a residual connection, and the output is the frequency domain feature.

[0073] b) Feature Fusion Module

[0074] As Figure 4 shown, the feature fusion module includes spatial attention fusion and channel attention fusion;

[0075] The spatial attention fusion is obtained by concatenating the time domain feature f t and the frequency domain feature f s Then, it goes through average pooling, PWConv, and Sigmoid, and then performs element-wise matrix multiplication with f and PWConv to output con

[0076] The channel attention fusion performs PWConv, matrix addition operation, and Sigmoid on the time domain feature f t and the frequency domain feature f s respectively, and then performs element-wise multiplication with the fusion result f att1 of the spatial attention to output the final encoded feature

[0077] c) Domain Discriminator

[0078] The domain discriminator consists of a gradient reversal, a fully connected layer, and a Sigmoid activation function;

[0079] The output value of the Sigmoid is between the interval [0, 1], representing the probability of predicting that the current sample belongs to the target domain;

[0080] The cross-entropy loss L disc is used to calculate the output value of the domain discriminator:

[0081]

[0082] where N s , N t represent the number of source domain and target domain samples, i represents the current sample number, are the feature encoding and the label of the domain to which the i-th sample in the source domain belongs, are the feature encoding and the label of the domain to which the i-th sample in the target domain belongs; D(·) represents the discriminator module, and L(·) represents the cross-entropy loss;

[0083] d) Triplet Contrast

[0084] The input of the triple contrast module each time is the encoded features of the anchor sample, positive sample, and negative sample of the same trajectory, and the contrast loss L con is as follows:

[0085]

[0086] where represent the anchor, positive sample, and negative sample, and f(·) corresponds to the feature extraction and fusion network, represents the square of the Euclidean distance, and α is a hyperparameter;

[0087] The source domain triple contrast loss is denoted as The target domain triple contrast loss is denoted as

[0088] Step 3: Pre-training of the backbone model for ship trajectory contrast learning:

[0089] Input the source domain samples and the target domain pre-training dataset samples into the backbone model for ship trajectory contrast learning, and complete the pre-training of the backbone model for ship trajectory contrast learning with the goal of minimizing the composite loss function;

[0090] Through the domain discriminator loss value L disc , the source domain contrast loss value and the target domain contrast loss value Add adaptive weights and sum them to obtain the composite loss value L sum :

[0091]

[0092] where α i is the weight generated by model learning.

[0093] The pre-training of the backbone model for ship trajectory contrast learning uses the AdamW optimizer, with an initial learning rate and weight decay parameter of 0.0001, a batch size of 512, and 50 pre-training epochs.

[0094] Step 4: Fine-tuning of the ship trajectory prediction model:

[0095] Segment the trajectories of the target domain fine-tuning dataset into the observation interval x j and the prediction interval y j ; Using x j as the input, load the weights of the feature extraction and feature fusion modules obtained from the pre-training of the backbone model for ship trajectory contrast learning, and pass through the prediction head to output the predicted trajectory with the same length as the domain prediction interval With the goal of minimizing the and the mean absolute error between y j , complete the fine-tuning of the ship trajectory prediction model;

[0096] The prediction head module consists of a fully connected layer, a Sigmoid activation function, a fully connected layer, and an inverse normalization layer;

[0097] The prediction head is fine-tuned using the mean absolute error loss function. The mean absolute error loss function L pred is defined as follows:

[0098]

[0099] In the formula, y i is the true value of the trajectory, is the predicted value output by the model, and N is the length of the prediction interval;

[0100] The number of epochs for fine-tuning the prediction head is 10. The weights of the fixed feature extraction and feature fusion modules are solidified, and the fine-tuning is only for the weights of the prediction head.

[0101] Step 5: Prediction of the trajectory to be measured:

[0102] The actual trajectory to be measured is subjected to data cleaning and preprocessing in Step 1 and then input into the trajectory prediction model fine-tuned in Step 4. The prediction head outputs the predicted trajectory information. By modifying the output dimension of the prediction head or concatenating the predicted value behind the observed value, a trajectory of the same length as the original observed value can be obtained through a sliding window as the input for the new round of prediction. Repeating the above iterative steps can obtain predictions over a longer distance.

[0103] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0104] The above-described embodiments only represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A small sample ship trajectory prediction method based on self-supervision and domain adaptation, characterized in that: Here are the steps: Step 1: Obtain the source domain dataset and the target domain small sample dataset. Each ship trajectory contains four parameters: longitude, latitude, speed, and heading. Divide the target domain dataset into a pre-training dataset and a fine-tuning dataset. Intercept a fixed-length trajectory segment x from the source domain and target domain pre-training datasets. i , and randomly select one of the parameters, perform data enhancement operations through two random drops, and obtain anchor point samples x anc and positive sample x pos ; In trajectory segment x i Select another parameter and randomly discard it to perform data enhancement operation to obtain negative samples x neg ; Step 2: Establish a backbone model for ship trajectory contrast learning, including feature extraction module, feature fusion module, domain discriminator and triplet contrast module. The samples after data enhancement are sequentially passed through the feature extraction module and feature fusion module to output encoding features. The encoded features pass through the domain discriminator and triple contrast loss module in parallel, where the domain discriminator module outputs the probability of the domain to which the sample belongs and calculates the cross entropy loss value L disc , the output of the triplet contrast loss module is the contrast loss value of the source domain sample Compare the loss value with the target domain Step 3: Based on the cross entropy loss value L disc , source domain sample contrast loss value Compare the loss value with the target domain Construct a composite loss function, with the goal of minimizing the composite loss function, complete the pre-training of the ship trajectory contrast learning backbone model, and solidify the network parameters of the feature extraction module and feature fusion module; Step 4: Load the pre-trained feature extraction module and feature fusion module, connect the prediction heads in series to build the ship trajectory prediction model, and output the coded features of the feature extraction module and feature fusion module through the prediction head to output the predicted trajectory, with the goal of minimizing the mean absolute error between the predicted trajectory and the actual trajectory, to complete the fine-tuning of the ship trajectory prediction model; Step 5: Input the trajectory of the ship to be tested into the fine-tuned ship trajectory prediction model, and output the longitude, latitude, speed and heading of the target ship trajectory.

2. According to claim 1, a small sample ship trajectory prediction method based on self-supervision and domain adaptation is characterized in that: In step 1, the source domain dataset and the target domain small sample dataset are obtained. Each ship trajectory contains four parameters: longitude, latitude, speed, and heading. The target domain dataset is divided into a pre-training dataset and a fine-tuning dataset. A fixed-length trajectory segment x is intercepted from the source domain and target domain pre-training datasets. i , and randomly select one of the parameters, perform data enhancement operations through two random drops, and obtain anchor point samples x anc and positive sample x pos ; In trajectory segment x i Select another parameter and randomly discard it to perform data enhancement operation to obtain negative samples x neg ,in: Each ship trajectory in the target domain and source domain datasets needs to undergo data cleaning and preprocessing operations, including filtering outliers, too short trajectories, shore trajectories, trajectories with long docking time, and removing high-frequency noise; The target domain dataset is split into a pre-training dataset and a fine-tuning dataset in a ratio of 6:

4.

3. According to claim 1, a small sample ship trajectory prediction method based on self-supervision and domain adaptation is characterized in that: Step 2: Establish a backbone model for ship trajectory contrast learning, including feature extraction module, feature fusion module, domain discriminator and triplet contrast module. The samples after data enhancement are sequentially passed through the feature extraction module and feature fusion module to output encoding features. The encoded features pass through the domain discriminator and triple contrast loss module in parallel, where the domain discriminator module outputs the probability of the domain to which the sample belongs and calculates the cross entropy loss value L disc , the output of the triplet contrast loss module is the contrast loss value of the source domain sample Compare the loss value with the target domain in: a) Feature extraction module The input data of the feature extraction module is the anchor points, positive and negative samples of the source domain dataset and the target domain pre-training dataset data enhancement. The input is then instance normalized and passes through the parallel time domain branch and frequency domain branch; The time domain branch consists of deep convolution (DWConv), GeLU activation function, batch normalization (BatchNorm, BN), point-by-point convolution (PWConv), GeLU, BN, PWConv and residual connection, and the output is the time domain feature The frequency domain branch consists of discrete cosine transform DCT, PWConv, GeLU, BN, PWConv and residual connection, and the output is frequency domain features b) Feature fusion module The feature fusion module includes spatial attention fusion and channel attention fusion; Spatial attention fusion is composed of temporal features f t and frequency domain characteristics f s After concatenation, we get Then after average pooling, PWConv and Sigmoid, and then with f con Perform element-wise matrix multiplication and PWConv output Channel attention fusion is composed of time domain features f t and frequency domain characteristics f s Perform PWConv, matrix addition, Sigmoid, and then fuse the result f with spatial attention. att1 Perform element-by-element multiplication and output the final encoded features c) Domain Discriminator The input of the domain discriminator is the encoded features f of the anchor samples of the source domain and target domain pre-training dataset after feature extraction and fusion modules. att ; The domain discriminator consists of gradient reversal, fully connected layer, and Sigmoid activation function; The output value of Sigmoid is between the interval [0,1], which represents the probability of predicting the domain to which the current input sample belongs. If the result is close to 1, it means that the sample comes from the source domain; if the result is close to 0, it means that the sample comes from the target domain; Use cross entropy loss L disc Compute the output value of the domain discriminator: Where N s , N t represents the number of samples in the source domain and the target domain, i represents the current sample number, are the feature code of the i-th sample in the source domain and the label of the domain to which it belongs, respectively. are the feature encoding of the i-th sample in the target domain and the label of the domain to which it belongs, respectively; D(·) represents the discriminator module, and L(·) represents the cross entropy loss; d) Triplet comparison module The input of the triplet comparison module each time is the anchor sample, positive sample and negative sample encoding features of the same trajectory, and the comparison loss L con as follows: in represents anchor points, positive samples and negative samples, f(·) corresponds to feature extraction and fusion network, represents the square of the Euclidean distance, and α is a hyperparameter.

4. According to claim 1, a small sample ship trajectory prediction method based on self-supervision and domain adaptation is characterized in that: Step 3: Based on the cross entropy loss value L disc , source domain sample contrast loss value Compare the loss value with the target domain Construct a composite loss function, with the goal of minimizing the composite loss function, complete the pre-training of the ship trajectory contrast learning backbone model, and solidify the network parameters of the feature extraction module and feature fusion module, where: Through the domain discriminator loss value L disc , source domain contrast loss value Compare the loss value with the target domain Add the adaptive weights and sum them to get the composite loss value L sum : where α i is the generated weight.

5. According to claim 4, a small sample ship trajectory prediction method based on self-supervision and domain adaptation is characterized in that: Step 3: Based on the cross entropy loss value L disc , source domain sample contrast loss value Compare the loss value with the target domain Construct a composite loss function, with the goal of minimizing the composite loss function, complete the pre-training of the ship trajectory contrast learning backbone model, and solidify the network parameters of the feature extraction module and feature fusion module, where: The AdamW optimizer was used for pre-training, with the initial learning rate and weight decay parameters of 0.0001, the size of each batch of 512, and the number of pre-training epochs of 50.

6. According to claim 1, a small sample ship trajectory prediction method based on self-supervision and domain adaptation is characterized in that: Step 4: Load the pre-trained feature extraction module and feature fusion module, connect the prediction heads in series to build the ship trajectory prediction model, and output the coded features of the feature extraction module and feature fusion module through the prediction head to output the predicted trajectory. The goal is to minimize the mean absolute error between the predicted trajectory and the actual trajectory, and complete the fine-tuning of the ship trajectory prediction model, where: The prediction head module consists of a fully connected layer, a Sigmoid activation function, a fully connected layer, and an inverse normalization layer; Divide the trajectory of the target domain fine-tuning dataset into observation intervals x j and the prediction interval y j , with x j As input, load the pre-trained feature extraction and feature fusion modules, pass through the prediction head, and output the predicted trajectory To minimize and j The mean absolute error is taken as the goal to complete the fine-tuning of the ship trajectory prediction model. Specifically, the mean absolute error loss function L pred The definition is as follows: Where N is the length of the prediction interval.

7. The method for predicting small sample ship trajectories based on self-supervision and domain adaptation according to claim 1, characterized in that: Step 4: Load the pre-trained feature extraction module and feature fusion module, connect the prediction heads in series to build the ship trajectory prediction model, and output the coded features of the feature extraction module and feature fusion module through the prediction head to output the predicted trajectory. The goal is to minimize the mean absolute error between the predicted trajectory and the actual trajectory, and complete the fine-tuning of the ship trajectory prediction model, where: The epoch of prediction head fine-tuning is 10. The fine-tuning is only for the weights of the prediction head, and the weights of the feature extraction and feature fusion modules will be frozen.

8. A small sample ship trajectory prediction method based on self-supervision and domain adaptation, characterized in that: Implement the method for predicting ship trajectories with a small sample based on self-supervision and domain adaptation as described in any one of claims 1-7 to realize the prediction of ship trajectories with a small sample based on self-supervision and domain adaptation, and perform steps 1 to 4 respectively in four modules.

9. A computer device, comprising 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, the method for predicting small sample ship trajectories based on self-supervision and domain adaptation as described in any one of claims 1 to 7 is implemented to realize the prediction of small sample ship trajectories based on self-supervision and domain adaptation.

10. A computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting a small sample ship trajectory based on self-supervision and domain adaptation according to any one of claims 1 to 7 is implemented to realize the prediction of a small sample ship trajectory based on self-supervision and domain adaptation.

Citation Information

Cited By

  • Unmanned aerial vehicle GPS spoofing attack detection method and device based on comparative learning and Mama

    CN120559680A

  • Remote takeover risk early warning system and method based on behavior prediction model

    CN121375854A

  • A remote takeover risk early warning system and method based on a behavior prediction model

    CN121375854B