A watershed water body heavy metal pollution prediction system based on multi-modal attention

CN121524548BActive Publication Date: 2026-08-11BEIJING UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]然而,传统重金属污染预测方法多基于单模态数据,忽略流域时空动态、气象条件及遥感反演信息等多源异构数据的协同作用,难以全面表征污染状态,而部分研究尝试多模态数据融合,但不同模态在特征空间、时间分辨率及空间维度上存在显著差异,直接拼接或简单加权融合易导致关键信息丢失或噪声放大,同时流域水体的流动特性导致上下游污染状态相互影响,但传统模型多基于全局特征建模,难以动态聚焦上下游关键节点的交互信息,预测精度受限,因此,本发明提出一种基于多模态注意力的流域水体重金属污染预测系统以解决现有技术中存在的问题

Benefits of technology

[0022]The beneficial effects of this invention are as follows: This invention dynamically focuses on key correlation information of multimodal data through intramodal and intermodal attention mechanisms to improve the accuracy of cross-modal interaction, solving the heterogeneity problem of different modal data. At the same time, combined with Transformer, it can simultaneously capture the temporal evolution law of pollutants and the spatial distribution characteristics of watersheds, and construct a data-driven prediction model for the dynamic change characteristics of watersheds. By optimizing the prediction accuracy of high-risk areas through weighted loss function, the prediction error is effectively reduced, and high-precision dynamic prediction of heavy metal pollution at the watershed scale is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524548B_ABST
    Figure CN121524548B_ABST
Patent Text Reader

Abstract

This invention discloses a watershed water heavy metal pollution prediction system based on multimodal attention. It includes a data acquisition module for collecting multimodal data related to heavy metal pollution in watershed water, a preprocessing module for standardizing the acquired multimodal data, a multimodal attention fusion module for extracting features from the preprocessed multimodal data and generating fused features through cross-modal interaction, and a dynamic prediction module for outputting the spatiotemporal distribution prediction results of heavy metal pollutant concentrations within the watershed by constructing a spatiotemporally coupled prediction model. This invention dynamically focuses on key correlation information of multimodal data through intramodal and intermodal attention mechanisms to improve the accuracy of cross-modal interaction. Simultaneously, it constructs a data-driven prediction model and optimizes the prediction accuracy of high-risk areas through a weighted loss function, effectively reducing prediction errors and achieving high-precision dynamic prediction of heavy metal pollution at the watershed scale.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water heavy metal pollution prediction technology, and in particular to a watershed water heavy metal pollution prediction system based on multimodal attention. Background Technology

[0002] The water bodies in the basin exhibit significant spatiotemporal coupling, dynamic evolution, and complex runoff changes. Heavy metal pollution is driven by multiple factors, including upstream water inflow, sediment release, precipitation scouring, and industrial and agricultural emissions. Furthermore, there is a strong correlation between the water quality conditions of upstream and downstream areas.

[0003] However, traditional heavy metal pollution prediction methods are mostly based on single-modal data, ignoring the synergistic effect of multi-source heterogeneous data such as watershed spatiotemporal dynamics, meteorological conditions, and remote sensing inversion information, making it difficult to comprehensively characterize the pollution state. Some studies have attempted multimodal data fusion, but different modalities have significant differences in feature space, temporal resolution, and spatial dimension. Direct splicing or simple weighted fusion can easily lead to the loss of key information or noise amplification. At the same time, the flow characteristics of water bodies in watersheds cause the pollution states of upstream and downstream to influence each other. However, traditional models are mostly based on global feature modeling, making it difficult to dynamically focus on the interaction information of key upstream and downstream nodes, thus limiting the prediction accuracy. Therefore, this invention proposes a watershed water heavy metal pollution prediction system based on multimodal attention to solve the problems existing in the prior art. Summary of the Invention

[0004] To address the aforementioned problems, the present invention aims to propose a watershed water heavy metal pollution prediction system based on multimodal attention. This system solves the problem of significant differences between different modalities in feature space, temporal resolution, and spatial dimension by using a multimodal attention mechanism. It dynamically focuses key information to improve the accuracy of cross-modal interaction and constructs a data-driven prediction model to achieve high-precision dynamic prediction of heavy metal pollution at the watershed scale.

