A method for predicting coagulant dosing by fusing contrastive learning with spatiotemporal dual-branching

By combining comparative learning with spatiotemporal dual-branch fusion, the problems of insufficient spatiotemporal information fusion and inadequate feature discriminability in existing technologies are solved, achieving high-precision prediction of coagulant dosage and improving the stability and generalization ability of the model.

CN121278360BActive Publication Date: 2026-03-10CHENGDU QIANJIA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-10
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing deep learning methods fail to effectively integrate spatiotemporal information in coagulant dosing prediction, resulting in low feature extraction efficiency, limited prediction accuracy, insufficient model generalization ability, and difficulty in coping with complex and ever-changing source water quality.

Method used

We employ a contrastive learning and spatiotemporal dual-branch fusion approach. By using a spatiotemporal dual-branch feature extraction network, a fully connected layer, and an improved loss function, combined with temporal neighborhood sliding window encoding and Gaussian distribution threshold sampling, we construct positive and negative sample pairs to enhance feature discriminativeness and robustness.

Benefits of technology

It significantly improves the accuracy and stability of coagulant dosage prediction, enhances the model's adaptability to different operating conditions, and improves the discriminativeness and robustness of feature representation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121278360B_ABST
    Figure CN121278360B_ABST
Patent Text Reader

Abstract

This invention relates to the field of time series data modeling and prediction technology, and discloses a coagulant addition prediction method based on contrastive learning and spatiotemporal dual-branch fusion. At the feature extraction level, independent dual-branch networks are used to process temporal and spatial features respectively. A feature cross-attention mechanism is used to achieve deep interactive fusion of spatiotemporal information, effectively avoiding feature interference and fully exploring the complementary advantages of spatiotemporal features. At the feature learning level, an improved contrastive learning mechanism is introduced. High-quality positive and negative sample pairs are constructed through temporal neighborhood sampling, and positive sample pairs are aligned and negative sample pairs are separated in the feature space. Through joint optimization of the improved contrastive learning loss function and mean squared error loss, the discriminativeness of the feature space is enhanced while ensuring prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of time series data modeling and prediction, and in particular to a coagulant dosage prediction method based on contrastive learning and spatiotemporal dual-branch fusion. BACKGROUND

[0002] With the rapid development of deep learning technology, its application in the field of water treatment is becoming increasingly widespread. Convolutional neural networks (CNN) and recurrent neural networks (RNN) in deep learning have been introduced into this field. Convolutional neural networks (CNN) are good at processing image data and have played a certain role in analyzing the image features of flocculation; the long short-term memory (LSTM) and gated recurrent unit (GRU) models in recurrent neural networks (RNN) have shown advantages in processing time series data and capturing long-term dependencies of data, and have been applied to learning from time series data to improve the accuracy of coagulant dosage prediction.

[0003] However, in practical applications of predicting coagulant dosage based on collected source water quality parameters (such as pH, temperature, water intake flow, turbidity, etc.), existing deep learning methods still have obvious shortcomings. On the one hand, source water quality data has dynamic variation rules in the time dimension, and water quality parameters at different water intake points are related in the spatial dimension, while most existing models only focus on the features of time series or a single spatial point, failing to effectively fuse spatiotemporal information, resulting in a lack of ability to capture complex changes in water quality. For example, in different seasons, the water temperature and pH value in different regions of the water source will show complex spatiotemporal differences due to factors such as light and water flow, and existing models are difficult to fully grasp the comprehensive influence of these changes on coagulant dosage. On the other hand, in the feature extraction stage, the models have low efficiency in selecting and utilizing key water quality features closely related to coagulant dosage. Taking the turbidity parameter as an example, the demand for coagulant of different particle size turbidity particles is significantly different, and existing models are difficult to accurately separate and strengthen such key features, resulting in limited prediction accuracy of the model. At the same time, the depth of data mining in the model training process is not enough, and the potential rules and hidden relationships in a large amount of data are not fully utilized, making the model's prediction performance extremely unstable when facing complex and variable source water quality, and unable to enhance the discriminability of features, making it difficult to meet the strict requirements of accurate prediction of coagulant dosage in actual production. SUMMARY

[0004] The present application aims to solve the technical problems of insufficient spatiotemporal feature extraction, poor fusion effect, insufficient feature discriminability, and limited model generalization ability, and provides a coagulant dosage prediction method based on contrastive learning and spatiotemporal dual-branch fusion.

[0005] To achieve the above-mentioned application purposes, the embodiments of the present application provide the following technical solutions:

[0006] A coagulant dosing prediction method fusing contrastive learning and space-time double branches, comprising the following steps:

[0007] Based on the space-time double branch feature fusion extraction network, the full connection layer, the time neighborhood sliding window encoding method and the loss function, a coagulant dosing prediction model is constructed;

[0008] The industrial water training data set is input into the coagulant dosing prediction model, the industrial water training data set is encoded by the time neighborhood sliding window to generate a plurality of time sequence samples, the anchor point samples are sampled by combining the Gaussian distribution threshold sampling, and a positive and negative sample pair is constructed;

[0009] The anchor point samples and the positive and negative sample pair are subjected to feature fusion by the space-time double branch feature fusion extraction network, and high-dimensional features are obtained;

[0010] The high-dimensional features are predicted based on the full connection layer to obtain a prediction result, and the contrastive loss of the high-dimensional features is calculated by the improved contrastive learning loss function;

[0011] The mean square error loss of the high-dimensional features is calculated by using the MSE loss function, and the loss function is constructed by the contrastive loss and the mean square error loss;

[0012] The coagulant dosing prediction model is trained and iteratively optimized by back propagation using the loss function, and after training, the real industrial water data set collected by the sensor is input to obtain the prediction result of the coagulant dosing amount.

[0013] In view of the problems of insufficient space-time feature extraction and poor fusion effect, the space-time double branch feature fusion extraction network of the present application adopts a parallel space branch and time branch structure, the space branch captures and processes the topological relationship between processing units through a graph convolution network, the time branch extracts dynamic change law by using a time series convolution network, and finally realizes deep fusion of space-time features through a feature cross attention mechanism, solving the problem of mutual interference of traditional single branch network space-time features. In view of the problems of insufficient feature discriminability and limited model generalization ability, the present application generates sample sequences with time sequence consistency by time neighborhood sliding window encoding, constructs positive and negative sample pairs with semantic consistency by combining the threshold sampling strategy based on Gaussian distribution, and designs an improved contrastive learning loss function, aligns the positive sample pair and separates the negative sample pair in the feature space, thereby enhancing the discriminability of feature representation.

