A remote sensing water quality inversion black and odorous water body identification method based on a time sequence convolution network

By constructing a black and odorous water body identification model based on temporal convolutional networks, the problem of insufficient identification accuracy of black and odorous water bodies in rural areas was solved, and high-precision water quality parameter inversion and accurate identification of black and odorous water bodies were achieved.

CN122289947APending Publication Date: 2026-06-26ANHUI INST OF GEOLOGICAL SURVEYING & MAPPING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ANHUI INST OF GEOLOGICAL SURVEYING & MAPPING TECH
Filing Date
2026-05-28
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies rely on general spectral features for inversion identification of black and odorous water bodies in rural areas, resulting in limited accuracy, especially in complex environments where high accuracy is difficult to achieve.

Method used

A remote sensing water quality inversion method based on temporal convolutional networks was adopted to construct a black and odorous water body identification model, which includes a temporal convolutional network residual module, a channel attention module, a temporal attention module, and a regressor module. The predicted values ​​of water quality parameters are output through adaptive weighting and fusion of feature maps, and the black and odorous water bodies are determined by combining the measured threshold.

Benefits of technology

It significantly improves the accuracy of black and odorous water body identification, especially in terms of the coefficient of determination and root mean square error of dissolved oxygen, ammonia nitrogen and transparency parameters, which are 0.829, 0.911 and 0.920 respectively, which are better than traditional machine learning methods, and realize the accurate identification and quantitative inversion of black and odorous water bodies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289947A_ABST
    Figure CN122289947A_ABST
Patent Text Reader

Abstract

This invention relates to the field of remote sensing water quality identification technology, and in particular to a method for identifying black and odorous water bodies based on a temporal convolutional network. By constructing a black and odorous water body identification model comprising a cascaded temporal convolutional network residual module, a channel attention module, a temporal attention module, a global average pooling layer, and a regressor module, and replacing the original output layer of the temporal convolutional network with the regressor module, a mapping from remote sensing image data to continuous water quality parameter predictions is achieved. This solves the technical problem of limited accuracy in identifying black and odorous water bodies by relying solely on general spectral features in existing technologies. Furthermore, by performing addition, subtraction, multiplication, and division operations on the original spectral bands to generate combined bands, and using the Pearson correlation coefficient method to select the original and combined bands with the highest correlation, a sample dataset is constructed by combining this with ground-based measured data. This further expands the sample size based on existing samples, significantly improving the model's learning efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of remote sensing water quality identification technology, and in particular to a method for identifying black and odorous water bodies based on temporal convolutional networks. Background Technology

[0002] The treatment of polluted and odorous water bodies in rural areas is an important aspect of improving the rural living environment, and accurate identification of these water bodies is fundamental to effective treatment. Polluted and odorous water bodies in rural areas are typically characterized by their scattered distribution, small area, and complex causes. Traditional methods relying on manual field surveys are limited by low efficiency and high cost. Remote sensing technology, with its advantages of wide coverage, fast monitoring speed, and ease of long-term dynamic observation, has shown significant potential in water body information extraction and the identification of polluted and odorous water bodies. This technology is not limited by natural conditions, can compensate for the shortcomings of traditional manual surveys, and provides technical support for large-scale, long-term water quality monitoring and parameter inversion.

[0003] Currently, the identification of black and odorous water bodies mainly relies on two approaches: one is to construct band indices based on the spectral characteristics of the water body and make judgments by setting empirical thresholds; the other is to rely on manual on-site judgment of the water's color and odor. However, black and odorous water bodies in rural areas are greatly affected by the surrounding environment and pollution sources, and the accuracy of methods that rely solely on general spectral characteristics for inversion is limited. Although mathematical statistical methods are often used to construct remote sensing inversion models of water quality parameters to analyze the water conditions of target areas and extract key parameters, the identification accuracy of such methods in the complex environment of rural areas still needs to be improved. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a remote sensing water quality inversion method for identifying black and odorous water bodies based on temporal convolutional networks, which solves the technical problem that existing technologies rely solely on general spectral features for inversion and identification of black and odorous water bodies with limited accuracy.

[0005] To address the aforementioned technical problems, this invention provides the following technical solution: a remote sensing water quality inversion method for identifying black and odorous water bodies based on temporal convolutional networks, the method specifically including the following steps: S1. Acquire remote sensing image data of the target area and preprocess it to extract remote sensing reflectance data; S2. A black and odorous water body identification model is constructed and trained based on a temporal convolutional network to extract temporal feature maps from remote sensing reflectance data and output predicted values ​​of water quality parameters through adaptive weighting. The black and odorous water body identification model includes: A channel attention module is used to adaptively enhance spectral feature channels that are strongly correlated with water quality parameters in the time-series feature map and suppress noise channels to output a channel-weighted feature map. And a temporal attention module for adaptively weighting the time steps in the channel-weighted feature map and outputting a fused feature map that simultaneously achieves spectral feature channel enhancement and adaptive time step weighting after fusion; And a regressor module that maps the pooled feature vector output by global average pooling of the fused feature map to continuous water quality parameter prediction values. S3. Compare the predicted water quality parameters with the preset water quality parameter thresholds and output the distribution results of black and odorous water bodies.

[0006] Preferably, the preprocessing steps include at least one of radiometric calibration, atmospheric correction, geometric correction, image fusion and mosaicking.