[0005] To achieve the objectives of this invention, the following technical solution is provided: a watershed water heavy metal pollution prediction system based on multimodal attention, comprising a data acquisition module, a preprocessing module, a multimodal attention fusion module, and a dynamic prediction module. The data acquisition module is used to collect multimodal data related to heavy metal pollution in watershed water. The preprocessing module is used to standardize the acquired multimodal data. The multimodal attention fusion module is used to extract features and perform cross-modal interaction on the preprocessed multimodal data. Key features of each modality are extracted through intramodal attention mechanism, and cross-modal correlation is calculated and feature weights are dynamically adjusted through intermodal attention mechanism to generate fused features. The dynamic prediction module is used to construct a spatiotemporally coupled prediction model and output the spatiotemporal distribution prediction results of heavy metal pollutant concentration in the watershed using the fused features as input.

[0006] Further improvements include: the multimodal data includes water quality monitoring time-series data, hydrological dynamic data, meteorological driving data, and remote sensing spatial data. The water quality monitoring time-series data includes time-series data of heavy metal ion concentrations and conventional water quality indicators from distributed monitoring stations within the basin, with a sampling frequency of ≥1 time / hour. The hydrological dynamic data includes flow, water level, and flow velocity data from hydrological stations within the basin. The meteorological driving data includes precipitation, temperature, wind speed, and humidity data from meteorological stations within the basin. The remote sensing spatial data includes data on suspended solids concentration, chlorophyll a concentration, and riverbed sediment type retrieved from satellite imagery.

[0007] Further improvements are made in the following aspects: The standardization process includes time alignment, spatial registration, missing value imputation, and Z-score standardization. Time alignment is specifically achieved by unifying the time step to 1 hour through linear interpolation or cubic spline interpolation; spatial registration is specifically achieved by using GIS to rasterize the remote sensing data to a watershed grid with a resolution ≤1km×1km; missing value imputation is specifically achieved by using KNN interpolation or variational autoencoder (VAE) for completion; and Z-score standardization has a mean of 0 and a standard deviation of 1.

[0008] A further improvement is that the multimodal attention fusion module includes intramodal attention units and intermodal attention units. The intramodal attention units are used to encode each type of modal data separately, extract key intramodal features, and assign attention weights. The intermodal attention units use water quality time-series features H... water For querying, use H hydro H meteo and H remote Modal features are defined as keys and values. Cross-modal correlations are calculated and fused features are generated.

[0009] A further improvement lies in the following: the extraction of key features within the modality specifically involves extracting time-dependent features from water quality time-series data using an LSTM encoder, and outputting a time-series feature vector. T represents the time step, and d represents the feature dimension; hydrological data are processed using a one-dimensional convolutional neural network to extract spatial correlation features between stations, and the output is... N represents the number of hydrological stations; meteorological data is reduced in dimensionality using a fully connected layer to extract the dominant meteorological factors, and the output is... M represents the number of weather stations; remote sensing data is processed through a ResNet-18 convolutional neural network to extract grid spatial features, outputting... S represents the number of watershed grids.

[0010] A further improvement is made in that: in the calculation of the cross-modal correlation, the attention score is calculated using Score(Q, K) = QK. T / Implementation, where Q represents the query vector and K represents the key vector, QK T This represents calculating the correlation score between Q and each of the K features, d k The feature dimension is defined as follows: attention weights are generated using α = softmax(Score), where α represents the attention weight, softmax represents the normalized exponential function, and Score represents the attention score matrix calculated in the previous step; the fused feature output is F. fusion =Comcat(α) hydro ·H hydro α meteo ·H meteo α remote ·H remote )⊙H water And reduce the dimensionality to through a fully connected layer. ⊙ indicates element-wise multiplication, α hydro α meteo and α remote These are the attention weight matrices corresponding to the hydrological, meteorological, and remote sensing modes, respectively.

[0011] A further improvement is that the dynamic prediction module is a spatiotemporally coupled Transformer model, including an encoder, a decoder, a loss function, and an output layer;

[0012] The encoder is composed of multiple stacked Transformer encoders, each layer containing a multi-head self-attention sublayer and a feedforward neural network sublayer, used to capture fused features F. fusion The spatiotemporal dependencies are defined, with the multi-head self-attention sublayer employing an 8-head self-attention mechanism to capture the fusion feature F. fusion The long-range spatiotemporal dependence of the output self-attention feature Z self The feedforward neural network sublayer consists of two fully connected layers and a GELU activation function, outputting Z. ffn The residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z) self +Z ffn )express;