[0014] Compared with the prior art, the present application has the beneficial effects: through the collaborative innovation design of "spatiotemporal double-branch feature extraction + improved contrast learning", at the feature extraction level, the independent double-branch network is used to process the spatiotemporal features respectively, the deep interaction and fusion of the spatiotemporal information are realized through the feature cross attention mechanism, the feature interference is effectively avoided, and the complementary advantages of the spatiotemporal features are fully tapped; at the feature learning level, the improved contrast learning mechanism is innovatively introduced, the high-quality positive and negative sample pairs are constructed through the time neighborhood sampling, the distinguishing ability of the model to the similar working conditions is enhanced, the robustness and discriminativeness of the feature representation are improved, and thus the accuracy and stability of the coagulant dosage prediction method under different operating conditions are significantly improved.

[0015] Further, a coagulant dosage prediction method combining contrast learning and spatiotemporal double-branch fusion, the anchor point samples are sampled by combining Gaussian distribution threshold sampling, and the positive and negative sample pairs are constructed, comprising:

[0016] The complete time series data are divided into time series samples using a sliding window with a size of ;

[0017] Any anchor point sample is sampled from the time series samples, and it is assumed that the probability that the th sample of the anchor point sample is sampled as a negative sample obeys a truncated Gaussian distribution, and the formula is:

[0018] ;

[0019] wherein , is a threshold coefficient, is a non-sampling range centered on the anchor point index , is a Gaussian distribution centered on the anchor point index , is the sampling probability of the th sample, is the sampling probability of the th sample obeying the Gaussian distribution centered on the anchor point index , , is the variance of the Gaussian distribution corresponding to the negative sample sampling probability;

[0020] Non-repeated sample sampling is performed through the anchor point sample , and negative samples are obtained, and the anchor point sample The positive sample is constructed by adding Gaussian noise, and the formula is:

[0021] ;

[0022] wherein, is a positive sample, is random noise obeying a normal distribution with a mathematical expectation of 0 and a variance of is added to the anchor sample to construct the positive sample , is a negative sample, and k is the kth negative sample, is a random variable obeying a normal distribution with a mathematical expectation of and a variance of , is the distribution variance of the Gaussian noise added when the positive sample is constructed.

[0023] In the above scheme, through the sample pair construction strategy of "Gaussian distribution threshold sampling and noise injection", the problems of strong randomness of positive and negative sample sampling in traditional contrast learning methods, difficulty in capturing time sequence semantic similarity, and resulting in insufficient discriminability of feature learning are effectively solved. Traditional methods such as random sampling or uniform sampling often ignore the local continuity and global distribution characteristics of time series, cannot distinguish the semantic correlation of samples at different time points, resulting in semantic inconsistency between positive samples and anchor samples, semantic confusion between negative samples and anchor samples, thereby weakening the effect of contrast learning. The simple noise addition strategy may destroy the original distribution of the sample, introduce too much noise interference, and reduce the robustness of feature learning. The negative sample sampling of the present application is based on a truncated Gaussian distribution probability model, and through the control of the threshold coefficient and the non-sampling range, the negative sample is preferentially sampled outside the time neighborhood, avoiding the semantic confusion that may be caused by random sampling, and accurately capturing the negative examples far from the anchor in the time sequence. The positive sample is constructed by adding Gaussian noise to the anchor sample, which introduces slight disturbance while maintaining semantic consistency, enhances the diversity of the sample and the robustness of the model, and avoids overfitting. Through the construction of high-quality positive and negative sample pairs, the contrast learning can more effectively bring similar samples closer and push dissimilar samples further apart, improving the discriminability of feature representation and the model generalization ability, and realizing the unity of precision, diversity and effectiveness of contrast learning.

[0024] Further, a coagulant dosage prediction method based on contrast learning and spatiotemporal dual-branch fusion, the spatiotemporal dual-branch feature fusion is based on a shared linear mapping layer and multiple spatiotemporal dual-branch cross fusion modules, and is constructed in combination with a gating module and a flattening layer;

[0025] The spatiotemporal dual-branch cross fusion module is based on a time feature extraction branch and a space feature extraction branch, and is constructed in combination with an MLP module and a hybrid scale space feature extraction module.

[0026] The MLP module is constructed based on a shared linear layer, combined with random dropout and a GeLU activation function;

[0027] The gating module is constructed based on a shared linear layer and a Sigmoid activation function;

[0028] The scale space feature extraction module is constructed based on a scale mixing module, combined with a Top-k sparse attention module and layer normalization.

[0029] In the above scheme, through the hierarchical architecture design of "shared linear mapping-double branch cross fusion-gating control", the problems of shallow feature interaction, information transmission redundancy and time-space feature interference in traditional spatio-temporal feature fusion methods are effectively solved. Traditional methods such as simple concatenation or weighted summation often ignore the complementarity and difference of spatio-temporal features, resulting in insufficient expression of fused features and affecting subsequent prediction performance; single scale feature extraction cannot capture multi-level spatial dependencies, and fixed fusion strategies cannot adaptively adjust information flow, causing key features to be submerged or noise to be amplified. The spatio-temporal double branch cross fusion module of the present application captures temporal dynamics and spatial correlations through independent time feature extraction branches and spatial feature extraction branches, respectively, and realizes deep interaction of spatio-temporal features through cross fusion mechanism, avoiding feature confusion caused by single branch processing; the MLP module enhances the non-linear expression ability of features by means of shared linear layer, random dropout and GeLU activation function, prevents overfitting and improves the generalization ability of the model; the gating module dynamically adjusts the feature transmission weight based on the shared linear layer and the Sigmoid activation function, ensuring effective preservation of key information and suppression of redundant information; the mixed scale space feature extraction module focuses on key information in multi-scale spatial features by combining Top-k sparse attention mechanism and layer normalization, reduces the computational complexity, and at the same time enhances the discriminability and robustness of feature representation. The fused features output by the flattening layer not only retain the rich structure and semantic information of spatio-temporal features, but also eliminate redundant interference, realizing the unity of feature fusion comprehensiveness, efficiency and discriminability.

[0030] Further, a contrastive learning and spatio-temporal double branch fusion method for predicting the dosage of coagulant, the Top-k sparse attention module is based on convolutional layers and depth separable convolutional layers, generates queries, keys and values, selects Top-k score values through queries, keys and values, and constructs after Softmax function normalization;

[0031] The scale mixing module is constructed based on convolutional layers and depth separable convolutional layers, combined with ReLU activation function to enhance non-linear expression and cross-branch concatenation to promote multi-scale feature interaction and fusion.

[0032] Further, a coreset learning and spatiotemporal double-branch fusion coagulant dosage prediction method, the processing process of the scale mixing module includes:

