An intelligent correction method for wave forecasting

By introducing the Transformer block and multi-head self-attention mechanism into UNet, combined with dynamic attention adjustment and pre-training models, the limitations of traditional wave forecasting methods in accuracy and adaptive capabilities are solved, and more efficient and accurate wave predictions are achieved. forecast.

CN118504779BActive Publication Date: 2024-09-27青岛阅海信息服务有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410946723.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-09-27
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

When dealing with large-scale and complex marine environment data, traditional wave forecasting methods are difficult to capture the detailed characteristics of waves and understand complex ocean dynamic processes, and have limitations in accuracy, real-time performance and adaptive capabilities.

Method used

An intelligent correction method for wave forecast is adopted, by introducing the Transformer block in the encoder and decoder layers of UNet, combining the multi-head self-attention mechanism, feed-forward neural network and dynamic attention adjustment mechanism, and utilizing the pre-trained ocean environment data model , optimize the model to improve the accuracy and adaptive ability of wave forecast.

Benefits of technology

The model's ability to capture wave patterns and prediction accuracy are significantly improved, enabling more efficient wave forecasting, enabling rapid adaptation to environmental changes and providing high-quality prediction services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118504779B
    Figure CN118504779B
Patent Text Reader

Abstract

The present invention relates to the field of forecast correction technology, and specifically to an intelligent correction method for wave forecast, comprising the following steps: introducing a self-attention mechanism in each layer of the encoder and decoder of UNet, and transforming each layer into a Transformer block; in the model initialization stage, using a pre-trained Transformer model to initialize the Transformer block in UNet; implementing a multi-head self-attention mechanism in each Transformer block; dynamically adjusting the attention weight in each Transformer block according to the characteristics of the input image and the needs of wave forecast; model training and optimization; hyperparameter adjustment and performance evaluation, by adjusting the hyperparameters and continuously evaluating the model prediction performance. The present invention can provide higher prediction accuracy and more detailed feature performance when processing complex marine environment images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of forecast correction, and in particular to an intelligent correction method for wave forecast. Background Art

[0002] In the field of wave forecasting, traditional methods usually rely on physical models or classical statistical analysis to predict wave dynamics. These methods face many challenges when processing large-scale and complex ocean environment data, especially in capturing the detailed characteristics of waves and understanding complex ocean dynamic processes. Although these traditional technologies have achieved certain successes in history, they still have limitations in accuracy, real-time and adaptability.

[0003] With the development of deep learning technology, especially convolutional neural networks (CNN) and Transformer models, they have shown powerful performance in image processing and sequence data analysis, and are particularly suitable for processing massive amounts of ocean observation data and capturing complex patterns of wave behavior. However, the direct application of these deep learning models to wave forecasting still faces challenges, such as how to effectively integrate the models to take advantage of their advantages in spatial and temporal analysis, and how to adjust and optimize the models to suit specific wave forecasting needs.

[0004] Therefore, there is an urgent need to develop a new wave forecasting method that can fully utilize the advantages of deep learning, especially combining the spatial feature extraction capability of convolutional neural networks and the long-range sequence dependency capture capability of Transformer, so as to provide more accurate, real-time and adaptive wave forecast results. Summary of the invention

[0005] Based on the above purpose, the present invention provides an intelligent correction method for wave forecasting.

[0006] A method for intelligent correction of sea wave forecasting comprises the following steps:

[0007] S1: In the architecture integration phase, the self-attention mechanism is introduced in each layer of the encoder and decoder of UNet, and each layer is transformed into a Transformer block to enhance the model's understanding and processing capabilities of input data;

[0008] S2: Model initialization phase, using the pre-trained Transformer model to initialize the Transformer block in UNet, using the capabilities of the pre-trained model to accelerate the learning process and improve prediction accuracy;

[0009] S3: Application of self-attention mechanism. Multi-head self-attention mechanism is implemented in each Transformer block, allowing the network to capture the detailed relationship between the parts in the input image sequence and enhance the ability to understand the global information and local features of the image.