[0013] The decoder includes a spatiotemporal location coding layer, a mask self-attention sublayer, and a cross-attention sublayer;

[0014] The spatiotemporal location encoding layer introduces learnable location embedding vectors to represent the geospatial location of the watershed grid. The masked self-attention sublayer is used to predict features for future moments. A lower triangular mask is used to prevent the leakage of future information, capture historical moment dependencies, and output the masked self-attention feature Z. mask The cross-attention sublayer uses the encoder input as the key and value, and the decoder's current state as the query, to generate context-aware features Z. crossThe residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z) mask +Z cross +Z ffn )express;

[0015] The loss function uses weighted mean squared error loss, expressed by the following formula:

[0016]

[0017] Where y t,i For the true value, For the predicted value, w i Let G be the weight of the i-th grid, G be the total number of grids in the watershed, and T be the prediction time step.

[0018] The output layer maps the decoder output to the predicted heavy metal concentration through a fully connected layer. , where G is the number of grid cells, and the concentration is constrained to be non-negative using the Softmax activation function.

[0019] Further improvements are made in the following aspects: The training of the dynamic prediction module uses multimodal data from the past 3 years, with the ratio of training set, validation set and test set being 7:2:1. The optimizer is AdamW, the batch size is 64, the training takes 100 rounds, and the early stopping condition is that the validation set loss does not decrease for 10 consecutive rounds.

[0020] When the dynamic prediction module receives new monitoring data, it automatically triggers an online learning process. Specifically, it first freezes the parameters of the first four layers of the encoder, updates only the parameters of the decoder and the last two layers of the encoder, then uses mini-batch gradient descent to train for 20 rounds, and finally evaluates the consistency of the distribution of the new and old models through adversarial verification after the update. If the KL divergence is >0.1, it rolls back to the previous version.

[0021] Further improvements include a visualization and early warning module, which displays the prediction results in the form of spatiotemporal heat maps, time series curves, and contribution factor maps. It also sets heavy metal concentration thresholds, triggering tiered early warnings when the predicted value exceeds the threshold. The system connects to the environmental protection department's business system, SMS platform, and mobile APP via API interface to push early warning information, which includes the exceeding factor, predicted concentration, affected area, and recommended measures.

[0022] The beneficial effects of this invention are as follows: This invention dynamically focuses on key correlation information of multimodal data through intramodal and intermodal attention mechanisms to improve the accuracy of cross-modal interaction, solving the heterogeneity problem of different modal data. At the same time, combined with Transformer, it can simultaneously capture the temporal evolution law of pollutants and the spatial distribution characteristics of watersheds, and construct a data-driven prediction model for the dynamic change characteristics of watersheds. By optimizing the prediction accuracy of high-risk areas through weighted loss function, the prediction error is effectively reduced, and high-precision dynamic prediction of heavy metal pollution at the watershed scale is achieved. Attached Figure Description

[0023] Figure 1 This is a system architecture diagram of the present invention. Detailed Implementation

[0024] To enhance understanding of the present invention, the present invention will be further described in detail below with reference to embodiments. These embodiments are only used to explain the present invention and do not constitute a limitation on the scope of protection of the present invention.

[0025] Watershed water bodies exhibit significant spatiotemporal coupling, dynamic evolution, and complex runoff variations. Heavy metal pollution in these water bodies is driven by multiple factors, including upstream inflow, sediment release, precipitation erosion, and industrial and agricultural emissions, with a strong correlation between upstream and downstream water quality. However, traditional heavy metal pollution prediction methods suffer from the following problems:

[0026] Existing methods are mostly based on single-modal data, such as time series of chemical indicators from water quality monitoring points, neglecting the spatiotemporal dynamics of the watershed, such as flow rate and water level, meteorological conditions such as precipitation and temperature, and the synergistic effect of multi-source heterogeneous data such as remote sensing inversion information of suspended solids concentration, making it difficult to comprehensively characterize the pollution status.