[0033] The input data is normalized to layer normalization H1, and then divided into two branches. One branch performs 1x1 convolution operation and 3x3 depth separable convolution operation, and the other branch performs 1x1 convolution operation and 5x5 depth separable convolution operation.

[0034] After the convolution operation, the data of the two branches is activated by the ReLU activation function, and then cross-branch splicing is performed. The data after cross-branch splicing is subjected to 3x3 depth separable convolution operation in one branch, and the data after cross-branch splicing is subjected to 5x5 depth separable convolution operation in one branch.

[0035] After the depth convolution, the data of the two branches is activated by the ReLU activation function, and then splicing is performed. The spliced data is subjected to 1x1 convolution operation and added to the input data, and the output data is output.

[0036] Further, a coreset learning and spatiotemporal double-branch fusion coagulant dosage prediction method, the processing process of the scale mixing module includes:

[0037] The data tensors of the anchor point sample, the positive sample pair and the negative sample pair are respectively input to the shared linear mapping layer for linear transformation, and the transformed data tensors are output to the spatiotemporal double-branch cross-fusion module.

[0038] The spatiotemporal double-branch cross-fusion module extracts time features and space features in a double-path manner from the transformed data tensors, and inputs the extracted time features and space features to the gate module 1 and the gate module 2.

[0039] The gate module 1 and the gate module 2 alleviate the gradient vanishing and gradient explosion problems of the time features and the space features, fuse the alleviated time features and space features, input the fused features to the flattening layer for data dimension flattening, and output high-dimensional features.

[0040] In the above scheme, the spatial features in the prior art usually use independent parameters to process feature mapping of different sample types, resulting in inconsistent feature spaces; the spatiotemporal feature extraction uses a serial or simple parallel structure, causing mutual interference of spatiotemporal information. The present application ensures that the anchor point sample, the positive sample pair and the negative sample pair are transformed in a unified feature space through the shared linear mapping layer, maintaining the consistency of feature representation; the spatiotemporal double-branch cross-fusion module uses a parallel double-path structure to extract time dynamic features and space correlation features respectively, avoiding the problem of mutual interference of spatiotemporal features in traditional methods; the double-gate module design adjusts the adaptive weight, which not only alleviates the gradient vanishing and explosion problems, but also realizes the optimal fusion of spatiotemporal features; finally, the dimension uniformity processing of the flattening layer ensures the regularity of the feature tensor and the convenience of subsequent processing.

[0041] Further, a co-contrast learning and spatio-temporal double-branch fusion coagulant dosage prediction method, the processing process of the spatio-temporal double-branch cross fusion module includes:

[0042] The transformed data tensor is input into the time feature extraction branch, and the transformed transposed data tensor is input into the space feature extraction branch. The input data of the time feature extraction branch is fused after passing through the layer normalization S1 and the MLP module. The input transposed data of the space feature extraction branch is fused after passing through the layer normalization S2 and the mixed scale space feature extraction module.

[0043] The fused data of the time feature extraction branch is interactively connected with the space feature extraction branch through the gating module S1, and the added data of the space feature extraction branch is interactively connected with the time feature extraction branch through the gating module S2.

[0044] The interactive data of the gating module S2 and the fused data of the time feature extraction branch are fused again and then input into the layer normalization S3 for normalization processing to output the time feature. The interactive data of the gating module S1 and the fused data of the space feature extraction branch are fused again and then input into the layer normalization S4 for normalization processing to output the space feature.

[0045] Further, a co-contrast learning and spatio-temporal double-branch fusion coagulant dosage prediction method, the corresponding formula of the spatio-temporal double-branch cross fusion module is:

[0046] ;

[0047] Wherein, is the input data of the time feature extraction branch, is the input data of the space feature extraction branch, is the output data of the time feature extraction branch, is the output data of the space feature extraction branch, is the output data of the layer normalization S1, is the output data of the layer normalization S2, is the MLP module operation, is the mixed scale space feature extraction module operation, is the gating module S1 feature operation, is the gating module S2 feature operation, is the layer normalization S1 operation, is the layer normalization S2 operation, is the layer normalization S3 operation, is the layer normalization S4 operation, is the transposition operation.

[0048] In the above scheme, due to the problems of the prior art in fusing space-time features, such as the lack of space-time interaction mechanism, the single feature propagation path, etc., the space-time features are difficult to complement each other deeply, which affects the model's ability to capture complex water quality dynamics. The space-time double-branch cross-fusion module of the present application builds a deep complementary mechanism for space-time features through a bidirectional interaction connection design: the time feature extraction branch extracts the time series dynamic law through the layer normalization S1 and MLP module, and the space feature extraction branch captures the multi-scale spatial correlation through the layer normalization S2 and the mixed scale space feature extraction module; the two branches realize bidirectional feature interaction through the gating modules S1 and S2, so that the time branch can absorb the context information of the spatial structure, and the spatial branch can obtain the guidance of the time series dynamics; finally, the features after interaction are stabilized through the layer normalization S3 and S4, to ensure the regularity and effectiveness of the output features. The bidirectional interaction fusion mechanism in the present application breaks through the limitations of traditional single path, not only maintains the uniqueness of space-time features, but also realizes deep feature complementation, significantly improving the model's ability to model the spatio-temporal evolution of water quality.

[0049] Further, a coagulant dosage prediction method based on contrastive learning and space-time double-branch fusion, characterized in that the improved contrastive learning loss function improvement process is:

[0050] The Euclidean distance between the prediction samples is used to improve the contrastive learning loss function, and the formula is:

[0051] ;

[0052] Among them, , is the prediction result of the anchor sample, is used to correct the Euclidean distance between each negative sample and the anchor sample , and is scaled by , is a hyperparameter for controlling the distance, is the neighborhood sample around the anchor point, is a hyperparameter for controlling the difficulty of separating the control samples in the improved contrastive loss function, is the improved contrastive learning loss function.

[0053] In the above scheme, due to the problems of insufficient supervision signal and unreasonable negative sample weight distribution of the existing contrast learning loss function, the model is difficult to effectively distinguish different difficulty negative samples, which limits the discriminant performance of feature learning. The traditional InfoNCE loss function gives the same weight to all negative samples, which cannot reflect the semantic difference between different negative samples and anchor samples, and lacks a targeted learning mechanism for difficult negative samples. The improved contrast learning loss function of the present application introduces a distance weighting factor, dynamically adjusts the contribution of the negative sample according to the similarity between the negative sample and the anchor sample, so that the model pays more attention to the challenging difficult negative sample; by scaling the distance, the distribution characteristics of the feature space are finely adjusted, and the perception ability of the model to subtle differences is enhanced. Through the improved loss function calculation, the present application realizes the differentiated supervision of positive and negative samples, significantly improves the discriminant of feature representation and the generalization ability of the model, retains the advantages of traditional contrast learning, and overcomes the defect of rigid weight distribution, so that the model can better adapt to the complex distribution characteristics of industrial water data.