[0010] S4: Dynamic attention adjustment mechanism, which dynamically adjusts the attention weights in each Transformer block according to the characteristics of the input image and the needs of wave forecasting, ensuring that the network prioritizes the image areas that contribute most to the prediction results;

[0011] S5: Model training and optimization: Use the labeled wave forecast dataset to train the model, select the cross entropy loss and Adam optimizer, and perform back propagation and parameter update of the model;

[0012] S6: Hyperparameter Tuning and Performance Evaluation, by adjusting the hyperparameters and continuously evaluating the model prediction performance to ensure efficient learning and accurate prediction of waves.

[0013] Furthermore, the S1 specifically includes:

[0014] S11: A Transformer block consisting of a multi-head self-attention layer, a feed-forward neural network layer, and a residual connection is embedded in each encoder and decoder layer of UNet;

[0015] S12: For each Transformer block, the input feature map is first processed by a multi-head self-attention layer to capture feature relationships in different subspaces in parallel;

[0016] S13: Use residual connections to add the output of the multi-head self-attention layer to the original input to enhance information flow and prevent gradient vanishing;

[0017] S14: Pass the output of the residual connection to the feed-forward neural network layer to refine and enhance the feature representation;

[0018] S15: Residual connections are applied again after the output of the feedforward neural network to ensure the effective transfer and utilization of information in the deep network;

[0019] S16: Repeat S12-S15 until all encoder and decoder layers of UNet have been enhanced with Transformer blocks.

[0020] Furthermore, the S2 specifically includes:

[0021] S21: Select the Transformer model pre-trained based on marine environment data and extract the parameters of the pre-trained model, including the weights and biases of the multi-head self-attention mechanism, feedforward neural network, and residual connection;

[0022] S22: Map the pre-trained parameters to the Transformer block of UNet. For each encoder and decoder layer of the Transformer block, initialize it with the corresponding pre-trained weights and biases.

[0023] S23: During the initialization process, ensure that the parameter structure of the pre-trained model matches the Transformer block structure in UNet, and make corresponding adjustments or conversions to ensure the consistency of the model structure and the integrity of its functions.

[0024] Furthermore, the S3 specifically includes:

[0025] S31: A multi-head self-attention layer is set in each Transformer block. The multi-head self-attention layer consists of multiple parallel attention mechanisms, each of which focuses on a different part of the input feature map;

[0026] S32: Decompose the input feature map into different subsets, each subset corresponds to the input of an attention mechanism, process information from multiple perspectives in parallel, and enhance the information capture ability of the model;

[0027] S33: For each attention mechanism, the query Q, key K and value V matrices are calculated, each of which is obtained by linear transformation of the corresponding input feature map;

[0028] S34: In each attention mechanism, the attention score matrix is ​​generated by calculating the dot product of Q and K, and then the softmax function is applied to normalize these scores to obtain the attention weights, which are multiplied by the V matrix to produce weighted output features, allowing the model to dynamically adjust the contribution of each input part;

[0029] S35: The weighted output features generated by all attention mechanisms are merged to form the final output of the Transformer block, integrating information from different perspectives and enhancing the model's ability to understand global information and local features.

[0030] Furthermore, the query ,key Sum The calculation includes:

[0031] For the input feature map , using different weight matrices , , To convert To obtain , and :

[0032] ;

[0033] ;

[0034] ;

[0035] in, , , are trainable parameter matrices used to generate query, key, and value matrices respectively;

[0036] The attention score is calculated by taking the dot product of the query matrix and the key matrix, and scaled by the square root of the key dimension:

[0037] ,in, is the dimension of the key matrix, divided by This is to control the magnitude of the inner product and prevent the gradient from disappearing or exploding.

[0038] Furthermore, the S4 specifically includes:

[0039] S41: Analyze the input image sequence and identify the feature area that contributes most to the wave prediction, including the starting point, crest and trough features of the wave;