[0027] Some studies have attempted multimodal data fusion, but different modalities have significant differences in feature space, temporal resolution and spatial dimension. For example, direct splicing or simple weighted fusion of time-series monitoring data, spatial remote sensing data and attribute meteorological data can easily lead to the loss of key information or amplification of noise.

[0028] The flow characteristics of water bodies in a watershed lead to mutual influence between upstream and downstream pollution states. However, traditional models such as LSTM and random forests are mostly based on global feature modeling, which makes it difficult to dynamically focus on the interaction information of key upstream and downstream nodes, thus limiting prediction accuracy.

[0029] according to Figure 1 As shown, this embodiment provides a watershed water heavy metal pollution prediction system based on multimodal attention, including a data acquisition module, a preprocessing module, a multimodal attention fusion module, and a dynamic prediction module.

[0030] The data acquisition module is used to collect multimodal data related to heavy metal pollution in the watershed, including water quality monitoring time series data, hydrological dynamic data, meteorological driving data, and remote sensing spatial data.

[0031] Water quality monitoring time series data includes time series data of heavy metal ion concentrations such as lead ion, cadmium ion, mercury ion, and conventional water quality indicators such as pH, COD, ammonia nitrogen, and dissolved oxygen from distributed monitoring stations within the watershed, with a sampling frequency of ≥1 time / hour.

[0032] Hydrological dynamic data includes flow, water level, and velocity data from hydrological stations within the basin, reflecting the transport capacity of runoff for pollutants;

[0033] Meteorological driving data include precipitation, temperature, wind speed, and humidity data from meteorological stations within the basin, which affect non-point source pollution input and pollutant degradation rates;

[0034] Remote sensing spatial data includes data on suspended solids concentration, chlorophyll a concentration, and riverbed sediment type retrieved from satellite imagery, characterizing the impact of water ecological status on heavy metal adsorption / desorption.

[0035] The preprocessing module is used to standardize the acquired multimodal data. The standardization process includes time alignment, spatial registration, missing value imputation, and Z-score standardization.

[0036] Time alignment is achieved by unifying the time step to 1 hour through linear interpolation or cubic spline interpolation; spatial registration is achieved by rasterizing remote sensing data to a watershed grid using GIS, with a resolution ≤1km×1km; missing value imputation is achieved by using KNN interpolation or variational autoencoder (VAE); and the Z-score standardization has a mean of 0 and a standard deviation of 1.

[0037] The multimodal attention fusion module is used to extract features and perform cross-modal interaction on preprocessed multimodal data. It extracts key features of each modality through intramodal attention mechanism, and then calculates cross-modal correlation and dynamically adjusts feature weights through intermodal attention mechanism to generate fused features.

[0038] The multimodal attention fusion module includes intramodal attention units and intermodal attention units. Intramodal attention units encode each modal data separately, extract key intramodal features, and assign attention weights. Intermodal attention units use water quality time-series features H... water For querying, use H hydro H meteo and H remote Modal features are defined as keys and values; cross-modal correlations are calculated and fused features are generated.

[0039] Intramodal key feature extraction specifically involves:

[0040] Water quality time-series data are processed by an LSTM encoder to extract time-dependent features, outputting a time-series feature vector. T is the time step, and d is the feature dimension;

[0041] Hydrological data are processed using a one-dimensional convolutional neural network to extract spatial correlation features between stations, and the output is... N represents the number of hydrological stations;

[0042] Meteorological data is used to extract the features of dominant meteorological factors through dimensionality reduction using a fully connected layer, and the output is... M represents the number of weather stations;

[0043] Remote sensing data is processed through a ResNet-18 convolutional neural network to extract grid spatial features and output... S represents the number of watershed grids.

[0044] In the calculation of cross-modal correlation, attention score is calculated through... The implementation, where Q represents the query vector, aims to align other modalities such as hydrology, meteorology, and remote sensing with water quality features, and K represents the key vector, which is the feature of other modalities after intra-modal attention encoding. QK T This represents the correlation score between Q and each of the K features. The result of matrix multiplication is a T×N score matrix (assuming Q has a dimension of T×d and K has a dimension of N×d), where each element represents the correlation strength between a water quality feature and a certain hydrological / meteorological / remote sensing feature, d. k For feature dimension, divide by This is to scale the score and prevent the dot product from becoming too large due to high dimensionality, which would cause the gradient of the subsequent softmax function to vanish.