[0054] Further, a coagulant dosing prediction method based on fusion of contrast learning and space-time double branches, characterized in that the loss function is constructed by contrast loss and mean square error loss, and the formula is:

[0055] ;

[0056] Among them, MSE loss function operation is represented by MSE, , and are the prediction results of anchor samples, positive samples and negative samples, , and are the true label values of anchor samples, positive samples and negative samples, is the mean square error, is the contrast loss, is the loss function. BRIEF DESCRIPTION OF DRAWINGS

[0057] In order to more clearly illustrate the technical scheme of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0058] Figure 1 The flowchart of the coagulant dosing prediction method based on fusion of contrast learning and space-time double branches.

[0059] Figure 2 A structural schematic diagram of a spatio-temporal dual-branch feature fusion extraction network.

[0060] Figure 3 A structural schematic diagram of a spatio-temporal dual-branch cross fusion module.

[0061] Figure 4 A structural schematic diagram of an MLP module.

[0062] Figure 5 A structural schematic diagram of a gating module S1.

[0063] Figure 6 A structural schematic diagram of a mixed scale space feature extraction module.

[0064] Figure 7 A structural schematic diagram of a Top-k sparse attention module.

[0065] Figure 8 A structural schematic diagram of a scale mixing module.

[0066] Figure 9 A flowchart of constructing positive and negative samples by Gaussian distribution threshold sampling.

[0067] Figure 10 A flowchart of network forward training and back propagation. DETAILED DESCRIPTION

[0068] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.

[0069] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance, or implying any such actual relationship or order between these entities or operations. In addition, the terms "connected", "connected", etc. can be direct connection between elements, or indirect connection via other elements.

[0070] The application is realized by the technical scheme, which comprises the following steps: Figure 1 As shown in the figure, a coagulant dosing prediction method combining contrastive learning and space-time dual-branch fusion comprises the following steps:

[0071] S1, based on the space-time dual-branch feature fusion extraction network and the full connection layer, combining the time neighborhood sliding window encoding method and the loss function to construct the coagulant dosing prediction model;

[0072] The space-time dual-branch feature fusion extraction network is constructed based on the shared linear mapping layer and a plurality of space-time dual-branch cross fusion modules, and combined with the gate module and the flattening layer;

[0073] Specifically, as shown in the figure, the space-time dual-branch feature fusion extraction network comprises a shared linear mapping layer (Liner), N space-time dual-branch cross fusion modules (STDF), a gate module (Gate) and a flattening layer (Flatten); the gate module (Gate) of the space-time dual-branch feature fusion extraction network comprises a gate module 1 (Gate-1) and a gate module 2 (Gate-2). Figure 2 The space-time dual-branch cross fusion module is based on the time feature extraction branch and the space feature extraction branch, and is constructed by combining the MLP module and the mixed scale space feature extraction module (MEM);

[0074] Specifically, as shown in the figure, the space-time dual-branch cross fusion module comprises an MLP module, a layer normalization (LayerNorm), a mixed scale space feature extraction module (MEM), and a gate module (Gate); the layer normalization (LayerNorm) of the space-time dual-branch cross fusion module comprises a layer normalization S1 (LayerNorm-S1), a layer normalization S2 (LayerNorm-S2), a layer normalization S3 (LayerNorm-S3), and a layer normalization S4 (LayerNorm-S4); the gate module (Gate) of the space-time dual-branch cross fusion module comprises a gate module S1 (Gate-S1) and a gate module S2 (Gate-S2).

[0075] Figure 3 The MLP module is constructed based on the shared linear layer (Shared Liner) and combined with the random dropout (Dropout) and the GeLU activation function;

[0076] Specifically, as shown in the figure, the MLP module comprises a shared linear layer 1 (Shared Liner-1), a random dropout (Dropout), a GeLU activation function, and a shared linear layer 2 (Shared Liner-2) connected in series.

[0077] Specifically, as shown in the figure, the MLP module comprises a shared linear layer 1 (Shared Liner-1), a random dropout (Dropout), a GeLU activation function, and a shared linear layer 2 (Shared Liner-2) connected in series. Figure 4 Specifically, as shown in the figure, the MLP module comprises a shared linear layer 1 (Shared Liner-1), a random dropout (Dropout), a GeLU activation function, and a shared linear layer 2 (Shared Liner-2) connected in series.​

[0078] The gate module (Gate) is constructed based on a shared linear layer and a Sigmoid activation function;

[0079] Specifically, as shown in Figure 5 The gate module S1 (Gate-S1) of the time feature extraction branch includes a shared linear layer G1 (Shared Liner-G1) and a Sigmoid activation function.

[0080] The scale space feature extraction module (MEM) is constructed based on a scale mixing module (Shared Liner), combined with a sparse attention mechanism and layer normalization;

[0081] Specifically, as shown in Figure 6 The mixed scale space feature extraction module (MEM) includes a layer normalization M1 (LayerNorm-M1), a Top-k sparse attention module (TKM), a layer normalization M2 (LayerNorm-M2), and a scale mixing module (SHM).

[0082] The Top-k sparse attention module (TKM) is constructed based on a convolution layer (Conv) and a depthwise separable convolution layer (DW-conv), generates a query (Q), a key (K), and a value (V), selects Top-k score values through the query (Q), the key (K), and the value (V), and constructs after normalization by a Softmax function;

[0083] Specifically, as shown in Figure 7 The Top-k sparse attention module (TKM) includes a convolution layer 1 (Conv1), a convolution layer 2 (Conv2), a convolution layer 3 (Conv3), a convolution layer 4 (Conv4), a depthwise separable convolution layer 1 (DW-conv1), a depthwise separable convolution layer 2 (DW-conv2), a depthwise separable convolution layer 3 (DW-conv3), and a layer normalization K1 (LayerNorm-K1).

[0084] The scale mixing module (SHM) is constructed based on a convolution layer (Conv) and a depthwise separable convolution layer (DW-conv), combined with a ReLU activation function to enhance nonlinear expression and cross-branch splicing to promote multi-scale feature interaction and fusion;

[0085] Specifically, as shown in Figure 8As shown, the scale mixing module (SHM) includes a convolution layer S1 (Conv-S1), a convolution layer S2 (Conv-S2), a convolution layer S3 (Conv-S3), a depth separable convolution layer S1 (DW-convS1), a depth separable convolution layer S2 (DW-convS2), a depth separable convolution layer S3 (DW-convS3), a depth separable convolution layer S4 (DW-convS4), and a layer normalization H1 (LayerNorm-H1).

