Ocean front prediction method based on space-time coupling
Patent Information
- Application Number
- CN202611127090.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]为了解决现有方法在海洋锋预测过程中时空特征捕捉能力单一、特征融合方式未充分针对海洋锋特点优化等问题,本发明提出了一种基于时空耦合的海洋锋预测方法,命名为Ocean Fronts Prediction Net(OFPNet)
[0079](1)本发明并非仅对海表温度场进行预测后再进行锋面检测,而是以海表温度梯度模量场及提取的海洋锋特征作为建模对象,并结合梯度幅值阈值、动态梯度方向角约束和 Canny 边缘检测进行多尺度锋线提取,可抑制低梯度背景及方向异常伪边缘,提高海洋锋数据集的物理一致性和锋线识别可靠性。
Smart Images

Figure CN122926319A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of physical oceanography and deep learning, and specifically relates to a method for predicting ocean fronts based on spatiotemporal coupling. Background Technology
[0002] Oceanic fronts, as typical mesoscale phenomena in the ocean, are interfaces formed by significant differences in the physicochemical properties of water bodies, such as temperature and salinity. They possess strong horizontal gradients and their formation is closely related to multiple factors, including atmospheric wind fields and ocean circulation. They hold significant research value in areas such as fisheries resource management, marine ecosystem protection, climate change prediction, and underwater acoustic environment modeling. On the one hand, fronts drive differences in latent and sensible heat fluxes, alter pressure fields, influence wind stress and Ekman transport, provide energy for cyclones, and are interconnected with climate modes such as ENSO, making them a key link in air-sea coupling and climate prediction. On the other hand, significant changes in the acoustic properties of seawater in frontal regions lead to sound wave refraction and reflection, significantly impacting underwater acoustic applications such as sonar detection. Therefore, accurate prediction of oceanic fronts is of great significance for marine scientific research and practical applications. However, most current mainstream prediction methods first predict the sea surface temperature (SST) field and then detect the front using algorithms. This approach only treats front prediction as a temperature gradient calculation process, lacking an explanation of the physical changes in oceanic fronts. Direct prediction of ocean front image sequences suffers from inherent limitations in spatiotemporal coupling modeling due to the multi-scale interactions, nonlinear dynamics, and fully developed turbulent characteristics of ocean fronts. Traditional models struggle to simultaneously account for the spatial multi-scale features and temporal dynamic evolution of the front, resulting in insufficient prediction accuracy and stability. Therefore, a prediction method that deeply integrates spatiotemporal correlation features and adapts to the complex characteristics of ocean fronts is urgently needed.
[0003] In oceanography, scientists primarily understand the mechanisms of ocean evolution by building physical models. Currently, a relatively advanced physical model is GLO12v4, a global ocean analysis and prediction system from Operational Mercatorzuix, which provides 10-day global ocean forecasts updated daily. This system is built on a mature numerical simulation framework. Its core uses the NEMO ocean circulation model version 3.6, discretizing the global ocean at a horizontal grid resolution of 1 / 12°, thus enabling it to analyze key processes such as mesoscale ocean phenomena. Vertically, the system is configured with 50 levels, extending from the sea surface to the seabed, to capture the ocean's vertical structure. These models can simulate the evolution of ocean fronts through mathematical formulas, possessing high interpretability. However, these mathematical formulas involve a large number of parameters, requiring precise initial conditions, and the model requires supercomputer support, making it unsuitable for deployment on platforms such as ships.
[0004] Thanks to the widespread application of data-driven AI technologies, including Transformer, RNN, and CNN, in learning patterns from time-series data, they demonstrate a powerful ability to extract spatiotemporal features from the data. However, existing deep learning methods have certain shortcomings in the prediction process: at the spatial level, they are limited by the local receptive field of the convolutional kernel, making it difficult to effectively capture the long-range spatial dependence and complex multi-scale structure of ocean fronts; at the temporal level, they only use a single memory state to simultaneously carry both the short-term dynamics (diurnal variation) of the ocean front and the long-term trend (seasonal variation) of the background field, leading to mutual interference between the two types of temporal information, with the long-term background easily obscured by short-term fluctuations; furthermore, ocean fronts are affected by both spatial and temporal features, and existing methods usually only perform simple superposition without achieving deep interaction, resulting in weak spatiotemporal collaborative perception capabilities. Therefore, it is essential to effectively capture the spatiotemporal features of ocean fronts and design a feasible prediction model accordingly to achieve ocean front prediction in complex environments. Summary of the Invention
[0005] To address the shortcomings of existing methods in ocean front prediction, such as limited spatiotemporal feature capture capabilities and insufficient optimization of feature fusion methods for the characteristics of ocean fronts, this invention proposes a spatiotemporally coupled ocean front prediction method, named Ocean Fronts Prediction Net (OFPNet). This method enhances the model's understanding of ocean front characteristics and evolution trends by constructing a spatial feature extraction module based on CSWinTransformer and a dual memory mechanism incorporating short-term and long-term cell states. Subsequently, a feature interaction module with bidirectional cross-attention and a feature weighted fusion module with attention weights are constructed to generate the final spatiotemporal fusion representation, achieving accurate prediction of ocean fronts in complex environments.
[0006] The technical solution of this invention is as follows:
[0007] The ocean front prediction method based on spatiotemporal coupling includes the following steps:
[0008] S1: Obtain historical sea surface temperature data of the target sea area, establish a dynamic gradient direction angle constraint mechanism based on climate state parameters, and extract ocean front feature data based on the dynamic gradient direction angle constraint mechanism and edge detection algorithm;
[0009] S2: Input the ocean front feature data into the spatial feature extraction module. This module uses a cross-shaped window attention mechanism and local enhancement position coding to extract multi-scale spatial feature sequences.
[0010] S3: Input the multi-scale spatial feature sequence into the time series modeling module containing short-term cell state and long-term memory state to extract the time feature sequence;
[0011] S4: Based on the bidirectional cross-attention mechanism, the multi-scale spatial feature sequence and the temporal feature sequence are fused to generate full-time spatiotemporal fusion output features;
[0012] S5: Generate the temporal variation of the ocean front at a future preset time step based on the full-time spatiotemporal fusion output features, and recursively accumulate the temporal variation of the ocean front based on the historical baseline state to obtain the ocean front prediction result.
[0013] Furthermore, in step S1, the establishment of a dynamic gradient direction angle constraint mechanism based on climate state parameters includes:
[0014] Based on the historical sea surface temperature data, the mean and standard deviation of the historical monthly gradient direction angle are calculated to generate the climate state parameters:
[0015] Obtain real-time sea surface temperature data And extract its real-time gradient direction angle The matching probability between the real-time gradient direction angle and the climate state parameter is calculated using the following formula:
[0016] (1)
[0017] in, For the first Climate state parameters for the month, , These are the mean and standard deviation of the historical monthly gradient direction angle, respectively; The Euclidean distance is a spatiotemporal feature. ;
[0018] In response to the matching probability satisfying a preset probability threshold, a dynamic gradient direction angle constraint mechanism is established based on the real-time gradient direction angle:
[0019] (2)
[0020] in, This is the probability threshold.
[0021] Furthermore, in step S1, the ocean front feature data is extracted based on the dynamic gradient direction angle constraint mechanism and edge detection algorithm, including:
[0022] A multi-scale space is constructed using a Gaussian kernel to generate a multi-scale feature map from the real-time sea surface temperature data, as shown in the following formula:
[0023] (3)
[0024] in, Representing the Typical frontal widths corresponding to each scale; Indicates the first Feature maps at various scales; Indicates the first A two-dimensional Gaussian kernel function with multiple scales; This refers to the real-time sea surface temperature data at time t. These are spatial coordinates;
[0025] The dynamic gradient direction angle constraint mechanism is introduced into the Canny edge detection algorithm, and gradient direction filtering is used to enhance the consistency of the ocean front direction. Combined with the frontal region mask constructed based on gradient magnitude, ocean front feature maps at various scales are obtained. The calculation formula is as follows:
[0026] (4)
[0027] in, Indicates the first Characteristic map of ocean fronts at various scales; Indicates the first Edge detection results of feature maps at various scales; This represents a frontal region mask constructed based on gradient magnitude. Regions with a gradient greater than or equal to the frontal threshold are represented by 1 and retained; background regions with low gradients are represented by 0 and filtered out. This represents element-wise multiplication;
[0028] By integrating ocean front feature maps at various scales, a global ocean front feature map is obtained.
[0029] The global ocean front feature map is subjected to region filtering to remove discrete noise, and morphological closing operation is used to eliminate false targets and connect the fracture front to obtain the ocean front feature data.
[0030] Furthermore, in step S2, the extraction of multi-scale spatial feature sequences includes:
[0031] The ocean front feature data is input into the patch embedding layer, and the mapping from low-dimensional pixel values to high-dimensional feature vectors is completed through two-dimensional convolution operation. Then, the preliminary embedded feature map is output through non-linear activation function and layer normalization operation.
[0032] The initial embedded feature map is reshaped into a one-dimensional sequence and superimposed with a learnable positional encoding vector to generate an initial sequence feature containing both content and positional information.
[0033] Multi-stage feature extraction is performed. In the first stage, multiple CSWin blocks are used to capture preliminary long-range spatial dependencies and local texture features at the original resolution to obtain the first-stage spatial feature sequence. The first-stage spatial feature sequence is transformed back into a two-dimensional spatial structure and downsampled by stride convolution to reduce the feature map resolution. In the second stage, multiple CSWin blocks are used to extract deep multi-scale spatial features at the downsampled resolution to obtain the final multi-scale spatial feature sequence.
[0034] Furthermore, the first-stage spatial feature sequence is extracted using multiple CSWin blocks, specifically including:
[0035] The initial sequence features are used to generate a query matrix, a key matrix, and a value matrix through linear mapping.
[0036] The feature maps corresponding to the query matrix, key matrix, and value matrix are respectively divided into horizontal window branches and vertical window branches according to the attention head;
[0037] Calculate the scaled dot product attention within the horizontal window branch and the vertical window branch respectively to obtain the horizontal window attention features and the vertical window attention features;
[0038] A depthwise separable convolution is applied to the value matrix to obtain a local enhanced positional encoding, which is then superimposed onto the horizontal window attention feature and the vertical window attention feature, respectively.
[0039] The outputs of the two superimposed branches are concatenated along the channel dimension and then linearly mapped to obtain the attention output features of the CSWin block. :
[0040] (5)
[0041] in, and These represent the value matrices in the horizontal and vertical window branches, respectively. This indicates a channel-level concatenation operation. To output a linear mapping matrix; For horizontal window attention features, Vertical window attention features;
[0042] The attention output features are connected to a multilayer perceptron via gated residual connections, resulting in an output sequence of intermediate spatial features that is both accurate and distinct. :
[0043] (6)
[0044] in, Represents a linear transformation. This represents the Sigmoid activation function. Indicates the initial sequence features. This represents the characteristics after residual fusion. Indicates the features after gating and filtering;
[0045] Multiple CSWin blocks are applied sequentially to the input feature sequence and the intermediate spatial feature sequence in a serial cascade manner. As input to the next CSWin block, the first-stage spatial feature sequence is finally obtained.
[0046] Furthermore, in step S3, the time series modeling module extracts time feature sequences, including:
[0047] The multi-scale spatial feature sequences of multiple consecutive time steps are stacked and input into the time series modeling module;
[0048] Short-term cell states are updated via input and forget gates to capture short-term spatial dynamics;
[0049] The reading and writing of long-term memory states are controlled by memory gates to preserve the spatial trend of the background field;
[0050] Based on the updated short-term cell state and long-term memory state, a hidden state containing spatial features and temporal dynamics is generated through the output gate, which serves as the temporal feature sequence.
[0051] Furthermore, in step S3, the time series modeling module extracts the time feature sequence.
[0052] The input features of the current time step are concatenated with the hidden state of the previous time step, and the input gate, forget gate, output gate, candidate cell state and memory gate are generated through convolutional layers.
[0053] Layer normalization is applied to the input gate, forget gate, output gate, and candidate cell states;
[0054] The formula for updating the short-term cell state is: ,in, This represents the short-term cell state at the current time step. This represents the short-term cellular state at the previous time step. This represents element-wise multiplication; Indicates a memory gate. It indicates the long-term memory state of the previous time step; , , These represent the normalized input gate, forget gate, and candidate cell state, respectively.
[0055] The formula for updating the long-term memory state is: ,in, This represents the long-term memory state at the current time step.
[0056] Furthermore, in step S4, the feature fusion of the multi-scale spatial feature sequence and the temporal feature sequence based on the bidirectional cross-attention mechanism to generate spatiotemporal fusion features includes:
[0057] The multi-scale spatial feature sequence and the temporal feature sequence are reshaped in dimension, and a query vector, a key vector, and a value vector are generated through linear transformation.
[0058] Scaled dot product attention is calculated based on the query vector, key vector, and value vector to obtain spatiotemporal sequence fusion features;
[0059] The spatiotemporal sequence fusion features are concatenated with the multi-scale spatial feature sequences along the channel dimension, and a spatial adaptive attention weight map is calculated using convolutional layers and activation functions. :
[0060] (7)
[0061] Where ReLU is a non-linear activation function. This represents the convolution operation. For convolution kernel weights, For the Sigmoid function; It is a multi-scale spatial feature sequence. Features for spatiotemporal sequence fusion;
[0062] The spatiotemporal sequence fusion features and the multi-scale spatial feature sequences are weighted and fused based on the spatial adaptive attention weight map to obtain the spatiotemporal fusion features. :
[0063] (8)
[0064] The spatiotemporal fusion features of all time steps are concatenated along the time dimension, and global pixel-by-pixel time step weights are generated through a lightweight convolutional neural network. :
[0065] (9)
[0066] in, , , The kernel is a convolution kernel; ReLU is a non-linear activation function. For the multi-time spatiotemporal fusion feature tensor of all time steps;
[0067] Based on the global pixel-by-pixel time step weights, the spatiotemporal fusion features of all time steps are weighted and summed to obtain the full-time spatiotemporal fusion output features. :
[0068] (10)
[0069] in, This indicates the total number of time steps.
[0070] Furthermore, in step S5, the temporal variation of the ocean front at a future preset time step is generated based on the full-time-series spatiotemporal fusion output features, and the temporal variation of the ocean front is recursively accumulated based on the historical baseline state to obtain the ocean front prediction result, including:
[0071] The full-time spatiotemporal fusion output features are reshaped into a two-dimensional feature map and input into the decoder. The spatial resolution of the feature map is gradually restored through continuous multi-layer transposed convolution, and the prediction map of the temporal change of the ocean front at each future prediction time step is output.
[0072] Using the ocean front feature data of the last time step of the historical input sequence as a benchmark, the predicted ocean front temporal variation map is recursively accumulated to obtain the final ocean front prediction value for the next preset time step; the formula for the recursive accumulation is:
[0073] (11)
[0074] in, Indicates the future number The final ocean front forecast value at each time step; This represents the final ocean front prediction value at the previous time step. hour, Ocean front feature data for the last time step of the historical input sequence; Indicates the future number The temporal variation of the ocean front at each time step.
[0075] Furthermore, a multi-component loss function is used during training. :
[0076] (12)
[0077] in, To balance the weighting hyperparameters of various losses, For MSE loss, For gradient loss, For frontal structure similarity loss, This represents the total variational loss.
[0078] The beneficial effects of this invention are:
[0079] (1) This invention does not only predict the sea surface temperature field and then perform front detection, but uses the sea surface temperature gradient modulus field and the extracted ocean front features as the modeling object, and combines gradient magnitude threshold, dynamic gradient direction angle constraint and Canny edge detection to extract multi-scale fronts. This can suppress low gradient background and directional abnormal pseudo edges, improve the physical consistency of the ocean front dataset and the reliability of front identification.
[0080] (2) The present invention uses CSWin Transformer as a spatial feature extraction module, and uses horizontal and vertical window attention mechanisms to model horizontal and vertical long-range dependencies respectively. Combined with local enhanced position encoding and multi-stage downsampling structure, it can simultaneously capture the continuous morphology, local small branches and multi-scale spatial structure of the main line of the ocean front, and overcome the problem that the receptive field of traditional convolutional neural networks is limited and it is difficult to fully express long-distance spatial correlations.
[0081] (3) The present invention constructs a gated ConvLSTM time series modeling module with short-term cell state and long-term memory state, so that short-term memory focuses on characterizing the rapid dynamics of ocean fronts such as diurnal movement and intensity changes, while long-term memory focuses on preserving the slow evolution trend of the background field; by controlling the reading and writing of long-term information through adaptive memory gate, the mutual interference of information at different time scales is reduced, and the ability to characterize the complex time series evolution process of ocean fronts is improved.
[0082] (4) This invention achieves deep interaction between spatial and temporal features through a bidirectional cross-attention mechanism, and adaptively allocates feature contributions at different spatial locations and historical moments through spatial adaptive weights and global pixel-by-pixel temporal weights. Therefore, the model can focus on utilizing spatiotemporal information related to the current prediction task for the frontal structure and its evolution in different regions, avoiding information redundancy caused by simple feature superposition.
[0083] (5) The present invention adopts the output method of "predicting the inter-diurnal variation of the ocean front and recursively superimposing it", and uses the ocean front data at the last moment of the historical sequence as a benchmark to recover the future absolute prediction value. This method explicitly introduces the continuous evolution relationship between adjacent moments into the prediction process, which is beneficial to reduce the numerical span when directly predicting the absolute field and improve the stability and coherence of multi-day continuous prediction and front evolution.
[0084] (6) The present invention adopts a multi-component loss function consisting of mean square error loss, gradient loss, frontal structure similarity loss and total variational loss. It simultaneously constrains numerical error, strong gradient frontal region, frontal morphology and structure and spatial smoothness of prediction results. This helps to reduce the fuzziness, breakage and false noise of predicted fronts and improve the overall performance of ocean front prediction results in terms of numerical accuracy, structural similarity and geographical location accuracy.
[0085] (7) This invention is applicable to satellite remote sensing SST data from different sources and with different spatial resolutions, and can output ocean front prediction results for multiple future times, providing data support for fishery resource management, marine ecological environment monitoring, air-sea interaction analysis, underwater acoustic environment protection and marine disaster risk assessment. Attached Figure Description
[0086] Figure 1 This is a flowchart of the OFPNet model in an embodiment of the present invention.
[0087] Figure 2 This is a diagram illustrating the process of generating the ocean front dataset in an embodiment of the present invention.
[0088] Figure 3 This is the qualitative result of OFPNet on the Moving MNIST dataset in this embodiment of the invention. The first row is the historical input data, the second row is the true value, the third row is the prediction of OFPNet, and the fourth row is the prediction result of ConvLSTM.
[0089] Figure 4 This is a comparison chart of the root mean square error (RMSE) and mean absolute error (MAE) of CSwinLSTM (OFPNet) and the improved ConvLSTM in this embodiment of the invention.
[0090] Figure 5 This is the prediction result of the model in this embodiment of the invention for the oceanic front over the next 7 days using JCOPE2M data.
[0091] Figure 6 This is the prediction result of the model in this embodiment of the invention for the oceanic front over the next 7 days using IOSST data. Detailed Implementation
[0092] The embodiments of the present invention are implemented under the premise of the technical solution of the present invention, and detailed implementation methods and specific operation processes are given. However, the protection scope of the present invention is not limited to the following embodiments.
[0093] This embodiment uses Windows 11 as the development and deployment environment, Python as the development language, PyTorch as the deep learning framework, and employs the spatiotemporal coupling-based ocean front prediction method described in this invention to deploy the ocean front prediction program; as follows Figure 1 As shown, the specific steps are as follows:
[0094] Step 1: Select the SST dataset from satellite remote sensing. Extract historical diurnal SST data for the target sea area from the SST dataset. Calculate the sea surface temperature gradient modulus field to quantify the spatial distribution and intensity of ocean fronts. After normalizing the gradient field, divide it into training, validation, and test sets according to the time series ratio of 80%, 10%, and 10% to avoid data leakage. The process for establishing the ocean front dataset is as follows: Figure 2 As shown.
[0095] Step 1.1: Download daily sea surface temperature data from the JCOPE2M website (https: / / www.jamstec.go.jp) and the OISST website (https: / / doi.org / 10.7289 / V5SQ8XB5). Rotate and align the original geographic coordinate data to a unified planar coordinate system, and then use the min-max normalization method to map the temperature values to the [0,1] interval to eliminate the interference of magnitude differences on model training.
[0096] Step 1.2: Based on JCOPE2M reanalysis data from 1993 to 2022 (30 years in total), a database of climate state parameters along the lunar sea surface temperature gradient was established. This was achieved by calculating the lunar gradient direction angle. Determine the mean of the cyclic statistic. and standard deviation :
[0097] (1)
[0098] (2)
[0099] in, Indicates the month index. For the first The amount of historical daily SST data for the past month; This is the average result length in circumferential statistics, used to measure the concentration of angular data. The final statistical result is expressed as a climate state parameter. Stored in the form of .
[0100] Step 1.3: Obtain real-time SST data And extract its gradient direction angle Then, calculate Probability of matching with climate state parameters :
[0101] (3)
[0102] in, Euclidean distance, a measure of spatiotemporal characteristics. and The difference in orientation angles between them, which is measured by circumferential distance:
[0103] (4)
[0104] Establish a dynamic gradient direction angle constraint mechanism:
[0105] (5)
[0106] in, As a probability threshold, the optimal probability threshold is determined in this embodiment. .
[0107] Step 1.4: Combine Canny edge detection with dynamic gradient orientation angle constraints to construct a multi-scale gradient fusion mechanism; details are as follows:
[0108] Different scale spaces are constructed using Gaussian kernels to cover the typical physical width range of ocean fronts (such as mesoscale and sub-mesoscale fronts):
[0109] (6)
[0110] in, km, representing the first Typical frontal widths corresponding to each scale; The original input data for the ocean front at time t. These are spatial coordinates, containing the original spatial gradient information of the front; Indicates the first A two-dimensional Gaussian kernel function with multiple scales; Indicates the first Feature maps at various scales.
[0111] A dynamic gradient direction angle constraint mechanism is introduced into the traditional Canny edge detection, and gradient direction filtering is adopted. To enhance the consistency of the direction of the ocean front, a feature map of the ocean front is obtained:
[0112] (7)
[0113] in, Indicates the first Characteristic map of ocean fronts at various scales; Indicates the first Each scale feature map gradient plot; This represents a binary mask generated by DAM. The function of this process is to filter regions that meet the gradient direction requirements based on climate state parameters; if the region... The gradient direction satisfies the condition If the mask position is 1, then the corresponding mask position is marked as 1 (retained); otherwise, it is marked as 0 (deleted). This represents element-wise multiplication (Hadamard product), the purpose of which is to multiply the Canny edge detection results. With mask By combining these factors, oceanic fronts that simultaneously satisfy the constraints of Canny algorithm detection, gradient direction, and climate conditions are selected.
[0114] Integrate ocean front feature maps at various scales using logical OR operations. This method fuses ocean fronts detected at different scales (such as the continuous main front of a large-scale layer and the fine branches of a small-scale layer) to obtain a global ocean front feature map.
[0115] (8)
[0116] in, Represents the global ocean frontal line feature map; This represents the spatial union operation of ocean fronts at different scales.
[0117] right Regional filtering was performed to remove discrete noise areas smaller than 100 square kilometers, resulting in... ;right False targets are eliminated by using circular structural units and connecting the fracture fronts to obtain continuous ocean fronts, ultimately forming an ocean front dataset. The above process is expressed by the following formula:
[0118] (9)
[0119] (10)
[0120] in, The results were filtered to remove low-confidence false ocean fronts; This indicates an indicator function, representing the area to be retained ≥ Connected regions, The area threshold is set to 100 km². 2 ; For element-level logical AND operation (to eliminate small-area noise); To repair the continuous ocean front after the break; It is a morphological closing operation; Use circular structural elements; This refers to spatial resolution.
[0121] Step 1.5: Normalize the Ocean Front dataset and divide it into training, validation, and test sets according to the proportions of the first 80%, middle 10%, and last 10% of the time series.
[0122] Step 2: Input the ocean front feature data into the improved Patch Embedding layer, project the number of channels from 1 to 64 dimensions through a 3×3 convolution kernel, and output the initial embedded feature map through the GELU activation function and Layer Norm. Reshape the initial embedded feature map into a one-dimensional sequence and superimpose the learnable positional encoding vector to generate the initial sequence features. Then, perform multi-stage feature extraction. In the first stage, capture long-range spatial dependencies and local texture features at 50×50 resolution through two CSWin blocks (including cross-shaped window attention, LePE, gated residual connections and MLP). In the second stage, downsample to 25×25 resolution through stride 2 convolution, and then extract deep multi-scale spatial features through two CSWin blocks to output the final multi-scale spatial feature sequence.
[0123] Step 2.1: Adjust the shape of the ocean front feature data to ,in For batch size, For input channels, These represent the height and width of the image, respectively. The processed ocean front feature data is then input into an improved patch embedding layer, which consists of a 2D convolutional layer, an activation function, and a layer normalization layer in sequence. The processing flow is as follows:
[0124] First, the ocean front data is subjected to a 2D convolution operation to map "low-dimensional pixel values to high-dimensional feature vectors". Then, a non-linear transformation is performed using a non-linear activation function, enabling the model to learn more complex feature representations. Based on this, layer normalization is applied to each ocean front dataset to stabilize the training process and accelerate convergence. Finally, a preliminary embedded feature map Z is obtained. The above process is expressed by the following formula:
[0125] (11)
[0126] Wherein, Conv2D represents a two-dimensional convolution operation; LayerNorm represents a non-linear activation function; LayerNorm represents layer normalization. , , These represent the kernel size, stride, and zero-padding size of a two-dimensional convolutional layer, respectively. This represents the number of time steps in the input historical sequence; This represents the number of intermediate feature channels after convolution mapping (i.e., the embedding dimension of the patch embedding layer, which can be set to 64 in this embodiment).
[0127] Step 2.2: Reshape the initial embedded feature map Z into a one-dimensional sequence and add a learnable position encoding vector. This yields initial sequence features containing both content and location information. ,in For sequence length, The total embedding dimension is given. This positional encoding vector employs a standard Transformer parameter initialization strategy, initialized as a tensor sampled from a truncated normal distribution, ensuring initial parameter values are within a reasonable range and avoiding gradient anomalies in the early stages of training. Through this operation, the input to the self-attention mechanism becomes a hybrid pattern containing both content information (Z) and positional information (P), thus resolving permutation invariance.
[0128] (12)
[0129] in, To form the initial sequence features after fusing content information and location encoding information, This is a dimensional reshaping operation.
[0130] Step 2.3: Multi-stage feature extraction. In the first stage, the model applies two CSWin blocks at the original resolution. First, the initial sequence features are... Generate query matrix through linear mapping Key matrix Sum matrix :
[0131] (13)
[0132] in, , and These are the learnable linear projection matrices; Used to represent the query requirements for relevant features at the current location. Used with Calculate the correlation. These are the feature values that are weighted and converged based on attention weights.
[0133] Subsequently, respectively , and The corresponding feature map is divided into horizontal and vertical window branches according to the attention head. The horizontal window expands along the row direction to model long-range dependencies within the same row and its horizontal region; the vertical window expands along the column direction to model long-range dependencies within the same column and its vertical region. Scaling dot product attention is calculated in both branches to obtain the horizontal window attention features. and vertical window attention features .
[0134] To preserve potentially weakened local spatial location information in window attention, the value matrix is adjusted. A depthwise separable convolution is applied to obtain the Local Enhancement Position Encoding (LePE), which is then added to the attention output of the corresponding branch. Finally, the outputs of the two branches are concatenated along the channel dimension and linearly mapped to obtain the attention output features of the CSWin block. :
[0135] (14)
[0136] in, and These represent the value matrices in the horizontal and vertical window branches, respectively. This indicates a channel-level concatenation operation. To output a linear mapping matrix.
[0137] Finally, the attention output features By using gated residual connections and a multilayer perceptron (MLP), the gated residual connections first filter out valuable frontal features and propagate them stably. The MLP then performs nonlinear feature enhancement on these features, ultimately outputting an intermediate spatial feature sequence that is both accurate and clear. :
[0138] (15)
[0139] in, The operation randomly deactivates some neurons to prevent the model from overfitting. Represents a linear transformation. This represents the Sigmoid activation function. This represents the characteristics after residual fusion. This indicates the features after gating and filtering.
[0140] Two CSWin blocks are applied sequentially to the input feature sequence in a cascaded manner: the first CSWin block extracts preliminary long-range spatial dependencies and local texture features, and its output... This serves as the input to the second CSWin block; the second CSWin block further enhances the multi-scale spatial correlation and frontal structure representation, ultimately yielding the first-stage spatial feature sequence. .
[0141] To further extract ocean front features, the first stage output... It needs to be transformed back into a two-dimensional spatial structure and downsampled for the second stage of Transformer processing, as shown in the following formula:
[0142] (16)
[0143] Wherein, Reshape is the dimension reshaping operation. This is the reconstructed two-dimensional spatiotemporal feature map. This is the feature map after convolution downsampling. This is the spatial feature sequence of the second stage.
[0144] Ultimately After further processing by another set of 2-layer CSWin blocks, the spatial feature sequence is obtained. .
[0145] Step 3: Predict the next 7 days' data using data from the past 15 days. Stack the spatial feature sequences of the past 15 consecutive time steps, input them into a gated ConvLSTM, and concatenate the spatial features of the current time step with the previous hidden state, then generate the input gate through a 1×1 convolution. Forgotten Gate Output gate Candidate cell status and memory gate Then update the dual memory state and short-term cell state. Depend on Retain the previous short-term state. Incorporating current candidate states to capture short-term spatial dynamics, long-term memory is... Controlling "reading and writing" to memorize the spatial trends of the background field, and finally updating the... The model activates with tanh and outputs a hidden state containing both spatial features and temporal dynamics. This hidden state can be understood as a "comprehensive feature summary" of the current ocean state: it retains spatial features such as the position, shape, and intensity of the ocean front, while encoding temporal evolution information such as recent movement, strengthening, weakening of the ocean front, and long-term changes in the background field. Therefore, It is not a direct prediction result, but an intermediate feature representation used by the subsequent spatiotemporal feature fusion module and decoder to generate prediction results.
[0146] Step 3.1: Since ocean evolution often involves long-term, continuously evolving characteristic patterns, these patterns may be difficult to remember stably and for a long time in the single-cell state of traditional ConvLSTM. Therefore, a dual-memory state-gated ConvLSTM unit was designed. In addition to the traditional short-term cell state, a long-term memory state was introduced, and an adaptive memory gating was added to simulate the spatiotemporal evolution of ocean fronts in detail. Specifically, the spatial feature sequences of the past 15 consecutive time steps were... Stack as input The input is fed into a multi-layer gated ConvLSTM network to simulate the change of its state over time. Compared to the previous hidden state The signals are concatenated along the channel dimension and then generated using convolutional layers to produce traditional gated signals. And an additional memory gating signal The formula is expressed as follows:
[0147] (17)
[0148] in, These represent the input gate, forget gate, output gate, and candidate cell state, respectively; Concat is the fusion operation; Split is the split operation, which splits the convolution output into 4 parts in the channel dimension, corresponding to the 4 core gates of the gated LSTM; It is a newly introduced memory gate, generated by another 1×1 convolutional layer, used to regulate the input and fusion of long-term memory; It is the Sigmoid activation function. and These are the corresponding convolution kernel weights.
[0149] To ensure training stability, layer normalization (LN) was applied to the gating signal:
[0150] (18)
[0151] in, , , , These represent the normalized input gate, forget gate, output gate, and candidate cell state, respectively.
[0152] Step 3.2: To address the inherent conflict in traditional time series models (such as standard LSTM / ConvLSTM) when simultaneously modeling short-term and long-term dependencies, this invention constructs a dual-state update mechanism, introducing an independent long-term memory state. By separating the short-term and long-term memory functions of the ConvLSTM model, the model can simultaneously remember information at both time scales instead of mixing them. The state update formula for this ConvLSTM model is as follows:
[0153] (19)
[0154] (20)
[0155] in, For cell state update, and Consistent with traditional ConvLSTM, the former uses a forget gate to control the degree of retention of short-term memory from the previous time step, while the latter uses an input gate to control the degree of inclusion of the current candidate state; both parts focus on short-term, fine-grained dynamic evolution. The model uses a memory gate From long-term memory Extracting relevant information and inputting it into the current short-term decision-making process allows current calculations to be based not only on recent historical data but also to directly utilize long-term background information. Update long-term memory status; The memory gate determines how much long-term memory from the past is retained; It can be viewed as a holding gate; This determines how much information from the current cell state (which already incorporates short-term and extracted long-term information) will be stored in long-term memory. It is an adaptive controller with a value between 0 and 1, during updates. At that time, it controls from How much information is read during the update? At that time, it controls the current information Write The proportion of [something]. It is not extracted directly from the data. At the beginning of the sequence, the recurrent neural network is at the initial time step, with no historical information to refer to, and is in a long-term memory state. Initialized as an all-zero tensor, related to the cell state. Similarly, it is dynamically generated and updated through model iterations at time steps, ultimately carrying global long-term information.
[0156] Step 4: Reshape the multi-scale spatial feature sequence and temporal feature sequence into a sequence form. Generate query, key, and value vectors through linear transformation. Use a bidirectional cross-attention mechanism to achieve interaction between the two modalities. Then, concatenate the enhanced features with the original multi-scale spatial feature sequence. Generate a spatial adaptive attention weight map through two layers of convolution and a sigmoid activation function. Sum the features according to the weights to obtain the spatiotemporal fusion features. Finally, stack the spatiotemporal fusion features of all time steps. Generate global pixel-by-pixel time step weights through lightweight convolution. Sum the spatiotemporal fusion features of each time step according to the weights to obtain a full-time spatiotemporal fusion output feature that combines spatial details and temporal dynamics for subsequent prediction.
[0157] Step 4.1: Transform the multi-scale spatial feature sequence and time feature sequences Perform dimensional reshaping and generate queries through linear transformation. Time series characteristics As keys and values vector:
[0158] (twenty one)
[0159] in, For space flattening operation, It is a learnable projection matrix.
[0160] Subsequently, feature fusion was performed to obtain spatiotemporal sequence fusion features. This feature is able to proactively retrieve and extract the most relevant contextual information from the time dynamic sequence based on the current spatial structure information, thus realizing deep interaction between the two modalities: (twenty two)
[0161] in, It is a scaling factor used to stabilize the training process.
[0162] Step 4.2: To avoid information redundancy, enhance the preservation of spatial details, and enable the gating mechanism to more effectively learn the trade-off between spatial and spatiotemporal features, the spatiotemporal sequence features are fused. Compared with the original multi-scale spatial feature sequence The data is concatenated along the channel dimension and input into an attention weight generation network. This network calculates a spatially adaptive attention weight map using two convolutional layers and a sigmoid activation function, with a value range of [0,1].
[0163] (twenty three)
[0164] Where ReLU is a non-linear activation function. This represents the convolution operation. For convolution kernel weights, For the Sigmoid function, This is a spatial adaptive attention weight map used to control the fusion features of the original multi-scale spatial feature sequences and spatiotemporal sequences. The proportion of contribution.
[0165] The final weighted fusion output is calculated by the following formula:
[0166] (twenty four)
[0167] in, This is the Hadamard product (element-by-element multiplication). This refers to the spatiotemporal fusion features of the final output.
[0168] Step 4.3: To further optimize the fusion effect, during the forward propagation of the main model, the fusion features of all time steps are stacked into a tensor. (Generated at different time steps) (The data is concatenated along the time dimension, preserving the spatiotemporal fusion information at each moment), and a global pixel-by-pixel time step weight is generated through a lightweight convolutional neural network. :
[0169] (25)
[0170] in, , , The kernel is a convolutional layer, and three convolutional layers are used for stepwise extraction. Mid-temporal and spatial characteristics; ReLU is a nonlinear activation function.
[0171] Finally, the contributions of all time steps are weighted and summed using this weight to obtain the full-time-series spatiotemporal fusion output features. :
[0172] (26)
[0173] Step 5: Output features by spatiotemporal fusion of the entire time series. The feature map is reconstructed into a two-dimensional feature map and input into the decoder. The decoder gradually restores the spatial resolution of the feature map through three consecutive transposed convolutions, and outputs a prediction map of the interdiurnal variation of the ocean front at each predicted time. Subsequently, ocean front data from the last moment of the historical input sequence in the SST satellite remote sensing dataset were used. Based on this, the predicted interday variations of ocean fronts are recursively accumulated to obtain the future... Final ocean front forecast for the day:
[0174] (27)
[0175] in, The model predicts the first Inter-diurnal variation of celestial and oceanic fronts Indicates the future number The final ocean front forecast for the day.
[0176] The OFPNet model employs a multi-component loss function during training. :
[0177] (28)
[0178] in, To balance the weighting hyperparameters of various losses, For MSE loss, For gradient loss, For frontal structure similarity loss, This represents the total variational loss.
[0179] Gradient loss Specifically optimized for the gradient characteristics of ocean fronts, emphasizing accurate prediction of regions with strong gradients:
[0180] (29)
[0181] in, For the sample size, and The weighted graph shows the predicted and actual values for the i-th sample, respectively. Constructed based on the actual gradient magnitude: , These are the edge weight coefficients. To prevent division by zero errors, small constants, gradient operators This is achieved using a Sobel filter. The loss term calculates the difference between the gradient magnitudes of the predicted image and the ground image after processing by the Sobel operator. Furthermore, using the ground gradient magnitudes as the weight map, regions with large gradient differences (i.e., frontal regions) are given higher penalty weights, forcing the model to prioritize the prediction accuracy of frontal regions.
[0182] To better capture the morphological structure of the front, a loss term based on the structural similarity (SSIM) concept is introduced. :
[0183] (30)
[0184] Unlike traditional brightness-based SSIM, this invention applies it to the gradient magnitude field calculated by the Sobel operator described above. This method shifts the focus of comparison from grayscale values to the edges and structural features of the image, directly measuring the morphological similarity between the predicted front and the true front.
[0185] Preliminary experimental results
[0186] To ensure the effectiveness of the model in this invention, commonly used time series datasets in the computer science field were used for model pre-validation. Before applying the model to the main task of ocean front prediction, preliminary experiments were conducted on the MovingMNIST dataset to lay a reliable foundation for complex ocean front prediction.
[0187] exist Figure 3 The results show that both OFPNet and ConvLSTM effectively capture the motion trajectory of digits. However, in terms of shape and structure, ConvLSTM's predictions become increasingly blurry with increasing time steps, while OFPNet(Lite)'s predictions remain highly similar.
[0188] Table 1. Quantitative evaluation of CSwinLSTM (OFPNet) and LSTM
[0189]
[0190] Figure 4The dataset consists of three subplots (a), (b), and (c), corresponding to the results on days 1, 2, and 3 of the prediction task, respectively. Each subplot comprises a scatter plot, a density curve, and a box plot to illustrate the data distribution, with the box plot showing the quartiles. Different colors indicate model types, and the vertical axis represents the magnitude of the error. RMSE measures the standard deviation between predicted and actual values and is sensitive to outliers; MAE reflects the mean absolute deviation and provides a more robust representation of the overall error level. Figure 4 As shown in Table 1, CSwinLSTM (OFPNet) has significantly lower RMSE and MAE than the traditional ConvLSTM model at all time steps.
[0191] Evaluation indicators
[0192] To better evaluate the performance of ocean front prediction models, this invention constructs multiple evaluation metrics, including not only traditional metrics that measure pixel-level prediction accuracy, but also metrics that reflect the similarity of frontal morphology and structure and the accuracy of geographical location, enabling a comprehensive evaluation from multiple aspects such as numerical accuracy, structural similarity, and geographical accuracy.
[0193] The root mean square error (RMSE) is the square root of the average of the square powers of the differences between predicted and actual values, and is defined as follows:
[0194] (31)
[0195] in, This represents the total number of samples (total number of image pixels). Let i be the true value of the i-th pixel. The value represents the corresponding predicted value. RMSE is one of the most commonly used metrics; the smaller the value, the higher the overall prediction accuracy of the model. Because it imposes a higher penalty on larger errors, it can sensitively capture significant outliers or extreme errors in the prediction, which helps ensure the overall reliability of ocean temperature field predictions. Furthermore, RMSE has the same dimensions as the prediction target, making it easy to understand intuitively.
[0196] The mean absolute error (MAE) is calculated as the average of the absolute differences between the predicted and actual values.
[0197] (32)
[0198] Compared to RMSE, MAE is less sensitive to outliers. It reflects the average deviation of predicted values and measures the average predictive ability of the model. In evaluation, using both RMSE and MAE provides a more comprehensive understanding of the error distribution. If RMSE is much larger than MAE, it indicates that there are a few points with large errors in the prediction results, meaning that there may be local distortion in the prediction field.
[0199] The correlation coefficient (CC) is used to measure the degree of linear correlation between the predicted field and the actual field. The Pearson correlation coefficient is commonly used.
[0200] (33)
[0201] in, and These represent the mean values of the actual and predicted values, respectively. RMSE and MAE primarily focus on numerical differences, while CC focuses on the consistency between the predicted and actual fields in terms of spatial variation trends. A value close to 1 indicates that the predicted results are relatively close to the spatial distribution patterns of the actual ocean temperature field (such as the gradient direction of fronts and the relative positions of warm and cold centers), which is of great value for ocean dynamics analysis.
[0202] The Structural Similarity Index (SSIM) compares two images based on three aspects: brightness, contrast, and structure. Its calculation formula is as follows:
[0203] (34)
[0204] in, and These are the mean values of the predicted and actual values of the image, respectively. It is variance. It is covariance. This is a constant set to avoid the denominator being zero. Since the human visual system is more sensitive to the perception of local structure in an image than to simple pixel errors, SSIM aims to simulate this characteristic and evaluate the fidelity of the predicted image to the real image in terms of visual structural information. For ocean front prediction, a front is essentially a strong temperature gradient band, an important spatial structure. A high SSIM value means that the predicted front lines are clear, continuous, and visually more similar to the real front.
[0205] Hu similarity consists of two parts: Hu invariant moments and similarity calculation. The Hu invariant moments are first calculated for the predicted and actual binarized front regions, using seven Hu invariant moments. Hu moments are constructed from the second and third central moments of the image and possess translation, rotation, and scale invariance.
[0206] (35)
[0207] in It is the k-th original Hu moment. It is a very small constant. Cosine similarity is used to measure the similarity between two Hu moment vectors. and Similarity:
[0208] (36)
[0209] This value is mapped to the range [0, 1], with values closer to 1 indicating greater shape similarity. This metric is specifically designed to assess the similarity of the overall shape of fronts. Even if two fronts differ at the pixel level, their Hu moments will be very close if their macroscopic morphology (such as curvature and principal axis direction) is consistent. This compensates for the shortcomings of SSIM, which focuses more on local structure, while Hu moments focus on global shape.
[0210] Front distance consists of two parts: front extraction and average distance calculation. Front extraction first performs thresholding and skeletonization on the predicted and actual temperature gradient fields to extract the main front line with a width of one pixel. and Then, the shortest distance from each point on the predicted front line to the actual front line is calculated and averaged. This invention uses a distance transformation graph for efficient calculation:
[0211] (37)
[0212] in Based on real forwards The calculated distance transformation map, This refers to the number of points on the predicted front line. This metric is one of the most practically significant. It directly quantifies the average deviation (in pixels) between the predicted and actual front lines in terms of geographical location. A smaller front line distance means that the model not only predicted the shape of the front but also placed it in the correct geographical location.
[0213] Ablation test results
[0214] To evaluate the impact of different components in the model on ocean front prediction performance, ablation experiments were conducted. These experiments performed ocean front prediction over a period of 7 days on the JCOPE2M ocean front dataset. In the ablation study, components such as the spatial feature extraction module, gated ConvLSTM, spatiotemporal feature fusion, and loss function were systematically removed or modified to evaluate their individual impact on prediction accuracy. The experiments were conducted using the PyTorch framework. The network was trained for 35 epochs and optimized using the AdamW optimizer via backpropagation, with weight decay applied to adjust the loss. Finally, a series of evaluation metrics were used to evaluate the experimental results.
[0215] Experiment 1: Spatial Feature Extraction Module
[0216] The experiment used OFPNet as the baseline model. The comparison model (denoted as Remove CSWin) removed the CSWin Transformer spatial feature extraction module from the original architecture. Instead, it directly mapped the input SST gradient field through three 3×3 convolutional layers, followed by a gated ConvLSTM, a spatiotemporal feature fusion module, and a decoder. Table 2 shows that OFPNet significantly outperformed the Remove CSWin model in all evaluation metrics for prediction lead time (1-7 days).
[0217] Table 2 Performance evaluation of OFPNet and the model after removing the spatial feature extraction module on the Ocean Front dataset.
[0218]
[0219] Experiment 2: Gated ConvLSTM
[0220] To verify the role of the gated ConvLSTM time series modeler in OFPNet, this ablation experiment removed this module (denoted as RemoveLSTM) for system evaluation. The comparison model retained only the CSWin Transformer spatial feature extractor, directly feeding its output into the spatiotemporal feature fusion module and decoder, omitting the dual-memory state mechanism of the gated ConvLSTM to ensure consistency of other parameters except for the time modeling component, thus allowing for isolated analysis of the gated ConvLSTM's contribution. Experimental results are shown in Table 3. OFPNet outperforms the RemoveLSTM model in most prediction lead times, demonstrating the advantage of the gated ConvLSTM in capturing time.
[0221] Table 3 Performance comparison between OFPNet and the model after removing gated ConvLSTM
[0222]
[0223] Experiment 3: Loss Function
[0224] To verify the effectiveness of the multi-component loss function (including mean squared error loss, gradient loss, front structure similarity loss, and total variational loss) designed in this invention in improving the performance of ocean front prediction, this ablation experiment used a model that only uses a single mean squared error (MSE) loss (denoted as Only MSE) as a benchmark. The experimental results are shown in Table 4. OFPNet consistently outperformed the Only MSE model in most performance metrics over the period (1-7 days), fully demonstrating the rationality of adapting the multi-component loss function to the characteristics of ocean front prediction tasks.
[0225] Table 4 Performance comparison of OFPNet and Only MSE on the Ocean Front dataset.
[0226]
[0227] Main experimental results
[0228] Experiment 1: JCOPE2M Data
[0229] The experiment on ocean front prediction based on the JCOPE2M dataset takes the SST gradient field of the past 15 time steps as input and aims to predict the daily variation of ocean fronts in the next 1-7 days. The absolute prediction value is obtained by recursively superimposing the data. The improved ConvLSTM, PredRNN and CausalLSTM models are selected for comparison. The performance of OFPNet is verified from both qualitative and quantitative aspects.
[0230] Qualitative analysis results show that OFPNet performs excellently in terms of visual morphological fidelity. For example... Figure 5 As shown, the model's predictions for the oceanic front over the next 7 days are largely consistent with the actual situation in terms of frontal direction, curvature, and intensity. The frontal edge is clear and continuous, without obvious blurring or breakage. The quantitative analysis in Table 5 also demonstrates the superior predictive performance of the model proposed in this invention.
[0231] Table 5 Evaluation of different prediction models on the JCOPE2M dataset
[0232]
[0233] Experiment 2: IOSST Data
[0234] To further verify the adaptability and generalization ability of OFPNet on ocean front datasets of different resolutions, the main experiment was conducted using the OISST dataset. Improved versions of ConvLSTM, PredRNN, and CausalLSTM were selected for comparison. The evaluation metrics used previously defined were RMSE, MAE, CC, SSIM, Hu moment similarity, and frontal distance to achieve a multi-dimensional and objective performance comparison.
[0235] Figure 6 The table presents typical visual results of the 7-day ocean front prediction. The first row shows the historical SST gradient fields at 15 time steps, the second row shows the actual ocean front distribution during the same period, and the third row shows the OFPNet prediction results. Visually, the OFPNet prediction results maintain good consistency with the ground truth (GT) morphology, accurately reproducing the direction and curvature of the main front (circled in red), and preserving details of local branching structures. The quantitative analysis in Table 6 also demonstrates the superior predictive performance of the proposed model.
[0236] Table 6 Evaluation of different prediction models on the IOSST dataset
[0237]
[0238] Finally, it should be noted that the above embodiments are intended to illustrate the technical solutions of the present invention and do not constitute any limitation on the present invention. Those skilled in the art should fully understand that modifications to the technical solutions described in the foregoing embodiments or equivalent substitutions for any part or all of the technical features are entirely feasible. Such modifications or substitutions, as long as they do not depart from the scope of protection defined by the claims of the present invention, should be considered reasonable extensions of the present invention.
Claims
1. A method for predicting ocean fronts based on spatiotemporal coupling, characterized in that, include: S1: Obtain historical sea surface temperature data of the target sea area, establish a dynamic gradient direction angle constraint mechanism based on climate state parameters, and extract ocean front feature data based on the dynamic gradient direction angle constraint mechanism and edge detection algorithm; S2: Input the ocean front feature data into the spatial feature extraction module. This module uses a cross-shaped window attention mechanism and local enhancement position coding to extract multi-scale spatial feature sequences. S3: Input the multi-scale spatial feature sequence into the time series modeling module containing short-term cell state and long-term memory state to extract the time feature sequence; S4: Based on the bidirectional cross-attention mechanism, the multi-scale spatial feature sequence and the temporal feature sequence are fused to generate full-time spatiotemporal fusion output features; S5: Generate the temporal variation of the ocean front at a future preset time step based on the full-time spatiotemporal fusion output features, and recursively accumulate the temporal variation of the ocean front based on the historical baseline state to obtain the ocean front prediction result.
2. The ocean front prediction method based on spatiotemporal coupling according to claim 1, characterized in that, In step S1, the establishment of a dynamic gradient direction angle constraint mechanism based on climate state parameters includes: Based on the historical sea surface temperature data, the mean and standard deviation of the historical monthly gradient direction angle are calculated to generate the climate state parameters: Obtain real-time sea surface temperature data And extract its real-time gradient direction angle The matching probability between the real-time gradient direction angle and the climate state parameter is calculated using the following formula: (1) in, For the first Climate state parameters for the month, , These are the mean and standard deviation of the historical monthly gradient direction angle, respectively; The Euclidean distance is a spatiotemporal feature. ; In response to the matching probability satisfying a preset probability threshold, a dynamic gradient direction angle constraint mechanism is established based on the real-time gradient direction angle: (2) in, This is the probability threshold.
3. The ocean front prediction method based on spatiotemporal coupling according to claim 2, characterized in that, In step S1, ocean front feature data is extracted based on the dynamic gradient direction angle constraint mechanism and edge detection algorithm, including: A multi-scale space is constructed using a Gaussian kernel to generate a multi-scale feature map from the real-time sea surface temperature data, as shown in the following formula: (3) in, Representing the Typical frontal widths corresponding to each scale; Indicates the first Feature maps at various scales; Indicates the first A two-dimensional Gaussian kernel function with multiple scales; This refers to the real-time sea surface temperature data at time t. These are spatial coordinates; The dynamic gradient direction angle constraint mechanism is introduced into the Canny edge detection algorithm, and gradient direction filtering is used to enhance the consistency of the ocean front direction. Combined with the frontal region mask constructed based on gradient magnitude, ocean front feature maps at various scales are obtained. The calculation formula is as follows: (4) in, Indicates the first Characteristic map of ocean fronts at various scales; Indicates the first Edge detection results of feature maps at various scales; This represents a frontal region mask constructed based on gradient magnitude. Regions with a gradient greater than or equal to the frontal threshold are represented by 1 and retained; background regions with low gradients are represented by 0 and filtered out. This represents element-wise multiplication; By integrating ocean front feature maps at various scales, a global ocean front feature map is obtained. The global ocean front feature map is subjected to region filtering to remove discrete noise, and morphological closing operation is used to eliminate false targets and connect the fracture front to obtain the ocean front feature data.
4. The ocean front prediction method based on spatiotemporal coupling according to claim 3, characterized in that, In step S2, the extraction of multi-scale spatial feature sequences includes: The ocean front feature data is input into the patch embedding layer, and the mapping from low-dimensional pixel values to high-dimensional feature vectors is completed through two-dimensional convolution operation. Then, the preliminary embedded feature map is output through non-linear activation function and layer normalization operation. The initial embedded feature map is reshaped into a one-dimensional sequence and superimposed with a learnable positional encoding vector to generate an initial sequence feature containing both content and positional information. Multi-stage feature extraction is performed. In the first stage, multiple CSWin blocks are used to capture preliminary long-range spatial dependencies and local texture features at the original resolution to obtain the first-stage spatial feature sequence. The first-stage spatial feature sequence is transformed back into a two-dimensional spatial structure and downsampled by stride convolution to reduce the feature map resolution. In the second stage, multiple CSWin blocks are used to extract deep multi-scale spatial features at the downsampled resolution to obtain the final multi-scale spatial feature sequence.
5. The ocean front prediction method based on spatiotemporal coupling according to claim 4, characterized in that, The first-stage spatial feature sequence is extracted using multiple CSWin blocks, specifically including: The initial sequence features are used to generate a query matrix, a key matrix, and a value matrix through linear mapping. The feature maps corresponding to the query matrix, key matrix, and value matrix are respectively divided into horizontal window branches and vertical window branches according to the attention head; Calculate the scaled dot product attention within the horizontal window branch and the vertical window branch respectively to obtain the horizontal window attention features and the vertical window attention features; A depthwise separable convolution is applied to the value matrix to obtain a local enhanced positional encoding, which is then superimposed onto the horizontal window attention feature and the vertical window attention feature, respectively. The outputs of the two superimposed branches are concatenated along the channel dimension and then linearly mapped to obtain the attention output features of the CSWin block. : (5) in, and These represent the value matrices in the horizontal and vertical window branches, respectively. This indicates a channel-level concatenation operation. To output a linear mapping matrix; For horizontal window attention features, Vertical window attention features; The attention output features are connected to a multilayer perceptron via gated residual connections, resulting in an output sequence of intermediate spatial features that is both accurate and distinct. : (6) in, Represents a linear transformation. This represents the Sigmoid activation function. Indicates the initial sequence features. This represents the characteristics after residual fusion. Indicates the features after gating and filtering; Multiple CSWin blocks are applied sequentially to the input feature sequence and the intermediate spatial feature sequence in a serial cascade manner. As input to the next CSWin block, the first-stage spatial feature sequence is finally obtained.
6. The ocean front prediction method based on spatiotemporal coupling according to claim 5, characterized in that, In step S3, the time series modeling module extracts time feature sequences, including: The multi-scale spatial feature sequences of multiple consecutive time steps are stacked and input into the time series modeling module; Short-term cell states are updated via input and forget gates to capture short-term spatial dynamics; The reading and writing of long-term memory states are controlled by memory gates to preserve the spatial trend of the background field; Based on the updated short-term cell state and long-term memory state, a hidden state containing spatial features and temporal dynamics is generated through the output gate, which serves as the temporal feature sequence.
7. The ocean front prediction method based on spatiotemporal coupling according to claim 6, characterized in that, In step S3, the time series modeling module extracts the time feature sequence. The input features of the current time step are concatenated with the hidden state of the previous time step, and the input gate, forget gate, output gate, candidate cell state and memory gate are generated through convolutional layers. Layer normalization is applied to the input gate, forget gate, output gate, and candidate cell states; The formula for updating the short-term cell state is: ,in, This represents the short-term cell state at the current time step. This represents the short-term cellular state at the previous time step. This represents element-wise multiplication; Indicates a memory gate. It indicates the long-term memory state of the previous time step; , , These represent the normalized input gate, forget gate, and candidate cell state, respectively. The formula for updating the long-term memory state is: ,in, This represents the long-term memory state at the current time step.
8. The ocean front prediction method based on spatiotemporal coupling according to claim 7, characterized in that, In step S4, the feature fusion of the multi-scale spatial feature sequence and the temporal feature sequence based on the bidirectional cross-attention mechanism to generate spatiotemporal fusion features includes: The multi-scale spatial feature sequence and the temporal feature sequence are reshaped in dimension, and a query vector, a key vector, and a value vector are generated through linear transformation. Based on the query vector, key vector, and value vector, a scaled dot product attention is calculated to obtain the spatiotemporal sequence fusion features; The spatiotemporal sequence fusion features are concatenated with the multi-scale spatial feature sequences along the channel dimension, and a spatial adaptive attention weight map is calculated using convolutional layers and activation functions. : (7) Where ReLU is a non-linear activation function. This represents the convolution operation. For convolution kernel weights, For the Sigmoid function; It is a multi-scale spatial feature sequence. Features for spatiotemporal sequence fusion; The spatiotemporal sequence fusion features and the multi-scale spatial feature sequences are weighted and fused based on the spatial adaptive attention weight map to obtain the spatiotemporal fusion features. : (8) The spatiotemporal fusion features of all time steps are concatenated along the time dimension, and global pixel-by-pixel time step weights are generated through a lightweight convolutional neural network. : (9) in, , , The kernel is a convolution kernel; ReLU is a non-linear activation function. For the multi-time spatiotemporal fusion feature tensor of all time steps; Based on the global pixel-by-pixel time step weights, the spatiotemporal fusion features of all time steps are weighted and summed to obtain the full-time spatiotemporal fusion output features. : (10) in, This indicates the total number of time steps.
9. The ocean front prediction method based on spatiotemporal coupling according to claim 8, characterized in that, In step S5, the temporal variation of the ocean front at a future preset time step is generated based on the full-time-series spatiotemporal fusion output features, and the temporal variation of the ocean front is recursively accumulated based on the historical baseline state to obtain the ocean front prediction result, including: The full-time spatiotemporal fusion output features are reshaped into a two-dimensional feature map and input into the decoder. The spatial resolution of the feature map is gradually restored through continuous multi-layer transposed convolution, and the prediction map of the temporal change of the ocean front at each future prediction time step is output. Using the ocean front feature data of the last time step of the historical input sequence as a benchmark, the predicted ocean front temporal variation map is recursively accumulated to obtain the final ocean front prediction value for the next preset time step; the formula for the recursive accumulation is: (11) in, Indicates the future number The final ocean front forecast value at each time step; This represents the final ocean front prediction value at the previous time step. hour, Ocean front feature data for the last time step of the historical input sequence; Indicates the future number The temporal variation of the ocean front at each time step.
10. The ocean front prediction method based on spatiotemporal coupling according to claim 7, characterized in that, A multi-component loss function is used during training. : (12) in, To balance the weighting hyperparameters of various losses, For MSE loss, For gradient loss, For frontal structure similarity loss, This represents the total variational loss.