[0007] Preferably, the specific steps for constructing the dataset during the training of the black and odorous water body identification model are as follows: Select a sample area and obtain the reflectance values ​​of multiple original spectral bands within the sample area; Multiple combined bands are generated by performing at least one operation among addition, subtraction, multiplication, and division on the reflectance values ​​of multiple original spectral bands. The Pearson correlation coefficient was used to assess the correlation between the reflectance values ​​of the original spectral bands and the combined bands and various water quality parameters. For each water quality parameter, a preset number of original spectral bands and combined bands with the highest correlation are selected as sample bands, and the remote sensing reflectance values ​​of the sample bands are extracted. These are then combined with the measured water quality parameter values ​​to construct a sample dataset.

[0008] Preferably, the black and odorous water body identification model further includes a temporal convolutional network residual module and a global average pooling layer; The temporal convolutional network residual module is used to extract the long-term dependence of water quality parameters over time and retain the original temporal signal to obtain a temporal feature map. The residual module of the temporal convolutional network is used to extract the long-term dependence of water quality parameters over time in the preliminary temporal feature map and retain the original temporal signal to obtain the temporal feature map. The global average pooling layer is used to reduce the dimensionality of the fused feature map to eliminate redundant information caused by fluctuations in water quality parameters at different time steps, and to retain the overall contribution of each spectral channel to the inversion of water quality parameters, thus obtaining the pooling feature vector.

[0009] Preferably, the water quality parameters include at least one of dissolved oxygen concentration, ammonia nitrogen concentration, and transparency.

[0010] Preferably, the channel-weighted feature map and the time-weighted feature map are fused by adding them element by element to obtain a fused feature map.

[0011] Preferably, when comparing the predicted water quality parameters with the preset water quality parameter thresholds, if at least one predicted water quality parameter in a certain area reaches the preset water quality parameter threshold, it is determined to be a black and odorous water body.

[0012] Preferably, in step S2, the training of the black and odorous water body identification model specifically includes the following steps: S21. Obtain the source domain remote sensing image dataset and the corresponding source domain measured water quality parameter values. The source domain is a rich sample water area with different water body optical characteristics from the target area. Using the reflectance value of the source domain remote sensing image data as input and the source domain measured water quality parameter values ​​as labels, pre-train the black and odorous water body identification model to obtain the pre-trained model parameters. S22. Based on the loss function of the pre-trained model parameters in the source domain pre-training process, calculate the Fisher information matrix of the weight parameters of each layer in the pre-trained model parameters. The calculation of the Fisher information matrix is ​​performed on a verification set randomly extracted from the sample dataset of the target region. S23. Compare the Fisher information values ​​of each parameter in the Fisher information matrix with a preset importance threshold, and mark the network layer containing the parameter whose Fisher information value is higher than the importance threshold as a key layer, and mark the remaining layers as adaptable layers. S24. Freeze the parameters of all key layers in the black and odorous water body identification model, and fine-tune the parameters of the adaptive layer on the sample dataset of the target area. S25. When the total loss value on the validation set does not decrease within a preset number of consecutive training rounds, stop fine-tuning to obtain a black and odorous water body identification model suitable for the target area.

[0013] Preferably, during the fine-tuning process, the loss function is constructed by introducing a maximum mean difference regularization term based on the mean square error between the predicted and measured water quality parameter values. The maximum mean difference regularization term is used to calculate the distribution distance in the feature space between the fused feature map obtained from the source area remote sensing image data extracted by the black and odorous water body identification model and the fused feature map obtained from the target area remote sensing image data extracted by the black and odorous water body identification model.

[0014] The present invention also provides a remote sensing water quality inversion black and odorous water body identification system based on temporal convolutional networks, including a processor and a memory. The memory is used to store a computer program, and when the computer program is executed by the processor, it implements the black and odorous water body identification method.

[0015] By employing the above technical solution, the present invention provides a method for identifying black and odorous water bodies based on remote sensing water quality inversion using temporal convolutional networks, which has at least the following beneficial effects: 1. This invention constructs a black and odorous water body identification model by constructing a cascaded temporal convolutional network residual module, channel attention module, temporal attention module, global average pooling layer, and regressor module. The regressor module replaces the original output layer of the temporal convolutional network, realizing the mapping from remote sensing image data to continuous water quality parameter prediction values. This solves the technical problem of limited accuracy in the inversion identification of black and odorous water bodies by relying solely on general spectral features in existing technologies, and provides a high-precision inversion method for the identification of black and odorous water bodies in complex rural environments.

[0016] 2. This invention generates combined bands by performing addition, subtraction, multiplication, and division operations on the original spectral bands. It then uses the Pearson correlation coefficient to select the original and combined bands with the highest correlation to construct a sample dataset. The model's accuracy is validated using the coefficient of determination and root mean square error (RMSE), effectively improving the model's inversion accuracy and generalization ability. The coefficients of determination for dissolved oxygen, ammonia nitrogen, and transparency reach 0.829, 0.911, and 0.920, respectively, while the RMSEs are only 0.374, 0.056, and 0.646, respectively, significantly outperforming traditional machine learning methods such as random forests, extreme gradient boosting, and gradient boosting decision trees.

[0017] 3. This invention obtains a fused feature map by element-wise addition and fusion of the channel-weighted feature map and the time-weighted feature map. The fused feature map simultaneously contains the importance weights of the channel dimension features and the time dimension features, achieving dual focus on key spectral channels and key time-series nodes. It outputs continuous water quality parameter prediction values ​​through the regressor module. Combined with the water quality parameter thresholds of less than 25cm transparency, less than 2mg / L dissolved oxygen, and greater than 15mg / L in the "Guidelines for the Treatment of Black and Odorous Water Bodies in Rural Areas", it achieves accurate identification of black and odorous water bodies. Compared with comparative models such as random forest, extreme gradient boosting, and gradient boosting decision tree, the model of this invention has higher determination coefficients for the three water quality parameters of dissolved oxygen, ammonia nitrogen, and transparency by more than 0.185, 0.231, and 0.280, respectively, which significantly improves the inversion accuracy. Attached Figure Description