[0086] S2, input industrial water training data into the coagulant dosing prediction model, the industrial water training data is encoded in a time neighborhood sliding window to generate industrial water samples, and the anchor point samples are sampled in combination with a Gaussian distribution threshold to sample and construct positive and negative sample pairs 、 ;

[0087] Specifically, as shown in Figure 9 and 10 , the S2 specifically includes the following steps:

[0088] S21: using a sliding window with a size of to divide a set of complete time series data into time series samples ;

[0089] S22: sampling any anchor point sample from the time series samples , assuming that the probability that the th sample in the anchor point sample is sampled as a negative sample obeys a truncated Gaussian distribution, and the formula is:

[0090] ;

[0091] wherein, , is a threshold coefficient, is a non-sampling range centered on , is a Gaussian distribution centered on the anchor point index , is the sampling probability of the th sample, is the sampling probability of the th sample obeying a Gaussian distribution centered on the anchor point index , , is the variance of the Gaussian distribution corresponding to the negative sample sampling probability;

[0092] It can be understood that: around ​The sample is more likely to be sampled as a negative sample, but the threshold coefficient Ensure that the sampling distance is not too close;

[0093] S23: Through the anchor sample Non-repetitive sample sampling is carried out, and A negative sample , add Gaussian noise to the anchor sample Construct a positive sample, the formula is:

[0094] ;

[0095] Wherein, is a positive sample, is a random noise subject to a normal distribution with a mathematical expectation of 0 and a variance Add disturbance to the anchor sample to construct a positive sample , is a negative sample, k is the kth negative sample, is a random variable Subject to a normal distribution with a mathematical expectation , variance , is the distribution variance of the Gaussian noise added when constructing a positive sample.

[0096] S3, based on the space-time dual branch feature fusion extraction network, the anchor sample , positive and negative sample pair , Feature fusion is performed to obtain high-dimensional features 、 and ;

[0097] The processing process of the space-time dual branch feature fusion extraction network includes:

[0098] S3-1, input the data tensor of the anchor sample and the positive and negative sample pair to the shared linear mapping layer (Liner) for linear change, and output the transformed data tensor to the space-time dual branch cross fusion module (STDF);

[0099] S3-2, the space-time dual branch cross fusion module (STDF) extracts the time feature and the space feature in the transformed data tensor, and the extracted time feature and the space feature are output to the gate module 1 (Gate-1) and the gate module 2 (Gate-2).

[0100] S3-3, gate module 1 (Gate-1) and gate module 2 (Gate-2) alleviate the gradient disappearance and gradient explosion problem of time characteristics and space characteristics, fuse the alleviated time characteristics and space characteristics, input the fused characteristics to the flatten layer (Flatten) for data dimension flattening, and output high-dimensional features.

[0101] Specifically, it should be noted that, as Figure 2 shown, the complete historical sensor time series data tensor is input to the shared linear mapping layer (Liner) for linear transformation processing, and is divided into two branches. The transformed data tensor is input to the N space-time double-branch cross fusion module (STDF) for time characteristic and space characteristic double-path extraction, and the space-time double-branch cross fusion module (STDF) outputs the output data of the time characteristic extraction branch to gate module 1 (Gate-1) and the output data of the space characteristic extraction branch to gate module 2 (Gate-2), which alleviates the gradient disappearance and gradient explosion problem, and the output data of the gate module (Gate-1) and the gate module (Gate-2) are added and input to the flatten layer (Flatten) for data dimension flattening. The flatten layer (Flatten) outputs the data tensor after feature flattening operation .

[0102] Therefore, the formulas corresponding to S3-1 to S3-3 are:

[0103] ;

[0104] Among them, N is the number of time series samples, D is the feature dimension, and the actual value of N is adjusted according to different source water quality, is the transformed data tensor, is the data tensor after feature flattening operation, is the shared linear mapping layer, is the gate module 1 feature operation, is the gate module 2 feature operation, is the feature flattening operation, and the dimension of the flattened data changes from to .

[0105] It should be noted that includes high-dimensional features , and ;

[0106] The processing process of the space-time double-branch cross fusion module includes:

[0107] S3-2-1: The transformed data tensor enters the temporal feature extraction branch and the transformed transposed data tensor enters the spatial feature extraction branch. The input data of the temporal feature extraction branch is fused after passing through Layer Normalization S1 (LayerNorm-S1) and the MLP module.

[0108] S3-2-2: The input transposed data of the spatial feature extraction branch is fused through Layer Normalization S2 (LayerNorm-S2) and Hybrid Scale Spatial Feature Extraction Module (MEM);

[0109] S3-2-3: The fused data of the temporal feature extraction branch is interactively connected to the spatial feature extraction branch through the gate module S1 (Gate-S1), and the summed data of the spatial feature extraction branch is interactively connected to the temporal feature extraction branch through the gate module S2 (Gate-S2).

[0110] S3-2-4: The interaction data of the gate module S2 (Gate-S2) and the fused data of the time feature extraction branch are fused again, and the input layer normalization S3 (LayerNorm-S3) is normalized before the output time feature is output. The interaction data of the gate module S1 (Gate-S1) and the fused data of the spatial feature extraction branch are fused again, and the input layer normalization S4 (LayerNorm-S4) is normalized before the output spatial feature is output.

[0111] Among them, the dimensionality transformation of the data stream after transpose in the spatial feature extraction branch is... Become Similar to the residual connections in the network depth direction, interactive connections exchange information in the network width direction.

[0112] Specifically, it should be noted that, such as Figure 3 As shown, the processing steps for entering the temporal feature extraction branch include: processing the input data of the temporal feature extraction branch... Input the MLP module to enable Approximating complex nonlinear relationships, the output and input data of the MLP module After addition, the input layer normalizer S1 (LayerNorm-S1) is normalized, and the output data of layer normalizer S1 (LayerNorm-S1) is also normalized. The data is transposed and output from gate module S1 (Gate-S1) and gate module S2 (Gate-S2) of the spatial feature extraction branch. After summing, the input layer is normalized to S3 (LayerNorm-S3), and the output data of the time feature extraction branch is then processed by normalization. .