[0040] S42: In each Transformer block, a dynamic weight adjustment module is introduced. The dynamic weight adjustment module adjusts the attention weight according to the characteristics of the input image and the specific requirements of the wave forecast. The content-based attention weight adjustment strategy is used, in which the attention weight depends not only on the relative relationship between the input features, but also on the relevance of the features themselves to the wave forecast task.

[0041] S43: Implement a feedback mechanism to optimize the attention weight adjustment strategy by analyzing the difference between the results of the previous prediction cycle and the actual observation data, and apply the adjusted attention weights to the multi-head self-attention mechanism in the Transformer block to ensure that the model can focus on processing the image area that contributes most to the prediction of wave dynamics.

[0042] Furthermore, the dynamic weight adjustment module adjusts the attention weight based on the correlation between the input features and the prediction task. Assuming that the preliminary attention weight A is calculated by the multi-head self-attention mechanism, the dynamic adjustment process of the attention weight is expressed as:

[0043] Feature importance evaluation: For each feature of the input image, calculate its score of relevance to the wave forecasting task ,Score This is done through a small neural network or scoring function that takes into account the content of the feature and its importance in wave forecasting: ,in are input features, is a function of the relevance of the assessment feature to the wave forecast;

[0044] Dynamic adjustment of attention weights: Use the importance score of the feature to adjust the original attention weights to obtain the adjusted attention weights ,in represents element-wise multiplication, Make sure all adjusted weights add up to 1.

[0045] Furthermore, the S5 specifically includes:

[0046] Dataset preparation: Prepare a labeled wave forecast dataset, including wave image data and its corresponding forecast results (wave height, period) as labels;

[0047] Cross-entropy loss calculation: For each output of the model, a cross-entropy loss function is used to calculate the difference between the predicted value and the true label:

[0048] ,in, is the true label, is the model prediction value, is the calculated loss;

[0049] Adam optimizer parameter update: Use Adam optimizer to update the parameters of the model;

[0050] Backpropagation and parameter update: During the training process, the prediction results and losses are first obtained through forward propagation. Then, the backpropagation algorithm is used to calculate the gradient of the loss function with respect to the model parameters. Finally, the Adam optimizer formula is applied to update the model parameters to minimize the cross entropy loss.

[0051] Furthermore, the Adam optimizer combines the advantages of momentum and adaptive learning rate, and the parameter update formula is:

[0052] ,in, is at the time step Parameters, is the learning rate, and are the bias-corrected first-order and second-order moment estimates, is a small constant added to increase numerical stability.

[0053] Furthermore, the S6 specifically includes:

[0054] Hyperparameter tuning: Determine the key hyperparameters that affect the model learning process and prediction performance. Key hyperparameters include learning rate, batch size, number of training epochs, and number of self-attention heads within the Transformer block.

[0055] Use Bayesian optimization methods to explore different hyperparameter combinations to find the optimal configuration so that the model performs best on the validation set;

[0056] Model performance evaluation: After each round of training, the model is evaluated using the validation set to calculate the accuracy, recall, and loss function values.

[0057] Beneficial effects of the present invention:

[0058] The present invention significantly enhances the model's ability to capture the detailed relationship between various parts in the input image sequence by introducing Transformer blocks, especially the multi-head self-attention mechanism, into the encoder and decoder layers of UNet. This mechanism enables the model to understand and predict wave patterns more effectively, and strengthens the understanding of the global information and local features of the image. Therefore, compared with the traditional UNet model, it can provide higher prediction accuracy and more detailed feature expression when processing complex ocean environment images.

[0059] The present invention uses a Transformer model pre-trained based on marine environment data to initialize the Transformer block in UNet, and utilizes the capabilities of the pre-trained model to accelerate the learning process. This strategy not only reduces the time required to train the model from scratch, but also improves the generalization ability of the model on specific wave forecasting tasks. The knowledge transfer of the pre-trained model enables the present invention to quickly adapt to new prediction tasks, thereby improving the prediction accuracy of the model.