[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of the black and odorous water body identification model of the present invention; Figure 2 This is a flowchart of the channel attention module of the present invention; Figure 3 This is a flowchart of the timing attention module of the present invention; Figure 4This is a diagram showing the distribution of black and odorous water bodies obtained through the inversion method of this invention. Detailed Implementation

[0019] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. This will allow for a full understanding of how the present application uses technical means to solve technical problems and achieve technical effects, and to facilitate its implementation.

[0020] To address the limited accuracy of existing technologies that rely solely on general spectral features for identifying black and odorous water bodies, this embodiment provides a remote sensing water quality inversion method for identifying black and odorous water bodies based on temporal convolutional networks. This method improves upon current temporal convolutional network models to form a black and odorous water body identification model. This embodiment uses a rural area as the target region to illustrate this method: S1. Acquire high-resolution Jilin-1 remote sensing image data of the target area at a specific time phase, and complete the preprocessing process in ENVI 5.6 software. This mainly includes radiometric calibration, atmospheric correction, geometric correction, image fusion, and mosaicking. At least one of these preprocessing methods must be used. This embodiment employs all five preprocessing methods in sequence. To improve preprocessing efficiency, PIE software is used in the image fusion and mosaicking stage to extract remote sensing reflectance data. Radiometric calibration can be performed using the ENVI China Satellite Extensions tool to convert the grayscale values ​​of the remote sensing image... The conversion formula for radiance values ​​is as follows:

[0021] In the above formula, Indicates band Radiance Represents the original grayscale value of a pixel in a remotely sensed image. and These are the calibration parameters for the first sensor and the calibration parameters for the second sensor, respectively, provided by the satellite data metadata file.

[0022] Atmospheric correction uses the FLAASH model to convert the radiometrically calibrated radiance values ​​of remotely sensed images into true surface reflectance values. The purpose is to eliminate interference from atmospheric scattering and absorption. The conversion formula is as follows:

[0023] In the above formula, The values ​​represent the Earth's surface reflectance, where A is a combined parameter of atmospheric absorption and scattering, and B is the atmospheric background radiation. is the pixel surface reflectance, and S is the balloon-shaped albedo.

[0024] Geometric correction can be achieved by selecting the "Geographic Information Public Service Platform (Tianditu)" as the reference image, using the RPCorthorectification tool, and combining DEM (Digital Elevation Model) data to eliminate terrain undulations and sensor geometric distortions, thereby converting remote sensing images into images with true geographic coordinates and vertical projection.

[0025] Image fusion and mosaicking can be performed using PIE software. The geometrically corrected images are resampled in the same spatial coordinate system to achieve the same spatial resolution. The registered images are then transformed, and the Gram-Schmidt fusion method is selected to fuse panchromatic and multispectral images. Finally, mosaicking is performed using image boundary vectors to obtain the preprocessed image. Using PIE software for image fusion and mosaicking significantly improves the efficiency of the image preprocessing workflow.

[0026] S2. A black and odorous water body identification model is constructed and trained based on a temporal convolutional network (TCN) to extract temporal feature maps from remote sensing reflectance data and output predicted water quality parameters through adaptive weighting. Convolutional neural networks (CNNs) have been widely used in various fields due to their excellent nonlinear fitting capabilities and have shown significant effectiveness in water quality monitoring. However, this model is sensitive to the number of samples and is prone to overfitting when data is insufficient, leading to a decrease in the accuracy of water quality parameter inversion. Traditional CNNs often face problems such as gradient vanishing and low efficiency of serial computation when processing long-term series data. To address this challenge, the temporal convolutional network (TCN) model introduces temporal convolution as the core temporal prediction module. Through convolution operations, it extracts and learns sequence features, exhibiting significant advantages in parallel computing, long-sequence modeling, long-term dependency capture, and training stability, making it particularly suitable for processing complex long-term series data.

[0027] like Figure 1As shown, the TCN network model is based on the idea of ​​Convolutional Neural Network (CNN). Its network architecture consists of an input layer, a Temporal Convolutional Network Residual Block (TCN Residual Block), a global average pooling layer, and an output layer. The Temporal Convolutional Network Residual Block is the core component of this network, including a one-dimensional causal convolutional layer, a one-dimensional depth dilation convolutional layer, and a one-dimensional pointwise convolutional layer. The input data are the reflectance values ​​of remote sensing image feature bands and the measured water quality parameter values. Considering that the remote sensing reflectance data has a sequential temporal order, information from future times should not affect the prediction of the current time. However, traditional convolution will see future data, which does not meet the requirements of temporal prediction. Therefore, this embodiment uses one-dimensional causal convolution to first perform causal convolution on the remote sensing reflectance data step by step, ensuring that the output at the current time depends only on the reflectance values ​​of the current and historical times, thereby extracting local temporal features related to changes in water quality parameters such as dissolved oxygen, ammonia nitrogen, and transparency, and outputting a preliminary temporal feature map. One-dimensional deep dilated convolutional layers insert holes between convolutional kernel elements, causing the receptive field to expand exponentially with the number of layers. This captures the long-term dependence of water quality parameters over time, such as the cumulative effect of pollutants and the dilution process after rainfall. Simultaneously, this module uses residual connections to add the input element-wise to the output processed by convolution, batch normalization, and activation functions, preserving the original temporal signal and preventing information loss in deep networks. One-dimensional batch normalization (BatchNorm1d) is applied after the convolutional layers to standardize the batch data, followed by activation functions (LeakyReLU) and dropout layers to prevent overfitting. This module ultimately outputs a high-dimensional temporal feature map, where each time step incorporates historical reflectance information spanning months or even years, used for accurate modeling of the evolution of black and odorous water bodies. The expression for calculating the one-dimensional convolutional layer is:

[0028] In the above formula, This represents the value of the output sequence at time step t. Let represent the i-th weight of the convolution kernel, where the kernel size is k, b is the bias term, and d is the inflation coefficient. This represents the value of the d×i-th ​​time step before the current time step t in the input sequence.

[0029] The expression for calculating the residual module of a temporal convolutional network can be represented as:

[0030] In the above formula, and These represent the input and output features of the residual module of the temporal convolutional network, respectively. This represents a one-dimensional causal convolution. This represents a one-dimensional depth dilated convolution. This represents a one-dimensional pointwise convolution with a kernel size of 1. This indicates batch normalization processing. Indicates random inactivation. Let represent the LeakyReLU activation function, p_drop represent the random deactivation probability, and r(t) represent the residual. This indicates a negative slope for LeakyReLU.

[0031] Although the TCN module can efficiently capture feature information, it often treats features from different time steps equally when feeding feature maps into the fully connected layer, failing to fully reflect the nonlinear impact of key information in the sequence on the prediction results. Therefore, to improve the current TCN network, a channel attention module (SE Block), a temporal attention module, and a regressor module are introduced after the temporal convolutional network residual module. The improved TCN network model is the black and odorous water body identification model in this embodiment. This model can adaptively focus on the most critical features for prediction, thereby significantly improving the ability to identify and represent abrupt changes and core driving factors. The channel attention module aims to enhance effective features and weaken ineffective features by learning feature weights, thereby improving model performance; the temporal attention module improves the model's ability to model long sequence dependencies by dynamically weighting the importance of different time steps.

[0032] The specific structure of the black and odorous water body identification model is as follows: A cascaded channel attention module and a temporal attention module are added between the temporal convolutional network residual module and the global average pooling layer of the temporal convolutional network. A regressor module is introduced to replace the output layer of the temporal convolutional network. Specifically, the temporal convolutional network residual module extracts preliminary temporal features from remote sensing reflectance data, captures long-term dependencies in these features, and preserves the original temporal signal to obtain a temporal feature map. The channel attention module adaptively weights the feature channels of the temporal feature map to obtain a channel-weighted feature map. The temporal attention module further weights the channel-weighted features. The time steps of the weighted feature map are adaptively weighted to obtain a time-weighted feature map; the channel-weighted feature map and the time-weighted feature map are fused to obtain a fused feature map; the global average pooling layer is used to reduce the dimensionality of the fused feature map, that is, to calculate the average value of each feature channel in the time dimension to obtain the pooled feature vector. This operation can eliminate redundant information caused by the fluctuation of water quality parameters at different time steps, while retaining the overall contribution of each spectral channel to the inversion of dissolved oxygen, ammonia nitrogen, and transparency, providing a stable, low-dimensional feature representation for subsequent regression mapping; the regressor module is used to map the pooled feature vector to continuous water quality parameter prediction values.

[0033] To address the significant differences in the sensitivity of different spectral bands to water quality parameters in rural black and odorous water bodies, the severe interference from environmental factors such as bottom sediment, suspended solids, and aquatic plants, and the difficulty in pre-determining the optimal characteristic bands, this embodiment introduces a channel attention module, such as... Figure 2 As shown, the channel attention module consists of a global average pooling layer, two fully connected layers, a nonlinear function layer, and an activation function layer. The input data for this module is the temporal feature map output by the residual module of the temporal convolutional network of the TCN network. First, the global average pooling layer compresses each channel into a scalar in the time dimension to obtain a channel descriptor. Then, it sequentially passes through a first fully connected layer for dimensionality reduction, an activation function (ReLU) for activation, and a second fully connected layer to restore the dimensionality. Finally, an activation function (Sigmoid) is used to generate adaptive weights for each channel. The learned weights are multiplied with the input feature map channel by channel to output a channel-weighted feature map. Through end-to-end training, this module enables the model to automatically enhance spectral feature channels strongly correlated with water quality parameters such as dissolved oxygen, ammonia nitrogen, and transparency, such as the ratio of the red-edge band reflecting chlorophyll and the blue-green band reflecting organic pollutants, while suppressing noise channels affected by water sediment, suspended matter, and aquatic plants. This solves the problem of poor generalization ability of fixed spectral indices in complex rural environments, enhances the model's ability to fuse and utilize multi-level features, and ultimately improves inversion accuracy. As shown in Table 1 below: Table 1. Model Comparison Results

[0034] In this embodiment, the black and odorous water body identification model achieved coefficients of determination (R²) of 0.829, 0.911, and 0.920 for dissolved oxygen, ammonia nitrogen, and transparency, respectively, and root mean square errors (RMSE) of 0.374, 0.056, and 0.646, respectively. These figures are significantly better than comparative models such as random forest, extreme gradient boosting, and gradient boosting decision tree. This indicates that the adaptive calibration of the feature channels by the channel attention module effectively improves the model's inversion accuracy. The calculation expression for the channel attention module can be as follows:

[0035] In the above formula, and These represent the output and input feature maps of the channel attention module (SE Block), respectively. This represents the Sigmoid activation function. and These are the weight matrices for the first and second fully connected layers, respectively. and These represent the bias terms of the first fully connected layer and the second fully connected layer, respectively. Indicates global average pooling. This indicates channel-by-channel multiplication. This represents the ReLU activation function.

[0036] To address the sudden and temporally uneven changes in water quality parameters during the identification of black and odorous water bodies, such as a rapid increase in ammonia nitrogen concentration after rainfall and drastic diurnal fluctuations in dissolved oxygen due to algal blooms, and the problem that traditional time-series models treat all time steps equally and fail to focus on key abrupt changes, leading to missed or false detections, this embodiment introduces a time-series attention module, such as... Figure 3 As shown, the temporal attention module consists of two fully connected layers, an activation function (Tanh) layer, and a normalization function (Softmax) layer. This module receives the channel-weighted feature map output from the channel attention module, reduces the data dimensionality through a fully connected layer, then passes through a non-linear activation function Tanh layer to improve gradient descent efficiency, and finally passes through a fully connected layer and a normalization function Softmax layer to convert the real-valued vector output by the model into a probability distribution. With the addition of the temporal attention module, the model can dynamically weight features at different time steps, dynamically focusing on key time steps where water quality parameters change significantly, such as a sudden surge in ammonia nitrogen concentration after rainfall and drastic diurnal fluctuations in dissolved oxygen caused by algal blooms, ignoring redundant information interference during stable periods. This significantly improves the response sensitivity and identification accuracy for sudden events in black and odorous water bodies. This model achieved an R² of 0.920 and an RMSE of 0.646 in transparency inversion and an R² of 0.911 and an RMSE of 0.056 in ammonia nitrogen inversion, demonstrating a significant advantage over the comparative model that only relies on static time step processing. This verifies the effectiveness of the temporal attention mechanism in improving the modeling ability for long-term time-series dependencies. The calculation expression for the temporal attention module can be expressed as:

[0037] In the above formula, This represents the output of the Temporal Attention mechanism module. and These represent the weight matrix and bias of the first fully connected layer, respectively. and These represent the weight matrix and bias of the second fully connected layer, respectively. This represents the hyperbolic tangent activation function.

[0038] like Figure 1As shown, the regressor module consists of three fully connected layers, two leakyReLU activation function layers, and a dropout layer. Its input data is the fusion data from the channel attention module and the temporal attention module. Fusion is achieved through element-wise addition, reducing data dimensionality and preventing overfitting, and is primarily used for outputting predicted values. Introducing the regressor module allows direct learning of the complex nonlinear relationship between high-dimensional remote sensing features and water quality parameters, outputting continuous quantitative inversion results. This overcomes the limitation of traditional models that can only perform discrete level discrimination, such as only outputting whether there is black and odorous water or not, which better reflects the environmental reality of continuously changing black and odorous water bodies. The parameters of the black and odorous water body identification model can be set as shown in Table 2 below. One-dimensional causal convolution, one-dimensional depthwise convolution, and one-dimensional pointwise convolution layers constitute the core convolutional structure of the temporal convolutional network residual module, used to extract temporal features; fully connected layer 1 and fully connected layer 2 constitute the fully connected structure of the squeeze-excitation network module of the channel attention module, used to achieve adaptive calibration of channel attention. Table 2 Model Parameters

[0039] The calculation expression for the regressor module can be represented as:

[0040] In the above formula, This represents the vector output by the regression module, consisting of predicted values ​​of multiple water quality parameters. and These represent the weight matrix and bias vector of the first fully connected layer in the regression module, respectively. and These represent the weight matrix and bias vector of the second fully connected layer in the regression module, respectively. and These represent the weight matrix and bias vector of the third fully connected layer in the regression module, respectively. This represents a random deactivation operation, enabled during training, but typically used as an identity mapping during inference. Let g represent the LeakyReLU activation function, and g represent the input feature vector.

[0041] After constructing the black and odorous water body identification model, it is necessary to train the model. Therefore, it is necessary to construct a sample dataset for training, using the reflectance value of preprocessed remote sensing image data as input and the measured water quality parameter values ​​as labels. In addition, as mentioned earlier, the model is quite sensitive to the number of samples and is prone to overfitting when the data is insufficient, which leads to a decrease in the accuracy of water quality parameter inversion. Therefore, this embodiment can further expand the existing sample dataset. The specific steps are as follows: Select the sample area and obtain the reflectance values ​​of multiple original spectral bands within the sample area; Add and subtract the reflectance values ​​of multiple original spectral bands. At least one operation among scalar, multiplication, and division is used to generate multiple combined bands. These combined bands provide richer initial information for the model, accelerating model convergence, improving generalization ability, and reducing dependence on the original data. The Pearson correlation coefficient is used to evaluate the correlation between the reflectance values ​​of the original spectral bands and combined bands and various water quality parameters. For each water quality parameter, a preset number (e.g., 20) of the most correlated original spectral bands and combined bands are selected as sample bands, and the remote sensing reflectance values ​​of the sample bands are extracted. These are combined with the measured water quality parameter values ​​to construct a sample dataset, which can finally be divided into training and test sets in a 7:3 ratio.

[0042] During model training, the actual values ​​of water quality parameters collected from the ground are used as a reference standard to select the coefficient of determination (R-squared, or R for short). 2 The root mean square error (RMSE) is used to verify the accuracy of the model output and evaluate the model's accuracy. The formula is as follows:

[0043] In the above formula, Let be the measured value of the water quality parameter for the i-th sample. Let be the predicted value of the water quality parameter for the i-th sample. Let be the average value of the water quality parameters of the i-th sample, and n be the number of samples.

[0044] The above describes one model training method. To overcome the problems of scarce measured water quality sample data in the target area and the ease with which the model can overfit, this embodiment further adopts a new model training strategy. The general idea is as follows: First, pre-train the model on a source domain with abundant measured data, enabling it to learn a general representation of the water remote sensing spectrum. Then, quantify and evaluate the importance of each layer parameter in the pre-trained model to the source domain task using the Fisher information matrix. Freeze the network layers carrying general spectral knowledge, allowing only the network layers carrying domain-specific knowledge to be adaptively fine-tuned on target domain samples. Simultaneously, incorporate distribution alignment constraints during the fine-tuning process to prevent the model from losing its generalization ability due to overfitting a small number of target domain samples. Specifically, this includes the following steps: S21. First, it is necessary to obtain the source domain remote sensing image dataset and the corresponding measured water quality parameter values ​​of the source domain. The selection of the source domain is crucial. In this embodiment, the source domain is a rich sample water area with different water optical characteristics from the target area. Rich sample means that the water area has sufficient and widely distributed measured water quality parameter samples, which are sufficient to support the full training of the deep learning model. Different water optical characteristics mean that the water type, suspended solids composition and colored soluble organic matter concentration background of the source domain are different from those of the target area. If the source domain and the target domain are completely consistent, there is no need for transfer learning. If the two have no commonalities, transfer learning will not work. Therefore, source regions are usually selected from lakes, reservoirs, or large rivers with existing long-term water quality monitoring networks. Although their water optical characteristics are different from those of rural black and odorous water bodies, they share commonalities in the basic physical laws of spectral absorption and scattering. In specific training, a training set is first constructed using remote sensing image data of the source region as input and measured water quality parameters of the source region as labels. The training set can also be further increased by the dataset construction method mentioned above to pre-train the black and odorous water body identification model. The loss function of pre-training is the mean square error between the predicted and measured water quality parameters output by the model. The optimizer can be Adam. The number of training epochs is set according to the scale of the source region data until the model converges on the source region validation set. After pre-training, all weight parameters of the model at this time are saved, which are the pre-trained model parameters. This set of parameters encodes the nonlinear mapping relationship from remote sensing spectrum to water quality parameters learned by the model on the big data of the source region. The low-level convolutional kernels usually capture general spectral-spatial features such as water-land boundaries, wave textures, and solar flares, while the high-level features focus on the water quality parameter response patterns unique to the source region.

[0045] S22. After completing the source domain pre-training and obtaining the pre-trained model parameters, the Fisher information matrix of each layer's weight parameters in the pre-trained model parameters is calculated based on the loss function of the pre-trained model parameters during the source domain pre-training process. The Fisher information matrix is ​​a core concept in information geometry; it measures the curvature of the model's log-likelihood function with respect to the parameters. In the context of deep learning, a higher Fisher information value means that the parameter is more sensitive to the model's loss function in the source domain water quality inversion task, i.e., the parameter is more important to the source domain task. Conversely, a lower Fisher information value means that the parameter is less sensitive to the source domain task, and changing it will not significantly affect the model's performance in the source domain. Therefore, it can be released for adaptive learning in the target domain. Specifically, this embodiment calculates the Fisher information matrix of each layer's weight parameters in the pre-trained model parameters based on the loss function defined during the source domain pre-training process. For a model with N parameters, its Fisher information matrix F is an N×N matrix. However, in actual calculations, only the approximate values ​​of its diagonal elements are usually calculated. For any parameter, the approximate formula for calculating its Fisher information value is as follows:

[0046] In the above formula, Represents the j-th parameter The Fisher information value, M represents the number of samples used for calculation, that is, the number of samples randomly drawn from the target region sample dataset to form the validation set. and These represent the remote sensing image input and the corresponding measured water quality parameter label for the m-th sample in the validation set, respectively. θ This represents all pre-trained model parameters. Indicates the given input and parameters θ Time model output The likelihood probability, Represents the log-likelihood for the j-th parameter The gradient of the j-th parameter, the square of which reflects the gradient of the j-th parameter. The extent to which small perturbations affect the likelihood of the model output is considered. However, it is important to note that the calculation of the Fisher information matrix is ​​performed on a validation set, which is a subset of samples randomly drawn from the sample dataset of the target region. This means that although the calculation process is based on the loss function structure pre-trained in the source domain, the data used comes from the target domain. This not only reflects the importance of the parameters to the task in the source domain, but also ensures consistency between the evaluation process and the monitoring data for subsequent fine-tuning in the target domain.

[0047] S23. In this embodiment, the network layers of the black and odorous water body identification model are divided into two categories: key layers and adaptive layers. The Fisher information values ​​of each parameter in the Fisher information matrix are compared with a preset importance threshold. The network layers containing parameters whose Fisher information values ​​are higher than the importance threshold are marked as key layers, and the remaining layers are marked as adaptive layers. The importance threshold can be set using various strategies, such as taking a certain quantile of the distribution of Fisher information values ​​of all parameters in the entire network, such as the median or the upper quartile, or using the Otsu adaptive thresholding method to automatically search for the optimal partition point.

[0048] S24. Freeze the parameters of all key layers in the black and odorous water body identification model. That is, these parameters will not participate in gradient updates in subsequent training. Fine-tune the parameters of the adaptive layers on the sample dataset of the target region. The adaptive layers are usually deeper layers of the network, such as the fully connected layers in the channel attention module and the weight layers in the temporal attention module. They capture high-level semantic features related to the concentration range of water quality parameters in a specific water area and the spectral response patterns of specific pollutants. These feature source domains are different from the target domain and need to be recalibrated on the target domain samples. Therefore, only update the parameters of these layers. During fine-tuning, the loss function, based on the mean square error between the predicted and measured water quality parameter values, introduces a maximum mean difference regularization term to construct the total loss function. This maximum mean difference regularization term is used to calculate the distribution distance in the feature space between the fused feature map extracted from the source region remote sensing image data using the black and odorous water body identification model and the fused feature map extracted from the target region remote sensing image data using the same model. The maximum mean difference is a non-parametric distribution distance metric, calculated based on the distance between two distribution mean embeddings in the regenerating kernel Hilbert space. Its calculation formula can be expressed as:

[0049] In the above formula, This represents the maximum mean difference regularization term. This represents the feature vector of the i-th sample in the source domain after the fusion feature map has been vectorized by the black and odorous water body identification model. The number of source domain samples participating in this calculation. Let represent the feature vector corresponding to the j-th sample in the target domain. This represents the kernel mapping function that maps eigenvectors to the reproducing kernel Hilbert space H. In practical calculations, the Gaussian kernel function is usually used. The term represents the number of training samples in the target domain. The maximum mean difference regularization term is used to explicitly penalize the distribution shift between the source and target domains in the deep feature space.

[0050] S25. When the total loss value on the validation set does not decrease within a preset number of consecutive training rounds, stop fine-tuning to obtain a black and odorous water body identification model suitable for the target area.

[0051] S3. Input the preprocessed remote sensing image data of the target area into the trained black and odorous water body identification model to obtain the predicted values ​​of water quality parameters. Then, compare the predicted values ​​of water quality parameters with the preset water quality parameter thresholds and output the distribution results of black and odorous water bodies. The water quality parameters include at least one of dissolved oxygen concentration, ammonia nitrogen concentration, and transparency. In this embodiment, these three parameters are used as examples. According to the "Guidelines for the Treatment of Black and Odorous Water Bodies in Rural Areas", areas with transparency less than 25cm, dissolved oxygen less than 2mg / L, and ammonia nitrogen greater than 15mg / L are identified as black and odorous water bodies. If any one of the three indicators in a certain area reaches the corresponding water quality parameter threshold requirement, it is determined that there is a black and odorous water body in that area. In actual use, through this method and accuracy verification, suspected black and odorous water bodies in rural areas can be effectively identified and located, providing a basis for their monitoring and treatment.

[0052] To systematically evaluate the comprehensive performance of the algorithm proposed in this study for identifying black and odorous water bodies, we selected three widely used machine learning methods as benchmarks for comparison: Random Forest (RF), Extreme Gradient Boosting (XGBoost), and Gradient Boosting Decision Tree (GBDT). The black and odorous water body identification model in this embodiment significantly outperforms the three comparative models in terms of the inversion accuracy of key water quality parameters. Specifically, the RF model only shows some inversion capability for dissolved oxygen, while its accuracy is significantly insufficient for the other two key parameters. In contrast, the black and odorous water body identification model in this embodiment achieves smaller prediction errors and higher inversion accuracy across all evaluation indicators, demonstrating comprehensively superior identification performance and robust fitting ability. The aforementioned performance improvements are mainly attributed to the following technical features of this invention: First, the temporal convolutional network residual module effectively captures long-term dependencies in remote sensing temporal data through dilated convolution and residual connections; second, the introduction of the channel attention module and the temporal attention module enables the model to adaptively focus on key feature channels and key temporal nodes; third, the regressor module realizes the quantitative inversion of continuous water quality parameter values, overcoming the limitation of traditional models that can only perform discrete level discrimination; finally, the element-wise addition and fusion of the output features of the channel attention module and the temporal attention module forms a comprehensive feature representation with dual weighting of channel and time, further improving the model's robustness to complex environmental disturbances.

[0053] In this embodiment, the channel-weighted feature map output by the channel attention module and the time-weighted feature map output by the temporal attention module are fused element-wise to obtain a fused feature map. This fused feature map simultaneously contains feature importance weights in both the channel dimension and the time dimension, forming a comprehensive feature representation that focuses on both key spectral channels and key temporal nodes. After dimensionality reduction by a global average pooling layer, the fused feature map is mapped by the regressor module to continuous water quality parameter prediction values. Through the synergistic effect of the above modules, the black and odorous water body identification model in this embodiment can simultaneously capture the importance of spectral features and the dynamics of temporal evolution, thereby achieving excellent inversion results in the black and odorous water body identification task in complex rural environments. The model achieved R² values ​​of 0.829, 0.911, and 0.920 for the three key water quality parameters of dissolved oxygen, ammonia nitrogen, and transparency, respectively, with root mean square errors of 0.374, 0.056, and 0.646. Compared with traditional machine learning models such as random forest, extreme gradient boosting, and gradient boosting decision tree, this model achieved smaller prediction errors and higher inversion accuracy across all evaluation metrics, demonstrating the effectiveness and superiority of the proposed black and odorous water body model architecture.

[0054] This embodiment uses a specific region as the research object and 57 field-measured water body data points as the actual data. Based on the water quality parameter prediction results of the method in this embodiment, areas with dissolved oxygen less than 2 mg / L and ammonia nitrogen greater than 15 mg / L are designated as black and odorous water bodies. 29 black and odorous water bodies and 28 normal water bodies were predicted. Compared with the true data, there were 3 prediction errors. Two of these errors resulted in normal water bodies, but field observations showed they were black and odorous; another error resulted in black and odorous water bodies, but field observations showed they were normal. Therefore, the actual inversion accuracy is 94.74%. Figure 4 As shown, the distribution of black and odorous water bodies is presented.

[0055] This embodiment also provides a remote sensing water quality inversion black and odorous water body identification system based on temporal convolutional networks, including a processor and a memory. The memory is used to store computer programs. When the computer programs are executed by the processor, they implement the remote sensing water quality inversion black and odorous water body identification method based on temporal convolutional networks.

[0056] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0057] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. Since the above embodiments are substantially similar to the method embodiments, their descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0058] The above embodiments provide a detailed description of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A remote sensing water quality inversion method for identifying black and odorous water bodies based on temporal convolutional networks, characterized in that, The method specifically includes the following steps: S1. Acquire remote sensing image data of the target area and preprocess it to extract remote sensing reflectance data; S2. A black and odorous water body identification model is constructed and trained based on a temporal convolutional network to extract temporal feature maps from remote sensing reflectance data and output predicted values ​​of water quality parameters through adaptive weighting. The black and odorous water body identification model includes: A channel attention module is used to adaptively enhance spectral feature channels that are strongly correlated with water quality parameters in the time-series feature map and suppress noise channels to output a channel-weighted feature map. And a temporal attention module for adaptively weighting the time steps in the channel-weighted feature map and outputting a fused feature map that simultaneously achieves spectral feature channel enhancement and adaptive time step weighting after fusion; And a regressor module that maps the pooled feature vector output by global average pooling of the fused feature map to continuous water quality parameter prediction values. S3. Compare the predicted water quality parameters with the preset water quality parameter thresholds and output the distribution results of black and odorous water bodies.