[0045] Attention weight generation α = softmax(Score), where α represents the attention weight. The output dimension is the same as the Score, and each element α... t,n This represents the relative importance of the features of the nth hydrological station to the water quality time series features at time step t. The higher the weight, the greater the contribution of the hydrological station to water quality prediction. softmax represents the normalization exponential function, which transforms each row of the score matrix (corresponding to the water quality features of a time step) into a probability distribution, so that the sum of the contribution weights of each hydrological station to the water quality features of the current time step is 1. Score represents the attention score matrix calculated in the previous step, with a dimension of T×N. Taking the interaction between water quality and hydrological modalities as an example, T is the time step and N is the number of hydrological stations.

[0046] The fused feature output is F fusion =Comcat(α) hydro ·H hydro α meteo ·H meteo α remote·H remote )⊙H water And reduce the dimensionality to through a fully connected layer. ⊙ indicates element-wise multiplication, α hydro α meteo and α remote These are the attention weight matrices corresponding to the hydrological, meteorological, and remote sensing modes, respectively. α·H is a weighted summation. Each modal feature is weighted according to its attention weight to obtain the effective contribution of that mode to the water quality characteristics, such as α. hydro ·H hydro It is the time-step weighted feature of water quality characteristics of each station in the hydrological mode. Comcat() represents the splicing operation, which splices the weighted features of the hydrological, meteorological and remote sensing modes to obtain the intermediate fusion feature with dimension T×(3d).

[0047] The dynamic prediction module is used to construct a spatiotemporally coupled prediction model and take fused features as input to output the spatiotemporal distribution prediction results of heavy metal pollutant concentrations in the watershed.

[0048] The dynamic prediction module is a spatiotemporally coupled Transformer model, including an encoder, decoder, loss function, and output layer;

[0049] The encoder consists of multiple stacked Transformer encoders, each containing a multi-head self-attention sublayer and a feedforward neural network sublayer, used to capture fused features F. fusion The spatiotemporal dependencies are defined, with the multi-head self-attention sublayer employing an 8-head self-attention mechanism to capture the fusion feature F. fusion The long-range spatiotemporal dependence of the output self-attention feature Z self The feedforward neural network sublayer consists of two fully connected layers and a GELU activation function, outputting Z. ffn The residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z) self +Z ffn )express;

[0050] The decoder includes a spatiotemporal location coding layer, a masked self-attention sublayer, and a cross-attention sublayer;

[0051] The spatiotemporal location encoding layer introduces learnable location embedding vectors to represent the geospatial location of the watershed grid. The masked self-attention sublayer is used to predict features for future moments. A lower triangular mask is used to prevent the leakage of future information, capture historical moment dependencies, and output the masked self-attention feature Z. mask The cross-attention sublayer uses the encoder input as the key and value, and the decoder's current state as the query, to generate context-aware features Z. cross The residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z)mask +Z cross +Z ffn )express;

[0052] The loss function uses weighted mean squared error loss, expressed by the following formula:

[0053]

[0054] Where y t,i For the true value, For the predicted value, w i The weight of the i-th grid is ≥2 for densely populated or ecologically sensitive downstream areas and 1 for upstream areas. G is the total number of grids in the watershed and T is the prediction time step.

[0055] The output layer maps the decoder output to the predicted heavy metal concentration through a fully connected layer. , where G is the number of grid cells, and the concentration non-negativity is constrained by the Softmax activation function;

[0056] The dynamic prediction module is trained using 3 years of historical multimodal data, with the ratio of training set, validation set and test set being 7:2:1. The optimizer is AdamW, the batch size is 64, the training is conducted for 100 rounds, and the early stopping condition is that the validation set loss does not decrease for 10 consecutive rounds.

[0057] When the dynamic prediction module receives new monitoring data, it automatically triggers an online learning process. Specifically, it first freezes the parameters of the first four layers of the encoder, updates only the parameters of the decoder and the last two layers of the encoder, and then uses mini-batch gradient descent with a batch size of 32 and a learning rate of 1e-5 for 20 training rounds. Finally, after the update, it evaluates the consistency of the distribution of the new and old models through adversarial verification. If the KL divergence is >0.1, it rolls back to the previous version.