[0060] The present invention realizes self-correction and optimization of model prediction performance through dynamic attention adjustment mechanism and continuous performance evaluation. The dynamic attention adjustment mechanism adjusts the attention weight according to the characteristics of the input image and the needs of wave prediction, ensuring that the model focuses on the most important area for the prediction result. In addition, by adjusting the hyperparameters through methods such as Bayesian optimization and combining the performance evaluation of the model, the learning efficiency and prediction accuracy can be continuously improved. These features enable the model to adapt to various environmental changes in long-term operation and continuously provide high-quality wave forecast services. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0062] Figure 1 A schematic diagram of a method flow of an embodiment of the present invention;

[0063] Figure 2 Schematic diagram of the self-attention mechanism application process of an embodiment of the present invention. DETAILED DESCRIPTION

[0064] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0065] like Figure 1-Figure 2 As shown, a method for intelligent correction of wave forecasting includes the following steps:

[0066] S1: In the architecture integration phase, the self-attention mechanism is introduced in each layer of the encoder and decoder of UNet, and each layer is transformed into a Transformer block to enhance the model's understanding and processing capabilities of input data;

[0067] S2: Model initialization phase, using the pre-trained Transformer model to initialize the Transformer block in UNet, using the capabilities of the pre-trained model to accelerate the learning process and improve prediction accuracy;

[0068] S3: Application of self-attention mechanism. Multi-head self-attention mechanism is implemented in each Transformer block, allowing the network to capture the detailed relationship between the parts in the input image sequence and enhance the ability to understand the global information and local features of the image.

[0069] S4: Dynamic attention adjustment mechanism, which dynamically adjusts the attention weights in each Transformer block according to the characteristics of the input image and the needs of wave forecasting, ensuring that the network prioritizes the image areas that contribute most to the prediction results;

[0070] S5: Model training and optimization: Use the labeled wave forecast dataset to train the model, select the cross entropy loss and Adam optimizer, and perform back propagation and parameter update of the model;

[0071] S6: Hyperparameter Tuning and Performance Evaluation, by adjusting the hyperparameters and continuously evaluating the model prediction performance to ensure efficient learning and accurate prediction of waves.

[0072] S1 specifically includes:

[0073] S11: A Transformer block consisting of a multi-head self-attention layer, a feed-forward neural network layer, and a residual connection is embedded in each encoder and decoder layer of UNet;

[0074] S12: For each Transformer block, the input feature map is first processed by a multi-head self-attention layer to capture feature relationships in different subspaces in parallel;

[0075] S13: Use residual connections to add the output of the multi-head self-attention layer to the original input to enhance information flow and prevent gradient vanishing;

[0076] S14: Pass the output of the residual connection to the feed-forward neural network layer to refine and enhance the feature representation;

[0077] S15: Residual connections are applied again after the output of the feedforward neural network to ensure the effective transfer and utilization of information in the deep network;

[0078] S16: Repeat S12-S15 until all encoder and decoder layers of UNet have been enhanced with Transformer blocks.

[0079] The feedforward neural network consists of two linear transformation layers with an activation function (ReLU) in between. The input data first passes through the first linear layer and the activation function, and then passes through the second linear layer.

[0080] Residual connections and layer normalization: Residual connections are applied to the outputs of multi-head self-attention and feed-forward neural networks, that is, these outputs are directly added to the corresponding inputs. Layer normalization is used to stabilize the training process, which is usually applied after the residual connection.

[0081] S2 specifically includes:

[0082] S21: Select the Transformer model pre-trained based on marine environment data and extract the parameters of the pre-trained model, including the weights and biases of the multi-head self-attention mechanism, feedforward neural network, and residual connection;

[0083] S22: Map the pre-trained parameters to the Transformer block of UNet. For each encoder and decoder layer of the Transformer block, initialize it with the corresponding pre-trained weights and biases.