2. The method for identifying black and odorous water bodies according to claim 1, characterized in that, The preprocessing includes at least one of radiometric calibration, atmospheric correction, geometric correction, image fusion, and mosaicking.

3. The method for identifying black and odorous water bodies according to claim 1, characterized in that, The specific steps for constructing the dataset during the training of the black and odorous water body identification model are as follows: Select a sample area and obtain the reflectance values ​​of multiple original spectral bands within the sample area; Multiple combined bands are generated by performing at least one operation among addition, subtraction, multiplication, and division on the reflectance values ​​of multiple original spectral bands. The Pearson correlation coefficient was used to assess the correlation between the reflectance values ​​of the original spectral bands and the combined bands and various water quality parameters. For each water quality parameter, a preset number of original spectral bands and combined bands with the highest correlation are selected as sample bands, and the remote sensing reflectance values ​​of the sample bands are extracted. These are then combined with the measured water quality parameter values ​​to construct a sample dataset.

4. The method for identifying black and odorous water bodies according to claim 1, characterized in that, The black and odorous water body identification model also includes a temporal convolutional network residual module and a global average pooling layer; The temporal convolutional network residual module is used to perform causal convolution on the remote sensing reflectance data step by step to extract local temporal features related to water quality parameters based on the current and historical remote sensing reflectance data, and obtain a preliminary temporal feature map. Then, the long-term dependence of water quality parameters over time in the preliminary temporal feature map is extracted and the original temporal signal is retained to obtain the temporal feature map. The global average pooling layer is used to reduce the dimensionality of the fused feature map to eliminate redundant information caused by fluctuations in water quality parameters at different time steps, and to retain the overall contribution of each spectral channel to the inversion of water quality parameters, thus obtaining the pooling feature vector.