[0113] The processing procedure of the spatial feature extraction branch includes: inputting the input data of the spatial feature extraction branch into the mixed scale spatial feature extraction module (MEM) after transposition, so that The processing procedure of the spatial feature extraction branch includes: inputting the input data of the spatial feature extraction branch into the mixed scale spatial feature extraction module (MEM) after transposition, so that After multi-scale fusion and enhancement, the output data of the mixed scale spatial feature extraction module (MEM) and the input data after transposition are added and input into the layer normalization S2 (LayerNorm-S2) for normalization processing, and the output of the layer normalization S2 (LayerNorm-S2) is output to the gate module S2 (Gate-S2). The gate module S1 (Gate-S1) of the temporal feature extraction branch performs transposition on the output data and adds the input layer normalization S4 (LayerNorm-S4) for normalization processing, and then outputs the output data of the spatial feature extraction branch .

[0114] Therefore, the formulas corresponding to S3-2-1 to S3-2-4 are as follows:

[0115] ;

[0116] Wherein, is the input data of the temporal feature extraction branch, is the input data of the spatial feature extraction branch, is the output data of the temporal feature extraction branch, is the output data of the spatial feature extraction branch, is the output data of the layer normalization S1, is the output data of the layer normalization S2, is the MLP module operation, is the mixed scale spatial feature extraction module operation, is the gate module S1 feature operation, is the gate module S2 feature operation, is the layer normalization S1 operation, is the layer normalization S2 operation, is the layer normalization S3 operation, is the layer normalization S4 operation, is the transposition operation.

[0117] The processing procedure of the MLP module includes:

[0118] S3-2-1-1: The input data is mapped and expanded through the shared linear layer 1 (Shared Liner-1), the expanded data is introduced into nonlinearity through the dropout (Dropout) regularization and GeLU activation function;

[0119] S3-2-1-2: GeLU activation function output introduces nonlinearity to the data to the shared linear layer 2 (Shared Liner-2) to restore the original dimension, and outputs the data.

[0120] Specifically, as shown in FIG. 3, the input data of the time feature extraction branch is input to the shared linear layer 1 (Shared Liner-1) to map the data to an intermediate dimension. Figure 4 The output data of the shared linear layer 1 (Shared Liner-1) is prevented from overfitting by random dropout (Dropout) and then introduced to nonlinearity by the GeLU activation function, and is output to the shared linear layer 2 (Shared Liner-2). The shared linear layer 2 (Shared Liner-2) maps the data back to the original input dimension. The output data of the shared linear layer 2 (Shared Liner-2) is output as the output data of the MLP module.

[0121] Therefore, S3-2-1-1 to S3-2-1-2: the corresponding formula is:

[0122] ;

[0123] wherein, is the output data of the MLP module, is the shared linear layer 1 mapping, is the shared linear layer 2 mapping, is the GeLU activation function, and the approximate formula is , , is the random dropout operation on the neurons in the network during the training process.

[0124] The processing process of the gate module S1 (Gate-S1) includes:

[0125] S3-2-3-1: input data to the shared linear layer G1 (Shared Liner-G1), and the shared linear layer G1 (Shared Liner-G1) learns the features of the input data. The weight matrix with the same shape as the input data feature is learned through the Sigmoid activation function.

[0126] S3-2-3-2: filter the input features with the weight matrix through Hadamard product, and output the data after filtering.

[0127] Specifically, as shown in FIG. 3, the input data of the time feature extraction branch is input to the shared linear layer 1 (Shared Liner-1) to map the data to an intermediate dimension. Figure 5 ​​​​Input shared linear layer-G1 (Shared Liner-G1) learns data features, and outputs to a Sigmoid activation function to normalize the output of each neuron, and input data of gate module S1 and the data after the Sigmoid activation function are Hadamard products, and the output data of gate module S1 is output.

[0128] Therefore, S3-2-3-1 to S3-2-3-2: the corresponding formula is:

[0129] ;

[0130] wherein, is the input data of gate module S1, , is the output data of gate module S1, is the Hadamard product, is the shared linear layer-G1 mapping, is the Sigmoid activation function, .

[0131] The processing process of the mixed scale space feature extraction module (MEM) includes:

[0132] S3-2-2-1: input data to layer normalization M1 (LayerNorm-M1) and Top-k sparse attention module (TKM) for normalization and extraction of sparse attention features;

[0133] S3-2-2-2: input data and sparse attention features are connected in residual, and the data after residual connection is input to layer normalization M2 (LayerNorm-M2) and scale mixing module (SHM) for normalization and fusion of multi-scale features;

[0134] S3-2-2-3: the data after residual connection and the data after fusion of multi-scale features are connected in residual again, and the output data is output.

[0135] Among them, the output data becomes the feature enhanced data after fusion of multi-scale and sparse attention.

[0136] Specifically, as shown in Figure 6 , the input data of the mixed scale space feature extraction module (MEM) is input to the layer normalization M1 (LayerNorm-M1) for normalization processing, and the normalized data is input to the Top-k sparse attention module (TKM) to extract sparse attention features, and the input data of the mixed scale space feature extraction module (MEM) The residual connection data is input to a layer normalization M2 (LayerNorm-M2) for normalization processing, and the normalized data is input to a scale hybrid module (SHM) to fuse multi-scale features. The residual connection data and the data fused with the multi-scale features are again residual connected, and output data of the mixed scale space feature extraction module (MEM) is output .

[0137] Thus, S3-2-2-1 to S3-2-2-3: the corresponding formula is:

[0138] ;

[0139] Wherein, is the input data of the mixed scale space feature extraction module, is the output data of the mixed scale space feature extraction module, is a layer normalization M1 operation, is a layer normalization M2 operation, is a Top-k sparse attention module operation, is a scale hybrid module operation.

[0140] The processing process of the Top-k sparse attention module (TKM) includes:

[0141] S3-2-2-1-1: The input data is input to a layer normalization K1 (LayerNorm-K1) for normalization processing. The normalized data is subjected to 1x1 convolution operation and 3x3 depth separable convolution operation through different branches to generate query (Q), key (K), and value (V).

[0142] S3-2-2-1-2: The product of the query (Q) and the transposed key (K) is subjected to Top-k screening to focus on the key position. After the focused data is normalized by the Softmax function and multiplied by the value (V), 1x1 convolution operation is performed. The output data is obtained by adding the convolution operation data and the input data.

[0143] Wherein, the output data becomes the data enhanced by fusing multi-scale and sparse attention features.