[0084] S23: During the initialization process, ensure that the parameter structure of the pre-trained model matches the Transformer block structure in UNet, and make corresponding adjustments or conversions to ensure the consistency of the model structure and the integrity of its functions.

[0085] The UNet model initialized in this way is then fine-tuned on a specific wave forecast dataset. During the fine-tuning process, the network parameters are adjusted to adapt to the specific wave forecast task, and the knowledge of the pre-trained model is used to accelerate the learning process and improve the prediction accuracy of the model.

[0086] S3 specifically includes:

[0087] S31: A multi-head self-attention layer is set in each Transformer block. The multi-head self-attention layer consists of multiple parallel attention mechanisms, each of which focuses on a different part of the input feature map;

[0088] S32: Decompose the input feature map into different subsets, each subset corresponds to the input of an attention mechanism, process information from multiple perspectives in parallel, and enhance the information capture ability of the model;

[0089] S33: For each attention mechanism, the query Q, key K and value V matrices are calculated, each of which is obtained by linear transformation of the corresponding input feature map;

[0090] S34: In each attention mechanism, the attention score matrix is ​​generated by calculating the dot product of Q and K, and then the softmax function is applied to normalize these scores to obtain the attention weights, which are multiplied by the V matrix to produce weighted output features, allowing the model to dynamically adjust the contribution of each input part;

[0091] S35: Merge the weighted output features generated by all attention mechanisms to form the final output of the Transformer block, integrate information from different perspectives, and enhance the model's ability to understand global information and local features;

[0092] By implementing this multi-head self-attention mechanism in each Transformer block in the network, the network can effectively capture the detailed relationship between the various parts of the input image sequence, thereby enhancing the ability to understand the global information and local features of the image.

[0093] Query ,key Sum The calculation includes:

[0094] For the input feature map , using different weight matrices , , To convert To obtain , and :

[0095] ;

[0096] ;

[0097] ;

[0098] in, , , are trainable parameter matrices used to generate query, key, and value matrices respectively;

[0099] The attention score is calculated by taking the dot product of the query matrix and the key matrix, and scaled by the square root of the key dimension:

[0100] ,in, is the dimension of the key matrix, divided by It is to control the magnitude of the inner product to prevent the gradient from disappearing or exploding;

[0101] In the multi-head self-attention mechanism, the above process is performed multiple times in parallel (once for each head), and the outputs are then combined and passed through another linear layer to produce the final output:

[0102] , where each head is to use different weight matrices , , Computed self-attention, is the weight matrix of the output layer.

[0103] In the present invention, a multi-head self-attention mechanism is used to enhance the ability to capture global information and local features of the image in the encoder and decoder layers of UNet. By introducing this mechanism, the model can more effectively understand and predict wave patterns because it can comprehensively utilize the information provided by different parts of the image, thereby improving the accuracy and detail of the prediction. This method enables the network to not only pay attention to the local features of the image, but also capture how these features interact with each other across the entire image, providing a richer information basis for wave forecasting.

[0104] S4 specifically includes:

[0105] S41: Analyze the input image sequence and identify the feature area that contributes most to the wave prediction, including the starting point, crest and trough features of the wave;

[0106] S42: In each Transformer block, a dynamic weight adjustment module is introduced. The dynamic weight adjustment module adjusts the attention weight according to the characteristics of the input image and the specific requirements of the wave forecast. The content-based attention weight adjustment strategy is used, in which the attention weight depends not only on the relative relationship between the input features, but also on the relevance of the features themselves to the wave forecast task.

[0107] S43: Implement a feedback mechanism to optimize the attention weight adjustment strategy by analyzing the difference between the results of the previous prediction cycle and the actual observation data, and apply the adjusted attention weights to the multi-head self-attention mechanism in the Transformer block to ensure that the model can focus on processing the image area that contributes most to the prediction of wave dynamics;

[0108] Through this dynamic adjustment mechanism, the model can focus more on the key factors affecting the prediction results in the subsequent training and prediction process, thereby improving the overall prediction accuracy and efficiency.