5. The method for identifying black and odorous water bodies according to claim 1, characterized in that, The water quality parameters include at least one of dissolved oxygen concentration, ammonia nitrogen concentration, and transparency.

6. The method for identifying black and odorous water bodies according to claim 1, characterized in that, The channel-weighted feature map and the time-weighted feature map are fused together by adding them element by element to obtain a fused feature map.

7. The method for identifying black and odorous water bodies according to claim 1, characterized in that, When comparing the predicted water quality parameters with the preset water quality parameter thresholds, if at least one predicted water quality parameter in a certain area reaches the preset water quality parameter threshold, it is determined that there is a black and odorous water body in that area.

8. The method for identifying black and odorous water bodies according to claim 1, characterized in that, In step S2, the training of the black and odorous water body identification model specifically includes the following steps: S21. Obtain the source domain remote sensing image dataset and the corresponding source domain measured water quality parameter values. The source domain is a rich sample water area with different water body optical characteristics from the target area. Using the reflectance value of the source domain remote sensing image data as input and the source domain measured water quality parameter values ​​as labels, pre-train the black and odorous water body identification model to obtain the pre-trained model parameters. S22. Based on the loss function of the pre-trained model parameters in the source domain pre-training process, calculate the Fisher information matrix of the weight parameters of each layer in the pre-trained model parameters. The calculation of the Fisher information matrix is ​​performed on a verification set randomly extracted from the sample dataset of the target region. S23. Compare the Fisher information values ​​of each parameter in the Fisher information matrix with a preset importance threshold, and mark the network layer containing the parameter whose Fisher information value is higher than the importance threshold as a key layer, and mark the remaining layers as adaptable layers. S24. Freeze the parameters of all key layers in the black and odorous water body identification model, and fine-tune the parameters of the adaptive layer on the sample dataset of the target area. S25. When the total loss value on the validation set does not decrease within a preset number of consecutive training rounds, stop fine-tuning to obtain a black and odorous water body identification model suitable for the target area.

9. The method for identifying black and odorous water bodies according to claim 8, characterized in that, In step S24, during the fine-tuning process, the loss function is constructed by introducing a maximum mean difference regularization term based on the mean square error between the predicted and measured water quality parameter values. The maximum mean difference regularization term is used to calculate the distribution distance in the feature space between the fused feature map obtained by the source domain remote sensing image data through the black and odorous water body identification model and the fused feature map obtained by the target area remote sensing image data through the black and odorous water body identification model.

10. A remote sensing water quality inversion black and odorous water body identification system based on temporal convolutional networks, used to implement the remote sensing water quality inversion black and odorous water body identification method based on temporal convolutional networks as described in any one of claims 1-9, characterized in that, It includes a processor and a memory, the memory being used to store a computer program, which, when executed by the processor, implements the black and odorous water body identification method as described in any one of claims 1-9.