[0144] Specifically, as shown in Figure 7 , the input data of the Top-k sparse attention module (TKM) The input data is input to layer normalization K1 (LayerNorm-K1) to normalize the input data distribution, and the normalized data is divided into three branches and input to convolution layer 1 (Conv1), convolution layer 2 (Conv2) and convolution layer 3 (Conv3) to perform 1x1 convolution operation. The output data of convolution layer 1 (Conv1) is input to deep separable convolution layer 1 (DW-conv1) to generate query (Q) through 3x3 deep separable convolution. The output data of convolution layer 2 (Conv2) is input to deep separable convolution layer 2 (DW-conv2) to generate key (K) through 3x3 deep separable convolution. The output data of convolution layer 2 (Conv2) is input to deep separable convolution layer 2 (DW-conv2) to generate value (V) through 3x3 deep separable convolution. The product of query (Q) and transposed key (K) is Top-k filtered to focus on key positions. The data filtered by Top-k is converted into a probability distribution by a Softmax function. The data after the Softmax function is multiplied by key (K). The multiplied data is input to convolution layer 4 (Conv4) to perform 1x1 convolution operation. The data after convolution operation is added to the input data of op-k sparse attention module (TKM). The output data of Top-k sparse attention module (TKM) is output .

[0145] Therefore, S3-2-2-1-1 to S3-2-2-1-2: the corresponding formula is:

[0146] ;

[0147] Among them, is the input data of Top-k sparse attention module, is the output data of Top-k sparse attention module, is the layer normalization K1 operation, , , , are all 1x1 convolution operation, , , are all 3x3 deep separable convolution operation, is the operation of selecting Top-k score values, is the Softmax function.

[0148] The processing process of the scale mixing module (SHM) includes:

[0149] S3-2-2-2-1: the input data is normalized by LayerNorm-H1, and then divided into two branches, one branch is subjected to 1x1 convolution operation and 3x3 depth separable convolution operation, and the other branch is subjected to 1x1 convolution operation and 5x5 depth separable convolution operation;

[0150] S3-2-2-2-2: the data of the two branches after convolution operation is subjected to ReLU activation function, and then cross-branch splicing is performed, the data after cross-branch splicing is subjected to 3x3 depth separable convolution operation in one branch, and the data after cross-branch splicing is subjected to 5x5 depth separable convolution operation in one branch;

[0151] S3-2-2-2-3: the data of the two branches after depth convolution is subjected to ReLU activation function, and then splicing is performed, and the spliced data is added to the input data after 1x1 convolution operation, and the output data is output.

[0152] Specifically, as shown in Figure 8 , the input data of the scale mixing module (SHM) is input to LayerNorm-H1 to standardize the input data distribution, and the standardized data is divided into two branches and input to convolution layer S1 (Conv-S1) and convolution layer S2 (Conv-S2) respectively to obtain by 1x1 convolution operation, the output data of convolution layer S1 (Conv-S1) is input to depth separable convolution layer S1 (DW-convS1) to perform 3x3 depth separable convolution processing, and is output to ReLU activation function to enhance the linear fitting ability, to obtain , the output data of convolution layer S2 (Conv-S2) is input to depth separable convolution layer S2 (DW-convS2) to perform 5x5 depth separable convolution processing, and is output to ReLU activation function to obtain , and cross-branch splicing is input to depth separable convolution layer S3 (DW-convS3) to perform 3x3 depth separable convolution processing, and is output to ReLU activation function to obtain , and cross-branch splicing is input to depth separable convolution layer S4 (DW-convS4) to perform 5x5 depth separable convolution processing, and is output to ReLU activation function to obtain , and splicing is input to convolution layer S3 (Conv-S3) to perform 1x1 convolution operation, and the data after convolution operation is added to the input data of the scale mixing module (SHM) , and the output data of the scale mixing module (SHM) is output .

[0153] Thus, S3-2-2-2-1 to S3-2-2-2-3: the corresponding formula is:

[0154] ;

[0155] wherein, is the input data of the scale mixing module, is the output data of the scale mixing module, , , , , is an intermediate variable, is a layer normalization H1 operation, , , are all 1x1 convolution operation, , are all 3x3 depth separable convolution operation, , is a 5x5 depth separable convolution operation, is a tensor splicing operation.

[0156] As shown in Figure 10 , S1-S4 is the network forward training of the coagulant dosing prediction model.

[0157] S4: based on the full connection layer, the high-dimensional features , and are predicted to obtain the anchor sample prediction result , the positive sample prediction result and the negative sample prediction result , the contrastive loss of the high-dimensional features , and is calculated by the improved contrastive learning loss function (InfoNCE), and is obtained.

[0158] Specifically, the improvement process of the improved contrastive learning loss function (InfoNCE) is as follows:

[0159] The Euclidean distance between the prediction samples is used to improve the contrastive learning loss function (InfoNCE), and the formula is:

[0160] ;

[0161] wherein, , is the anchor sample prediction result, to correct the Euclidean distance between each negative sample and the anchor sample , and scaled by , is a hyperparameter that controls the distance, is the neighborhood sample around the anchor, is a hyperparameter that controls the difficulty of separating control samples in the improved contrast loss function, is the improved contrast learning loss function.

[0162] It should be noted that the farther the negative sample distance is, the greater the weight , and the more significant the effect of pushing the negative sample away from the anchor sample, resulting in better prediction results, allowing the weight of false difficult samples to be automatically reduced during gradient optimization, thereby more accurately focusing optimization on real difficult samples with high similarity to anchor samples.

[0163] S5: Calculate the mean square error loss of high-dimensional features , and using the MSE loss function operation, obtain , construct the loss function based on the contrast loss and the mean square error loss, and construct the loss function based on the mean square error loss and the contrast loss , the formula is:

[0164] ;

[0165] wherein, denotes the MSE loss function operation, , and are the anchor sample prediction result, the positive sample prediction result and the negative sample prediction result, , and are the true label value of the anchor sample, the true label value of the positive sample and the true label value of the negative sample, is the mean square error, is the contrast loss, is the loss function.

[0166] S6: Use the loss function to train and iteratively optimize the coagulant dosage prediction model through backpropagation, and after training, input the real industrial water data set collected by the sensor to obtain the prediction result of the coagulant dosage.