[0109] The dynamic weight adjustment module adjusts the attention weight based on the correlation between the input features and the prediction task. Assuming that the initial attention weight A is calculated through the multi-head self-attention mechanism, the dynamic adjustment process of the attention weight is expressed as:

[0110] Feature importance evaluation: For each feature of the input image, calculate its score of relevance to the wave forecasting task ,Score This is done via a small neural network or scoring function that takes into account the content of the feature and its importance in the wave forecast: ,in are input features, is a function of the relevance of the assessment feature to the wave forecast;

[0111] Dynamic adjustment of attention weights: Use the importance score of the feature to adjust the original attention weights to obtain the adjusted attention weights ,in represents element-wise multiplication, Make sure all adjusted weights add up to 1.

[0112] In the present invention, the mechanism of dynamically adjusting the attention weights allows the network to more accurately focus on the image areas that contribute most to the wave forecast. For example, if the model identifies that the features of certain areas are closely related to upcoming wave events, the features of these areas will receive a higher importance score when calculating the attention weights. In this way, the model can dynamically adjust its focus and focus more on those parts that are most critical to predicting wave dynamics, thereby improving the accuracy and efficiency of predictions.

[0113] S5 specifically includes:

[0114] Dataset preparation: Prepare a labeled wave forecast dataset, including wave image data and its corresponding forecast results (wave height, period) as labels;

[0115] Cross-entropy loss calculation: For each output of the model, a cross-entropy loss function is used to calculate the difference between the predicted value and the true label:

[0116] ,in, is the true label, is the model prediction value, is the calculated loss;

[0117] Adam optimizer parameter update: Use Adam optimizer to update the parameters of the model;

[0118] Backpropagation and parameter update: During the training process, the prediction results and losses are first obtained through forward propagation. Then, the backpropagation algorithm is used to calculate the gradient of the loss function with respect to the model parameters. Finally, the Adam optimizer formula is applied to update the model parameters to minimize the cross entropy loss.

[0119] The Adam optimizer combines the advantages of momentum and adaptive learning rate, and the parameter update formula is:

[0120] ,in, is at the time step Parameters, is the learning rate, and are the bias-corrected first-order and second-order moment estimates, is a small constant added to increase numerical stability.

[0121] S6 specifically includes:

[0122] Hyperparameter tuning: Determine the key hyperparameters that affect the model learning process and prediction performance. Key hyperparameters include learning rate, batch size, number of training epochs, and number of self-attention heads within the Transformer block.

[0123] Use Bayesian optimization methods to explore different hyperparameter combinations to find the optimal configuration so that the model performs best on the validation set;

[0124] Model performance evaluation: After each round of training, the model is evaluated using the validation set to calculate the accuracy, recall, and loss function values;

[0125] Record and analyze the performance changes of the model during the training process in order to detect and solve overfitting or underfitting problems. Use early stopping techniques to terminate the training process. If the performance on the validation set does not improve significantly over several consecutive cycles, stop training to avoid overfitting.

[0126] Based on the performance of the model on the validation set, feedback is provided to adjust hyperparameters and refine the learning process. Through continuous experiments and evaluations, the model structure and parameter settings are iteratively optimized to ensure that the model can effectively learn from the data and make accurate predictions.

[0127] In the present invention, the hyperparameter adjustment and model performance evaluation steps are used to ensure the efficiency and accuracy of the model in learning the wave forecast data, which not only enables the model to capture the complex patterns of the wave data, but also optimizes the learning process through continuous performance evaluation and parameter adjustment to improve the accuracy of the prediction. This is of great significance for achieving efficient and accurate wave prediction, and helps to improve the safety and predictability of marine activities.

[0128] Bayesian optimization predicts the model performance for each set of parameters by building a probability model of hyperparameters. The calculation process includes:

[0129] Establish a probabilistic model of the objective function: usually a Gaussian process is used for simulation.