[0058] The system also includes a visualization and early warning module, which displays the prediction results in the form of spatiotemporal heat maps, time series curves, and contribution factor maps, and sets heavy metal concentration thresholds, such as Pb. 2+ When the predicted value exceeds 0.5 mg / L, a graded warning is triggered, such as yellow, orange, or red. The warning information is pushed to the environmental protection department's business system, SMS platform, and mobile APP through the API interface. The warning information includes the exceeding factor, the predicted concentration, the affected area, and recommended measures, such as initiating emergency monitoring and restricting pollution discharge.

[0059] The spatiotemporal heat map, based on WebGL technology, displays the changes in heavy metal concentration over time (hours / days / months) and space (grids / sub-basins) on a GIS platform; the time series curve can select specific monitoring points or grids, overlay predicted and measured values, and display error bands; the contribution factor map uses Sankey diagrams to show the contribution ratio of each modality of data to the prediction results, such as water quality data accounting for 55%, meteorology for 30%, hydrology for 10%, and remote sensing for 5%.

[0060] The prediction method of this system is as follows: First, multimodal data is collected and preprocessed; then, key features of each modality are extracted through intramodal attention, and fusion features are generated through intermodal attention; then, the fusion features are input into a spatiotemporally coupled Transformer model to output the spatiotemporal distribution prediction results of heavy metal concentration; finally, the prediction results are displayed through a visualization module, and early warnings are triggered according to thresholds.

[0061] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of the present invention is defined by the appended claims and their equivalents.

Claims

1. A watershed water heavy metal pollution prediction system based on multimodal attention, characterized in that: The system includes a data acquisition module, a preprocessing module, a multimodal attention fusion module, and a dynamic prediction module. The data acquisition module is used to collect multimodal data related to heavy metal pollution in the watershed. The preprocessing module is used to standardize the acquired multimodal data. The multimodal attention fusion module is used to extract features and perform cross-modal interaction on the preprocessed multimodal data. It extracts key features of each modality through an intramodal attention mechanism, calculates cross-modal correlations and dynamically adjusts feature weights through an intermodal attention mechanism to generate fused features. The dynamic prediction module is used to construct a spatiotemporally coupled prediction model and output the spatiotemporal distribution prediction results of heavy metal pollutant concentrations in the watershed by taking the fused features as input. The multimodal attention fusion module includes intramodal attention units and intermodal attention units. The intramodal attention units are used to encode each type of modal data separately, extract key intramodal features, and assign attention weights. The intermodal attention units use water quality time-series features H... water For querying, use H hydro H meteo and H remote Modal features are defined as keys and values; cross-modal correlations are calculated and fused features are generated. The intramodal key feature extraction specifically involves extracting time-dependent features from water quality time-series data using an LSTM encoder, outputting a time-series feature vector Hwater∈ T×d T represents the time step, and d represents the feature dimension; hydrological data are processed using a one-dimensional convolutional neural network to extract spatial correlation features between stations, outputting H. hydro ∈ N×d N represents the number of hydrological stations; meteorological data is reduced in dimensionality using a fully connected layer to extract the dominant meteorological factors, outputting H. meteo ∈ M×d M represents the number of weather stations; remote sensing data is processed through a ResNet-18 convolutional neural network to extract grid spatial features, outputting H. remote ∈ S×d S is the number of watershed grids; In the calculation of the cross-modal correlation, the attention score is calculated using Score(Q, K) = QK. T / Implementation, where Q represents the query vector and K represents the key vector, QK T This represents the calculation of the correlation score between Q and each of the K features, d k For feature dimensions; attention Weight generation α = softmax(Score), where α represents the attention weight, softmax represents the normalized exponential function, and Score represents the attention score matrix calculated in the previous step; The fused feature output is F fusion =Concat(α) hydro ·H hydro α meteo ·H meteo α remote ·H remote )⊙H water And reduce the dimensionality to through a fully connected layer. T×d ⊙ indicates element-wise multiplication, α hydro α meteo and α remote These are the attention weight matrices for the hydrological, meteorological, and remote sensing modes, respectively. The dynamic prediction module is a spatiotemporally coupled Transformer model, including an encoder, a decoder, a loss function, and an output layer; The encoder is composed of multiple stacked Transformer encoders, each layer containing a multi-head self-attention sublayer and a feedforward neural network sublayer, used to capture fused features F. fusion The spatiotemporal dependencies are defined, with the multi-head self-attention sublayer employing an 8-head self-attention mechanism to capture the fusion feature F. fusion The long-range spatiotemporal dependence of the output self-attention feature Z self The feedforward neural network sublayer consists of two fully connected layers and a GELU activation function, outputting Z. ffn The residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z) self +Z ffn )express; The decoder includes a spatiotemporal location coding layer, a mask self-attention sublayer, and a cross-attention sublayer; The spatiotemporal location encoding layer introduces learnable location embedding vectors to represent the geospatial location of the watershed grid. The masked self-attention sublayer is used to predict features for future moments. A lower triangular mask is used to prevent the leakage of future information, capture historical moment dependencies, and output the masked self-attention feature Z. mask The cross-attention sublayer uses the encoder input as the key and value, and the decoder's current state as the query, to generate context-aware features Z. cross The residual connection and layer normalization are derived from equation Z. out =LayerNorm(Z) mask +Z cross +Z ffn )express; The loss function uses weighted mean squared error loss, expressed by the following formula: Where y t,i For the true value, For the predicted value, w i Let G be the weight of the i-th grid, G be the total number of grids in the watershed, and T be the prediction time step. The output layer maps the decoder output to the predicted heavy metal concentration through a fully connected layer. ∈ T×G , where G is the number of grid cells, and the concentration is constrained to be non-negative using the Softmax activation function.