[0167] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A coagulant dosing prediction method combining contrastive learning and spatio-temporal dual-branch fusion, characterized in that, The method comprises the following steps: Based on the spatio-temporal double-branch feature fusion extraction network, the full connection layer, the time neighborhood sliding window coding method and the loss function, a coagulant dosing prediction model is constructed; The industrial water training data set is input into the coagulant dosing prediction model, the industrial water training data set is coded in the time neighborhood sliding window to generate multiple time series samples, the anchor point samples are sampled by combining the Gaussian distribution threshold sampling, and a positive and negative sample pair is constructed; The anchor point samples and the positive and negative sample pair are subjected to feature fusion through the spatio-temporal double-branch feature fusion extraction network to obtain high-dimensional features; The high-dimensional features are predicted based on the full connection layer to obtain a prediction result, and the contrast loss of the high-dimensional features is calculated through the improved contrast learning loss function; The mean square error loss of the high-dimensional features is calculated through the MSE loss function, and the loss function is constructed through the contrast loss and the mean square error loss; The coagulant dosing prediction model is trained and iteratively optimized through back propagation using the loss function, and after training, the prediction result of the coagulant dosing amount is obtained by inputting the industrial water data set actually collected by the sensor; The Gaussian distribution threshold sampling is combined to sample the anchor point samples to construct a positive and negative sample pair, which comprises: The complete time series data set is divided into time series samples using a sliding window of size ;​​ right Samples are taken from a time series sample at any anchor point. Assuming any anchor point sample The Middle The probability that a sample is sampled as a negative sample follows a truncated Gaussian distribution, as shown in the formula: ; wherein, , is a threshold coefficient, is a non-sampling range centered at , is a Gaussian distribution centered at anchor index , is a sampling probability of the th sample, is a sampling probability of the th sample subject to a Gaussian distribution centered at anchor index , , is a variance of the Gaussian distribution corresponding to the negative sample sampling probability; Through the anchor sample Non-repetitive sample sampling is performed to obtain Negative samples The anchor sample Add Gaussian noise to the anchor sample to construct a positive sample, and the formula is: ; wherein, is a positive sample, is a random noise subject to a normal distribution with a mathematical expectation of 0 and a variance of is added to the anchor sample to construct the positive sample , is a negative sample, k is the kth negative sample, is a random variable subject to a normal distribution with a mathematical expectation of and a variance of , is a distribution variance of the Gaussian noise added when constructing the positive sample; The improved contrast learning loss function is improved as follows: The Euclidean distance contrast learning loss function between the prediction samples is improved, and the formula is as follows: ; wherein, , is the anchor sample prediction result, is used to correct the Euclidean distance between each negative sample and the anchor sample and scaled by , is a hyperparameter that controls the distance, is the neighborhood sample around the anchor point, is a hyperparameter that improves the difficulty of separating control samples in the contrastive loss function, is the improved contrastive learning loss function.

2. The method of claim 1, wherein the method is characterized by, The spatio-temporal double-branch feature fusion is based on a shared linear mapping layer and multiple spatio-temporal double-branch cross fusion modules, and is constructed in combination with a gating module and a flattening layer; The spatio-temporal double-branch cross fusion module is based on a time feature extraction branch and a space feature extraction branch, and is constructed in combination with an MLP module and a mixed scale space feature extraction module; The MLP module is based on a shared linear layer, and is constructed in combination with random dropout and a GeLU activation function; The gating module is based on a shared linear layer and a Sigmoid activation function. The scale space feature extraction module is based on a scale mixing module, and is constructed in combination with a Top-k sparse attention module and layer normalization.

3. The method of claim 2, wherein the method is characterized by, The Top-k sparse attention module is based on a convolution layer and a depth separable convolution layer, generates queries, keys and values, selects Top-k score values through the queries, keys and values, and is constructed after normalization by a Softmax function; The scale mixing module is based on a convolution layer and a depth separable convolution layer, and is constructed in combination with a ReLU activation function to enhance nonlinear expression and cross-branch splicing to promote multi-scale feature interaction and fusion.

4. The method according to claim 3, wherein, The processing process of the scale mixing module comprises: The input data is normalized by layer normalization H1 and then divided into two branches, one branch is subjected to 1x1 convolution operation and 3x3 depth separable convolution operation, and the other branch is subjected to 1x1 convolution operation and 5x5 depth separable convolution operation; The data of the two branches after the convolution operation is subjected to cross-branch splicing through a ReLU activation function, the data after the cross-branch splicing is subjected to 3x3 depth separable convolution operation in one branch, and the data after the cross-branch splicing is subjected to 5x5 depth separable convolution operation in one branch; The two branch data after deep convolution are spliced after ReLU activation function, and the spliced data are added to the input data after 1*1 convolution operation, and the output data are output.

5. The method of claim 1, wherein the method is characterized by, The processing process of the space-time double branch feature fusion extraction network comprises: respectively inputting data tensors of anchor point samples, positive and negative sample pairs into a shared linear mapping layer for linear change, and outputting the transformed data tensors to a space-time double branch cross fusion module; The space-time double branch cross fusion module extracts time features and spatial features in a double path from the transformed data tensors, and inputs the extracted time features and spatial features in the double path to a gating module 1 and a gating module 2; The gating module 1 and the gating module 2 alleviate the gradient disappearance and gradient explosion problems of the time features and the spatial features, fuse the alleviated time features and spatial features, and input the fused features to a flattening layer to perform data dimension flattening and output high-dimensional features.

6. The method of claim 5, wherein the method is characterized by, The processing process of the space-time double branch cross fusion module comprises: The transformed data tensors are input into a time feature extraction branch, and the transposed transformed data tensors are input into a spatial feature extraction branch, the input data of the time feature extraction branch are fused through layer normalization S1 and an MLP module, and the input transposed data of the spatial feature extraction branch are fused through layer normalization S2 and a mixed scale spatial feature extraction module; The fused data of the time feature extraction branch are interactively connected with the spatial feature extraction branch through a gating module S1, and the added data of the spatial feature extraction branch are interactively connected with the time feature extraction branch through a gating module S2; The interactive data of the gating module S2 and the fused data of the time feature extraction branch are fused again, input into layer normalization S3 for normalization processing, and output time features, and the interactive data of the gating module S1 and the fused data of the spatial feature extraction branch are fused again, input into layer normalization S4 for normalization processing, and output spatial features.

7. The method according to claim 6, wherein, The corresponding formula of the space-time double branch cross fusion module is: ; wherein, is the input data of the temporal feature extraction branch, is the input data of the spatial feature extraction branch, is the output data of the temporal feature extraction branch, is the output data of the spatial feature extraction branch, is the output data of the layer normalization S1, is the output data of the layer normalization S2, is the MLP module operation, is the mixed scale spatial feature extraction module operation, is the gating module S1 feature operation, is the gating module S2 feature operation, is the layer normalization S1 operation, is the layer normalization S2 operation, is the layer normalization S3 operation, is the layer normalization S4 operation, is the transpose operation.

8. The method of claim 1, wherein the method is characterized by, The loss function is constructed by comparing the loss and the mean square error loss, and the formula is: ; wherein, represents MSE loss function operation, , and are anchor sample prediction results, positive sample prediction results and negative sample prediction results, respectively, , and are real label values of the anchor sample, real label values of the positive sample and real label values of the negative sample, respectively, is mean square error, is contrastive loss, is loss function.

Citation Information

Patent Citations

  • Deep learning traffic flow prediction method based on meteorological information fusion

    CN119181256A

  • Sudden drought identification method and system based on space-time double-branch fusion model

    CN120524408A