[0130] Select the next point to evaluate: Based on maximizing the expected improvement criterion.

[0131] if is the target function, and the Gaussian process provides the mean of this function and variance The expected improvement is calculated as:

[0132] ,in, is the current best observed value, , and are the cumulative distribution function and probability density function of the standard normal distribution, respectively.

[0133] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.

[0134] The present invention is intended to cover all such substitutions, modifications and variations that fall within the broad scope of the claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An intelligent correction method for wave forecasting, characterized in that: The following steps are involved: S1: In the architecture integration phase, the self-attention mechanism is introduced in each layer of the encoder and decoder of UNet, and each layer is transformed into a Transformer block to enhance the model's understanding and processing capabilities of input data; S2: Model initialization phase, using the pre-trained Transformer model to initialize the Transformer block in UNet, using the capabilities of the pre-trained model to accelerate the learning process and improve prediction accuracy; S3: Application of self-attention mechanism. Multi-head self-attention mechanism is implemented in each Transformer block, allowing the network to capture the detailed relationship between the parts in the input image sequence and enhance the ability to understand the global information and local features of the image. S4: Dynamic attention adjustment mechanism, which dynamically adjusts the attention weights in each Transformer block according to the characteristics of the input image and the needs of wave forecasting, ensuring that the network prioritizes the image areas that contribute most to the prediction results; S5: Model training and optimization: Use the labeled wave forecast dataset to train the model, select the cross entropy loss and Adam optimizer, and perform back propagation and parameter update of the model; S6: Hyperparameter tuning and performance evaluation, by adjusting hyperparameters and continuously evaluating model prediction performance to ensure efficient learning and accurate prediction of waves; The S1 specifically includes: S11: A Transformer block consisting of a multi-head self-attention layer, a feed-forward neural network layer, and a residual connection is embedded in each encoder and decoder layer of UNet; S12: For each Transformer block, the input feature map is first processed by a multi-head self-attention layer to capture feature relationships in different subspaces in parallel; S13: Use residual connections to add the output of the multi-head self-attention layer to the original input to enhance information flow and prevent gradient vanishing; S14: Pass the output of the residual connection to the feed-forward neural network layer to refine and enhance the feature representation; S15: Residual connections are applied again after the output of the feedforward neural network to ensure the effective transfer and utilization of information in the deep network; S16: Repeat S12-S15 until all encoder and decoder layers of UNet have been enhanced with Transformer blocks; The S2 specifically includes: S21: Select the Transformer model pre-trained based on marine environment data and extract the parameters of the pre-trained model, including the weights and biases of the multi-head self-attention mechanism, feedforward neural network, and residual connection; S22: Map the pre-trained parameters to the Transformer block of UNet. For each encoder and decoder layer of the Transformer block, initialize it with the corresponding pre-trained weights and biases. S23: During the initialization process, ensure that the parameter structure of the pre-trained model matches the Transformer block structure in UNet, and make corresponding adjustments or conversions to ensure the consistency of the model structure and the integrity of its functions; The S3 specifically includes: S31: A multi-head self-attention layer is set in each Transformer block. The multi-head self-attention layer consists of multiple parallel attention mechanisms, each of which focuses on a different part of the input feature map; S32: Decompose the input feature map into different subsets, each subset corresponds to the input of an attention mechanism, process information from multiple perspectives in parallel, and enhance the information capture ability of the model; S33: For each attention mechanism, the query Q, key K and value V matrices are calculated, each of which is obtained by linear transformation of the corresponding input feature map; S34: In each attention mechanism, the attention score matrix is ​​generated by calculating the dot product of Q and K, and then the softmax function is applied to normalize these scores to obtain the attention weights, which are multiplied by the V matrix to produce weighted output features, allowing the model to dynamically adjust the contribution of each input part; S35: Merge the weighted output features generated by all attention mechanisms to form the final output of the Transformer block, integrate information from different perspectives, and enhance the model's ability to understand global information and local features; The S4 specifically includes: S41: Analyze the input image sequence and identify the feature area that contributes most to the wave prediction, including the starting point, crest and trough features of the wave; S42: In each Transformer block, a dynamic weight adjustment module is introduced. The dynamic weight adjustment module adjusts the attention weight according to the characteristics of the input image and the specific requirements of the wave forecast. The content-based attention weight adjustment strategy is used, in which the attention weight depends not only on the relative relationship between the input features, but also on the relevance of the features themselves to the wave forecast task. S43: Implement a feedback mechanism to optimize the attention weight adjustment strategy by analyzing the difference between the results of the previous prediction cycle and the actual observation data, and apply the adjusted attention weights to the multi-head self-attention mechanism in the Transformer block to ensure that the model can focus on processing the image area that contributes most to the prediction of wave dynamics.