2. The watershed water heavy metal pollution prediction system based on multimodal attention according to claim 1, characterized in that: The multimodal data includes water quality monitoring time-series data, hydrological dynamic data, meteorological driving data, and remote sensing spatial data. The water quality monitoring time-series data includes time series data of heavy metal ion concentrations and conventional water quality indicators from distributed monitoring stations within the basin, with a sampling frequency of ≥1 time / hour. The hydrological dynamic data includes flow, water level, and flow velocity data from hydrological stations within the basin. The meteorological driving data includes precipitation, temperature, wind speed, and humidity data from meteorological stations within the basin. The remote sensing spatial data includes data on suspended solids concentration, chlorophyll a concentration, and riverbed sediment type retrieved from satellite imagery.

3. The watershed water heavy metal pollution prediction system based on multimodal attention according to claim 1, characterized in that: The standardization process includes time alignment, spatial registration, missing value imputation, and Z-score standardization. Time alignment is specifically achieved by unifying the time step to 1 hour through linear interpolation or cubic spline interpolation. Spatial registration is specifically achieved by rasterizing the remote sensing data to a watershed grid using GIS, with a resolution ≤1km×1km. Missing value imputation is specifically achieved by using KNN interpolation or variational autoencoder (VAE) for completion. The Z-score standardization has a mean of 0 and a standard deviation of 1.

4. The watershed water heavy metal pollution prediction system based on multimodal attention according to claim 1, characterized in that: The dynamic prediction module is trained using three years of historical multimodal data, with the ratio of training set, validation set, and test set being 7:2:

1. The optimizer is AdamW, the batch size is 64, the training takes 100 rounds, and the early stopping condition is that the validation set loss does not decrease for 10 consecutive rounds. When the dynamic prediction module receives new monitoring data, it automatically triggers an online learning process. Specifically, it first freezes the parameters of the first four layers of the encoder, updates only the parameters of the decoder and the last two layers of the encoder, then uses mini-batch gradient descent to train for 20 rounds, and finally evaluates the consistency of the distribution of the new and old models through adversarial verification after the update. If the KL divergence is >0.1, it rolls back to the previous version.

5. A watershed water heavy metal pollution prediction system based on multimodal attention according to claim 1, characterized in that: It also includes a visualization and early warning module, which displays the prediction results in the form of spatiotemporal heat maps, time series curves, and contribution factor maps, and sets heavy metal concentration thresholds. When the predicted value exceeds the threshold, a graded early warning is triggered. The system connects to the environmental protection department's business system, SMS platform, and mobile APP through API interface to push early warning information. The early warning information includes the exceeding factor, predicted concentration, affected area, and recommended measures.

Citation Information

Patent Citations

  • River pollution detection method based on multi-modal data fusion

    CN120449094A

  • Transform-based cross-modal fusion multi-modal emotion recognition method

    CN120508972A