Ship heave motion prediction method and system based on lightweight context perception network
The lightweight context-aware global-local network (LCGNet) addresses the issues of large parameter count and high computational complexity in the deployment of existing deep learning methods on shipboard edge devices, achieving high-precision and rapid heave motion prediction on resource-constrained devices and meeting the real-time requirements of active heave compensation systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2026-02-14
- Publication Date
- 2026-05-01
AI Technical Summary
When existing deep learning methods are deployed on shipborne edge devices, the number of model parameters is large and the computational complexity is high, making it difficult to meet the engineering requirements of active heave compensation systems for millisecond-level real-time prediction and control response.
We employ a lightweight context-aware global-local network (LCGNet) and design a ship heave prediction method with extremely low parameter count and computational cost through efficient operations such as grouped dilated convolution, depthwise separable convolution, and channel shuffling. By combining global and local paths for feature extraction, we can achieve real-time prediction of heave motion with multiple steps.
While ensuring high prediction accuracy, the model is extremely lightweight, has low computational cost, and fast inference speed. It can achieve millisecond-level real-time prediction on resource-constrained shipborne edge devices, adapt to complex sea conditions, and has good cross-domain migration capabilities.
Smart Images

Figure CN121705670B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for predicting ship heave motion based on lightweight context-aware networks, specifically to a real-time prediction method for ship heave motion based on deep learning, and particularly to a lightweight context-aware global-local network prediction method for deployment on shipborne edge computing platforms, belonging to the field of ship and marine engineering motion control technology. Background Technology
[0002] Ships and offshore platforms experience six degrees of freedom motion under wave excitation, with vertical heave motion having a particularly significant impact on the accuracy and safety of operations such as crane operations, personnel transfer, and equipment deployment and retrieval. Active heave compensation systems, which predict the ship's future motion in real time and drive actuators to perform reverse compensation, are a key technology for improving operational performance. The core of this system's effectiveness lies in the accuracy and real-time performance of the heave motion prediction module.
[0003] Existing heave prediction methods mainly fall into three categories: 1) Physical model-based methods, such as those using response amplitude operators or Kalman filters. These methods have clear physical meanings but are sensitive to model parameters and have limited generalization ability in complex and variable real sea conditions; 2) Methods based on traditional statistics and time series analysis, such as autoregressive moving average models. These methods have low computational cost but are difficult to effectively characterize the nonlinear and non-stationary characteristics of heave signals driven by waves; 3) Deep learning-based methods, such as long short-term memory networks, gated recurrent units, and Transformer models. These methods have made significant progress in prediction accuracy due to their powerful end-to-end feature learning capabilities.
[0004] However, existing deep learning methods generally suffer from problems such as large number of model parameters, high computational complexity, and significant inference latency. For example, models based on recurrent neural networks suffer from serial computation bottlenecks; the computational overhead of the self-attention mechanism in Transformer models is quadratically related to the sequence length. These factors make it difficult to directly deploy existing high-performance models on shipboard edge devices (such as motion control units and embedded industrial PCs) where computing resources, storage space, and power consumption are limited, and they cannot meet the stringent engineering requirements of active heave compensation systems for millisecond-level real-time prediction and control response.
[0005] Therefore, developing a lightweight heave motion prediction method that can guarantee high prediction accuracy while having extremely low parameter count, small model size, and extremely fast inference speed is of great significance for promoting the practical engineering application of active heave compensation technology. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention aims to overcome the drawbacks of current deep learning methods, such as heavy models, high computational overhead, and difficulty in real-time deployment on resource-constrained edge platforms. It provides a ship heave prediction method based on a lightweight context-aware global-local network (LCGNet). This method, through an innovative lightweight network structure design, achieves high-precision, multi-step real-time heave prediction with extremely low parameters and computational costs, thus meeting the engineering deployment requirements of shipborne active heave compensation systems.
[0007] The technical solution of the present invention is as follows:
[0008] To achieve the above objectives, this invention provides a method for predicting ship heave motion based on a lightweight context-aware network, comprising the following steps:
[0009] S1: Signal Acquisition and Preprocessing
[0010] The ship's heave motion timing signal is collected, the original signal is filtered and noise-reduced, and then downsampled to the target frequency before data standardization is performed.
[0011] Preferably, the specific steps are as follows:
[0012] S1-1. Data Generation: Data is generated using the Marine Systems Simulator (MSS), which is widely recognized in the field of shipbuilding and ocean engineering; the original sampling frequency is 200Hz; to simulate the real sensor environment, an appropriate amount of Gaussian white noise is superimposed on the simulation signal.
[0013] S1-2, Preprocessing: Downsample all data to 10Hz, calculate the mean μ and standard deviation σ of the entire training set, and standardize all data: x_norm = (x - μ) / σ.
[0014] S1-3, Sample Construction: Supervised learning samples are constructed using the sliding window method. The historical observation length L_hist = 128 (corresponding to 12.8 seconds of history) and the future prediction length L_pred = 16 (corresponding to 1.6 seconds of future) are set. For a sequence of length T, T - L_hist - L_pred + 1 sample pairs (X, Y) can be generated, where X ∈ R^(L_hist) is the input, Y ∈ R^(L_pred) is the prediction target, and R represents the set of real numbers.
[0015] S1-4. Dataset partitioning: Randomly shuffle the data and divide it into training and test sets in a 4:1 ratio. Further divide the training set into a 70% training subset for parameter updates and a 30% validation set for monitoring the training process and preventing overfitting.
[0016] S2: Multi-step prediction of heave motion based on LCGNet network
[0017] The preprocessed historical sequence is input into the LCGNet network, which includes a context-aware embedding module, a dual-path multi-scale feature extraction module, and a prediction output layer. The network outputs the predicted heave motion values for multiple future time steps via forward propagation.
[0018] Preferably, the structural features of the LCGNet network are as follows:
[0019] (1). Context-aware embedding module: This module does not explicitly segment the input sequence, but instead uses progressive downsampling and hybrid dilated grouped convolutions to efficiently aggregate contextual information across time periods while compressing the sequence length. Specifically, it includes a 1×1 convolutional layer input (projecting the input sequence to the target feature channel number), at least one set of processing units, each set of processing units including: a grouped convolutional layer with a specific dilation rate, a depth convolutional layer for downsampling, and a channel shuffling layer. The dilation rate of the grouped convolutional layer in each set of processing units increases progressively between groups. After the last set of processing units, it passes through a grouped convolutional layer with the maximum dilation rate to output the final feature embedding; this expands the receptive field and promotes channel information interaction under lightweight constraints, ultimately outputting a compact feature embedding rich in long-range dependencies. Further, the number of groups in the grouped convolutional layer G=4; the number of shuffling groups in the channel shuffling layer S=2.
[0020] (2). Dual-path multi-scale feature extraction module: This module receives the feature embedding and performs collaborative feature enhancement through two parallel paths:
[0021] Global Path: Global average pooling and global max pooling are used to extract window-level statistical features. A lightweight multilayer perceptron generates channel attention weights, and global statistical shaping is performed on the feature embeddings to stabilize the amplitude scale under different sea conditions. Further, the global path performs the following operations: global average pooling and global max pooling are performed on the input feature embeddings respectively to obtain two pooling statistical vectors; the two pooling statistical vectors are passed through a fully connected layer and a sigmoid activation function to generate two channel weight vectors; the two channel weight vectors are added to obtain a fused global channel weight vector; the global channel weight vector is broadcast in the time dimension and multiplied element-wise with the original feature embeddings to output the globally shaped features; furthermore, both fully connected layers have 64 units each.
[0022] Local Path: Through channel shuffling and channel segmentation, features are fed into depthwise separable convolutional branches with different kernel sizes to extract multi-scale local temporal morphological features in parallel, capturing key local changes such as peaks and troughs. Further, the local path performs the following operations: channel shuffling of the input feature embeddings; uniform segmentation of the shuffled features into K sub-parts along the channel dimension, where K≥2; inputting each sub-part into a depthwise separable convolutional layer, with at least two depthwise separable convolutional layers having different kernel sizes; concatenating the outputs of each sub-part processed by the depthwise separable convolutional layers along the channel dimension; and performing channel shuffling again on the concatenated features to output local multi-scale features.
[0023] Finally, the output features of the global path and the local path are multiplied element by element to achieve adaptive fusion of global statistical information and local morphological information.
[0024] (3). Prediction output layer: includes one or two standard convolutional layers and one fully connected layer, which integrates and nonlinearly maps the fused high-level features to output the final multi-step prediction sequence. Further, standard convolutional layer 1: 32 filters, kernel size 1; standard convolutional layer 2: 16 filters, kernel size 1; fully connected layer: 16 output units.
[0025] S3: Model Training and Optimization
[0026] A training set was constructed using historical heave and sag data. The Huber loss between predicted and true values was used as the optimization objective. The LCGNet network parameters were trained using the gradient descent algorithm until the model converged.
[0027] Preferably, the training steps include:
[0028] S3-1. Training configuration: Using the Adam optimizer, the initial learning rate is set to 0.001, the loss function is HuberLoss (δ=1.0), and the batch size is set to 32;
[0029] S3-2. Training process: Iterative training is performed on the training subset. After each epoch, the loss is calculated on the validation set. An "early stop" strategy is adopted: if the validation set loss does not decrease for 10 consecutive epochs, the training is terminated and the model parameters with the minimum validation loss are rolled back.
[0030] S3-3. Data Augmentation: During the training phase, weak zero-mean Gaussian noise is randomly added to each batch of input data to improve the model's robustness to measurement noise.
[0031] S4: Model Deployment and Real-Time Prediction
[0032] The trained LCGNet model is quantized and compressed, and deployed on a shipboard edge computing device. During system operation, historical heave data is collected in real time and input into the model. Step S2 is executed cyclically to achieve continuous online prediction of future heave motion.
[0033] Preferably, the specific steps include:
[0034] S4-1: Data Collection and Preparation for Actual Ship Operations
[0035] Real heave motion data were collected from the target ship's Motion Reference Unit (MRU), with the original sampling frequency processed to 10Hz;
[0036] The actual heave motion data of this segment is standardized. For rapid adaptation, the mean and standard deviation calculated by the actual ship data itself can be used directly.
[0037] The data was divided into a fine-tuning training set (first 1600 seconds) and a final test set (last 400 seconds) in chronological order.
[0038] S4-2: Model Transfer Learning (Fine-tuning)
[0039] Loading the pre-trained model: Loading the weights of the trained LCGNet model;
[0040] Freeze the front-end network: Freeze all parameters of the context-aware embedding module (CPE) and the dual-path multi-scale feature extraction module (DMFE) while retaining their learned general spatiotemporal feature extraction capabilities;
[0041] Fine-tuning the terminal network: Unlock only the parameters of the prediction output layer, allowing it to be adjusted on new real-world ship data;
[0042] Fine-tuning training: Using the real ship fine-tuning training set, the model is trained for 30 epochs with a smaller learning rate (0.0001) and the same Huber Loss (δ=1.0) than the original predicted output layer, in order to quickly adapt to possible distribution differences between real ship data and simulation data.
[0043] S4-3: Model Quantization and Deployment
[0044] Model quantization: The fine-tuned model is quantized using Float16 using deployment tools such as TensorFlow Lite Converter. This process converts the model weights from 32-bit floating-point numbers to 16-bit floating-point numbers, compressing the model file size from approximately 0.12MB to approximately 0.09MB.
[0045] Integration and Inference Testing: The quantized model file was integrated into the prediction software of the shipborne edge computing device, and performance tests were run on the device. The average time for a single prediction (128 historical data inputs and 16 future data outputs) was measured to be approximately 0.44 milliseconds.
[0046] A computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the steps of the ship heave motion prediction method based on a lightweight context-aware network as described in the first aspect of the present invention.
[0047] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the ship heave motion prediction method based on a lightweight context-aware network as described in the first aspect of the present invention.
[0048] The beneficial effects of this invention are as follows:
[0049] Compared with the prior art, the present invention has the following significant advantages:
[0050] 1. High prediction accuracy: By effectively modeling the long-range time-series dependence of heave signals through the context-aware embedding module, and combining the dual-path module to collaboratively characterize the global trend and local details, it can still maintain excellent prediction accuracy under complex sea conditions (RMSE can reach 0.0085 meters and R² can reach 0.9998 on simulation data).
[0051] 2. Extremely lightweight model: It innovatively integrates efficient operations such as grouped dilated convolution, depthwise separable convolution, and channel shuffling, which reduces the number of core parameters of the model to about 30,000, the computational cost to less than 0.2 MFLOPs, and the model size to about 0.12MB. After quantization, it can be further compressed to 0.09MB, which greatly reduces the storage and computing resource requirements.
[0052] 3. Extremely fast inference speed: Thanks to the fully convolutional and lightweight design, the inference time of a single multi-step prediction on a general-purpose CPU edge device can be as short as 0.44 milliseconds, which fully meets the strict requirements of the active heave compensation system for millisecond-level real-time control.
[0053] 4. Strong engineering generalization ability: The model pre-trained on simulation data only needs to be fine-tuned at the network end using a small amount of target real ship data to quickly adapt to real ships and sea conditions, demonstrating good cross-domain transfer ability and engineering practical value. Attached Figure Description
[0054] Figure 1 This is a schematic diagram of the overall architecture of the LCGNet network provided by the present invention;
[0055] Figure 2 for Figure 1 A detailed structural diagram of the context-aware embedding module;
[0056] Figure 3 for Figure 1 A detailed structural diagram of the dual-path multi-scale feature extraction module;
[0057] Figure 4 This is a schematic diagram illustrating the complete process of model training and deployment. Detailed Implementation
[0058] The present invention will be further described below with reference to the embodiments and accompanying drawings, but is not limited thereto.
[0059] Example 1
[0060] Model building, training, and comprehensive testing based on simulation data
[0061] This embodiment comprehensively demonstrates the construction and training process of the LCGNet model in a ship motion simulation environment, and verifies its prediction accuracy, robustness and lightweight characteristics through detailed simulation test data.
[0062] A method for predicting ship heave motion based on a lightweight context-aware network, the method comprising the following steps:
[0063] S1: Signal Acquisition and Preprocessing
[0064] The ship's heave motion timing signal is collected, the original signal is filtered and noise-reduced, and then downsampled to the target frequency before data standardization is performed.
[0065] The specific steps are as follows:
[0066] S1-1, Data Generation: Data was generated using the Marine Systems Simulator (MSS), a widely recognized tool in the field of shipbuilding and ocean engineering. The S175 ship type was selected, and the JONSWAP wave spectrum model was used. Three typical sea states were set with significant wave heights Hs of 2.5 meters, 3.5 meters, and 5.0 meters, respectively, to generate a total of 300 hours of ship heave motion time series data. The original sampling frequency was 200 Hz. To simulate the real sensor environment, an appropriate amount of Gaussian white noise was superimposed on the simulation signal.
[0067] S1-2, Preprocessing: Downsample all data to 10Hz, calculate the mean μ and standard deviation σ of the entire training set, and standardize all data: x_norm = (x - μ) / σ.
[0068] S1-3, Sample Construction: Supervised learning samples are constructed using the sliding window method. The historical observation length L_hist = 128 (corresponding to 12.8 seconds of history) and the future prediction length L_pred = 16 (corresponding to 1.6 seconds of future) are set. For a sequence of length T, T - L_hist - L_pred + 1 sample pairs (X, Y) can be generated, where X ∈ R^(L_hist) is the input, Y ∈ R^(L_pred) is the prediction target, and R represents the set of real numbers.
[0069] S1-4. Dataset partitioning: The data containing the three sea states is randomly shuffled and divided into a training set and a test set in a 4:1 ratio. The training set is further divided into a 70% training subset for parameter updates and a 30% validation set for monitoring the training process and preventing overfitting.
[0070] S2: Multi-step prediction of heave motion based on LCGNet network
[0071] The preprocessed historical sequence is input into the LCGNet network, which includes a context-aware embedding module, a dual-path multi-scale feature extraction module, and a prediction output layer. The network outputs the predicted heave motion values for multiple future time steps via forward propagation.
[0072] Figure 1 This demonstrates the overall structure of the LCGNet network, including the input layer, context-aware embedding module, dual-path multi-scale feature extraction module, feature fusion points, prediction output layer, and the data flow dimension changes of each part. Figure 1 The architecture shown uses a deep learning framework to build the LCGNet model. The hyperparameters of the core modules are set as follows: Input layer: accepts inputs of shape (batch_size, 128, 1).
[0073] (1). Context-aware Embedded Module (CPE): Figure 2 The internal structure of the context-aware embedding module is described in detail, demonstrating a progressive process that starts with the input sequence and proceeds through 1×1 convolutions, multi-level grouped dilation convolutions (with dilation rates of 1, 3, and 5), depthwise convolution downsampling, and channel shuffling operations, ultimately resulting in a compressed embedding. This module does not explicitly segment the input sequence; instead, it uses progressive downsampling and hybrid dilation grouped convolutions to efficiently aggregate contextual information across time periods while compressing the sequence length. Specifically, it employs at least two grouped convolutional layers with different dilation rates, and inserts depthwise convolutions between layers for downsampling and channel shuffling operations. This expands the receptive field and promotes channel information interaction under lightweight constraints, ultimately outputting a compact feature embedding rich in long-range dependencies.
[0074] Furthermore, in this embodiment, the context-aware embedding module (CPE) includes:
[0075] 1×1 convolution: 64 filters;
[0076] Grouped dilated convolutional layer 1: dilation rate r=1, number of groups G=4, convolutional kernel k=3, stride s=2;
[0077] Depthwise separable convolution 1: kernel size 3, stride 2;
[0078] Channel Mixed Wash 1: Number of mixed wash groups S=2;
[0079] Grouped dilated convolutional layer 2: dilation rate r=3, number of groups G=4, convolutional kernel k=3, stride s=1;
[0080] Depthwise separable convolution 2: kernel size 3, stride 2;
[0081] Channel mixed washing 2: Number of mixed washing groups S=2;
[0082] Grouped dilated convolutional layer 3: dilation rate r=5, number of groups G=4, convolutional kernel k=3, stride s=1.
[0083] (2). Dual-path multi-scale feature extraction module (DMFE): This module receives the feature embedding and performs collaborative feature enhancement through two parallel paths: Figure 3 The structure of the dual-path multi-scale feature extraction module is described in detail. The upper part is the pooling, fully connected and feature scaling process of the global path, the lower part is the channel shuffling, segmentation, multi-scale depth convolution and concatenation process of the local path, and the middle part is the fusion operation of the outputs of the two paths.
[0084] Global Path: Global average pooling and global max pooling are used to extract window-level statistical features. A lightweight multilayer perceptron generates channel attention weights, and global statistical shaping is performed on the feature embeddings to stabilize the amplitude scale under different sea conditions. Further, the global path performs the following operations: global average pooling and global max pooling are performed on the input feature embeddings respectively to obtain two pooling statistical vectors; the two pooling statistical vectors are each passed through a fully connected layer and a sigmoid activation function to generate two channel weight vectors; the two channel weight vectors are added to obtain a fused global channel weight vector; the global channel weight vector is broadcast in the time dimension and multiplied element-wise with the original feature embeddings to output the globally shaped features; in this embodiment, both fully connected layers have 64 units, and the activation function is sigmoid.
[0085] Local Path: Through channel shuffling and channel segmentation, features are fed into depthwise separable convolutional branches with different kernel sizes to extract multi-scale local temporal morphological features in parallel. These features are then concatenated and merged into a single feature tensor to capture key local changes such as peaks and troughs. The local path performs the following operations: channel shuffling of the input feature embeddings; uniform segmentation of the shuffled features into K sub-parts along the channel dimension, where K≥2; inputting each sub-part into a depthwise separable convolutional layer, with at least two depthwise separable convolutional layers having different kernel sizes; concatenating the outputs of the depthwise separable convolutional layers along the channel dimension; and performing channel shuffling again on the concatenated features to output local multi-scale features. In this embodiment, the channel segmentation ratio is 0.5, the kernel sizes of the two depthwise separable convolutional branches are 3 and 5, respectively, and the number of output channels is 32 for each branch.
[0086] Finally, the output features of the global path and the local path are multiplied element-wise to achieve adaptive fusion of global statistical information and local morphological information.
[0087] (3). Prediction output layer: includes two standard convolutional layers and one fully connected layer, which integrates and nonlinearly maps the fused high-level features to output the final multi-step prediction sequence.
[0088] In this embodiment:
[0089] Standard convolutional layer 1: 32 filters, kernel size 1;
[0090] Standard convolutional layer 2: 16 filters, kernel size 1;
[0091] Fully connected layer: 16 output units.
[0092] Total number of parameters: 30,625.
[0093] S3: Model Training and Optimization
[0094] A training set was constructed using historical heave and sag data. The Huber loss between predicted and true values was used as the optimization objective. The LCGNet network parameters were trained using the gradient descent algorithm until the model converged.
[0095] The training steps include:
[0096] S3-1. Training configuration: Using the Adam optimizer, the initial learning rate is set to 0.001, the loss function is HuberLoss (δ=1.0), and the batch size is set to 32.
[0097] S3-2. Training process: Iterative training is performed on the training subset. After each epoch, the loss is calculated on the validation set. An "early stop" strategy is adopted: if the validation set loss does not decrease for 10 consecutive epochs, the training is terminated and the model parameters with the minimum validation loss are rolled back.
[0098] S3-3. Data Augmentation: During the training phase, weak zero-mean Gaussian noise is randomly added to each batch of input data to improve the model's robustness to measurement noise.
[0099] The trained LCGNet model was comprehensively evaluated on an independent test set. All test data were generated by MSS simulation software to ensure the reliability and reference value of the evaluation results.
[0100] 1) Basic predictive performance evaluation:
[0101] On a mixed test set covering various sea states, the model achieved the following performance in predicting heave motion over the next 1.6 seconds (16 steps):
[0102] Root mean square error (RMSE): 0.0085 meters
[0103] Mean absolute error (MAE): 0.0058 meters
[0104] Coefficient of determination (R²): 0.9998
[0105] The above data demonstrate that this method possesses excellent comprehensive prediction accuracy under complex and ever-changing simulated sea conditions.
[0106] 2). Robustness verification under different sea state conditions:
[0107] To specifically verify the adaptability of the method of this invention to different marine environmental intensities, the test data were subdivided and evaluated according to the significant wave height (Hs) preset during simulation. As shown in Table 1, the method maintained stable high prediction accuracy under a series of sea states ranging from calm to severe (Hs increasing from 2.5 meters to 5.0 meters). In particular, under severe sea state Hs=5.0m, the RMSE remained at a low level of 0.0112 meters, and the R² was as high as 0.9998, fully demonstrating the robustness of the method and its ability to meet the prediction needs under a wide range of operating sea states.
[0108] Table 1: Prediction performance of the model based on simulation data at different salient wave heights (Hs)
[0109] Significant wave height Hs (meters) RMSE (meter) MAE (meter) R² 2.5 0.0053 0.0039 0.9988 3.5 0.0065 0.0039 0.9998 5.0 0.0112 0.0082 0.9998
[0110] 3). Lightweight feature verification:
[0111] While achieving high prediction accuracy, this method exhibits extreme model efficiency, as shown in the following metrics:
[0112] Number of model parameters: 30,625
[0113] Computational complexity: 0.17 MFLOPs (millions of floating-point operations)
[0114] Model file size: approximately 0.12 MB
[0115] These quantitative metrics demonstrate that LCGNet has successfully achieved an excellent balance between prediction accuracy and model efficiency. Its extremely small model size and computational overhead are key prerequisites for its deployment on resource-constrained shipboard edge devices.
[0116] 4). Ablation experiment analysis:
[0117] To verify the technical contributions of each module (Context-Aware Embedding Module CPE, Dual-Path Multi-Scale Feature Extraction Module DMFE and its sub-paths), ablation experiments were conducted based on simulation data. Key comparative results include:
[0118] If the CPE module is removed, the model's RMSE degrades significantly to 0.0604 meters, indicating that this module is crucial for establishing effective long-range time-series context and ensuring basic prediction performance.
[0119] If the global path (GMB) in the DMFE module is removed, the RMSE increases to 0.0253 meters, proving that global statistical shaping is indispensable for stabilizing the model output and adapting to input signals with different energy levels.
[0120] If the Local Path (LCB) in the DMFE module is removed, the RMSE increases to 0.0215 meters, demonstrating that local multi-scale morphological feature extraction plays an important role in capturing detailed changes in heave motion and improving local fitting accuracy.
[0121] The above comparative data clearly demonstrate that the overall network structure defined by this invention and the synergistic effect of its various components jointly achieve the final excellent prediction performance.
[0122] S4: Model Deployment and Real-Time Prediction
[0123] The general model pre-trained on authoritative simulation data is quickly adapted to a specific real ship environment and its engineering deployment on edge devices is completed.
[0124] The trained LCGNet model is quantized and compressed, and deployed on a shipboard edge computing device. During system operation, historical heave data is collected in real time and input into the model. Step S2 is executed cyclically to achieve continuous online prediction of future heave motion.
[0125] The specific steps include:
[0126] S4-1: Data Collection and Preparation for Actual Ship Operations
[0127] Real heave motion data were collected from the target ship's Motion Reference Unit (MRU), with the original sampling frequency processed to 10Hz.
[0128] The actual heave motion data of this segment is standardized in a similar manner to that described above. For rapid adaptation, the mean and standard deviation calculated by the actual ship data itself can be used directly.
[0129] The data was divided into a fine-tuning training set (first 1600 seconds) and a final test set (last 400 seconds) in chronological order.
[0130] S4-2: Model Transfer Learning (Fine-tuning)
[0131] Load the pre-trained model: Load the weights of the trained LCGNet model.
[0132] Freeze the front-end network: Freeze all parameters of the context-aware embedding module (CPE) and the dual-path multi-scale feature extraction module (DMFE) to retain their learned general spatiotemporal feature extraction capabilities.
[0133] Fine-tuning the terminal network: unlock only the parameters of the prediction output layer, allowing it to be adjusted on new real-world ship data.
[0134] Fine-tuning training: Using the real ship training set, the model is trained for 30 epochs with a smaller learning rate (0.0001) and the same Huber Loss (δ=1.0) than the original predicted output layer, in order to quickly adapt to possible distribution differences between the real ship data and the simulation data.
[0135] S4-3: Model Quantization and Deployment
[0136] Model quantization: The fine-tuned model is quantized using Float16 using deployment tools such as TensorFlow Lite Converter. This process converts the model weights from 32-bit floating-point numbers to 16-bit floating-point numbers, compressing the model file size from approximately 0.12MB to approximately 0.09MB.
[0137] Integration and Inference Testing: The quantized model file was integrated into the prediction software of a shipboard edge computing device (such as an industrial control computer equipped with an Intel Core i5-13600K). Performance tests were run on the device, and the average time for a single prediction (128 points of historical data input and 16 points of future data output) was measured to be approximately 0.44 milliseconds.
[0138] Figure 4 The complete implementation steps of the method of the present invention are illustrated in the form of a flowchart, from data acquisition, preprocessing, model forward prediction, to model training, quantization, and finally deployment and operation on edge devices.
[0139] Online performance verification and conclusions
[0140] The deployed prediction system was run on a reserved real-ship test set for continuous online prediction. Evaluation results show that, after minor adjustments with a small amount of data, the model's prediction accuracy on real-ship data is: RMSE ≈ 0.0110 meters, MAE ≈ 0.0080 meters. This accuracy, combined with millisecond-level inference latency, fully demonstrates that the method of this invention not only possesses high accuracy and strong robustness but also demonstrates genuine engineering deployment feasibility, meeting the core requirement of real-time prediction for a real-ship active heave compensation system.
[0141] Example 2
[0142] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in the ship heave motion prediction method based on a lightweight context-aware network as described in Embodiment 1.
[0143] Example 3
[0144] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the ship heave motion prediction method based on a lightweight context-aware network as described in Embodiment 1.
[0145] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for predicting ship heave motion based on lightweight context-aware networks, characterized in that, Includes the following steps: S1: Signal Acquisition and Preprocessing The ship's heave motion timing signal is collected, the raw signal is filtered and noise-reduced, and then downsampled to the target frequency before data standardization is performed. S2: Multi-step prediction of heave motion based on LCGNet network The structural features of the LCGNet network are as follows: (1). Context-aware embedding module: includes a 1×1 convolutional layer input, at least one set of processing units, each set of processing units includes: a group convolutional layer with a specific dilation rate, a depth convolutional layer for downsampling, and a channel shuffling layer. The dilation rate of the group convolutional layer of each set of processing units increases progressively between each set. After the last set of processing units, it passes through a group convolutional layer with the maximum dilation rate to output the final feature embedding. (2). Dual-path multi-scale feature extraction module: This module receives the feature embedding and performs collaborative feature enhancement through two parallel paths: Global path: Global average pooling and global max pooling are used to extract window-level statistical features. Channel attention weights are generated through a lightweight multilayer perceptron, and global statistical shaping is performed on the feature embedding. Local Path: Through channel shuffling and channel segmentation, features are fed into depthwise separable convolutional branches with different kernel sizes to extract multi-scale local temporal morphological features in parallel. Finally, the output features of the global path and the local path are multiplied element by element to achieve adaptive fusion of global statistical information and local morphological information. (3). Prediction output layer: includes one or two standard convolutional layers and a fully connected layer, which integrates and nonlinearly maps the fused high-level features to output the final multi-step prediction sequence; The preprocessed historical sequence is input into the LCGNet network, which includes a context-aware embedding module, a dual-path multi-scale feature extraction module, and a prediction output layer. The network outputs the predicted heave motion values for multiple future time steps using a forward propagation method. The context-aware embedding module is used to compress the input sequence and aggregate context information across time periods through progressive downsampling and hybrid dilated convolution, and output a compact feature embedding. The dual-path multi-scale feature extraction module is used to perform collaborative feature enhancement and fusion on the feature embedding through parallel global and local paths. The global path is used to perform channel-level feature shaping based on window statistics, and the local path is used to extract multi-scale local temporal morphological features. S3: Model Training and Optimization A training set was constructed using historical heave and sag data. The Huber loss between the predicted and actual values was used as the optimization objective. The LCGNet network parameters were trained using the gradient descent algorithm until the model converged. S4: Model Deployment and Real-Time Prediction The trained LCGNet model is quantized and compressed, and deployed on a shipboard edge computing device. During system operation, historical heave data is collected in real time and input into the model. Step S2 is executed cyclically to achieve continuous online prediction of future heave motion.
2. The ship heave prediction method based on a lightweight context-aware network according to claim 1, characterized in that, Step S1 includes the following specific steps: S1-1, Data Generation: Data is generated using a ship motion simulator; the original sampling frequency is 200Hz; Gaussian white noise is superimposed on the simulation signal; S1-2, Preprocessing: Downsample all data to 10Hz, calculate the mean μ and standard deviation σ of the entire training set, and standardize all data: x_norm = (x - μ) / σ; S1-3, Sample Construction: Supervised learning samples are constructed using the sliding window method; the historical observation length L_hist and the future prediction length L_pred are set. For a sequence of length T, T - L_hist - L_pred + 1 sample pairs (X, Y) are generated, where X ∈ R^(L_hist) is the input, Y ∈ R^(L_pred) is the prediction target, and R represents the set of real numbers. S1-4. Dataset partitioning: Randomly shuffle the data and divide it into training and test sets in a 4:1 ratio. Further divide the training set into a 70% training subset for parameter updates and a 30% validation set for monitoring the training process.
3. The ship heave prediction method based on a lightweight context-aware network according to claim 1, characterized in that, In step S2, within the context-aware embedding module, the number of groups in the grouped convolutional layer is G=4; the number of shuffling groups in the channel shuffling layer is S=2.
4. The method for predicting ship heave motion based on a lightweight context-aware network according to claim 1, characterized in that, In step S2, the dual-path multi-scale feature extraction module performs the following operations on the global path: Global average pooling and global max pooling are performed on the input feature embeddings to obtain two pooling statistical vectors; the two pooling statistical vectors are passed through a fully connected layer and a Sigmoid activation function to generate two channel weight vectors; the two channel weight vectors are added together to obtain a fused global channel weight vector; the global channel weight vector is broadcast over time and multiplied element-wise with the original feature embeddings to output the globally shaped features. The local path performs the following operations: channel shuffling is performed on the input feature embedding; the shuffled features are uniformly divided into K sub-parts along the channel dimension, where K≥2; each sub-part is input into a depthwise separable convolutional layer, wherein at least two depthwise separable convolutional layers have different kernel sizes; the outputs of each sub-part processed by the depthwise separable convolutional layer are concatenated along the channel dimension; the concatenated features are shuffled again to output local multi-scale features.
5. The ship heave prediction method based on a lightweight context-aware network according to claim 4, characterized in that, In the global path, both fully connected layers have 64 units.
6. The method for predicting ship heave motion based on a lightweight context-aware network according to claim 1, characterized in that, The predicted output layer in step S2 includes: standard convolutional layer 1: 32 filters, kernel size 1; standard convolutional layer 2: 16 filters, kernel size 1; and fully connected layer: 16 output units.
7. The method for predicting ship heave motion based on a lightweight context-aware network according to claim 1, characterized in that, Step S3 training steps include: S3-1. Training configuration: Using the Adam optimizer, the initial learning rate is set to 0.001, the loss function is HuberLoss with δ=1.0, and the batch size is set to 32; S3-2. Training process: Iterative training is performed on the training subset. After each epoch, the loss is calculated on the validation set. An early stopping strategy is adopted: if the validation set loss does not decrease for 10 consecutive epochs, the training is terminated and the model parameters with the minimum validation loss are rolled back. S3-3. Data Augmentation: During the training phase, zero-mean Gaussian noise is randomly added to each batch of input data.
8. The method for predicting ship heave motion based on a lightweight context-aware network according to claim 2, characterized in that, Step S4 includes the following specific steps: S4-1: Data Collection and Preparation for Actual Ship Operations Real heave motion data were collected from the target ship's motion reference unit (MRU), with the original sampling frequency processed to 10Hz. The actual heave motion data of this segment were standardized by using the mean and standard deviation calculated from the actual ship data itself. The data is divided into a fine-tuning training set and a final test set in chronological order. S4-2: Model Transfer Learning Loading the pre-trained model: Loading the weights of the trained LCGNet model; Freeze the front-end network: Freeze all parameters of the context-aware embedding module and the dual-path multi-scale feature extraction module; Fine-tune the terminal network: Unlock only the parameters of the prediction output layer; Fine-tuning training: Using the real ship fine-tuning training set, the model was trained for 30 epochs with a smaller learning rate than the original predicted output layer and the same HuberLossδ=1.
0. S4-3: Model Quantization and Deployment Model quantization: The fine-tuned model is quantized using Float16 using deployment tools; Integration and Inference Testing: The quantized model file is integrated into the prediction software of the shipborne edge computing device, and performance tests are run on the device.
9. A computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the steps of the ship heave motion prediction method based on a lightweight context-aware network as described in claim 1.
Citation Information
Patent Citations
Speech enhancement method based on FirePS convolutional neural network
CN115497496A
Conv-Bi-LSTM model-based ship heaving motion prediction system and prediction method
CN116280094A