2. The method for intelligent correction of sea wave forecast according to claim 1, characterized in that: The calculation of the query Q, key K and value V includes: For the input feature map X, use different weight matrices W Q ,W K ,W V To transform X to obtain Q, K, and V: Q=XW Q ; K=XW K ; V=XW V ; Among them, W Q ,W K ,W V are trainable parameter matrices used to generate query, key, and value matrices respectively; The attention score is calculated by taking the dot product of the query matrix and the key matrix, and scaled by the square root of the key dimension: Among them, d k is the dimension of the key matrix, divided by This is to control the magnitude of the inner product and prevent the gradient from disappearing or exploding.

3. The method for intelligent correction of sea wave forecast according to claim 2, characterized in that: The dynamic weight adjustment module adjusts the attention weight based on the correlation between the input features and the prediction task. Assuming that the initial attention weight A is calculated by the multi-head self-attention mechanism, the dynamic adjustment process of the attention weight is expressed as: Feature importance evaluation: For each feature of the input image, calculate its score S of relevance to the wave forecasting task. The score S is implemented by a small neural network or a scoring function: S = f score (X), where X is the input feature, f score is a function of the relevance of the assessment feature to the wave forecast; Dynamic adjustment of attention weights: Use the importance score of the feature to adjust the original attention weight to obtain the adjusted attention weight A′: A′=A⊙softmax(S), where ⊙ represents element multiplication, and softmax(S) ensures that all adjusted weights add up to 1.

4. The method for intelligent correction of sea wave forecast according to claim 3, characterized in that: The S5 specifically includes: Dataset preparation: Prepare a labeled wave forecast dataset, including wave image data and its corresponding forecast results as labels; Cross-entropy loss calculation: For each output of the model, a cross-entropy loss function is used to calculate the difference between the predicted value and the true label: Among them, y i is the true label, is the model prediction value, and L is the calculated loss; Adam optimizer parameter update: Use Adam optimizer to update the parameters of the model; Backpropagation and parameter update: During the training process, the prediction results and losses are first obtained through forward propagation. Then, the backpropagation algorithm is used to calculate the gradient of the loss function with respect to the model parameters. Finally, the Adam optimizer formula is applied to update the model parameters to minimize the cross entropy loss.

5. The method for intelligent correction of sea wave forecast according to claim 4, characterized in that: The Adam optimizer combines the advantages of momentum and adaptive learning rate, and the parameter update formula is: Among them, θ t is the parameter at time step t, η is the learning rate, and They are the bias-corrected first-order and second-order moment estimates, and ∈ is a small constant added to increase numerical stability.

6. The method for intelligent correction of sea wave forecast according to claim 5, characterized in that: The S6 specifically includes: Hyperparameter tuning: Determine the key hyperparameters that affect the model learning process and prediction performance. Key hyperparameters include learning rate, batch size, number of training epochs, and number of self-attention heads within the Transformer block. Use Bayesian optimization methods to explore different hyperparameter combinations to find the optimal configuration so that the model performs best on the validation set; Model performance evaluation: After each round of training, the model is evaluated using the validation set to calculate the accuracy, recall, and loss function values.